xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. add_rules("mode.debug", "mode.release")
  2. add_requires("fmt", "nlohmann_json", "openssl", "zlib")
  3. option("coro", {default = false})
  4. option("voice", {default = true})
  5. if has_config("voice") then
  6. add_requires("libopus", "libsodium")
  7. end
  8. target("dpp")
  9. set_kind("$(kind)")
  10. add_includedirs("include", "include/dpp")
  11. add_headerfiles("include/(dpp/**.h)")
  12. add_files("src/dpp/**.cpp")
  13. add_packages("fmt", "nlohmann_json", "openssl", "zlib")
  14. if has_config("voice") then
  15. add_packages("libopus", "libsodium")
  16. add_defines("HAVE_VOICE")
  17. end
  18. if has_config("coro") then
  19. add_defines("DPP_CORO")
  20. end
  21. local target_cpp_lang = "c++17"
  22. if has_config("coro") then
  23. target_cpp_lang = "c++20"
  24. end
  25. set_languages(target_cpp_lang)
  26. add_defines("DPP_BUILD", "DPP_USE_EXTERNAL_JSON")
  27. if is_plat("windows", "mingw") then
  28. add_defines("WIN32", "_WINSOCK_DEPRECATED_NO_WARNINGS", "WIN32_LEAN_AND_MEAN")
  29. add_defines("_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE")
  30. add_defines("FD_SETSIZE=1024")
  31. if is_plat("windows") then
  32. add_cxflags("/Zc:preprocessor")
  33. end
  34. if is_kind("static") then
  35. add_defines("DPP_STATIC", {public = true})
  36. end
  37. end