2016-12-19 17:41:01 +00:00
|
|
|
cmake_minimum_required (VERSION 3.4)
|
|
|
|
|
|
2020-01-21 11:33:55 +00:00
|
|
|
find_package (Qt5 COMPONENTS Core Widgets Network LinguistTools)
|
2016-12-19 17:41:01 +00:00
|
|
|
set (CMAKE_AUTOMOC ON)
|
|
|
|
|
set (CMAKE_AUTORCC ON)
|
|
|
|
|
set (CMAKE_AUTOUIC ON)
|
|
|
|
|
set (CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
|
|
file (GLOB LEGACY_GUI_SOURCE_FILES src/*.cpp src/*.h)
|
2017-02-09 19:57:13 +00:00
|
|
|
file (GLOB LEGACY_GUI_UI_FILES src/*.ui)
|
2018-06-07 15:22:49 +00:00
|
|
|
file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*)
|
2018-06-07 15:23:35 +00:00
|
|
|
file (GLOB LEGACY_ZEROCONF_FILES src/Zeroconf*)
|
2020-01-21 11:33:55 +00:00
|
|
|
file (GLOB LEGACY_LANGUAGE_FILES res/lang/*.ts)
|
|
|
|
|
|
2020-03-23 23:32:22 +00:00
|
|
|
configure_file(res/Languages.qrc res/Languages.qrc)
|
|
|
|
|
|
|
|
|
|
set_source_files_properties(${LEGACY_LANGUAGE_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/res/lang")
|
|
|
|
|
|
2020-03-24 00:45:11 +00:00
|
|
|
qt5_add_translation(QM_FILES ${LEGACY_LANGUAGE_FILES})
|
2018-06-07 15:22:49 +00:00
|
|
|
|
2020-05-04 20:00:54 +00:00
|
|
|
add_custom_target(translations ALL DEPENDS ${QM_FILES})
|
|
|
|
|
|
2020-01-11 15:42:34 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
file (GLOB LEGACY_GUI_MAC_SOURCE_FILES src/*.mm)
|
|
|
|
|
list (APPEND LEGACY_GUI_SOURCE_FILES ${LEGACY_GUI_MAC_SOURCE_FILES})
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-05-12 19:15:56 +00:00
|
|
|
# Retrieve the absolute path to qmake and then use that path to find
|
|
|
|
|
# the binaries
|
|
|
|
|
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
|
|
|
|
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
|
|
|
|
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
|
|
|
|
|
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
|
|
|
|
|
2018-06-07 15:22:49 +00:00
|
|
|
if (SYNERGY_ENTERPRISE)
|
|
|
|
|
list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ACTIVATION_FILES})
|
|
|
|
|
list (REMOVE_ITEM LEGACY_GUI_UI_FILES ${LEGACY_ACTIVATION_FILES})
|
2018-06-07 15:23:35 +00:00
|
|
|
list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ZEROCONF_FILES})
|
2018-06-07 15:22:49 +00:00
|
|
|
endif ()
|
2016-12-19 17:41:01 +00:00
|
|
|
|
2017-02-09 20:05:36 +00:00
|
|
|
if (WIN32)
|
2017-03-09 14:32:41 +00:00
|
|
|
set (LEGACY_GUI_RC_FILES res/win/Synergy.rc)
|
2017-02-09 20:05:36 +00:00
|
|
|
endif()
|
|
|
|
|
|
2017-02-09 15:57:10 +00:00
|
|
|
add_executable (synergy WIN32
|
2016-12-28 11:50:32 +00:00
|
|
|
${LEGACY_GUI_SOURCE_FILES}
|
|
|
|
|
${LEGACY_GUI_UI_FILES}
|
2017-02-09 20:05:36 +00:00
|
|
|
${LEGACY_GUI_RC_FILES}
|
2016-12-28 11:50:32 +00:00
|
|
|
res/Synergy.qrc
|
2020-03-23 23:32:22 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/res/Languages.qrc
|
2020-01-21 11:33:55 +00:00
|
|
|
${QM_FILES}
|
2016-12-19 17:41:01 +00:00
|
|
|
)
|
|
|
|
|
|
2017-03-09 14:32:41 +00:00
|
|
|
include_directories (./src)
|
2017-03-08 18:20:18 +00:00
|
|
|
target_link_libraries (synergy shared)
|
2016-12-19 17:41:01 +00:00
|
|
|
|
2018-06-07 15:23:35 +00:00
|
|
|
if (NOT SYNERGY_ENTERPRISE)
|
2016-12-19 17:41:01 +00:00
|
|
|
if (WIN32)
|
2016-12-28 11:50:32 +00:00
|
|
|
include_directories ($ENV{BONJOUR_SDK_HOME}/Include)
|
2018-03-20 11:41:38 +00:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
2018-06-07 15:22:49 +00:00
|
|
|
find_library (DNSSD_LIB dnssd.lib
|
2016-12-28 11:50:32 +00:00
|
|
|
HINTS ENV BONJOUR_SDK_HOME
|
|
|
|
|
PATH_SUFFIXES "Lib/x64")
|
2018-03-20 11:41:38 +00:00
|
|
|
else()
|
2018-06-07 15:22:49 +00:00
|
|
|
find_library (DNSSD_LIB dnssd.lib
|
2018-03-20 11:41:38 +00:00
|
|
|
HINTS ENV BONJOUR_SDK_HOME
|
|
|
|
|
PATH_SUFFIXES "Lib/Win32")
|
|
|
|
|
endif()
|
2017-03-08 18:20:18 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
|
target_link_libraries (synergy dns_sd)
|
2016-12-19 17:41:01 +00:00
|
|
|
endif()
|
2018-06-07 15:23:35 +00:00
|
|
|
endif()
|
2016-12-19 17:41:01 +00:00
|
|
|
|
2018-07-30 11:27:51 +00:00
|
|
|
qt5_use_modules (synergy Core Widgets Network)
|
2017-04-27 14:40:23 +00:00
|
|
|
target_compile_definitions (synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
|
|
|
|
|
target_compile_definitions (synergy PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}")
|
2017-02-07 01:35:07 +00:00
|
|
|
|
|
|
|
|
if (WIN32)
|
2018-06-07 15:23:35 +00:00
|
|
|
if (NOT SYNERGY_ENTERPRISE)
|
2017-03-09 14:32:41 +00:00
|
|
|
target_link_libraries (synergy ${DNSSD_LIB})
|
2018-06-07 15:23:35 +00:00
|
|
|
endif ()
|
2017-02-08 12:40:34 +00:00
|
|
|
set_target_properties (synergy PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
|
2017-02-07 01:35:07 +00:00
|
|
|
endif()
|
2017-03-07 14:10:24 +00:00
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
install (TARGETS synergy DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
|
2019-05-12 19:15:56 +00:00
|
|
|
install (CODE "MESSAGE (\"Running macdeployqt to install frameworks in bundle\")")
|
|
|
|
|
install (CODE "execute_process(COMMAND ${MACDEPLOYQT_EXECUTABLE}
|
|
|
|
|
${SYNERGY_BUNDLE_APP_DIR} -always-overwrite)")
|
2017-04-25 13:15:15 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
|
install (TARGETS synergy DESTINATION bin)
|
2017-03-07 14:10:24 +00:00
|
|
|
endif()
|
2020-07-08 12:17:06 +00:00
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
|
|
|
|
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
|
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
|
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX
|
|
|
|
|
RESULT_VARIABLE return_code
|
|
|
|
|
OUTPUT_VARIABLE qt5_install_prefix
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
|
|
|
|
|
|
|
|
|
|
if(EXISTS ${imported_location})
|
|
|
|
|
add_executable(Qt5::windeployqt IMPORTED)
|
|
|
|
|
|
|
|
|
|
set_target_properties(Qt5::windeployqt PROPERTIES
|
|
|
|
|
IMPORTED_LOCATION ${imported_location}
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
if(TARGET Qt5::windeployqt)
|
|
|
|
|
# execute windeployqt in a tmp directory after build
|
|
|
|
|
add_custom_command(TARGET synergy
|
|
|
|
|
POST_BUILD
|
|
|
|
|
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin
|
|
|
|
|
COMMAND Qt5::windeployqt "$<TARGET_FILE_DIR:synergy>/$<TARGET_FILE_NAME:synergy>"
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|