view src/CMakeLists.txt @ 75:16ae3e7338b3

Fix Macos short version string bundle information
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 26 May 2015 15:24:28 +0200
parents 93d3197a883b
children d9760a2a5909
line wrap: on
line source
# Copyright (C) 2015 by ETH Zürich
# Software engineering by Intevation GmbH
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.

include_directories(${Qt5Widgets_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(libqxt)

add_definitions(${Qt5Widgets_DEFINITIONS})

set(APPLICATION_SRC
   main.cpp
   mainwindow.cpp
   strhelp.c
   util_win.c
   util_linux.c
   metadataview.cpp
   pngplayer.cpp
   imagelabel.cpp
   filterwidget.cpp
   folderselectdialog.cpp
   icons/icon.rc
)

find_package(Qt5LinguistTools)
  
# See: https://bugreports.qt-project.org/browse/QTBUG-35918
# extra static libs should be automatically managed but they
# are not so we make this here explicitly neccessary.
# The list is taken from the libs/*.prl file
if(APPLE)
   set(GUI_TYPE MACOSX_BUNDLE)
   include_directories ( /Developer/Headers/FlatCarbon )
   find_library(COCOA_LIBRARAY Cocoa)
   find_library(CARBON_LIBRARY Carbon)
   find_library(APP_SERVICES_LIBRARY ApplicationServices)
   find_library(FOUNDATION_LIBRARAY Foundation)
   find_library(CORE_SERVICES_LIBRARAY CoreServices)
   find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
   find_library(OPENGL_LIBRARAY OpenGL)
   find_library(AGL_LIBRARY AGL)
   find_library(IOKIT_LIBRARY IOKit)

   get_target_property(_loc Qt5::Widgets LOCATION)
   get_filename_component(_qtpath ${_loc} PATH)

   set(MAC_EXTRA_LIBS
      -L${_qtpath}
      -lQt5Gui -lQt5Core -lQt5PlatformSupport
      -lQt5PrintSupport
      -lz -lm ${APP_SERVICES_LIBRARY}
      ${FOUNDATION_LIBRARAY}
      ${CORE_FOUNDATION_LIBRARY}
      ${COCOA_LIBRARAY}
      ${CORE_SERVICES_LIBRARAY}
      ${OPENGL_LIBRARAY}
      ${AGL_LIBRARY}
      ${CARBON_LIBRARY}
      ${IOKIT_LIBRARY}
      -lqtharfbuzzng -lz -lcups)
   set(EXTRA_STATIC_LIBS Qt5::QCocoaIntegrationPlugin ${MAC_EXTRA_LIBS} )

  SET(MACOSX_BUNDLE_ICON_FILE icon.icns)
  SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/icons/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
  SET(APPLICATION_SRC ${APPLICATION_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/icons/icon.icns)
  set (_add_executable_params MACOSX_BUNDLE)
  SET(APPS "\${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app")
  SET(MACOS_INFO_STRING "Tool to view recorded login sessions.")
  SET(MACOSX_BUNDLE_NAME "RetraceIT")
  SET(MACOSX_BUNDLE_GUI_IDENTIFIER "RetraceIT")
  SET(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
  SET(MACOSX_BUNDLE_BUNDLE_VERSION_STRING "${PROJECT_VERSION}")
  SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}")
  SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
  set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) 2015 by ETH Zürich\nSoftware engineering by Intevation GmbH")

elseif(WIN32)
   set (_add_executable_params WIN32)

   get_target_property(_loc Qt5::Widgets LOCATION)
   get_filename_component(_qtpath ${_loc} PATH)
   set(WINDOWS_EXTRA_LIBS
        -L${_qtpath}
        -lwinspool -lshlwapi
        -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm
        -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32
        -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16 -lz)

   set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS})
endif()

set(QT_RESOURCES
   fonts.qrc
   icons/icons.qrc
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES})

if(Qt5LinguistTools_FOUND)

   set(FILES_TO_TRANSLATE
      ${APPLICATION_SRC}
   )

   # Include translation as a resource
   # This works in the source directory to enable the rcc dependencies to be found
   # and it also updates the currently available localization.
   configure_file(l10n/l10n.qrc.in l10n.qrc)
   qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc)
   qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE}
      ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts)
endif()

add_subdirectory(libqxt)

add_executable(${PROJECT_NAME}
   ${_add_executable_params}
   #   ${IMG_SRC}
   ${APPLICATION_SRC}
   ${TRANSLATION_SRC}
   #   ${CMAKE_SOURCE_DIR}/img/icon.rc
   )


target_link_libraries(${PROJECT_NAME}
   Qt5::Widgets
   ${EXTRA_STATIC_LIBS}
   ${PROJECT_NAME}_libqxt
)

if (WIN32)
   set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode")
endif(WIN32)

install(TARGETS ${PROJECT_NAME} DESTINATION bin BUNDLE DESTINATION .)

if(APPLE)
   install(CODE "
       include(BundleUtilities)
       fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
       " COMPONENT Runtime)
endif()
set(CPACK_BINARY_DRAGNDROP ON)
include(CPack)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)