xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("ogre-next")
  2. set_homepage("https://www.ogre3d.org/")
  3. set_description("scene-oriented, flexible 3D engine written in C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/OGRECave/ogre-next/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/OGRECave/ogre-next.git")
  7. add_versions("v2.2.5", "b3b555386aa7ebf164a41451ad896bb3774521410944568ecec58f780d0725c4")
  8. add_patches("v2.2.5", path.join(os.scriptdir(), "patches", "2.2.5", "macosx.patch"), "a20f32d8847dd4c93fe2b824d2b793862b8e3126ae7fda4450ad22e76bb00c32")
  9. add_deps("cmake", "zziplib", "freetype", "zlib", "assimp")
  10. add_deps("boost", {configs = {thread = true, date_time = true}})
  11. if is_plat("linux") then
  12. add_deps("libx11", "libxt", "libxaw", "libxrandr", "libsm", "libice", "xtrans")
  13. add_syslinks("pthread")
  14. end
  15. add_includedirs("include/OGRE")
  16. on_load("windows", function (package)
  17. if not package:config("shared") then
  18. package:add("defines", "OGRE_STATIC_LIB")
  19. end
  20. end)
  21. on_install("windows", "macosx", "linux", function (package)
  22. io.replace("Components/Hlms/Pbs/src/IrradianceField/OgreIrradianceField.cpp", "2ᵃ * 2ᵇ = 2ⁿ", "", {plain = true})
  23. local configs = {"-DOGRE_BUILD_SAMPLES2=OFF", "-DOGRE_BUILD_TESTS=OFF", "-DCMAKE_CXX_STANDARD=17"}
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  25. table.insert(configs, "-DOGRE_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  26. if package:is_plat("macosx") then
  27. table.insert(configs, "-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=OFF")
  28. end
  29. if package:is_plat("linux") then
  30. import("package.tools.cmake").install(package, configs, {packagedeps = {"libx11", "libxt", "libxaw", "libxrandr", "libsm", "libice", "xtrans"}})
  31. else
  32. import("package.tools.cmake").install(package, configs)
  33. end
  34. end)
  35. on_test(function (package)
  36. assert(package:has_cxxtypes("Ogre::Root", {configs = {languages = "c++17"}, includes = "OgreRoot.h"}))
  37. end)