xmake.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("embree")
  2. set_homepage("https://www.embree.org/")
  3. set_description("Intel® Embree is a collection of high-performance ray tracing kernels, developed at Intel.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/RenderKit/embree/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/RenderKit/embree.git")
  7. add_versions("v3.12.1", "0c9e760b06e178197dd29c9a54f08ff7b184b0487b5ba8b8be058e219e23336e")
  8. add_versions("v3.13.0", "4d86a69508a7e2eb8710d571096ad024b5174834b84454a8020d3a910af46f4f")
  9. add_versions("v3.13.3", "74ec785afb8f14d28ea5e0773544572c8df2e899caccdfc88509f1bfff58716f")
  10. add_versions("v3.13.4", "e6a8d1d4742f60ae4d936702dd377bc4577a3b034e2909adb2197d0648b1cb35")
  11. add_versions("v3.13.5", "b8c22d275d9128741265537c559d0ea73074adbf2f2b66b0a766ca52c52d665b")
  12. add_versions("v4.3.0", "baf0a57a45837fc055ba828a139467bce0bc0c6a9a5f2dccb05163d012c12308")
  13. add_versions("v4.3.3", "baf0a57a45837fc055ba828a139467bce0bc0c6a9a5f2dccb05163d012c12308")
  14. -- Not recommanded to build embree as a static library.
  15. add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
  16. add_deps("cmake", "tbb")
  17. if is_plat("windows") then
  18. add_syslinks("advapi32")
  19. end
  20. on_install("macosx", "linux", "windows|x64", "windows|x86", function (package)
  21. if package:version():lt("4.0.0") then
  22. package:add("links", "embree3", "embree_sse42", "embree_avx", "embree_avx2", "embree_avx512", "tasking", "simd", "lexers", "math", "sys")
  23. end
  24. io.replace("common/tasking/CMakeLists.txt", "include(installTBB)", "", {plain = true})
  25. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF", "-DEMBREE_TUTORIALS=OFF", "-DEMBREE_ISPC_SUPPORT=OFF"}
  26. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  27. table.insert(configs, "-DEMBREE_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
  28. if package:is_plat("windows") then
  29. table.insert(configs, "-DUSE_STATIC_RUNTIME=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
  30. end
  31. if package:is_plat("macosx") and package:is_arch("x86_64") and not package:config("shared") then
  32. table.insert(configs, "-DEMBREE_MAX_ISA=DEFAULT")
  33. end
  34. import("package.tools.cmake").install(package, configs)
  35. end)
  36. on_test(function (package)
  37. local major_version = package:version():major()
  38. local includes = "embree" .. major_version .. "/rtcore.h"
  39. assert(package:check_cxxsnippets({test = [[
  40. #include <cassert>
  41. void test() {
  42. RTCDevice device = rtcNewDevice(NULL);
  43. assert(device != NULL);
  44. }
  45. ]]}, {configs = {languages = "c++11"}, includes = includes}))
  46. end)