Skip to content
Permalink
Browse files

Change cmake to build .app

  • Loading branch information...
DamirPorobic committed Mar 13, 2019
1 parent 5053829 commit a2355ed44be17f99004be1de90b761c945243c01
Showing with 33 additions and 7 deletions.
  1. +11 −6 CMakeLists.txt
  2. BIN icons/ksnip.icns
  3. +21 −1 src/CMakeLists.txt
  4. +1 −0 translations/CMakeLists.txt
@@ -6,7 +6,14 @@ if (DEFINED VERSION_SUFIX)
endif()

set(KSNIP_VERSION "${PROJECT_VERSION}${KSNIP_VERSION_SUFIX}")
set(KSNIP_LANG_INSTAL_DIR "/usr/share/ksnip/translations")

if(APPLE)
set(KSNIP_LANG_INSTAL_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/ksnip.app/Contents/Resources/translations)
set(APPS ${CMAKE_CURRENT_BINARY_DIR}/src/ksnip.app)
set(DIRS ${CMAKE_BINARY_DIR})
elseif(UNIX)
set(KSNIP_LANG_INSTAL_DIR "/usr/share/ksnip/translations")
endif()

configure_file(src/BuildConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/BuildConfig.h)

@@ -22,9 +29,9 @@ set(QT_MIN_VERSION "5.6.1")

find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets Network Xml PrintSupport DBus)

if (APPLE)

elseif (UNIX)
if(WIN32)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED WinExtras)
elseif (NOT APPLE)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED X11Extras)

# Without ECM we're unable to load XCB
@@ -33,8 +40,6 @@ elseif (UNIX)

find_package(X11 REQUIRED)
find_package(XCB COMPONENTS XFIXES)
elseif(WIN32)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED WinExtras)
endif ()

set(KIMAGEANNOTATOR_MIN_VERSION "0.0.2")
BIN +85.6 KB icons/ksnip.icns
Binary file not shown.
@@ -67,6 +67,18 @@ set(KSNIP_SRCS ${KSNIP_SRCS} PARENT_SCOPE)

if (WIN32)
add_executable(ksnip ${KSNIP_SRCS} ${CMAKE_SOURCE_DIR}/icons/ksnip_icons.qrc ${CMAKE_SOURCE_DIR}/icons/ksnip_windows_icon.rc)
elseif (APPLE)
set(MACOSX_BUNDLE_EXECUTABLE_NAME "ksnip")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ksnip")
set(MACOSX_BUNDLE_ICON_FILE "ksnip.icns")
set(MACOSX_BUNDLE_INFO_STRING "Cross-Platform Screenshot and Annotation Tool")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${KSNIP_VERSION})

set(MACOSX_ICON ${CMAKE_SOURCE_DIR}/icons/ksnip.icns)
set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")

add_executable(ksnip MACOSX_BUNDLE ${KSNIP_SRCS} ${CMAKE_SOURCE_DIR}/icons/ksnip_icons.qrc ${MACOSX_ICON})
else()
add_executable(ksnip ${KSNIP_SRCS} ${CMAKE_SOURCE_DIR}/icons/ksnip_icons.qrc)
endif ()
@@ -96,4 +108,12 @@ elseif(WIN32)
)
endif ()

install(TARGETS ksnip RUNTIME DESTINATION /bin)

if (APPLE)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")
" CPOMPONENT Runtime)
elseif (UNIX)
install(TARGETS ksnip RUNTIME DESTINATION /bin)
endif ()
@@ -18,3 +18,4 @@ endif ()
add_custom_target(translations ALL DEPENDS ${KSNIP_LANG_QM})

install(FILES ${KSNIP_LANG_QM} DESTINATION ${KSNIP_LANG_INSTAL_DIR})

0 comments on commit a2355ed

Please sign in to comment.
You can’t perform that action at this time.