andre@1: # Copyright (C) 2016 by ETH Zürich andre@1: # Software engineering by Intevation GmbH andre@1: # andre@1: # This file is Free Software under the GNU GPL (v>=2) andre@1: # and comes with ABSOLUTELY NO WARRANTY! andre@1: # See LICENSE.txt for details. andre@1: andre@1: include_directories(${Qt5Core_INCLUDE_DIRS}) andre@1: andre@1: include_directories(${CMAKE_CURRENT_SOURCE_DIR}) andre@1: andre@1: add_subdirectory(xlsx) andre@1: include_directories(xlsx) andre@1: andre@1: set(APPLICATION_SRC andre@1: main.cpp andre@1: converter.cpp andre@1: strhelp.c andre@21: cconvert_options.h andre@50: icons/icon.rc andre@50: filenamerequester.cpp andre@50: mainwindow.cpp andre@1: ) andre@1: andre@1: find_package(Qt5LinguistTools) andre@1: andre@1: if(Qt5LinguistTools_FOUND) andre@1: andre@1: set(FILES_TO_TRANSLATE andre@1: ${APPLICATION_SRC} andre@1: ) andre@1: andre@1: # Include translation as a resource andre@1: # This works in the source directory to enable the rcc dependencies to be found andre@1: # and it also updates the currently available localization. andre@1: configure_file(l10n/l10n.qrc.in l10n.qrc) andre@1: qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc) andre@1: qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE} andre@1: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts) andre@1: endif() andre@1: andre@50: qt5_add_resources(APPLICATION_SRC icons/icons.qrc) andre@1: andre@46: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 andre@46: # extra static libs should be automatically managed but they andre@46: # are not so we make this here explicitly neccessary. andre@46: # The list is taken from the libs/*.prl file andre@46: if(APPLE) andre@46: set(GUI_TYPE MACOSX_BUNDLE) andre@46: include_directories ( /Developer/Headers/FlatCarbon ) andre@46: find_library(COCOA_LIBRARAY Cocoa) andre@46: find_library(CARBON_LIBRARY Carbon) andre@46: find_library(APP_SERVICES_LIBRARY ApplicationServices) andre@46: find_library(FOUNDATION_LIBRARAY Foundation) andre@46: find_library(CORE_SERVICES_LIBRARAY CoreServices) andre@46: find_library(CORE_FOUNDATION_LIBRARY CoreFoundation) andre@46: find_library(OPENGL_LIBRARAY OpenGL) andre@46: find_library(AGL_LIBRARY AGL) andre@46: find_library(IOKIT_LIBRARY IOKit) andre@46: andre@46: get_target_property(_loc Qt5::Widgets LOCATION) andre@46: get_filename_component(_qtpath ${_loc} PATH) andre@46: andre@46: set(MAC_EXTRA_LIBS andre@46: -L${_qtpath} andre@46: -lQt5Gui -lQt5Core -lQt5PlatformSupport andre@46: -lQt5PrintSupport andre@46: -lz -lm ${APP_SERVICES_LIBRARY} andre@46: ${FOUNDATION_LIBRARAY} andre@46: ${CORE_FOUNDATION_LIBRARY} andre@46: ${COCOA_LIBRARAY} andre@46: ${CORE_SERVICES_LIBRARAY} andre@46: ${OPENGL_LIBRARAY} andre@46: ${AGL_LIBRARY} andre@46: ${CARBON_LIBRARY} andre@46: ${IOKIT_LIBRARY} andre@46: -lqtharfbuzzng -lz -lcups) andre@46: set(EXTRA_STATIC_LIBS Qt5::QCocoaIntegrationPlugin ${MAC_EXTRA_LIBS} ) andre@46: set (_add_executable_params MACOSX_BUNDLE) andre@46: SET(APPS "\${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app") andre@46: SET(MACOS_INFO_STRING "Tool to convert EduApp questionaires.") andre@46: SET(MACOSX_BUNDLE_NAME "EduExportConvert") andre@46: SET(MACOSX_BUNDLE_GUI_IDENTIFIER "EduExportConvert") andre@46: SET(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}) andre@46: SET(MACOSX_BUNDLE_BUNDLE_VERSION_STRING "${PROJECT_VERSION}") andre@46: SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}") andre@46: SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") andre@46: set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) 2016 by ETH Zürich\nSoftware engineering by Intevation GmbH") andre@46: endif() andre@46: andre@10: if (WIN32) andre@10: get_target_property(_loc Qt5::Widgets LOCATION) andre@10: get_filename_component(_qtpath ${_loc} PATH) andre@53: set (_add_executable_params WIN32) andre@10: set(EXTRA_STATIC_LIBS andre@10: -L${_qtpath} andre@10: Qt5::QWindowsIntegrationPlugin andre@10: -lwinspool -lshlwapi andre@10: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm andre@10: -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32 andre@33: -ladvapi32 -lshell32 -luser32 -lkernel32 -lqtfreetype -lqtharfbuzzng -lpcre16) andre@10: endif() andre@10: andre@53: add_executable(${PROJECT_NAME} andre@53: ${_add_executable_params} andre@53: ${APPLICATION_SRC} andre@53: ${TRANSLATION_SRC} andre@53: ) andre@53: andre@1: target_link_libraries(${PROJECT_NAME} andre@23: Qt5::Widgets andre@23: Qt5::PrintSupport andre@1: ${PROJECT_NAME}_libqtxslx andre@10: ${EXTRA_STATIC_LIBS} andre@1: ) andre@1: andre@1: if (WIN32) andre@1: set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode") andre@1: endif(WIN32) andre@1: andre@1: install(TARGETS ${PROJECT_NAME} DESTINATION bin BUNDLE DESTINATION .) andre@1: andre@1: if(APPLE) andre@1: install(CODE " andre@1: include(BundleUtilities) andre@1: fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\") andre@1: " COMPONENT Runtime) andre@1: endif() andre@1: set(CPACK_BINARY_DRAGNDROP ON) andre@1: include(CPack)