feat: mac os new build option BUILD_OSX_BUNDLE can be disabled to build a non app bundle
This commit is contained in:
parent
aa11dc94ba
commit
6eadba1ab2
6 changed files with 59 additions and 50 deletions
|
|
@ -160,6 +160,8 @@ add_definitions(-DQT_NO_KEYWORDS)
|
||||||
#Options for Linux platform support
|
#Options for Linux platform support
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
option(BUILD_X11_SUPPORT "Build with x11 support" ON)
|
option(BUILD_X11_SUPPORT "Build with x11 support" ON)
|
||||||
|
elseif (APPLE)
|
||||||
|
option(BUILD_OSX_BUNDLE "Build mac os bundle" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cmake/Libraries.cmake)
|
include(cmake/Libraries.cmake)
|
||||||
|
|
@ -172,13 +174,12 @@ if (WIN32)
|
||||||
set(CMAKE_INSTALL_LIBDIR .)
|
set(CMAKE_INSTALL_LIBDIR .)
|
||||||
set(CMAKE_INSTALL_LICENSE_DIR .)
|
set(CMAKE_INSTALL_LICENSE_DIR .)
|
||||||
set(CMAKE_INSTALL_I18N_DIR translations)
|
set(CMAKE_INSTALL_I18N_DIR translations)
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(BUILD_OSX_BUNDLE)
|
||||||
set(CMAKE_INSTALL_LICENSE_DIR ${CMAKE_INSTALL_DATADIR}/licenses/${CMAKE_PROJECT_NAME})
|
|
||||||
set(CMAKE_INSTALL_I18N_DIR ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/translations)
|
|
||||||
else()
|
|
||||||
set(CMAKE_INSTALL_BINDIR ${CMAKE_PROJECT_PROPER_NAME}.app/Contents/MacOS)
|
set(CMAKE_INSTALL_BINDIR ${CMAKE_PROJECT_PROPER_NAME}.app/Contents/MacOS)
|
||||||
set(CMAKE_INSTALL_LICENSE_DIR ${CMAKE_PROJECT_PROPER_NAME}.app/Contents/Resources)
|
set(CMAKE_INSTALL_LICENSE_DIR ${CMAKE_PROJECT_PROPER_NAME}.app/Contents/Resources)
|
||||||
set(CMAKE_INSTALL_I18N_DIR ${CMAKE_PROJECT_PROPER_NAME}.app/Contents/MacOS/translations)
|
else()
|
||||||
|
set(CMAKE_INSTALL_LICENSE_DIR ${CMAKE_INSTALL_DATADIR}/licenses/${CMAKE_PROJECT_NAME})
|
||||||
|
set(CMAKE_INSTALL_I18N_DIR ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/translations)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,20 @@
|
||||||
# HACK This is set when the files is included so its the real path
|
# HACK This is set when the files is included so its the real path
|
||||||
# calling CMAKE_CURRENT_LIST_DIR after include would return the wrong scope var
|
# calling CMAKE_CURRENT_LIST_DIR after include would return the wrong scope var
|
||||||
set(MY_DIR ${CMAKE_CURRENT_LIST_DIR})
|
set(MY_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
set(OSX_BUNDLE ${BUILD_OSX_BUNDLE})
|
||||||
|
|
||||||
|
set(OS_STRING "macos-${BUILD_ARCHITECTURE}")
|
||||||
|
|
||||||
|
if (OSX_BUNDLE)
|
||||||
install(CODE "execute_process(COMMAND
|
install(CODE "execute_process(COMMAND
|
||||||
${DEPLOYQT}
|
${DEPLOYQT}
|
||||||
\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_PROPER_NAME}.app\"
|
\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_PROPER_NAME}.app\"
|
||||||
-timestamp -codesign=-
|
-timestamp -codesign=-
|
||||||
)")
|
)")
|
||||||
|
|
||||||
set(OS_STRING "macos-${BUILD_ARCHITECTURE}")
|
|
||||||
set(CPACK_PACKAGE_ICON "${MY_DIR}/dmg-volume.icns")
|
set(CPACK_PACKAGE_ICON "${MY_DIR}/dmg-volume.icns")
|
||||||
set(CPACK_DMG_BACKGROUND_IMAGE "${MY_DIR}/dmg-background.tiff")
|
set(CPACK_DMG_BACKGROUND_IMAGE "${MY_DIR}/dmg-background.tiff")
|
||||||
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${MY_DIR}/generate_ds_store.applescript")
|
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${MY_DIR}/generate_ds_store.applescript")
|
||||||
set(CPACK_DMG_VOLUME_NAME "${CMAKE_PROJECT_PROPER_NAME}")
|
set(CPACK_DMG_VOLUME_NAME "${CMAKE_PROJECT_PROPER_NAME}")
|
||||||
set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE ON)
|
set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE ON)
|
||||||
set(CPACK_GENERATOR "DragNDrop")
|
set(CPACK_GENERATOR "DragNDrop")
|
||||||
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ CMake options:
|
||||||
| BUILD_INSTALLER | Build installers/packages | ON | |
|
| BUILD_INSTALLER | Build installers/packages | ON | |
|
||||||
| BUILD_TESTS | Build unit tests and legacy tests | ON | `gtest`|
|
| BUILD_TESTS | Build unit tests and legacy tests | ON | `gtest`|
|
||||||
| BUILD_X11_SUPPORT | Build X11 backend (linux and bsd only) | ON | `x11 libs`|
|
| BUILD_X11_SUPPORT | Build X11 backend (linux and bsd only) | ON | `x11 libs`|
|
||||||
|
| BUILD_OSX_BUNDLE | Build an app bundle (mac os only) | ON | |
|
||||||
| ENABLE_COVERAGE | Enable test coverage | OFF | `gcov` |
|
| ENABLE_COVERAGE | Enable test coverage | OFF | `gcov` |
|
||||||
| SKIP_BUILD_TESTS | Skip running of tests at build time | OFF | |
|
| SKIP_BUILD_TESTS | Skip running of tests at build time | OFF | |
|
||||||
| VCPKG_QT | Build Qt w/ vcpkg (windows only) | OFF | |
|
| VCPKG_QT | Build Qt w/ vcpkg (windows only) | OFF | |
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ install(
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(APPLE)
|
if(BUILD_OSX_BUNDLE)
|
||||||
set_target_properties(${target} PROPERTIES
|
set_target_properties(${target} PROPERTIES
|
||||||
BUILD_WITH_INSTALL_RPATH TRUE
|
BUILD_WITH_INSTALL_RPATH TRUE
|
||||||
INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks"
|
INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ if(WIN32)
|
||||||
set(EXE_ICON "IDI_ICON1 ICON DISCARDABLE \"${CMAKE_SOURCE_DIR}/src/apps/res/deskflow.ico\" ")
|
set(EXE_ICON "IDI_ICON1 ICON DISCARDABLE \"${CMAKE_SOURCE_DIR}/src/apps/res/deskflow.ico\" ")
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/src/apps/res/windows.rc.in deskflow.rc)
|
configure_file(${CMAKE_SOURCE_DIR}/src/apps/res/windows.rc.in deskflow.rc)
|
||||||
set(platform_extra deskflow.rc)
|
set(platform_extra deskflow.rc)
|
||||||
elseif(APPLE)
|
elseif(BUILD_OSX_BUNDLE)
|
||||||
#setup our bundle plist file
|
#setup our bundle plist file
|
||||||
set(BUNDLE_EXECUTABLE_NAME "${target}")
|
set(BUNDLE_EXECUTABLE_NAME "${target}")
|
||||||
set(BUNDLE_BUNDLE_NAME "${target}")
|
set(BUNDLE_BUNDLE_NAME "${target}")
|
||||||
|
|
@ -93,6 +93,7 @@ if(WIN32)
|
||||||
)
|
)
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
if (BUILD_OSX_BUNDLE)
|
||||||
set_target_properties(${target} PROPERTIES
|
set_target_properties(${target} PROPERTIES
|
||||||
INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks"
|
INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks"
|
||||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/deskflow.plist"
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/deskflow.plist"
|
||||||
|
|
@ -124,6 +125,9 @@ elseif(APPLE)
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
set_target_properties(${target} PROPERTIES MACOSX_BUNDLE FALSE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
generate_app_man(${target} "${CMAKE_PROJECT_DESCRIPTION} \\(GUI\\)")
|
generate_app_man(${target} "${CMAKE_PROJECT_DESCRIPTION} \\(GUI\\)")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ qt_create_translation(TRS ${CMAKE_SOURCE_DIR}/src ${${CMAKE_PROJECT_NAME}_TRS} O
|
||||||
#ensure that the targets are built always
|
#ensure that the targets are built always
|
||||||
add_custom_target(app_translations ALL DEPENDS ${TRS})
|
add_custom_target(app_translations ALL DEPENDS ${TRS})
|
||||||
|
|
||||||
if (NOT APPLE)
|
if (NOT BUILD_OSX_BUNDLE)
|
||||||
# install our translations
|
# install our translations
|
||||||
install(FILES ${TRS} DESTINATION ${CMAKE_INSTALL_I18N_DIR})
|
install(FILES ${TRS} DESTINATION ${CMAKE_INSTALL_I18N_DIR})
|
||||||
elseif(APPLE)
|
else()
|
||||||
#when making the bundle copy our translation into the bundle
|
#when making the bundle copy our translation into the bundle
|
||||||
set(BUNDLE_TR_DIR $<TARGET_BUNDLE_CONTENT_DIR:${CMAKE_PROJECT_PROPER_NAME}>/MacOS/translations)
|
set(BUNDLE_TR_DIR $<TARGET_BUNDLE_CONTENT_DIR:${CMAKE_PROJECT_PROPER_NAME}>/MacOS/translations)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue