Ver Fonte

try to build shared cunit (#6135)

* try to build shared

* removed newline

* remove parenthesis

* fallback

* avoid shared on windows

* fixup

* retry

* retry

* Update xmake.lua

---------

Co-authored-by: star9029 <[email protected]>
Saikari há 8 meses atrás
pai
commit
0ff15e094b
1 ficheiros alterados com 9 adições e 4 exclusões
  1. 9 4
      packages/c/cunit/xmake.lua

+ 9 - 4
packages/c/cunit/xmake.lua

@@ -1,22 +1,27 @@
 package("cunit")
 package("cunit")
     set_homepage("https://gitlab.com/cunity/cunit")
     set_homepage("https://gitlab.com/cunity/cunit")
     set_description("CUnit is a lightweight system for writing, administering, and running unit tests in C.")
     set_description("CUnit is a lightweight system for writing, administering, and running unit tests in C.")
-
     set_license("LGPL-2.1")
     set_license("LGPL-2.1")
 
 
     add_urls("https://gitlab.com/cunity/cunit/-/archive/$(version)/cunit-$(version).tar.bz2",
     add_urls("https://gitlab.com/cunity/cunit/-/archive/$(version)/cunit-$(version).tar.bz2",
              "https://gitlab.com/cunity/cunit.git")
              "https://gitlab.com/cunity/cunit.git")
+
     add_versions("3.4.4", "eda4c24afcb2f689b150dadea790a12efb1a0e5e2eb68df7d6417a3ae70a90c7")
     add_versions("3.4.4", "eda4c24afcb2f689b150dadea790a12efb1a0e5e2eb68df7d6417a3ae70a90c7")
 
 
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
+
     add_deps("cmake")
     add_deps("cmake")
 
 
     on_install(function (package)
     on_install(function (package)
+        io.replace("CUnit/CMakeLists.txt", "STATIC", "", {plain = true})
         io.replace("CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
         io.replace("CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
         io.replace("CUnit/CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
         io.replace("CUnit/CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
-        local configs = {}
-        table.insert(configs, "-DCUNIT_DISABLE_TESTS=TRUE")
-        table.insert(configs, "-DCUNIT_DISABLE_EXAMPLES=TRUE")
+
+        local configs = {"-DCUNIT_DISABLE_TESTS=TRUE", "-DCUNIT_DISABLE_EXAMPLES=TRUE"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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)
         import("package.tools.cmake").install(package, configs)
     end)
     end)