xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. package("cgns")
  2. set_homepage("http://cgns.github.io/")
  3. set_description("CFD General Notation System")
  4. add_urls("https://github.com/CGNS/CGNS/archive/refs/tags/$(version).tar.gz")
  5. add_versions("v4.2.0", "090ec6cb0916d90c16790183fc7c2bd2bd7e9a5e3764b36c8196ba37bf1dc817")
  6. add_configs("hdf5", {description = "Enable HDF5 interface.", default = false, type = "boolean"})
  7. add_deps("cmake")
  8. on_load("windows", "macosx", "linux", function (package)
  9. if package:config("hdf5") then
  10. package:add("deps", "hdf5")
  11. end
  12. end)
  13. on_install("windows", "macosx", "linux", function (package)
  14. if package:config("shared") then
  15. io.replace("src/CMakeLists.txt", "install(TARGETS cgns_static", "#", {plain = true})
  16. end
  17. local configs = {"-DCGNS_ENABLE_FORTRAN=OFF"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DCGNS_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  20. table.insert(configs, "-DCGNS_ENABLE_HDF5=" .. (package:config("hdf5") and "ON" or "OFF"))
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:has_cfuncs("cg_is_cgns", {includes = "cgnslib.h"}))
  25. end)