From 1e74ec6eda46f61f33025f8e0dc3bc2a1ef5663d Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Tue, 19 Oct 2021 15:51:53 +0800 Subject: [PATCH] add vc, gmsh and dune-common (#664) * add vc * add gmsh * add dune-common * improve vc to be only static --- packages/d/dune-common/xmake.lua | 35 ++++++++++++++++++++++++ packages/g/gmsh/xmake.lua | 46 ++++++++++++++++++++++++++++++++ packages/v/vc/xmake.lua | 24 +++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 packages/d/dune-common/xmake.lua create mode 100644 packages/g/gmsh/xmake.lua create mode 100644 packages/v/vc/xmake.lua diff --git a/packages/d/dune-common/xmake.lua b/packages/d/dune-common/xmake.lua new file mode 100644 index 000000000..2eaf125e0 --- /dev/null +++ b/packages/d/dune-common/xmake.lua @@ -0,0 +1,35 @@ +package("dune-common") + + set_homepage("https://dune-project.org/") + set_description("DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations with grid-based methods.") + set_license("GPL-2.0") + + add_urls("https://dune-project.org/download/$(version)/dune-common-$(version).tar.gz") + add_versions("2.8.0", "c9110b3fa350547c5e962c961905c6c67680471199ca41ed680489a0f30ffce9") + + add_configs("python", {description = "Enable the python interface.", default = false, type = "boolean"}) + + add_deps("cmake") + add_links("dunecommon") + on_load("macosx", "linux", function (package) + if package:config("python") then + package:add("deps", "python 3.x") + end + end) + + on_install("macosx", "linux", function (package) + local configs = {"-DBUILD_TESTING=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DDUNE_ENABLE_PYTHONBINDINGS=" .. (package:config("python") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + auto array = Dune::Std::make_array(1, 2); + } + ]]}, {configs = {languages = "c++14"}})) + end) diff --git a/packages/g/gmsh/xmake.lua b/packages/g/gmsh/xmake.lua new file mode 100644 index 000000000..a50047ad5 --- /dev/null +++ b/packages/g/gmsh/xmake.lua @@ -0,0 +1,46 @@ +package("gmsh") + + set_homepage("http://gmsh.info/") + set_description("Gmsh is an open source 3D finite element mesh generator with a built-in CAD engine and post-processor.") + set_license("GPL-2.0") + + add_urls("http://gmsh.info/src/gmsh-$(version)-source.tgz") + add_versions("4.8.4", "760dbdc072eaa3c82d066c5ba3b06eacdd3304eb2a97373fe4ada9509f0b6ace") + + add_deps("cmake") + if is_plat("windows") then + add_syslinks("shell32", "ws2_32", "winmm") + end + on_load("windows", function (package) + if package:config("shared") then + package:add("defines", "GMSH_DLL") + end + end) + + on_install("windows", "macosx", "linux", function (package) + local configs = {"-DENABLE_TESTS=OFF", "-DENABLE_GMP=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DENABLE_BUILD_LIB=" .. (package:config("shared") and "OFF" or "ON")) + table.insert(configs, "-DENABLE_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DENABLE_BUILD_DYNAMIC=" .. (package:config("shared") and "ON" or "OFF")) + if package:is_plat("windows") then + table.insert(configs, "-DENABLE_MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) + end + import("package.tools.cmake").install(package, configs) + if package:is_plat("windows") and package:config("shared") then + os.mv(path.join(package:installdir("lib"), "gmsh.dll"), package:installdir("bin")) + end + package:addenv("PATH", "bin") + end) + + on_test(function (package) + os.vrun("gmsh -version") + assert(package:check_cxxsnippets({test = [[ + void test() { + gmsh::initialize(); + gmsh::model::add("square"); + int square = gmsh::model::occ::addRectangle(0, 0, 0, 1, 1); + gmsh::model::occ::synchronize(); + } + ]]}, {configs = {languages = "c++11"}, includes = "gmsh.h"})) + end) diff --git a/packages/v/vc/xmake.lua b/packages/v/vc/xmake.lua new file mode 100644 index 000000000..09f92d879 --- /dev/null +++ b/packages/v/vc/xmake.lua @@ -0,0 +1,24 @@ +package("vc") + + set_homepage("https://github.com/VcDevel/Vc") + set_description("SIMD Vector Classes for C++") + set_license("BSD-3-Clause") + + add_urls("https://github.com/VcDevel/Vc/releases/download/$(version)/Vc-$(version).tar.gz") + add_versions("1.4.2", "50d3f151e40b0718666935aa71d299d6370fafa67411f0a9e249fbce3e6e3952") + + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + + add_deps("cmake") + on_install("windows", "macosx", "linux", function (package) + import("package.tools.cmake").install(package) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + Vc::Memory x_mem; + x_mem.vector(0) = Vc::float_v::Random() * 2.f - 1.f; + } + ]]}, {configs = {languages = "c++17"}, includes = "Vc/Vc"})) + end)