cmake: cleanup and link crashpad on mac
This commit is contained in:
+79
-84
@@ -22,13 +22,22 @@ set(OLIVE_SOURCES
|
|||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Include resource files for specific platforms
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(OLIVE_RESOURCES
|
set(OLIVE_RESOURCES
|
||||||
${OLIVE_RESOURCES}
|
${OLIVE_RESOURCES}
|
||||||
packaging/windows/resources.rc
|
packaging/windows/resources.rc
|
||||||
)
|
)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(OLIVE_ICON packaging/macos/olive.icns)
|
||||||
|
|
||||||
|
set(OLIVE_RESOURCES
|
||||||
|
${OLIVE_RESOURCES}
|
||||||
|
${OLIVE_ICON}
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add subdirectories, which will populate the above variables
|
||||||
add_subdirectory(audio)
|
add_subdirectory(audio)
|
||||||
add_subdirectory(cli)
|
add_subdirectory(cli)
|
||||||
add_subdirectory(codec)
|
add_subdirectory(codec)
|
||||||
@@ -36,6 +45,7 @@ add_subdirectory(common)
|
|||||||
add_subdirectory(config)
|
add_subdirectory(config)
|
||||||
add_subdirectory(dialog)
|
add_subdirectory(dialog)
|
||||||
add_subdirectory(node)
|
add_subdirectory(node)
|
||||||
|
add_subdirectory(packaging)
|
||||||
add_subdirectory(panel)
|
add_subdirectory(panel)
|
||||||
add_subdirectory(project)
|
add_subdirectory(project)
|
||||||
add_subdirectory(render)
|
add_subdirectory(render)
|
||||||
@@ -50,15 +60,6 @@ add_subdirectory(undo)
|
|||||||
add_subdirectory(widget)
|
add_subdirectory(widget)
|
||||||
add_subdirectory(window)
|
add_subdirectory(window)
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(OLIVE_ICON packaging/macos/olive.icns)
|
|
||||||
|
|
||||||
set(OLIVE_RESOURCES
|
|
||||||
${OLIVE_RESOURCES}
|
|
||||||
${OLIVE_ICON}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add translations
|
# Add translations
|
||||||
qt5_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})
|
qt5_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})
|
||||||
|
|
||||||
@@ -80,16 +81,18 @@ add_executable(olive-editor
|
|||||||
${OLIVE_RESOURCES}
|
${OLIVE_RESOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(APPLE)
|
# Set global definitions
|
||||||
set_target_properties(olive-editor PROPERTIES
|
target_compile_definitions(olive-editor PRIVATE ${OLIVE_DEFINITIONS})
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/MacOSXBundleInfo.plist.in
|
# Set include directories
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER org.olivevideoeditor.Olive
|
target_include_directories(
|
||||||
MACOSX_BUNDLE_ICON_FILE olive.icns
|
olive-editor
|
||||||
RESOURCE "${OLIVE_ICON}"
|
PRIVATE
|
||||||
OUTPUT_NAME "Olive"
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
)
|
${OCIO_INCLUDE_DIRS}
|
||||||
endif()
|
${OIIO_INCLUDE_DIRS}
|
||||||
|
${OPENEXR_INCLUDES}
|
||||||
|
)
|
||||||
|
|
||||||
# Set compiler options
|
# Set compiler options
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -120,29 +123,6 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
target_link_options(
|
|
||||||
olive-editor
|
|
||||||
PRIVATE
|
|
||||||
-rdynamic
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set include directories
|
|
||||||
target_include_directories(
|
|
||||||
olive-editor
|
|
||||||
PRIVATE
|
|
||||||
${FFMPEG_INCLUDE_DIRS}
|
|
||||||
${OCIO_INCLUDE_DIRS}
|
|
||||||
${OIIO_INCLUDE_DIRS}
|
|
||||||
${OPENEXR_INCLUDES}
|
|
||||||
|
|
||||||
# HACK: Brew on macOS separates OpenEXR and IlmBase into two folders even though they seem to
|
|
||||||
# expect to be in one. This includes the IlmBase files as if they were in the same folders
|
|
||||||
# as the OpenEXR headers.
|
|
||||||
${ILMBASE_INCLUDES}/OpenEXR
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set link libraries
|
# Set link libraries
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
olive-editor
|
olive-editor
|
||||||
@@ -166,23 +146,44 @@ target_link_libraries(
|
|||||||
${OPENEXR_LIBRARIES}
|
${OPENEXR_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
# Set Mac-specific properties for application
|
||||||
target_link_libraries(
|
if (APPLE)
|
||||||
|
set_target_properties(olive-editor PROPERTIES
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/MacOSXBundleInfo.plist.in
|
||||||
|
MACOSX_BUNDLE_GUI_IDENTIFIER org.olivevideoeditor.Olive
|
||||||
|
MACOSX_BUNDLE_ICON_FILE olive.icns
|
||||||
|
RESOURCE "${OLIVE_ICON}"
|
||||||
|
OUTPUT_NAME "Olive"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Enables use of special functions for slider dragging
|
||||||
|
if (NOT GoogleCrashpad_FOUND)
|
||||||
|
target_link_libraries(
|
||||||
|
olive-editor
|
||||||
|
PRIVATE
|
||||||
|
"-framework ApplicationServices"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# HACK: Brew on macOS separates OpenEXR and IlmBase into two folders even though they seem to
|
||||||
|
# expect to be in one. This includes the IlmBase files as if they were in the same folders
|
||||||
|
# as the OpenEXR headers. This would be better rolled into FindOpenEXR.cmake.
|
||||||
|
target_include_directories(
|
||||||
olive-editor
|
olive-editor
|
||||||
PRIVATE
|
PRIVATE
|
||||||
DbgHelp
|
${ILMBASE_INCLUDES}/OpenEXR
|
||||||
)
|
|
||||||
elseif (APPLE)
|
|
||||||
target_link_libraries(
|
|
||||||
olive-editor
|
|
||||||
PRIVATE
|
|
||||||
"-framework ApplicationServices"
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Set Linux-specific properties for application
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
install(TARGETS olive-editor RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Enable OTIO if found
|
# Enable OTIO if found
|
||||||
if (OpenTimelineIO_FOUND)
|
if (OpenTimelineIO_FOUND)
|
||||||
set(OLIVE_DEFINITIONS ${OLIVE_DEFINITIONS} USE_OTIO)
|
target_compile_definitions(olive-editor PRIVATE USE_OTIO)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
olive-editor
|
olive-editor
|
||||||
@@ -197,55 +198,52 @@ if (OpenTimelineIO_FOUND)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
install(TARGETS olive-editor RUNTIME DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Enable Crashpad if found
|
# Enable Crashpad if found
|
||||||
if (GoogleCrashpad_FOUND)
|
if (GoogleCrashpad_FOUND)
|
||||||
set(OLIVE_DEFINITIONS ${OLIVE_DEFINITIONS} USE_CRASHPAD)
|
# Signal code to use Crashpad
|
||||||
|
target_compile_definitions(
|
||||||
|
olive-editor
|
||||||
|
PRIVATE
|
||||||
|
USE_CRASHPAD
|
||||||
|
)
|
||||||
|
|
||||||
|
# Include Crashpad headers
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
olive-editor
|
olive-editor
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CRASHPAD_INCLUDE_DIRS}
|
${CRASHPAD_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Include Crashpad libs
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
olive-editor
|
olive-editor
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CRASHPAD_LIBRARIES}
|
${CRASHPAD_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(OLIVE_CRASH_TARGET "olive-crashhandler")
|
# Create crash handler executable
|
||||||
|
add_executable(
|
||||||
set(OLIVE_CRASH_SOURCES
|
olive-crashhandler
|
||||||
dialog/crashhandler/crashhandler.h
|
dialog/crashhandler/crashhandler.h
|
||||||
dialog/crashhandler/crashhandler.cpp
|
dialog/crashhandler/crashhandler.cpp
|
||||||
dialog/crashhandler/crashhandlermain.cpp
|
dialog/crashhandler/crashhandlermain.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
# Disable console appearing on crash handler dialog
|
||||||
add_executable(
|
set_target_properties(olive-crashhandler PROPERTIES
|
||||||
${OLIVE_CRASH_TARGET}
|
WIN32_EXECUTABLE TRUE
|
||||||
WIN32
|
)
|
||||||
${OLIVE_CRASH_SOURCES}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_executable(
|
|
||||||
${OLIVE_CRASH_TARGET}
|
|
||||||
${OLIVE_CRASH_SOURCES}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# Set crash handler includes
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${OLIVE_CRASH_TARGET}
|
olive-crashhandler
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CRASHPAD_INCLUDE_DIRS}
|
${CRASHPAD_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Set crash handler libs
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${OLIVE_CRASH_TARGET}
|
olive-crashhandler
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
@@ -254,32 +252,29 @@ if (GoogleCrashpad_FOUND)
|
|||||||
${CRASHPAD_LIBRARIES}
|
${CRASHPAD_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(${OLIVE_CRASH_TARGET} PRIVATE ${OLIVE_DEFINITIONS})
|
# Set global Olive compiler definitions
|
||||||
|
target_compile_definitions(olive-crashhandler PRIVATE ${OLIVE_DEFINITIONS})
|
||||||
|
|
||||||
set(CRASHPAD_HANDLER "crashpad_handler${CMAKE_EXECUTABLE_SUFFIX}")
|
set(CRASHPAD_HANDLER "crashpad_handler${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set(MINIDUMP_STACKWALK "minidump_stackwalk${CMAKE_EXECUTABLE_SUFFIX}")
|
set(MINIDUMP_STACKWALK "minidump_stackwalk${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS ${OLIVE_CRASH_TARGET} RUNTIME DESTINATION bin)
|
install(TARGETS olive-crashhandler RUNTIME DESTINATION bin)
|
||||||
install(PROGRAMS ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} DESTINATION bin)
|
install(PROGRAMS ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} DESTINATION bin)
|
||||||
install(PROGRAMS ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} DESTINATION bin)
|
install(PROGRAMS ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# Move crash handler executables inside Mac app bundle
|
# Move crash handler executables inside Mac app bundle
|
||||||
add_custom_command(TARGET ${OLIVE_CRASH_TARGET} POST_BUILD
|
add_custom_command(TARGET olive-crashhandler POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OLIVE_CRASH_TARGET} $<TARGET_FILE_DIR:olive-editor>
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different olive-crashhandler $<TARGET_FILE_DIR:olive-editor>
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} $<TARGET_FILE_DIR:olive-editor>
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRASHPAD_LIBRARY_DIRS}/${CRASHPAD_HANDLER} $<TARGET_FILE_DIR:olive-editor>
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} $<TARGET_FILE_DIR:olive-editor>
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BREAKPAD_BIN_DIR}/${MINIDUMP_STACKWALK} $<TARGET_FILE_DIR:olive-editor>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set compiler definitions
|
# Create docs if doxygen was found
|
||||||
target_compile_definitions(olive-editor PRIVATE ${OLIVE_DEFINITIONS})
|
|
||||||
|
|
||||||
add_subdirectory(packaging)
|
|
||||||
|
|
||||||
if(DOXYGEN_FOUND)
|
if(DOXYGEN_FOUND)
|
||||||
set(DOXYGEN_PROJECT_NAME "Olive")
|
set(DOXYGEN_PROJECT_NAME "Olive")
|
||||||
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
|
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ if (WIN32)
|
|||||||
"out/Default"
|
"out/Default"
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
# Assuming macOS works this way, don't actually know
|
|
||||||
find_path(CRASHPAD_LIBRARY_DIRS
|
find_path(CRASHPAD_LIBRARY_DIRS
|
||||||
obj/client/libclient.a
|
obj/client/libclient.a
|
||||||
HINTS
|
HINTS
|
||||||
@@ -77,8 +76,30 @@ set (_crashpad_components
|
|||||||
client
|
client
|
||||||
util
|
util
|
||||||
third_party/mini_chromium/mini_chromium/base
|
third_party/mini_chromium/mini_chromium/base
|
||||||
compat
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set (_crashpad_required
|
||||||
|
CRASHPAD_CLIENT_LIB
|
||||||
|
CRASHPAD_UTIL_LIB
|
||||||
|
CRASHPAD_BASE_LIB
|
||||||
|
BREAKPAD_BIN_DIR
|
||||||
|
CRASHPAD_BUILD_INCLUDE_DIR
|
||||||
|
CRASHPAD_CLIENT_INCLUDE_DIR
|
||||||
|
CRASHPAD_BASE_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32 OR (UNIX AND NOT APPLE))
|
||||||
|
set (_crashpad_components
|
||||||
|
${_crashpad_components}
|
||||||
|
compat
|
||||||
|
)
|
||||||
|
|
||||||
|
set (_crashpad_required
|
||||||
|
${_crashpad_required}
|
||||||
|
CRASHPAD_COMPAT_LIB
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach (COMPONENT ${_crashpad_components})
|
foreach (COMPONENT ${_crashpad_components})
|
||||||
get_filename_component(SHORT_COMPONENT ${COMPONENT} NAME)
|
get_filename_component(SHORT_COMPONENT ${COMPONENT} NAME)
|
||||||
string(TOUPPER ${SHORT_COMPONENT} UPPER_COMPONENT)
|
string(TOUPPER ${SHORT_COMPONENT} UPPER_COMPONENT)
|
||||||
@@ -92,6 +113,48 @@ foreach (COMPONENT ${_crashpad_components})
|
|||||||
list(APPEND CRASHPAD_LIBRARIES ${CRASHPAD_${UPPER_COMPONENT}_LIB})
|
list(APPEND CRASHPAD_LIBRARIES ${CRASHPAD_${UPPER_COMPONENT}_LIB})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
# macOS requires a bunch of extra loose object files that aren't made into static libraries
|
||||||
|
# See: https://groups.google.com/a/chromium.org/g/crashpad-dev/c/XVggc7kvlNs/m/msMjHS4KAQAJ
|
||||||
|
set (_crashpad_mach_loose_objects
|
||||||
|
child_portServer
|
||||||
|
#mach_excServer
|
||||||
|
child_portUser
|
||||||
|
#mach_excUser
|
||||||
|
excServer
|
||||||
|
notifyServer
|
||||||
|
excUser
|
||||||
|
notifyUser
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach (COMPONENT ${_crashpad_mach_loose_objects})
|
||||||
|
string(TOUPPER ${COMPONENT} UPPER_COMPONENT)
|
||||||
|
set(LIB_NAME CRASHPAD_MACH_${UPPER_COMPONENT}_LIB)
|
||||||
|
find_file(${LIB_NAME}
|
||||||
|
NAMES
|
||||||
|
mig_output.${COMPONENT}.o
|
||||||
|
HINTS
|
||||||
|
"${CRASHPAD_LIBRARY_DIRS}/obj/out/Default/gen/util/mach"
|
||||||
|
)
|
||||||
|
|
||||||
|
set (_crashpad_required
|
||||||
|
${_crashpad_required}
|
||||||
|
${LIB_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CRASHPAD_LIBRARIES ${${LIB_NAME}})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
list(APPEND CRASHPAD_LIBRARIES
|
||||||
|
bsm
|
||||||
|
"-framework IOKit"
|
||||||
|
"-framework Foundation"
|
||||||
|
"-framework Security"
|
||||||
|
"-framework CoreFoundation"
|
||||||
|
"-framework ApplicationServices"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Find Breakpad's minidump_stackwalk
|
# Find Breakpad's minidump_stackwalk
|
||||||
find_path(BREAKPAD_BIN_DIR
|
find_path(BREAKPAD_BIN_DIR
|
||||||
"minidump_stackwalk${CMAKE_EXECUTABLE_SUFFIX}"
|
"minidump_stackwalk${CMAKE_EXECUTABLE_SUFFIX}"
|
||||||
@@ -105,13 +168,7 @@ PATH_SUFFIXES
|
|||||||
|
|
||||||
find_package_handle_standard_args(GoogleCrashpad
|
find_package_handle_standard_args(GoogleCrashpad
|
||||||
REQUIRED_VARS
|
REQUIRED_VARS
|
||||||
CRASHPAD_CLIENT_LIB
|
${_crashpad_required}
|
||||||
CRASHPAD_UTIL_LIB
|
|
||||||
CRASHPAD_BASE_LIB
|
|
||||||
BREAKPAD_BIN_DIR
|
|
||||||
CRASHPAD_BUILD_INCLUDE_DIR
|
|
||||||
CRASHPAD_CLIENT_INCLUDE_DIR
|
|
||||||
CRASHPAD_BASE_INCLUDE_DIR
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
|
|||||||
Reference in New Issue
Block a user