xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. add_rules("mode.debug", "mode.release")
  2. set_allowedplats("macosx", "iphoneos", "android", "linux", "windows", "bsd")
  3. add_requires("quickcpplib", "outcome", "ntkernel-error-category")
  4. if has_config("openssl") then
  5. add_requires("openssl")
  6. end
  7. option("experimental_status_code")
  8. set_default(false)
  9. set_description("Use experimental_status_code.")
  10. add_defines("LLFIO_EXPERIMENTAL_STATUS_CODE")
  11. set_showmenu(true)
  12. option_end()
  13. option("enable_openssl")
  14. set_default(false)
  15. set_description("Enable OpenSSL")
  16. set_showmenu(true)
  17. option_end()
  18. option("cpp20")
  19. set_default(false)
  20. set_description("Use C++20 version.")
  21. set_languages("c++20")
  22. add_defines("QUICKCPPLIB_USE_STD_SPAN")
  23. set_showmenu(true)
  24. option_end()
  25. target("llfio")
  26. set_kind("$(kind)")
  27. set_languages("c++17")
  28. add_packages("quickcpplib", "outcome", "ntkernel-error-category")
  29. add_headerfiles("include/(llfio/**.hpp)")
  30. add_headerfiles("include/(llfio/**.ixx)")
  31. add_headerfiles("include/(llfio/**.h)")
  32. add_includedirs("include")
  33. on_config(function(target)
  34. if target:has_tool("cxx", "clang", "clangxx") then
  35. target:add("cxxflags", "-fsized-deallocation")
  36. end
  37. end)
  38. if not has_config("enable_openssl") then
  39. add_defines("LLFIO_DISABLE_OPENSSL=1")
  40. else
  41. add_packages("openssl")
  42. end
  43. add_options("cpp20", "experimental_status_code", "enable_openssl")
  44. if is_plat("windows") then
  45. add_syslinks("advapi32", "user32", "wsock32", "ws2_32", "ole32", "shell32")
  46. add_defines("LLFIO_LEAN_AND_MEAN")
  47. end
  48. if is_plat("android") then
  49. add_defines("QUICKCPPLIB_DISABLE_EXECINFO")
  50. end
  51. add_defines("QUICKCPPLIB_USE_STD_BYTE", "QUICKCPPLIB_USE_STD_OPTIONAL")
  52. if not is_kind("headeronly") then
  53. if is_kind("shared") then
  54. add_defines("LLFIO_DYN_LINK=1")
  55. else
  56. add_defines("LLFIO_STATIC_LINK=1")
  57. end
  58. add_defines("LLFIO_SOURCE=1")
  59. add_files("src/*.cpp")
  60. else
  61. add_defines("LLFIO_HEADERS_ONLY=1")
  62. add_headerfiles("include/(llfio/**.ipp)")
  63. end
  64. remove_headerfiles("include/llfio/ntkernel-error-category/**")