Skip to content

Commit

Permalink
Check if python 2 is available for crasphad
Browse files Browse the repository at this point in the history
Crashpad required python 2 since the gn build system invokes python. This disables crashpad if Python2 is not detected.
  • Loading branch information
jameskr97 committed Nov 18, 2020
1 parent 7d84bf0 commit d384b5e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ target_link_libraries(Etterna PRIVATE libcurl)
target_link_libraries(Etterna PRIVATE fmt::fmt)
target_link_libraries(Etterna PRIVATE plog::plog)

if(WITH_CRASHPAD)
# If the user wants crashpad, and the target exists (in-case
# the user wants it, but crashpad couldn't find python)
if(WITH_CRASHPAD AND TARGET crashpad)
target_link_libraries(Etterna PRIVATE crashpad)
endif()

Expand Down
5 changes: 4 additions & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ add_subdirectory(zlib)
add_subdirectory(mad-0.15.1b)
add_subdirectory(fmt)
add_subdirectory(plog)
add_subdirectory(crashpad)

## Vorbis depends on ogg
add_subdirectory(newogg)
add_subdirectory(newvorbis)
target_link_libraries(vorbis ogg)

# Only enable crashpad if the user wants it.
if(WITH_CRASHPAD)
add_subdirectory(crashpad)
endif()

if(MSVC) # Only required on Windows
add_subdirectory(ffmpeg)
Expand Down
10 changes: 10 additions & 0 deletions extern/crashpad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# First, we check to see if the user has Python2. The crashpad gn build invokes
# a Python2 script. We will see if we can find Python2. If we can, we will assume
# it's on the system path, otherwise, we will notify the user, then disable crashpad.
find_package (Python2)
if(NOT Python2_FOUND)
message(WARNING " Python 2 was not found. Crashpad will be disabled. If you would like to build"
" crashpad, please ensure Python 2 is installed and apart of the system path.")
return()
endif()

# Google uses depot_tools to download and build crashpad. We will do the same.
# This file make assumptions about where crashpad is located. Chromium uses depot_tools
# to download and setup a directory for the crashpad/breakpad/chromium tools. We do not
Expand Down

0 comments on commit d384b5e

Please sign in to comment.