-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Use Bundle Utilities for MacOS
- Loading branch information
Showing
1 changed file
with
36 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,47 @@ | ||
# include(BundleUtilities) | ||
message(STATUS "Creating Mac Bundle") | ||
|
||
set(TARGET_NAME QGroundControl) | ||
set(SYSTEM_FRAMEWORK_PATH /Library/Frameworks) | ||
set(BUNDLE_FRAMEWORK_PATH staging/${TARGET_NAME}.app/Contents/Frameworks) | ||
|
||
message(STATUS "Copy GStreamer framework into bundle") | ||
file(COPY /Library/Frameworks/GStreamer.framework DESTINATION staging/QGroundControl.app/Contents/Frameworks) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/bin) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/etc) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/share) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/Headers) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/include) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/Commands) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/glib-2.0) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/graphene-1.0) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/gst-validate-launcher) | ||
file(GLOB REMOVE_LIB_FILES staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/*.a) | ||
file(COPY ${SYSTEM_FRAMEWORK_PATH}/GStreamer.framework DESTINATION ${BUNDLE_FRAMEWORK_PATH}) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/bin) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/etc) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/share) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/Headers) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/include) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/Commands) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/pkgconfig) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/glib-2.0) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/graphene-1.0) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/gst-validate-launcher) | ||
file(GLOB REMOVE_LIB_FILES ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/*.a) | ||
file(REMOVE ${REMOVE_LIB_FILES}) | ||
file(GLOB REMOVE_LIB_FILES staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/*.la) | ||
file(GLOB REMOVE_LIB_FILES ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/*.la) | ||
file(REMOVE ${REMOVE_LIB_FILES}) | ||
file(GLOB REMOVE_LIB_FILES staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/*.a) | ||
file(GLOB REMOVE_LIB_FILES ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/*.a) | ||
file(REMOVE ${REMOVE_LIB_FILES}) | ||
file(GLOB REMOVE_LIB_FILES staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/*.la) | ||
file(GLOB REMOVE_LIB_FILES ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/*.la) | ||
file(REMOVE ${REMOVE_LIB_FILES}) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/include) | ||
file(REMOVE_RECURSE staging/QGroundControl.app/Contents/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/pkgconfig) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/include) | ||
file(REMOVE_RECURSE ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/pkgconfig) | ||
|
||
# Fix up library paths to point into bundle | ||
execute_process(COMMAND install_name_tool -change /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer @executable_path/../Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer staging/QGroundControl.app/Contents/MacOS/QGroundControl) | ||
execute_process(COMMAND ln -sf ${BUNDLE_FRAMEWORK_PATH} ${BUNDLE_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/libexec/Frameworks) | ||
execute_process(COMMAND install_name_tool -change ${SYSTEM_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/GStreamer @executable_path/../Frameworks/GStreamer.framework/Versions/1.0/lib/GStreamer staging/${TARGET_NAME}.app/Contents/MacOS/${TARGET_NAME}) | ||
|
||
message(STATUS "Creating Mac DMG") | ||
include(BundleUtilities) | ||
include(CMakePrintHelpers) | ||
file(REMOVE_RECURSE package) | ||
file(MAKE_DIRECTORY package) | ||
file(COPY staging/QGroundControl.app DESTINATION package) | ||
execute_process(COMMAND create-dmg --volname "QGroundControl Installer" "QGroundControl.dmg" "package/") | ||
copy_and_fixup_bundle("${CMAKE_BINARY_DIR}/staging/${TARGET_NAME}.app" "${CMAKE_BINARY_DIR}/package" "" "${SYSTEM_FRAMEWORK_PATH}/GStreamer.framework/Versions/1.0/lib/GStreamer") | ||
verify_app("${CMAKE_BINARY_DIR}/package/${TARGET_NAME}.app") | ||
verify_bundle_prerequisites("${CMAKE_BINARY_DIR}/package/${TARGET_NAME}.app" VERIFY_BUNDLE_PREREQS_RESULT VERIFY_BUNDLE_PREREQS_INFO) | ||
cmake_print_variables(VERIFY_BUNDLE_PREREQS_RESULT VERIFY_BUNDLE_PREREQS_INFO) | ||
verify_bundle_symlinks("${CMAKE_BINARY_DIR}/package/${TARGET_NAME}.app" VERIFY_BUNDLE_SYMLINKS_RESULT VERIFY_BUNDLE_SYMLINKS_INFO) | ||
cmake_print_variables(VERIFY_BUNDLE_SYMLINKS_RESULT VERIFY_BUNDLE_SYMLINKS_INFO) | ||
|
||
message(STATUS "Creating Mac DMG") | ||
file(COPY staging/${TARGET_NAME}.app DESTINATION package) | ||
execute_process(COMMAND create-dmg --volname "${TARGET_NAME} Installer" "${TARGET_NAME}.dmg" "package/") |