andre@25: # Copyright (C) 2015 by ETH Zürich andre@27: # Software engineering by Intevation GmbH andre@0: # andre@0: # This file is Free Software under the GNU GPL (v>=2) andre@0: # and comes with ABSOLUTELY NO WARRANTY! andre@0: # See LICENSE.txt for details. andre@0: andre@0: include_directories(${Qt5Widgets_INCLUDE_DIRS}) andre@0: andre@0: include_directories(${CMAKE_CURRENT_SOURCE_DIR}) andre@1: include_directories(libqxt) andre@0: andre@0: add_definitions(${Qt5Widgets_DEFINITIONS}) andre@0: andre@0: set(APPLICATION_SRC andre@0: main.cpp andre@0: mainwindow.cpp andre@0: strhelp.c andre@0: util_win.c andre@0: util_linux.c andre@2: metadataview.cpp andre@2: pngplayer.cpp andre@3: imagelabel.cpp andre@4: filterwidget.cpp andre@9: folderselectdialog.cpp andre@46: icons/icon.rc andre@0: ) andre@0: andre@0: find_package(Qt5LinguistTools) andre@57: andre@57: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 andre@57: # extra static libs should be automatically managed but they andre@57: # are not so we make this here explicitly neccessary. andre@57: # The list is taken from the libs/*.prl file andre@57: if(APPLE) andre@57: set(GUI_TYPE MACOSX_BUNDLE) andre@57: include_directories ( /Developer/Headers/FlatCarbon ) andre@57: find_library(COCOA_LIBRARAY Cocoa) andre@57: find_library(CARBON_LIBRARY Carbon) andre@57: find_library(APP_SERVICES_LIBRARY ApplicationServices) andre@57: find_library(FOUNDATION_LIBRARAY Foundation) andre@57: find_library(CORE_SERVICES_LIBRARAY CoreServices) andre@57: find_library(CORE_FOUNDATION_LIBRARY CoreFoundation) andre@57: find_library(OPENGL_LIBRARAY OpenGL) andre@57: find_library(AGL_LIBRARY AGL) andre@57: find_library(IOKIT_LIBRARY IOKit) andre@0: andre@0: get_target_property(_loc Qt5::Widgets LOCATION) andre@0: get_filename_component(_qtpath ${_loc} PATH) andre@0: andre@57: set(MAC_EXTRA_LIBS andre@0: -L${_qtpath} andre@57: -lQt5Gui -lQt5Core -lQt5PlatformSupport andre@57: -lQt5PrintSupport andre@57: -lz -lm ${APP_SERVICES_LIBRARY} andre@57: ${FOUNDATION_LIBRARAY} andre@57: ${CORE_FOUNDATION_LIBRARY} andre@57: ${COCOA_LIBRARAY} andre@57: ${CORE_SERVICES_LIBRARAY} andre@57: ${OPENGL_LIBRARAY} andre@57: ${AGL_LIBRARY} andre@57: ${CARBON_LIBRARY} andre@57: ${IOKIT_LIBRARY} andre@57: -lqtharfbuzzng -lz -lcups) andre@57: set(EXTRA_STATIC_LIBS Qt5::QCocoaIntegrationPlugin ${MAC_EXTRA_LIBS} ) andre@0: andre@60: SET(MACOSX_BUNDLE_ICON_FILE icon.icns) andre@60: SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/icons/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) andre@60: SET(APPLICATION_SRC ${APPLICATION_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/icons/icon.icns) andre@60: set (_add_executable_params MACOSX_BUNDLE) andre@60: SET(APPS "\${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app") andre@64: SET(MACOS_INFO_STRING "Tool to view recorded login sessions.") andre@64: SET(MACOSX_BUNDLE_NAME "RetraceIT") andre@64: SET(MACOSX_BUNDLE_GUI_IDENTIFIER "RetraceIT") andre@64: SET(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}) andre@64: SET(MACOSX_BUNDLE_BUNDLE_VERSION_STRING "${PROJECT_VERSION}") andre@64: SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}") andre@75: SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") andre@64: set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) 2015 by ETH Zürich\nSoftware engineering by Intevation GmbH") andre@64: andre@0: elseif(WIN32) andre@0: set (_add_executable_params WIN32) andre@0: andre@0: get_target_property(_loc Qt5::Widgets LOCATION) andre@0: get_filename_component(_qtpath ${_loc} PATH) andre@0: set(WINDOWS_EXTRA_LIBS andre@0: -L${_qtpath} andre@0: -lwinspool -lshlwapi andre@0: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm andre@0: -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32 andre@77: -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16) andre@0: andre@0: set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS}) andre@0: endif() andre@0: andre@0: set(QT_RESOURCES andre@50: fonts.qrc andre@50: icons/icons.qrc andre@0: ) andre@0: andre@0: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") andre@0: qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES}) andre@0: andre@0: if(Qt5LinguistTools_FOUND) andre@0: andre@0: set(FILES_TO_TRANSLATE andre@0: ${APPLICATION_SRC} andre@0: ) andre@0: andre@0: # Include translation as a resource andre@0: # This works in the source directory to enable the rcc dependencies to be found andre@0: # and it also updates the currently available localization. andre@0: configure_file(l10n/l10n.qrc.in l10n.qrc) andre@0: qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc) andre@0: qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE} andre@0: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts) andre@0: endif() andre@0: andre@1: add_subdirectory(libqxt) andre@1: andre@0: add_executable(${PROJECT_NAME} andre@0: ${_add_executable_params} andre@0: # ${IMG_SRC} andre@0: ${APPLICATION_SRC} andre@0: ${TRANSLATION_SRC} andre@0: # ${CMAKE_SOURCE_DIR}/img/icon.rc andre@0: ) andre@0: andre@0: andre@0: target_link_libraries(${PROJECT_NAME} andre@0: Qt5::Widgets andre@1: ${EXTRA_STATIC_LIBS} andre@1: ${PROJECT_NAME}_libqxt andre@1: ) andre@0: andre@0: if (WIN32) andre@0: set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode") andre@0: endif(WIN32) andre@0: andre@60: install(TARGETS ${PROJECT_NAME} DESTINATION bin BUNDLE DESTINATION .) andre@60: andre@68: if(APPLE) andre@68: install(CODE " andre@68: include(BundleUtilities) andre@68: fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\") andre@68: " COMPONENT Runtime) andre@68: endif() andre@60: set(CPACK_BINARY_DRAGNDROP ON) andre@60: include(CPack)