xmake.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("fastgltf")
  2. set_homepage("https://fastgltf.readthedocs.io/v0.7.x/")
  3. set_description("A modern C++17 glTF 2.0 library focused on speed, correctness, and usability")
  4. set_license("MIT")
  5. add_urls("https://github.com/spnda/fastgltf/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/spnda/fastgltf.git")
  7. add_versions("v0.8.0", "0bc88a0858c88d94306443946a5a1606118b7d5e4960f1e6186a3632e9df38fb")
  8. add_versions("v0.7.2", "292fc9d0d5a6726c90db88c1aadf09e6d152ffc0ebffe6fb968736c47288511c")
  9. add_versions("v0.7.1", "44bcb025dd5cd480236a3bc7a3f8c9a708a801ed773b7859677440d22e0e1e7c")
  10. add_patches("0.7.1", "patches/0.7.1/cmake-simdjson.patch", "943828708f0e011122249196dc70d9a1f026e3212e1c1c35f6988907a6ea4e49")
  11. add_configs("small_vector", {description = "Uses a custom SmallVector type optimised for small arrays", default = false, type = "boolean"})
  12. add_configs("memory_pool", {description = "Disables the memory allocation algorithm based on polymorphic resources", default = false, type = "boolean"})
  13. add_configs("f64", {description = "Default to 64-bit double precision floats for everything", default = false, type = "boolean"})
  14. add_configs("cxx_standard", {description = "Select c++ standard to build.", default = "17", type = "string", values = {"17", "20"}})
  15. if is_plat("linux", "mingw") then
  16. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  17. end
  18. add_deps("cmake")
  19. add_deps("simdjson")
  20. on_install("windows|x64", "mingw|x86_64", "macosx|x86_64", "linux|x86_64", "linux|arm64", function (package)
  21. local configs = {}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. table.insert(configs, "-DFASTGLTF_USE_CUSTOM_SMALLVECTOR=" .. (package:config("small_vector") and "ON" or "OFF"))
  25. table.insert(configs, "-DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=" .. (package:config("memory_pool") and "ON" or "OFF"))
  26. table.insert(configs, "-DFASTGLTF_USE_64BIT_FLOAT=" .. (package:config("f64") and "ON" or "OFF"))
  27. table.insert(configs, "-DFASTGLTF_COMPILE_AS_CPP20=" .. ((package:config("cxx_standard") == "20") and "ON" or "OFF"))
  28. import("package.tools.cmake").install(package, configs, {packagedeps = "simdjson"})
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cxxtypes("fastgltf::Parser", {configs = {languages = "c++" .. package:config("cxx_standard")}, includes = "fastgltf/core.hpp"}))
  32. end)