xmake.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package("omath")
  2. set_homepage("http://libomath.org")
  3. set_description("Cross-platform modern general purpose math library written in C++23")
  4. set_license("zlib")
  5. add_urls("https://github.com/orange-cpp/omath/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/orange-cpp/omath.git", {submodules = false})
  7. add_versions("v4.4.0", "46fe67d0524c643b28892d2c27b33c5bb4941b0cd5393390cc17e11ae5d31741")
  8. add_versions("v4.3.0", "e21c2e1ff22360715ef6dd231e9f0ac506256b786a246061fac2dfd4cd37d20d")
  9. add_versions("v4.2.0", "f1482c5fd0de0ed26b8197c51e4eb59425c541d4819a3ed6f9639aef251b4a53")
  10. add_versions("v4.1.0", "df5b6774a747ef91b8a34b23db774e92ecba3d3907cc060e36985ec2bd31c6d5")
  11. add_versions("v4.0.1", "983c17abb126dd4a0289c88be94f29af4772624500d75c0702e391e64fe65966")
  12. add_versions("v3.10.1", "17244abf5ffe9164a6f0c71cc8575e21ddb22d9816e949db924489fec0c1d72c")
  13. add_versions("v3.9.4", "7e4409ac40dc44f3c587067063bc66ecfa81ee9b1eeeb23a33f3952371b4eccf")
  14. add_versions("v3.9.3", "b2f3bf035aaa40cd527b5676af2ca8c581f78eca7a41ff0db6b93a237bab4aaf")
  15. add_versions("v3.9.0", "a87b77e00d3cbaad171a1682976359106fecdc20d99367f2b61719bc46b19776")
  16. add_versions("v3.8.2", "e759aba554f9d50147931852c13408ff0bd302a787ff28818d19d4dc1a8f7fd0")
  17. add_versions("v3.8.1", "aaea99570c382478f825af759a2b0a214b429c74a9a5492ddd2866c836e85f4e")
  18. add_patches("v3.9.3", "patches/v3.9.3/fix-cend.patch", "1e45f4e702963bddd456b85c39dbda9a64df5903f2d5e7568ac9fbf920ec8681")
  19. add_patches("v3.9.0", "patches/v3.9.0/fix-fastcall.patch", "c439cbde15949786e87241a4a81575296e81cfdca8ec76192b5ff228126fa02c")
  20. add_patches("v3.8.1", "patches/v3.8.1/fix-build.patch", "c1554cf0cdd027d6386544871d6248c868f8f95add343660334888da52119ae9")
  21. if is_plat("windows") then
  22. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  23. end
  24. if is_arch("x86_64", "x64", "x86", "i386", "i686") then
  25. add_configs("avx2", {description = "Enable AVX2", default = true, type = "boolean"})
  26. end
  27. add_configs("imgui", {description = "Define method to convert omath types to imgui types", default = true, type = "boolean"})
  28. add_deps("cmake")
  29. on_load(function (package)
  30. if package:config("imgui") then
  31. package:add("deps", "imgui")
  32. end
  33. end)
  34. on_install("!macosx and !iphoneos and !android and !bsd", function (package)
  35. local configs = {
  36. "-DOMATH_BUILD_TESTS=OFF",
  37. "-DOMATH_BUILD_BENCHMARK=OFF",
  38. "-DOMATH_THREAT_WARNING_AS_ERROR=OFF",
  39. "-DOMATH_BUILD_EXAMPLES=OFF",
  40. }
  41. table.insert(configs, "-DOMATH_USE_AVX2=" .. (package:config("avx2") and "ON" or "OFF"))
  42. table.insert(configs, "-DOMATH_IMGUI_INTEGRATION=" .. (package:config("imgui") and "ON" or "OFF"))
  43. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  44. table.insert(configs, "-DOMATH_BUILD_AS_SHARED_LIBRARY=" .. (package:config("shared") and "ON" or "OFF"))
  45. import("package.tools.cmake").install(package, configs)
  46. end)
  47. on_test(function (package)
  48. assert(package:check_cxxsnippets({test = [[
  49. #if __has_include(<omath/omath.hpp>)
  50. #include <omath/omath.hpp>
  51. #else
  52. #include <omath/vector2.hpp>
  53. #endif
  54. void test() {
  55. omath::Vector2 w = omath::Vector2(20.0, 30.0);
  56. }
  57. ]]}, {configs = {languages = "c++23"}}))
  58. end)