xmake.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("anari")
  2. set_homepage("https://github.com/KhronosGroup/ANARI-SDK")
  3. set_description("ANARI Software Development Kit (SDK)")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/KhronosGroup/ANARI-SDK/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/KhronosGroup/ANARI-SDK.git")
  7. add_versions("v0.15.0", "8fe0fa1a7eea6768fe69a46313ba405b62b2667b1bae5e843bc751a90a53fad3")
  8. add_versions("v0.14.1", "a1df9e917bdb0b6edb0ad4b8e59e1171468a446f850559c74ad5731317201e16")
  9. add_versions("v0.13.1", "b8979ab0dea22cf71c2eacf9421b0cf3fe5807224147c63686d6ed07e65873f4")
  10. add_versions("v0.12.1", "1fc5cf360b260cc2e652bff4a41dcf3507c84d25701dc6c6630f6f6f83656b6c")
  11. add_deps("cmake", "python 3.x", {kind = "binary"})
  12. on_install(function (package)
  13. if not package:config("shared") and package:is_plat("windows", "mingw") then
  14. package:add("defines", "ANARI_STATIC_DEFINE")
  15. end
  16. if package:config("shared") then
  17. package:add("links", "anari_test_scenes", "anari_library_debug", "anari_library_sink", "helium", "anari", "anari_backend")
  18. else
  19. package:add("links", "anari_test_scenes", "anari_library_debug", "anari_library_sink", "helium", "anari_static", "anari_backend")
  20. end
  21. local configs = {
  22. "-DBUILD_TESTING=OFF",
  23. "-DBUILD_EXAMPLES=OFF",
  24. "-DBUILD_VIEWER=OFF",
  25. "-DCTS_ENABLE_GLTF=OFF",
  26. "-DBUILD_HELIDE_DEVICE=OFF",
  27. }
  28. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  29. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (not package:config("shared") and "ON" or "OFF"))
  30. import("package.tools.cmake").install(package, configs)
  31. if package:config("shared") then
  32. os.tryrm(path.join(package:installdir("lib"), "*anari_static*"))
  33. else
  34. os.tryrm(path.join(package:installdir("lib"), "libanari.so*"))
  35. os.tryrm(path.join(package:installdir("lib"), "libanari.dylib*"))
  36. os.tryrm(path.join(package:installdir("lib"), "anari.lib"))
  37. os.tryrm(path.join(package:installdir("bin"), "anari.dll"))
  38. end
  39. end)
  40. on_test(function (package)
  41. assert(package:has_cfuncs("anariLoadLibrary", {includes = "anari/anari.h"}))
  42. end)