diff --git a/CMakeLists.txt b/CMakeLists.txt index 67f479fec..7bb65b213 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF) option(WITH_PIE "Build as Position-independent executable (PIE)" OFF) set( KEEPASSX_VERSION "2.0 alpha 1" ) +set( KEEPASSX_VERSION_NUM "1.9.80" ) if("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_COMPILER_IS_CLANG 1) @@ -109,6 +110,10 @@ else( APPLE OR MINGW ) set( PROGNAME keepassx ) endif( APPLE OR MINGW ) +if(APPLE AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local") + set(CMAKE_INSTALL_PREFIX "/Applications") +endif() + if(MINGW) set(BIN_INSTALL_DIR "") set(DATA_INSTALL_DIR "share") diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 0ce3e0146..c97c08643 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -22,5 +22,25 @@ if(UNIX AND NOT APPLE) FILES_MATCHING PATTERN "keepassx.png" PATTERN "keepassx.svgz") endif(UNIX AND NOT APPLE) +if(APPLE) + install(FILES macosx/keepassx.icns DESTINATION ${DATA_INSTALL_DIR}) +endif() + install(DIRECTORY icons/application/ DESTINATION ${DATA_INSTALL_DIR}/icons/application FILES_MATCHING PATTERN "*.png" PATTERN "*.svgz") + +add_custom_target(icons + COMMAND png2icns macosx/keepassx.icns + icons/application/16x16/apps/keepassx.png + icons/application/32x32/apps/keepassx.png + icons/application/48x48/apps/keepassx.png + icons/application/128x128/apps/keepassx.png + COMMAND icotool -c -o windows/keepassx.ico + icons/application/16x16/apps/keepassx.png + icons/application/24x24/apps/keepassx.png + icons/application/32x32/apps/keepassx.png + icons/application/48x48/apps/keepassx.png + icons/application/64x64/apps/keepassx.png + icons/application/128x128/apps/keepassx.png + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/share/macosx/Info.plist.cmake b/share/macosx/Info.plist.cmake new file mode 100644 index 000000000..d47558d2e --- /dev/null +++ b/share/macosx/Info.plist.cmake @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PROJECT_NAME} + CFBundleExecutable + ${PROGNAME} + CFBundleIconFile + keepassx.icns + CFBundleIdentifier + org.keepassx.keepassx + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PROJECT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${KEEPASSX_VERSION} + CFBundleSignature + KEPX + CFBundleVersion + ${KEEPASSX_VERSION_NUM} + NSHumanReadableCopyright + Copyright 2010-2012 KeePassX Development Team + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + kdbx + + CFBundleTypeIconFile + keepassx.icns + CFBundleTypeName + KeePassX Password Database + CFBundleTypeOSTypes + + kdbx + + CFBundleTypeRole + Editor + + + + diff --git a/share/macosx/keepassx.icns b/share/macosx/keepassx.icns new file mode 100644 index 000000000..5a9efe274 Binary files /dev/null and b/share/macosx/keepassx.icns differ diff --git a/share/windows/keepassx.ico b/share/windows/keepassx.ico new file mode 100644 index 000000000..44cd0b834 Binary files /dev/null and b/share/windows/keepassx.ico differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c778c685d..459a1540b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -146,6 +146,30 @@ add_library( keepassx_core STATIC ${keepassx_SOURCES} ) add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp ) target_link_libraries( ${PROGNAME} keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES} ) + +if(APPLE) + configure_file(${CMAKE_SOURCE_DIR}/share/macosx/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) + set_target_properties(${PROGNAME} PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) +endif() + install(TARGETS ${PROGNAME} BUNDLE DESTINATION . COMPONENT Runtime RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime) + +if(APPLE AND NOT (${CMAKE_VERSION} VERSION_LESS 2.8.8)) + if(QT_MAC_USE_COCOA AND EXISTS "${QT_LIBRARY_DIR}/Resources/qt_menu.nib") + install(DIRECTORY "${QT_LIBRARY_DIR}/Resources/qt_menu.nib" + DESTINATION "${DATA_INSTALL_DIR}") + endif() + + set(CPACK_GENERATOR "DragNDrop") + set(CPACK_DMG_FORMAT "UDBZ") + set(CPACK_DMG_VOLUME_NAME "${PROGNAME}") + set(CPACK_SYSTEM_NAME "OSX") + set(CPACK_PACKAGE_FILE_NAME "${PROGNAME}-${KEEPASSX_VERSION_NUM}") + include(CPacK) + + include(DeployQt4) + install_qt4_executable(${PROGNAME}.app "qjpeg") +endif()