Quellcode durchsuchen

add stlab, easyloggingpp and matplotplusplus (#542)

* update spdlog

* add easyloggingpp

* add stlab

* fix easyloggingpp

* add matplotplusplus

* add cgns

* fix matplotplusplus

* add nodesoup

* fix undefined reference

* fix matplotplusplus on vs2017

* ban vs2017 for matplot++
Hoildkv vor 4 Jahren
Ursprung
Commit
c5c25d11ca

+ 31 - 0
packages/c/cgns/xmake.lua

@@ -0,0 +1,31 @@
+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)

+ 32 - 0
packages/e/easyloggingpp/xmake.lua

@@ -0,0 +1,32 @@
+package("easyloggingpp")
+
+    set_homepage("https://github.com/amrayn/easyloggingpp")
+    set_description("Single header C++ logging library.")
+    set_license("MIT")
+
+    add_urls("https://github.com/amrayn/easyloggingpp/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/amrayn/easyloggingpp.git")
+    add_versions("v9.97.0", "9110638e21ef02428254af8688bf9e766483db8cc2624144aa3c59006907ce22")
+
+    add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("easyloggingpp")
+                set_kind("static")
+                set_languages("c++11")
+                add_files("src/easylogging++.cc")
+                add_headerfiles("src/easylogging++.h")
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            INITIALIZE_EASYLOGGINGPP
+            void test() {
+                LOG(INFO) << "My first info log using default logger";
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "easylogging++.h"}))
+    end)

+ 4 - 1
packages/h/hdf5/xmake.lua

@@ -4,8 +4,11 @@ package("hdf5")
     set_description("High-performance data management and storage suite")
     set_license("BSD-3-Clause")
 
-    add_urls("https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_$(version).tar.gz", {version = function (version) return version:gsub("%.", "_") .. "/source/hdf5-" .. version end})
+    add_urls("https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-$(version).tar.gz", {version = function (version)
+        return format("%d.%d/hdf5-%s/src/hdf5-%s", version:major(), version:minor(), version, version)
+    end})
     add_versions("1.12.0", "a62dcb276658cb78e6795dd29bf926ed7a9bc4edf6e77025cd2c689a8f97c17a")
+    add_versions("1.12.1", "79c66ff67e666665369396e9c90b32e238e501f345afd2234186bfb8331081ca")
 
     add_deps("cmake")
     if is_plat("linux") then

+ 65 - 0
packages/m/matplotplusplus/xmake.lua

@@ -0,0 +1,65 @@
+package("matplotplusplus")
+
+    set_homepage("https://alandefreitas.github.io/matplotplusplus/")
+    set_description("A C++ Graphics Library for Data Visualization")
+    set_license("MIT")
+
+    add_urls("https://github.com/alandefreitas/matplotplusplus/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/alandefreitas/matplotplus.git")
+    add_versions("v1.1.0", "5c3a1bdfee12f5c11fd194361040fe4760f57e334523ac125ec22b2cb03f27bb")
+
+    local configdeps = {jpeg   = "libjpeg-turbo",
+                        tiff   = "libtiff",
+                        zlib   = "zlib",
+                        png    = "libpng",
+                        blas   = "openblas",
+                        fftw   = "fftw",
+                        opencv = "opencv"}
+    for config, dep in pairs(configdeps) do
+        add_configs(config, {description = "Enable " .. config .. " support.", default = (config == "zlib"), type = "boolean"})
+    end
+
+    add_deps("cmake")
+    add_deps("nodesoup")
+    if is_plat("windows") then
+        add_syslinks("user32", "shell32", "gdi32")
+    end
+    on_load("windows", "macosx", "linux", function (package)
+        for config, dep in pairs(configdeps) do
+            if package:config(config) then
+                package:add("deps", dep)
+            end
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        if is_plat("windows") then
+            local vs = import("core.tool.toolchain").load("msvc"):config("vs")
+            if tonumber(vs) < 2019 then
+                raise("Your compiler is too old to use this library.")
+            end
+        end
+        local configs = {"-DBUILD_EXAMPLES=OFF", "-DBUILD_TESTS=OFF", "-DBUILD_INSTALLER=ON", "-DBUILD_PACKAGE=OFF", "-DWITH_SYSTEM_NODESOUP=ON"}
+        for config, dep in pairs(configdeps) do
+            if not package:config(config) then
+                table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_" .. config:upper() .. "=ON")
+            end
+        end
+        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"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <cmath>
+            #include <vector>
+            void test() {
+                using namespace matplot;
+                std::vector<double> x = linspace(0, 2 * pi);
+                std::vector<double> y = transform(x, [](auto x) { return sin(x); });
+                plot(x, y, "-o");
+                show();
+            }
+        ]]}, {configs = {languages = "c++17"}, includes = "matplot/matplot.h"}))
+    end)

+ 25 - 0
packages/n/nodesoup/xmake.lua

@@ -0,0 +1,25 @@
+package("nodesoup")
+
+    set_homepage("https://github.com/olvb/nodesoup")
+    set_description("Force-directed graph layout with Fruchterman-Reingold")
+    
+    add_urls("https://github.com/olvb/nodesoup.git")
+    add_versions("2020.09.05", "3158ad082bb0cd1abee75418b12b35522dbca74f")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("nodesoup")
+                set_kind("static")
+                set_languages("c++14")
+                add_files("src/*.cpp")
+                add_includedirs("include")
+                add_headerfiles("include/nodesoup.hpp")
+                add_defines("_USE_MATH_DEFINES")
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("nodesoup::adj_list_t", {configs = {languages = "c++14"}, includes = "nodesoup.hpp"}))
+    end)

+ 10 - 10
packages/s/spdlog/xmake.lua

@@ -5,6 +5,7 @@ package("spdlog")
 
     set_urls("https://github.com/gabime/spdlog/archive/$(version).zip",
              "https://github.com/gabime/spdlog.git")
+    add_versions("v1.9.1", "1a383a1d6bf604759c310a0b464a83afc54cc3147192d61c3d0c59695b38ff79")
     add_versions("v1.9.0", "61f751265cfce8fb17f67e18fa1ad00077280c080008252d9e8f0fbab5c30662")
     add_versions("v1.8.5", "6e66c8ed4c014b0fb00c74d34eea95b5d34f6e4b51b746b1ea863dc3c2e854fd")
     add_versions("v1.8.2", "f0410b12b526065802b40db01304783550d3d20b4b6fe2f8da55f9d08ed2035d")
@@ -14,9 +15,13 @@ package("spdlog")
     add_versions("v1.4.2", "56b90f0bd5b126cf1b623eeb19bf4369516fa68f036bbc22d9729d2da511fb5a")
     add_versions("v1.3.1", "db6986d0141546d4fba5220944cc1f251bd8afdfc434bda173b4b0b6406e3cd0")
 
-    add_configs("header_only",  { description = "Use header only", default = true, type = "boolean"})
-    add_configs("fmt_external", { description = "Use external fmt library instead of bundled", default = false, type = "boolean"})
-    add_configs("noexcept",     { description = "Compile with -fno-exceptions. Call abort() on any spdlog exceptions", default = false, type = "boolean"})
+    add_configs("header_only",  {description = "Use header only", default = true, type = "boolean"})
+    add_configs("fmt_external", {description = "Use external fmt library instead of bundled", default = false, type = "boolean"})
+    add_configs("noexcept",     {description = "Compile with -fno-exceptions. Call abort() on any spdlog exceptions", default = false, type = "boolean"})
+
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
 
     on_load(function (package)
         if not package:config("header_only") then
@@ -39,15 +44,10 @@ package("spdlog")
             return
         end
 
-        local configs = {}
-        if package:config("shared") and is_plat("windows") then
-            raise("spdlog shared lib is not yet supported under windows!")
-        end
+        local configs = {"-DSPDLOG_BUILD_TESTS=OFF", "-DSPDLOG_BUILD_EXAMPLE=OFF"}
         table.insert(configs, "-DSPDLOG_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DSPDLOG_FMT_EXTERNAL=" .. (package:config("fmt_external") and "ON" or "OFF"))
-        table.insert(configs, "-SPDLOG_NO_EXCEPTIONS=" .. (package:config("noexcept") and "ON" or "OFF"))
-        table.insert(configs, "-DSPDLOG_BUILD_TESTS=OFF")
-        table.insert(configs, "-DSPDLOG_BUILD_EXAMPLE=OFF")
+        table.insert(configs, "-DSPDLOG_NO_EXCEPTIONS=" .. (package:config("noexcept") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
     end)
 

+ 20 - 0
packages/s/stlab/xmake.lua

@@ -0,0 +1,20 @@
+package("stlab")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://stlab.cc/")
+    set_description("Adobe Source Libraries from Software Technology Lab")
+    set_license("BSL-1.0")
+
+    add_urls("https://github.com/stlab/libraries/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/stlab/libraries.git")
+    add_versions("v1.6.2", "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676")
+
+    add_deps("cmake")
+    add_deps("boost")
+    on_install("windows", "macosx", "linux", function (package)
+        import("package.tools.cmake").install(package, {"-Dstlab.testing=OFF", "-Dstlab.coverage=OFF"})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("stlab::forest<char>", {configs = {languages = "c++17"}, includes = "stlab/forest.hpp"}))
+    end)