package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.3 KiB

package("cgns")
set_homepage("http://cgns.github.io/")
set_description("CFD General Notation System")
add_urls("https://github.com/CGNS/CGNS/archive/refs/tags/$(version).tar.gz")
add_versions("v4.2.0", "090ec6cb0916d90c16790183fc7c2bd2bd7e9a5e3764b36c8196ba37bf1dc817")
add_configs("hdf5", {description = "Enable HDF5 interface.", default = false, type = "boolean"})
add_deps("cmake")
on_load("windows", "macosx", "linux", function (package)
if package:config("hdf5") then
package:add("deps", "hdf5")
end
end)
on_install("windows", "macosx", "linux", function (package)
if package:config("shared") then
io.replace("src/CMakeLists.txt", "install(TARGETS cgns_static", "#", {plain = true})
end
local configs = {"-DCGNS_ENABLE_FORTRAN=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCGNS_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCGNS_ENABLE_HDF5=" .. (package:config("hdf5") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("cg_is_cgns", {includes = "cgnslib.h"}))
end)