xmake.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("oatpp-openssl")
  2. set_homepage("https://oatpp.io/")
  3. set_description("It provides secure server and client connection providers for oatpp applications.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/oatpp/oatpp-openssl/archive/5925e8ba856fa71cda8937c4cb357508d4fdb3fb.tar.gz",
  6. "https://github.com/oatpp/oatpp-openssl.git")
  7. add_versions("1.3.0", "540ab736ca8f7b8a89c23ad51655e038b59c6df8a08a60b95125843c9643a405")
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. end
  11. add_deps("cmake")
  12. add_deps("oatpp")
  13. add_deps("openssl")
  14. on_load(function (package)
  15. package:add("includedirs", path.join("include", "oatpp-" .. package:version_str(), "oatpp-openssl"))
  16. package:add("linkdirs", path.join("lib", "oatpp-" .. package:version_str()))
  17. end)
  18. on_install("linux", "macosx", "windows|x64", function (package)
  19. local configs = {"-DOATPP_BUILD_TESTS=OFF"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. if package:is_plat("windows") then
  23. table.insert(configs, "-DOATPP_MSVC_LINK_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  24. end
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include "oatpp-openssl/server/ConnectionProvider.hpp"
  30. #include "oatpp-openssl/Config.hpp"
  31. #include "oatpp-openssl/configurer/TrustStore.hpp"
  32. void test() {
  33. const char* trust = "path/to/truststore";
  34. auto config = oatpp::openssl::Config::createDefaultClientConfigShared();
  35. }
  36. ]]}, {configs = {languages = "c++11"}}))
  37. end)