xmake.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. option("url", {default = false})
  2. option("thread", {default = false})
  3. option("open", {default = false})
  4. add_rules("mode.release", "mode.debug")
  5. add_requires("zlib")
  6. if has_config("url") then
  7. add_requires("libcurl")
  8. add_packages("libcurl")
  9. end
  10. if has_config("thread") then
  11. add_syslinks("pthread")
  12. end
  13. target("klib")
  14. set_kind("$(kind)")
  15. add_files("kmath.c", {defines = "M_SQRT2=1.41421356237309504880"})
  16. add_files("*.c|rand48.c|kurl.c|kthread.c|kopen.c|ksw.c")
  17. add_includedirs(os.projectdir())
  18. add_packages("zlib")
  19. if is_plat("windows") and is_kind("shared") then
  20. add_rules("utils.symbols.export_all")
  21. end
  22. if is_plat("windows", "mingw") then
  23. add_syslinks("ws2_32")
  24. end
  25. add_headerfiles("*.h|unistd.h|kurl.h|kthread.h|kopen.h|ksw.h")
  26. if has_config("url") then
  27. add_files("kurl.c")
  28. add_headerfiles("kurl.h")
  29. end
  30. if has_config("thread") then
  31. add_files("kthread.c")
  32. add_headerfiles("kthread.h")
  33. end
  34. if has_config("open") then
  35. add_files("kopen.c")
  36. add_headerfiles("kopen.h")
  37. end
  38. if is_arch("x64", "x86", "x86_64") then
  39. add_files("ksw.c")
  40. add_headerfiles("ksw.h")
  41. end