From a138af5e28e6474e7430bfb219568edc4944523d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 15 Jan 2023 11:35:14 +0100 Subject: [PATCH 1/2] Explicitly set target linker language for compat CMakeLists.txt This fixes compatibility with CMake's Ninja generator --- compat/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/compat/CMakeLists.txt b/compat/CMakeLists.txt index c0bfdf68..597fc45f 100644 --- a/compat/CMakeLists.txt +++ b/compat/CMakeLists.txt @@ -54,6 +54,7 @@ endif (WIN32) add_library(compat_incl INTERFACE) add_library(compat OBJECT) +set_target_properties(compat PROPERTIES LINKER_LANGUAGE CXX) target_sources(compat PRIVATE ${CRASHPAD_COMPAT_LIBRARY_FILES}) target_link_libraries(compat PUBLIC util compat_incl) From 310d06486516a5044d42498d5742633907bb0b06 Mon Sep 17 00:00:00 2001 From: krzaq Date: Sat, 25 Feb 2023 18:18:40 +0100 Subject: [PATCH 2/2] github: test Ninja builds. --- .github/workflows/main.yml | 24 +++++++++++++++++++++--- backtrace/save_artifacts.rb | 10 ++++++---- backtrace/test/crashpad_utils.rb | 6 +++++- backtrace/test/test_windows.rb | 10 ++++++++-- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b9e66c8..f08db272 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,12 @@ on: jobs: build-linux: runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + generator: ["Unix Makefiles", Ninja] + steps: # Install latest CMake. - uses: lukka/get-cmake@latest @@ -30,7 +36,7 @@ jobs: - name: CMake run: | mkdir cbuild - cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE + cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "${{ matrix.generator }}" cmake --build cbuild/ - uses: ruby/setup-ruby@v1 @@ -56,6 +62,12 @@ jobs: build-windows: # Because we want to use Visual Studio 16 2019, we need to use the windows-2019 GitHub runner runs-on: windows-2019 + + strategy: + fail-fast: false + matrix: + generator: ["Visual Studio 16 2019", Ninja] + steps: # Install latest CMake. - uses: lukka/get-cmake@latest @@ -64,6 +76,11 @@ jobs: with: submodules: recursive + - name: Add cl.exe to PATH + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + - name: CMake run: | # make a build directory (note: build is already used by Crashpad) @@ -71,7 +88,7 @@ jobs: # run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible) # it is recommended to specify the compiler version used for the build - cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "Visual Studio 16 2019" + cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "${{ matrix.generator }}" -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe cmake --build cbuild/ - uses: ruby/setup-ruby@v1 @@ -101,6 +118,7 @@ jobs: fail-fast: false matrix: arch: [arm64, x86_64] + generator: ["Unix Makefiles", Ninja] steps: # Install latest CMake. @@ -113,7 +131,7 @@ jobs: - name: CMake run: | mkdir cbuild - cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} + cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -G "${{ matrix.generator }}" cmake --build cbuild/ - uses: ruby/setup-ruby@v1 diff --git a/backtrace/save_artifacts.rb b/backtrace/save_artifacts.rb index 1e2adcfb..47873267 100755 --- a/backtrace/save_artifacts.rb +++ b/backtrace/save_artifacts.rb @@ -51,8 +51,8 @@ def gather_include_files dir = include_dir selected_headers = all_headers .reject{ _1 =~ /^#{Regexp.union REJECT_DIRS}/ } .map{ [ "include/#{_1}", File.absolute_path(_1) ] } - - + + selected_headers += Dir.chdir 'third_party/mini_chromium/mini_chromium' do Dir['**/*.h'] .map{ [ "include/#{_1}", File.absolute_path(_1) ] } @@ -82,9 +82,11 @@ def gather_binaries dir = binary_dir [ 'client/libclient.a', 'bin/libclient.a' ], [ 'handler/handler', 'bin/handler' ], [ './client/Debug/client.lib', 'bin/client.lib' ], - [ 'handler\Debug\handler.exe', 'bin/handler.exe' ], + [ 'handler/Debug/handler.exe', 'bin/handler.exe' ], [ './client/Release/client.lib', 'bin/client.lib' ], - [ 'handler\Release\handler.exe', 'bin/handler.exe' ], + [ 'handler/Release/handler.exe', 'bin/handler.exe' ], + [ './client/client.lib', 'bin/client.lib' ], + [ 'handler/handler.exe', 'bin/handler.exe' ], ] Dir.chdir dir do files.each do |file, name| diff --git a/backtrace/test/crashpad_utils.rb b/backtrace/test/crashpad_utils.rb index a28660b9..7e076662 100755 --- a/backtrace/test/crashpad_utils.rb +++ b/backtrace/test/crashpad_utils.rb @@ -117,7 +117,11 @@ def execute tmp_dir: nil def handler if OS.windows? - 'handler/Debug/handler.exe' + [ + 'handler/Debug/handler.exe', + 'handler/Release/handler.exe', + 'handler/handler.exe', + ].find { |f| File.exist? f } else 'handler/handler' end diff --git a/backtrace/test/test_windows.rb b/backtrace/test/test_windows.rb index 730ccdf9..89e84e95 100755 --- a/backtrace/test/test_windows.rb +++ b/backtrace/test/test_windows.rb @@ -2,9 +2,15 @@ require_relative 'crashpad_utils' -class TestLinux < Minitest::Test +class TestWindows < Minitest::Test def test_crashpad_uploads - result = Crashpad::perform_test executable: 'examples/windows/demo/Debug/demo_windows.exe' + exe = if File.exist?("#{__dir__}/../../cbuild/examples/windows/demo/Debug/demo_windows.exe") + 'examples/windows/demo/Debug/demo_windows.exe' + else + 'examples/windows/demo/demo_windows.exe' + end + + result = Crashpad::perform_test executable: exe assert result assert result.has_key? :upload