aheinecke@405: # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@405: # Software engineering by Intevation GmbH aheinecke@405: # aheinecke@405: # This file is Free Software under the GNU GPL (v>=2) aheinecke@405: # and comes with ABSOLUTELY NO WARRANTY! aheinecke@405: # See LICENSE.txt for details. aheinecke@405: andre@33: include_directories(${Qt5Widgets_INCLUDE_DIRS}) aheinecke@57: include_directories(${POLARSSL_INCLUDE_DIR}) andre@621: include_directories(${CMAKE_SOURCE_DIR}/common) andre@621: include_directories(${CMAKE_BINARY_DIR}/common) andre@33: add_definitions(${Qt5Widgets_DEFINITIONS}) andre@33: andre@994: message(STATUS "Using ${DOWNLOAD_SERVER} as download server for updates.") andre@994: add_definitions(-DSERVER_URL="${DOWNLOAD_SERVER}") andre@994: aheinecke@411: find_package(Qt5LinguistTools) andre@908: find_package(CURL) andre@908: andre@908: include_directories(${CURL_INCLUDE_DIRS}) aheinecke@411: aheinecke@520: # Common code is used in either the client or the administrator aheinecke@496: # application or in unit tests. aheinecke@496: set(UICOMMON_SOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp andre@908: ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection_bare.cpp andre@990: ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection.cpp aheinecke@452: ${CMAKE_CURRENT_SOURCE_DIR}/sslhelp.cpp aheinecke@45: ) aheinecke@45: andre@910: if (${CURL_FOUND} AND ${USE_CURL}) andre@908: set(UICOMMON_SOURCES ${UICOMMON_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection_curl.cpp) andre@954: add_definitions(-DUSE_CURL -DCURL_STATICLIB) andre@910: elseif (${USE_CURL}) andre@910: MESSAGE(FATAL_ERROR "libcurl not found but usage of curl is requested.") andre@908: endif() andre@908: aheinecke@407: set(TRUSTBRIDGE_SOURCES aheinecke@496: ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp rrenkert@190: ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp rrenkert@584: ${CMAKE_CURRENT_SOURCE_DIR}/certificatelistwidget.cpp rrenkert@584: ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemwidget.cpp rrenkert@273: ${CMAKE_CURRENT_SOURCE_DIR}/separatoritemdelegate.cpp aheinecke@257: ${CMAKE_CURRENT_SOURCE_DIR}/installwrapper.cpp andre@609: ${CMAKE_CURRENT_SOURCE_DIR}/processhelp_win.cpp andre@609: ${CMAKE_CURRENT_SOURCE_DIR}/processhelp_linux.cpp andre@609: ${CMAKE_CURRENT_SOURCE_DIR}/processwaitdialog.cpp andre@722: ${CMAKE_CURRENT_SOURCE_DIR}/textoverlaybutton.cpp andre@827: ${CMAKE_CURRENT_SOURCE_DIR}/taskscheduler.cpp andre@871: ${CMAKE_CURRENT_SOURCE_DIR}/trayicon.cpp andre@955: ${CMAKE_CURRENT_SOURCE_DIR}/proxysettingsdlg.cpp andre@33: ${CERTIFICATELIST_SOURCES} aheinecke@45: ${DOWNLOADER_SOURCES} andre@33: ) andre@33: aheinecke@572: set(ADMINISTRATOR_SOURCES rrenkert@333: ${CMAKE_CURRENT_SOURCE_DIR}/administratorwindow.cpp rrenkert@335: ${CMAKE_CURRENT_SOURCE_DIR}/certificatetablemodel.cpp rrenkert@348: ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp rrenkert@362: ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp aheinecke@527: ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp aheinecke@527: ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp rrenkert@566: ${CMAKE_CURRENT_SOURCE_DIR}/certificatediffdialog.cpp rrenkert@327: ${CERTIFICATELIST_SOURCES} rrenkert@327: ) rrenkert@327: andre@33: # Seperated to make it easier to include the sources in tests aheinecke@407: set(TRUSTBRIDGE_RESOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc andre@876: ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc andre@33: ) andre@1387: if(DO_RELEASE_BUILD) andre@1387: set(TRUSTBRIDGE_RESOURCES andre@1387: ${TRUSTBRIDGE_RESOURCES} andre@1387: ${CMAKE_CURRENT_SOURCE_DIR}/certs-release.qrc andre@1387: ) andre@1387: else() andre@1387: set(TRUSTBRIDGE_RESOURCES andre@1387: ${TRUSTBRIDGE_RESOURCES} andre@1387: ${CMAKE_CURRENT_SOURCE_DIR}/certs-test.qrc andre@1387: ) andre@1387: endif() andre@33: aheinecke@572: set(ADMINISTRATOR_RESOURCES rrenkert@327: ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc andre@876: ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc rrenkert@327: ) rrenkert@327: andre@33: if(UNIX) andre@33: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 andre@33: # XCB_EXTRA_LIBS should be gotten automatically. andre@33: # The following list is taken from the .pri file andre@33: get_target_property(_loc Qt5::Widgets LOCATION) andre@33: get_filename_component(_qtpath ${_loc} PATH) aheinecke@107: andre@33: set(XCB_EXTRA_LIBS andre@33: -L${_qtpath} andre@876: -lQt5DBus -lQt5Gui -lQt5Core -lQt5PlatformSupport andre@876: -lX11 -lX11-xcb -lxcb -lxcb-static andre@876: -lXrender -lSM -lICE -ldbus-1 andre@876: -lm -ldl -lrt -lpthread ) andre@855: andre@876: set(EXTRA_STATIC_LIBS -lpthread -ldl andre@33: Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS}) andre@33: andre@33: elseif(WIN32) andre@33: get_target_property(_loc Qt5::Widgets LOCATION) andre@33: get_filename_component(_qtpath ${_loc} PATH) andre@33: set(WINDOWS_EXTRA_LIBS andre@33: -L${_qtpath} andre@949: -lwinspool -lshlwapi andre@884: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm andre@949: -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32 andre@949: -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16) andre@33: andre@33: set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS} -lwinhttp -lcrypt32) andre@602: andre@602: add_definitions(-DUNICODE) andre@33: endif() andre@33: andre@33: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") andre@33: andre@33: # Adding resources here in an extra variable to enable reuse of aheinecke@407: # TRUSTBRIDGE_SOURCES in the test subdirectory. aheinecke@576: set(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp andre@620: ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc) aheinecke@561: qt5_add_resources(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES}) andre@33: andre@883: set(ADMINISTRATOR_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp andre@883: ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc) aheinecke@572: qt5_add_resources(ADMINISTRATOR_MAIN_WITH_RESOURCES ${ADMINISTRATOR_RESOURCES}) aheinecke@411: aheinecke@514: if(WIN32) aheinecke@514: # This option causes cmake to use the appropiate liker flags to hide aheinecke@514: # the console Window on Windows aheinecke@514: set (_add_executable_params WIN32) andre@617: andre@617: # Add the event messages andre@617: if (MINGW) andre@617: STRING(REGEX REPLACE "windres" "windmc" MC_COMPILER ${CMAKE_RC_COMPILER}) andre@617: else() andre@617: # untested andre@617: set(MC_COMPILER "mc.exe") andre@617: endif() andre@617: andre@617: add_custom_command( andre@617: OUTPUT ${CMAKE_BINARY_DIR}/common/events.h andre@617: ${CMAKE_BINARY_DIR}/common/events.rc andre@617: ${CMAKE_BINARY_DIR}/common/MSG00407.bin andre@617: ${CMAKE_BINARY_DIR}/common/MSG00409.bin andre@621: COMMAND ${MC_COMPILER} ${CMAKE_SOURCE_DIR}/common/events.mc -r ${CMAKE_BINARY_DIR}/common -h ${CMAKE_BINARY_DIR}/common andre@617: DEPENDS ${CMAKE_SOURCE_DIR}/common/events.mc) andre@621: set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/common/events.rc) aheinecke@514: endif() aheinecke@514: aheinecke@411: if(Qt5LinguistTools_FOUND) aheinecke@420: # Include translation as a resource aheinecke@420: # This works in the source directory to enable the rcc dependencies to be found aheinecke@420: # and it also updates the currently available localization. aheinecke@420: # This would probably be better placed in a macro aheinecke@420: configure_file(l10n/administrator.qrc.in administrator.qrc) aheinecke@420: qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc) aheinecke@572: qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINISTRATOR_SOURCES} aheinecke@420: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts) aheinecke@520: add_executable(trustbridge-admin aheinecke@514: ${_add_executable_params} aheinecke@572: ${ADMINISTRATOR_MAIN_WITH_RESOURCES} aheinecke@420: ${ADMINISTRATOR_L10N} aheinecke@420: ${ADMINISTRATOR_TRANSLATION} aheinecke@420: ) aheinecke@421: aheinecke@421: configure_file(l10n/trustbridge.qrc.in trustbridge.qrc) aheinecke@421: qt5_add_resources(TRUSTBRIDGE_L10N ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.qrc) aheinecke@561: qt5_create_translation(TRUSTBRIDGE_TRANSLATION ${TRUSTBRIDGE_SOURCES} aheinecke@421: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/trustbridge_de_DE.ts) aheinecke@514: add_executable(trustbridge aheinecke@514: ${_add_executable_params} aheinecke@561: ${TRUSTBRIDGE_MAIN_WITH_RESOURCES} aheinecke@421: ${TRUSTBRIDGE_L10N} aheinecke@421: ${TRUSTBRIDGE_TRANSLATION} aheinecke@421: ) aheinecke@421: aheinecke@411: else() aheinecke@421: message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.") aheinecke@520: add_executable(trustbridge-admin aheinecke@514: ${_add_executable_params} aheinecke@572: ${ADMINISTRATOR_MAIN_WITH_RESOURCES}) aheinecke@514: add_executable(trustbridge aheinecke@514: ${_add_executable_params} aheinecke@561: ${TRUSTBRIDGE_MAIN_WITH_RESOURCES}) aheinecke@411: endif() rrenkert@327: aheinecke@496: add_library(ui_common STATIC ${UICOMMON_SOURCES}) aheinecke@572: add_library(tbadminlib STATIC ${ADMINISTRATOR_SOURCES}) aheinecke@561: add_library(tblib STATIC ${TRUSTBRIDGE_SOURCES}) aheinecke@496: aheinecke@560: target_link_libraries(trustbridge-admin aheinecke@560: tbadminlib aheinecke@560: Qt5::Widgets aheinecke@496: ui_common aheinecke@408: trustbridge_common rrenkert@327: ${POLARSSL_LIBRARIES} rrenkert@327: ${EXTRA_STATIC_LIBS} rrenkert@327: ${PROFILING_LIBS}) rrenkert@327: aheinecke@560: target_link_libraries(trustbridge aheinecke@560: tblib aheinecke@560: Qt5::Widgets aheinecke@496: ui_common aheinecke@421: trustbridge_common andre@908: ${CURL_LIBRARIES} aheinecke@421: ${POLARSSL_LIBRARIES} aheinecke@421: ${EXTRA_STATIC_LIBS} aheinecke@421: ${PROFILING_LIBS}) aheinecke@421: andre@33: # Tests andre@33: add_subdirectory(tests) aheinecke@124: aheinecke@407: install(TARGETS trustbridge DESTINATION bin) aheinecke@520: install(TARGETS trustbridge-admin DESTINATION bin) wilde@738: if(UNIX) wilde@738: configure_file(trustbridge-tray-starter.sh trustbridge-tray-starter.sh COPYONLY) wilde@738: install(FILES trustbridge-tray-starter.sh DESTINATION bin) wilde@738: endif() andre@1019: andre@1019: # Strip the binaries andre@1019: if (WIN32) andre@1019: add_custom_command( andre@1019: TARGET trustbridge andre@1019: POST_BUILD andre@1019: COMMAND ${CMAKE_STRIP} trustbridge.exe andre@1019: ) andre@1019: add_custom_command( andre@1019: TARGET trustbridge-admin andre@1019: POST_BUILD andre@1019: COMMAND ${CMAKE_STRIP} trustbridge-admin.exe andre@1019: ) andre@1071: if (NOT RELEASE_BUILD) andre@1071: add_custom_command( andre@1071: TARGET trustbridge andre@1071: POST_BUILD andre@1071: COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.pem andre@1071: -key ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.key andre@1071: -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.exe andre@1071: -out ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-signed.exe && andre@1071: mv ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-signed.exe ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.exe andre@1071: ) andre@1071: add_custom_command( andre@1071: TARGET trustbridge-admin andre@1071: POST_BUILD andre@1071: COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.pem andre@1071: -key ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.key andre@1071: -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-admin.exe andre@1071: -out ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-admin-signed.exe && andre@1071: mv ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-admin-signed.exe ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-admin.exe andre@1071: ) andre@1071: endif() andre@1019: else() andre@1019: add_custom_command( andre@1019: TARGET trustbridge andre@1019: POST_BUILD andre@1019: COMMAND strip trustbridge andre@1019: ) andre@1019: add_custom_command( andre@1019: TARGET trustbridge-admin andre@1019: POST_BUILD andre@1057: COMMAND strip trustbridge-admin andre@1019: ) andre@1019: endif()