xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("clhep")
  2. set_homepage("https://proj-clhep.web.cern.ch/proj-clhep/")
  3. set_description("CLHEP - A Class Library for High Energy Physics")
  4. set_license("LGPL-3.0")
  5. add_urls("https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-$(version).tgz", {version = function (version) return version:gsub("%+", ".") end})
  6. add_versions("2.4.5+1", "2517c9b344ad9f55974786ae6e7a0ef8b22f4abcbf506df91194ea2299ce3813")
  7. add_versions("2.4.6+3", "fcd007f11b10ba4af28d027222b63148d0eb44ff7a082eee353bdf921f9c684a")
  8. add_patches("2.4.x", path.join(os.scriptdir(), "patches", "2.4.5.1", "kind.patch"), "60a65bbe05380f6cd89752bdd662bd1685a8944081c97746f7a0bd2d046edf9d")
  9. if is_plat("windows") then
  10. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  11. end
  12. add_deps("cmake")
  13. on_install("windows", "macosx", "linux", function (package)
  14. os.cd("CLHEP")
  15. if package:is_plat("windows") then
  16. io.replace("cmake/Modules/ClhepVariables.cmake", "/MD", "/" .. package:config("vs_runtime"), {plain = true})
  17. io.replace("Random/CMakeLists.txt", "add_subdirectory(test)", "", {plain = true})
  18. end
  19. local configs = {"-DCLHEP_BUILD_DOCS=OFF", "-DLIB_SUFFIX="}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. import("package.tools.cmake").install(package, configs, {buildir = os.tmpfile() .. ".dir"})
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. void test() {
  27. HepGeom::Point3D<float> point(1, 2, 3);
  28. point.set(4, 5, 6);
  29. }
  30. ]]}, {configs = {languages = "c++11"}, includes = "CLHEP/Geometry/Point3D.h"}))
  31. end)