Browse Source

add xerces-c (#385)

* update eastl

* add xerces-c
Hoildkv 4 years ago
parent
commit
38d64695cb
3 changed files with 49 additions and 15 deletions
  1. 1 4
      packages/e/eabase/xmake.lua
  2. 9 11
      packages/e/eastl/xmake.lua
  3. 39 0
      packages/x/xerces-c/xmake.lua

+ 1 - 4
packages/e/eabase/xmake.lua

@@ -7,10 +7,7 @@ package("eabase")
     add_urls("https://github.com/electronicarts/EABase/archive/$(version).tar.gz")
     add_versions("2.09.06", "981f922441617152b841585c0fc0bd205bd898c758016fa4985599a63c5a6e16")
 
-    add_deps("cmake")
-
     on_install("windows", "linux", "macosx", function (package)
-        import("package.tools.cmake").install(package)
         os.cp("include/Common/EABase", package:installdir("include"))
     end)
 
@@ -18,4 +15,4 @@ package("eabase")
     on_test(function (package)
         assert(package:has_cxxfuncs("EA_LIMITS_DIGITS_U(int)",
             {configs = {languages = "c++17"}, includes = "EABase/eabase.h"}))
-    end)
+    end)

+ 9 - 11
packages/e/eastl/xmake.lua

@@ -6,22 +6,20 @@ package("eastl")
 
     add_urls("https://github.com/electronicarts/EASTL/archive/$(version).tar.gz")
     add_versions("3.17.03", "50a072066e30fda364d482df6733572d8ca440a33825d81254b59a6ca9f4375a")
+    add_versions("3.17.06", "9ebeef26cdf091877ee348450d2711cd0bb60ae435309126c0adf8fec9a01ea5")
 
     add_deps("cmake")
     add_deps("eabase")
 
     on_install("windows", "linux", "macosx", function (package)
-        io.gsub("CMakeLists.txt", "add_subdirectory%(test/packages/EABase%)", "#")
-        local configs = {}
-        table.insert(configs, "-DEASTL_BUILD_BENCHMARK:BOOL=OFF")
-        import("package.tools.cmake").build(package, configs, {buildir = "build", packagedeps = "eabase"})
-        if package:is_plat("windows") then
-            os.trycp("build/*.lib", package:installdir("lib"))
-            os.trycp("build/*.dll", package:installdir("bin"))
-        else
-            os.trycp("build/*.a", package:installdir("lib"))
-            os.trycp("build/*.so", package:installdir("lib"))
+        io.replace("CMakeLists.txt", "add_subdirectory(test/packages/EABase)", "", {plain = true})
+        io.replace("CMakeLists.txt", "target_link_libraries(EASTL EABase)", "", {plain = true})
+        local configs = {"-DEASTL_BUILD_TESTS=OFF", "-DEASTL_BUILD_BENCHMARK=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        if not package:is_plat("windows") then
+            table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         end
+        import("package.tools.cmake").install(package, configs, {packagedeps = "eabase"})
         os.cp("include/EASTL", package:installdir("include"))
     end)
 
@@ -32,4 +30,4 @@ package("eastl")
                 eastl::vector<int> testInt{};
             }
         ]]},{configs = {languages = "c++17"}, includes = "EASTL/vector.h"}))
-    end)
+    end)

+ 39 - 0
packages/x/xerces-c/xmake.lua

@@ -0,0 +1,39 @@
+package("xerces-c")
+
+    set_homepage("https://xerces.apache.org/xerces-c/")
+    set_description("Xerces-C++ is a validating XML parser written in a portable subset of C++.")
+    set_license("Apache-2.0")
+
+    add_urls("https://downloads.apache.org/xerces/c/3/sources/xerces-c-$(version).zip")
+    add_versions("3.2.3", "4a3a23ed859cff886e50ee8b30e3223c603fbcad86d1ba5a11f29da692b825ce")
+
+    add_deps("cmake")
+    if is_plat("windows") then
+        add_syslinks("advapi32")
+    elseif is_plat("macosx") then
+        add_frameworks("CoreFoundation", "CoreServices")
+    end
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-Dnetwork=OFF", "-DCMAKE_DISABLE_FIND_PACKAGE_ICU=ON", "-DCMAKE_DISABLE_FIND_PACKAGE_CURL=ON"}
+        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"))
+        if package:config("pic") ~= false then
+            table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            using namespace xercesc;
+            void test() {
+                try {
+                    XMLPlatformUtils::Initialize();
+                }
+                catch (const XMLException& toCatch) {
+                    return;
+                }
+                XMLPlatformUtils::Terminate();
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "xercesc/util/PlatformUtils.hpp"}))
+    end)