xmake.lua 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package("alembic")
  2. set_homepage("https://alembic.io/")
  3. set_description("Open framework for storing and sharing scene data that includes a C++ library, a file format, and client plugins and applications.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/alembic/alembic/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/alembic/alembic.git")
  7. add_versions("1.8.8", "ba1f34544608ef7d3f68cafea946ec9cc84792ddf9cda3e8d5590821df71f6c6")
  8. add_versions("1.8.7", "6de0b97cd14dcfb7b2d0d788c951b6da3c5b336c47322ea881d64f18575c33da")
  9. add_versions("1.8.6", "c572ebdea3a5f0ce13774dd1fceb5b5815265cd1b29d142cf8c144b03c131c8c")
  10. add_versions("1.8.5", "180a12f08d391cd89f021f279dbe3b5423b1db751a9898540c8059a45825c2e9")
  11. add_configs("arnold", {description = "Include Arnold stuff", default = false, type = "boolean"})
  12. add_configs("hdf5", {description = "Include HDF5 stuff", default = false, type = "boolean"})
  13. add_configs("maya", {description = "Include maya stuff", default = false, type = "boolean"})
  14. add_configs("prman", {description = "Include prman stuff", default = false, type = "boolean"})
  15. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  16. if is_plat("linux", "bsd") then
  17. add_syslinks("m", "pthread")
  18. end
  19. add_deps("cmake", "imath")
  20. on_load(function (package)
  21. if package:is_plat("windows") and package:config("shared") then
  22. package:add("defines", "ALEMBIC_DLL")
  23. end
  24. if package:config("tools") then
  25. package:config_set("hdf5", true)
  26. end
  27. if package:config("hdf5") then
  28. package:add("deps", "hdf5", {configs = {zlib = true}})
  29. end
  30. end)
  31. on_install(function (package)
  32. if package:is_plat("windows", "mingw") then
  33. io.replace("lib/Alembic/Ogawa/OStream.cpp", "#include <stdexcept>", "#include <stdexcept>\n#include <Windows.h>", {plain = true})
  34. end
  35. local configs = {
  36. "-DBUILD_TESTING=OFF",
  37. "-DUSE_TESTS=OFF",
  38. "-DALEMBIC_DEBUG_WARNINGS_AS_ERRORS=OFF",
  39. }
  40. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  41. table.insert(configs, "-DALEMBIC_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  42. if package:is_plat("windows") then
  43. table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
  44. end
  45. table.insert(configs, "-DUSE_ARNOLD=" .. (package:config("arnold") and "ON" or "OFF"))
  46. table.insert(configs, "-DUSE_MAYA=" .. (package:config("maya") and "ON" or "OFF"))
  47. table.insert(configs, "-DUSE_PRMAN=" .. (package:config("prman") and "ON" or "OFF"))
  48. table.insert(configs, "-DUSE_BINARIES=" .. (package:config("tools") and "ON" or "OFF"))
  49. local hdf5 = package:dep("hdf5")
  50. if hdf5 then
  51. table.insert(configs, "-DUSE_HDF5=ON")
  52. table.insert(configs, "-DUSE_STATIC_HDF5=" .. (hdf5:config("shared") and "OFF" or "ON"))
  53. else
  54. table.insert(configs, "-DUSE_HDF5=OFF")
  55. end
  56. import("package.tools.cmake").install(package, configs)
  57. if package:is_plat("windows") and package:is_debug() then
  58. local dir = package:installdir(package:config("shared") and "bin" or "lib")
  59. os.vcp(path.join(package:buildir(), "lib/**.pdb"), dir)
  60. os.vcp(path.join(package:buildir(), "bin/**.pdb"), package:installdir("bin"))
  61. end
  62. end)
  63. on_test(function (package)
  64. assert(package:check_cxxsnippets({test = [[
  65. #include <Alembic/Abc/All.h>
  66. void test() {
  67. Alembic::Abc::OArchive archive;
  68. Alembic::Abc::OObject object = archive.getTop();
  69. }
  70. ]]}, {configs = {languages = "c++14"}}))
  71. end)