Просмотр исходного кода

Add Linux support to Crashpad. (#4157)

* 1. Compile binary files.
2. Modify crashpad/xmake.lua.
3. Add Linux support.

* format crashpad xmake.lua

* 1. add on_test check function
2. modify link sort
3. move add_includedirs position when platform is windows

* - add crashpad's license(Apache-2.0)

* Update xmake.lua

* Update xmake.lua

* - modify build type,now build from source
- windows is testing

* - passed build in linux

* - scope include and libs for linux

* - moidfy /include to include

* - add libcurl depedency

* - scope linux deps

* Update xmake.lua

delete libcurl

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

- add cmake options
- change verify platforms bin

* Update xmake.lua

---------

Co-authored-by: SanQi <[email protected]>
Co-authored-by: ruki <[email protected]>
Co-authored-by: star9029 <[email protected]>
sanqideshi 1 год назад
Родитель
Сommit
ecf7f2e3be
1 измененных файлов с 28 добавлено и 30 удалено
  1. 28 30
      packages/c/crashpad/xmake.lua

+ 28 - 30
packages/c/crashpad/xmake.lua

@@ -1,37 +1,35 @@
 package("crashpad")
     set_homepage("https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md")
     set_description("Crashpad is a crash-reporting system.")
+    set_license("Apache-2.0")
 
-    if is_host("windows") then
-    
-        local map = {
-            ["2021.8.1"] = "stable",
-            ["2022.4.16"] = "latest"
-        }
-    
-        function map_version(version)
-            return map[tostring(version)]
-        end
-    
-        if is_arch("x64", "x86_64") then
-            set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-64-$(version).zip", {version = map_version})
-            add_versions("2021.8.1", "b3facf8a802dfd12daf4d9fba416f4d4b5df0ae544afa14080662fa978aa18cb")
-            add_versions("2022.4.16", "7705073dfff89c376303cacea3a6f8c63322f77566ad5cdbe37060cf3cef9f8b")
-        else
-            set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-$(version).zip", {version = map_version})
-            add_versions("2021.8.1", "699fdf741f39da1c68069820ce891b6eb8b48ef29ab399fc1bcf210b67ff8547")
-            add_versions("2022.4.16", "c3bffb64d1087198946739dfb30d24b2355e49ddfe90d8e2a75ed373ed6e3377")
-        end
-    end
+    add_urls("https://github.com/getsentry/crashpad.git")
+    add_versions("2024.04.15", "96e301b7d6b81990a244d7de41a0d36eeb60899e")
+
+    add_includedirs("include/crashpad", "include/crashpad/mini_chromium")
+    add_links("crashpad_client", "crashpad_util", "mini_chromium")
 
-    add_includedirs("include", "include/mini_chromium")
+    add_deps("cmake")
+    add_deps("libcurl")
 
-    on_install("windows", function (package)
-        os.cp("include/*", package:installdir("include"))
-        os.cp("bin/crashpad_handler.exe", package:installdir("bin"))
-        if package:config("shared") then
-            os.cp("lib_md/*", package:installdir("lib"))
-        else
-            os.cp("lib_mt/*", package:installdir("lib"))
+    on_install("linux", "windows|x64", "windows|x86", function(package)
+        local configs = {}
+        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, {packagedeps = "libcurl"})
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function(package)
+        if not package:is_cross() then
+            os.vrun("crashpad_handler --help")
         end
-     end)
+
+        assert(package:check_cxxsnippets({test = [[
+            #include "client/crashpad_client.h"
+            using namespace crashpad;
+            void test() {
+                CrashpadClient *client = new CrashpadClient();
+            }
+        ]]}, {configs = {languages = "cxx17"}}))
+    end)