Skip to content

Commit

Permalink
Added MacOS X AppBundle option.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Apr 23, 2022
1 parent d0ca457 commit a6f3a6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(BUILD_TESTS "Build test programs" OFF)
option(BUILD_DOCS "Build API documentation" OFF)
option(BUILD_MAN "Build man page for dmrconf" OFF)
option(INSTALL_UDEV_RULES "Install udev rules file." ON)
option(INSTALL_BUNDLE "Installs QDMR as an AppBundle under MacOS X" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

Expand Down
25 changes: 23 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,29 @@ qt5_wrap_cpp(qdmr_MOC_SOURCES ${qdmr_MOC_HEADERS})
qt5_wrap_ui(qdmr_UI_SOURCES ${qdmr_UI_FORMS})
qt5_add_resources(qdmr_RCC_SOURCES ../shared/resources.qrc)

add_executable(qdmr WIN32 ${qdmr_SOURCES} ${qdmr_MOC_SOURCES} ${qdmr_RCC_SOURCES} ${qdmr_UI_SOURCES})
add_executable(qdmr WIN32
${qdmr_SOURCES} ${qdmr_MOC_SOURCES} ${qdmr_RCC_SOURCES} ${qdmr_UI_SOURCES})

if (UNIX AND APPLE AND INSTALL_BUNDLE)
set_target_properties(qdmr PROPERTIES
MACOSX_BUNDLE ON
MACOSX_BUNDLE_BUNDLE_NAME ${CMAKE_PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_GUI_IDENTIFIER "de.darc.dm3mat.qdmr"
MACOSX_BUNDLE_ICON_FILE "Resources/qdmr.icns"
MACOSX_BUNDLE_LONG_VERSION_STRING ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}"
RESOURCE "${CMAKE_SOURCE_DIR}/dist/macosx/qdmr.icns")
endif(UNIX AND APPLE AND INSTALL_BUNDLE)

target_link_libraries(qdmr ${LIBS} libdmrconf)
target_include_directories(qdmr PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
install(TARGETS qdmr DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})

# Install binary only if not a bundle under MacOS X
if (UNIX AND APPLE AND INSTALL_BUNDLE)
install(TARGETS qdmr
BUNDLE DESTINATION /Applications/
RESOURCE DESTINATION "/Applications/${CMAKE_PROJECT_NAME}.app/Contents/Resources")
else()
install(TARGETS qdmr DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
endif(UNIX AND APPLE AND INSTALL_BUNDLE)

0 comments on commit a6f3a6f

Please sign in to comment.