xmake.lua 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.9.0", "0bb564e127b14c22f062db50f89381dd2e0a20dbaf4987ca138a4ae8728712f9")
  8. add_versions("v0.8.0", "0bc88a0858c88d94306443946a5a1606118b7d5e4960f1e6186a3632e9df38fb")
  9. add_versions("v0.7.2", "292fc9d0d5a6726c90db88c1aadf09e6d152ffc0ebffe6fb968736c47288511c")
  10. add_versions("v0.7.1", "44bcb025dd5cd480236a3bc7a3f8c9a708a801ed773b7859677440d22e0e1e7c")
  11. add_patches("0.7.1", "patches/0.7.1/cmake-simdjson.patch", "943828708f0e011122249196dc70d9a1f026e3212e1c1c35f6988907a6ea4e49")
  12. add_configs("small_vector", {description = "Uses a custom SmallVector type optimised for small arrays", default = false, type = "boolean"})
  13. add_configs("memory_pool", {description = "Disables the memory allocation algorithm based on polymorphic resources", default = false, type = "boolean"})
  14. add_configs("f64", {description = "Default to 64-bit double precision floats for everything", default = false, type = "boolean"})
  15. add_configs("cxx_standard", {description = "Select c++ standard to build.", default = "17", type = "string", values = {"17", "20"}})
  16. if is_plat("linux", "mingw") then
  17. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  18. end
  19. add_deps("cmake")
  20. add_deps("simdjson")
  21. on_install("windows|x64", "mingw|x86_64", "macosx|x86_64", "linux|x86_64", "linux|arm64", function (package)
  22. local configs = {}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DFASTGLTF_USE_CUSTOM_SMALLVECTOR=" .. (package:config("small_vector") and "ON" or "OFF"))
  26. table.insert(configs, "-DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=" .. (package:config("memory_pool") and "ON" or "OFF"))
  27. table.insert(configs, "-DFASTGLTF_USE_64BIT_FLOAT=" .. (package:config("f64") and "ON" or "OFF"))
  28. table.insert(configs, "-DFASTGLTF_COMPILE_AS_CPP20=" .. ((package:config("cxx_standard") == "20") and "ON" or "OFF"))
  29. import("package.tools.cmake").install(package, configs, {packagedeps = "simdjson"})
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cxxtypes("fastgltf::Parser", {configs = {languages = "c++" .. package:config("cxx_standard")}, includes = "fastgltf/core.hpp"}))
  33. end)