diff --git a/CMakeLists.txt b/CMakeLists.txt index b9ceeed40..8c1eb44c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ endif() set(THIRDPARTY_DIRECTORY "${CMAKE_SOURCE_DIR}/third_party") # TODO: b/462767957 - remove set(CMAKE_INSTALL_PREFIX ...) once we fix search path and mac build. set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install") +option(DIVE_BUILD_WITH_CRASHPAD "Build Dive with CrashPad" ON) # Add an option to allow users to easily toggle the runtime layer build option( @@ -162,15 +163,17 @@ if(NOT ANDROID) list(POP_BACK CMAKE_MESSAGE_INDENT) message(CHECK_PASS "done") - message(CHECK_START "Generate build files for third_party/crashpad") - list(APPEND CMAKE_MESSAGE_INDENT " ") - set(CRASHPAD_BUILD_TESTS OFF CACHE BOOL "" FORCE) - set(CRASHPAD_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) - add_subdirectory(third_party/crashpad EXCLUDE_FROM_ALL) - list(POP_BACK CMAKE_MESSAGE_INDENT) - message(CHECK_PASS "done") - add_library(crashpad_client ALIAS client) - set_target_properties(handler PROPERTIES OUTPUT_NAME "crashpad_handler") + if(DIVE_BUILD_WITH_CRASHPAD) + message(CHECK_START "Generate build files for third_party/crashpad") + list(APPEND CMAKE_MESSAGE_INDENT " ") + set(CRASHPAD_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(CRASHPAD_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + add_subdirectory(third_party/crashpad EXCLUDE_FROM_ALL) + list(POP_BACK CMAKE_MESSAGE_INDENT) + message(CHECK_PASS "done") + add_library(crashpad_client ALIAS client) + set_target_properties(handler PROPERTIES OUTPUT_NAME "crashpad_handler") + endif() else() message( CHECK_START diff --git a/src/dive/crashpad/CMakeLists.txt b/src/dive/crashpad/CMakeLists.txt index 636426fd3..655bac474 100644 --- a/src/dive/crashpad/CMakeLists.txt +++ b/src/dive/crashpad/CMakeLists.txt @@ -17,7 +17,7 @@ add_library( dive_crashpad crashpad_client.h - crashpad_client.cpp + $,crashpad_client.cpp,crashpad_client_stub.cpp> crashpad_utils.h $<$:crashpad_utils_win32.cpp> $<$:crashpad_utils_macos.cpp> diff --git a/src/dive/crashpad/crashpad_client_stub.cpp b/src/dive/crashpad/crashpad_client_stub.cpp new file mode 100644 index 000000000..4bced74a5 --- /dev/null +++ b/src/dive/crashpad/crashpad_client_stub.cpp @@ -0,0 +1,25 @@ +/* + Copyright 2026 Google LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "absl/status/status.h" +#include "crashpad_client.h" + +namespace Dive +{ + +absl::Status InitializeCrashpad() { return absl::OkStatus(); } + +} // namespace Dive