Skip to content

Commit

Permalink
WIP ci: fix crashpad compilation on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryp committed Mar 11, 2024
1 parent 63de01e commit c6b5cc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build_ubuntu:
if: false # FIXME
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -108,8 +109,8 @@ jobs:
}
cmake_generator: ["Visual Studio 17 2022"]
cmake_arch: [x64]
cmake_build_shared_libs: [ON, OFF]
cmake_build_type: [Debug, Release]
cmake_build_shared_libs: [OFF] # FIXME
cmake_build_type: [Release] # FIXME
name: "${{ matrix.config.name }} ${{ matrix.cmake_build_shared_libs == 'ON' && 'Shared' || 'Static' }} ${{ matrix.cmake_build_type }}"
steps:
- name: Checkout
Expand All @@ -129,7 +130,6 @@ jobs:

- name: Configure CMake
run: |
# FIXME Restore crashpad support on windows
cmake .\ -Bbuild `
-G "${{ matrix.cmake_generator }}" `
-A "${{ matrix.cmake_arch }}" `
Expand All @@ -139,7 +139,6 @@ jobs:
-DREAPER_GIT_HOOKS_AUTO_UPDATE=OFF `
-DREAPER_RUN_CLANG_TIDY=OFF `
-DREAPER_HEADLESS=ON `
-DREAPER_USE_GOOGLE_CRASHPAD=OFF `
-DREAPER_USE_TRACY=OFF
- name: Build
Expand Down
7 changes: 4 additions & 3 deletions cmake/external/crashpad.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ set(GOOGLE_BREAKPAD_PATH ${GOOGLE_PATH}/breakpad/src)
set(GOOGLE_CRASHPAD_PATH ${GOOGLE_PATH}/crashpad/crashpad)
set(GOOGLE_DEPOT_TOOLS_PATH ${GOOGLE_PATH}/depot_tools)

# depot_tools used to contain the ninja binary but doesn't anymore, so we need
# to make sure it's in the PATH instead of sourcing it from google's repo.
find_program(EXE_NINJA ninja REQUIRED)
# depot_tools used to contain the ninja binary but doesn't anymore, so we are
# using crashpad's version as a fallback.
# FIXME this file might only get available once gclient tools are called.
find_program(EXE_NINJA ninja REQUIRED HINTS ${GOOGLE_CRASHPAD_PATH}/third_party/ninja)

list(APPEND CMAKE_PROGRAM_PATH ${GOOGLE_DEPOT_TOOLS_PATH})
find_program(GOOGLE_DEPOT_TOOLS_GCLIENT gclient REQUIRED)
Expand Down
19 changes: 16 additions & 3 deletions src/CrashpadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <fmt/format.h>
#include <ini.h>

#if defined(REAPER_PLATFORM_WINDOWS)
# include <shlobj.h>
#endif

namespace Reaper
{
namespace
Expand All @@ -34,11 +38,20 @@ CrashpadContext create_crashpad_context(const CrashpadConfig& config)
{
// FIXME
#if defined(REAPER_PLATFORM_LINUX)
auto database_dir = base::FilePath("/tmp");
auto database_dir = base::FilePath("/tmp/neptune");
auto handler_path = base::FilePath("build/external/crashpad/crashpad_handler");
#elif defined(REAPER_PLATFORM_WINDOWS)
auto database_dir = base::FilePath(L"C:\\tmp");
auto handler_path = base::FilePath(L"crashpad_handler.exe");
PWSTR path = NULL;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &path);

if (SUCCEEDED(hr))
{
wprintf(L"%ls\n", path);
}

auto database_dir = base::FilePath(path).Append(L"/neptune");
auto handler_path = base::FilePath(L"build/external/crashpad/crashpad_handler.exe");
CoTaskMemFree(path);
#endif

auto metrics_dir = database_dir;
Expand Down

0 comments on commit c6b5cc9

Please sign in to comment.