2024-07-08 14:37:51 +00:00
|
|
|
find_package(
|
|
|
|
|
Qt6
|
2024-07-15 11:57:39 +00:00
|
|
|
COMPONENTS Core Widgets Network
|
2024-07-08 14:37:51 +00:00
|
|
|
REQUIRED)
|
|
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
|
|
file(GLOB GUI_SOURCE_FILES src/*.cpp src/*.h src/validators/* src/widgets/*)
|
|
|
|
|
file(GLOB GUI_UI_FILES src/*.ui)
|
|
|
|
|
file(GLOB ACTIVATION_FILES src/*Activation* src/*License*)
|
2020-05-04 20:00:54 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
|
file(GLOB GUI_MAC_SOURCE_FILES src/*.mm)
|
|
|
|
|
list(APPEND GUI_SOURCE_FILES ${GUI_MAC_SOURCE_FILES})
|
2020-01-11 15:42:34 +00:00
|
|
|
endif()
|
|
|
|
|
|
2024-07-04 09:14:54 +00:00
|
|
|
if(NOT ENABLE_LICENSING)
|
2024-07-02 10:23:56 +00:00
|
|
|
list(REMOVE_ITEM GUI_SOURCE_FILES ${ACTIVATION_FILES})
|
|
|
|
|
list(REMOVE_ITEM GUI_UI_FILES ${ACTIVATION_FILES})
|
|
|
|
|
endif()
|
2021-06-09 08:23:09 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
if(WIN32)
|
|
|
|
|
set(GUI_RC_FILES res/win/Synergy.rc ${CMAKE_BINARY_DIR}/src/version.rc)
|
2017-02-09 20:05:36 +00:00
|
|
|
endif()
|
|
|
|
|
|
2024-07-08 14:37:51 +00:00
|
|
|
add_executable(synergy WIN32 ${GUI_SOURCE_FILES} ${GUI_UI_FILES}
|
|
|
|
|
${GUI_RC_FILES} res/Synergy.qrc ${QM_FILES})
|
2016-12-19 17:41:01 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
include_directories(./src)
|
|
|
|
|
target_link_libraries(synergy shared)
|
2016-12-19 17:41:01 +00:00
|
|
|
|
2024-07-15 11:57:39 +00:00
|
|
|
target_link_libraries(synergy Qt6::Core Qt6::Widgets Qt6::Network)
|
2024-07-02 10:23:56 +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
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
if(WIN32)
|
|
|
|
|
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
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2024-07-10 15:11:32 +00:00
|
|
|
|
|
|
|
|
find_program(MACDEPLOYQT_BIN macdeployqt6)
|
|
|
|
|
message(STATUS "Found macdeployqt6: ${MACDEPLOYQT_BIN}")
|
|
|
|
|
|
|
|
|
|
set(MACDEPLOYQT_CMD
|
|
|
|
|
"${MACDEPLOYQT_BIN} ${SYNERGY_BUNDLE_APP_DIR} -always-overwrite")
|
|
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
install(TARGETS synergy DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
|
2024-07-10 15:11:32 +00:00
|
|
|
install(CODE "MESSAGE (\"Running: ${MACDEPLOYQT_CMD}\")")
|
|
|
|
|
install(CODE "execute_process(COMMAND ${MACDEPLOYQT_CMD})")
|
|
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2024-07-10 15:11:32 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
install(TARGETS synergy DESTINATION bin)
|
2020-07-08 12:17:06 +00:00
|
|
|
|
2024-07-10 15:11:32 +00:00
|
|
|
elseif(WIN32)
|
|
|
|
|
|
2024-07-08 14:37:51 +00:00
|
|
|
if(Qt6_FOUND
|
2024-07-02 10:23:56 +00:00
|
|
|
AND WIN32
|
2024-07-08 14:37:51 +00:00
|
|
|
AND TARGET Qt6::qmake
|
|
|
|
|
AND NOT TARGET Qt6::windeployqt)
|
|
|
|
|
get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION)
|
2020-07-08 12:17:06 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
execute_process(
|
2024-07-08 14:37:51 +00:00
|
|
|
COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX
|
2024-07-02 10:23:56 +00:00
|
|
|
RESULT_VARIABLE return_code
|
2024-07-08 14:37:51 +00:00
|
|
|
OUTPUT_VARIABLE qt6_install_prefix
|
2024-07-02 10:23:56 +00:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-07-08 12:17:06 +00:00
|
|
|
|
2024-07-08 14:37:51 +00:00
|
|
|
set(imported_location "${qt6_install_prefix}/bin/windeployqt.exe")
|
2020-07-08 12:17:06 +00:00
|
|
|
|
2024-07-02 10:23:56 +00:00
|
|
|
if(EXISTS ${imported_location})
|
2024-07-08 14:37:51 +00:00
|
|
|
add_executable(Qt6::windeployqt IMPORTED)
|
2020-07-08 12:17:06 +00:00
|
|
|
|
2024-07-08 14:37:51 +00:00
|
|
|
set_target_properties(Qt6::windeployqt PROPERTIES IMPORTED_LOCATION
|
2024-07-02 10:23:56 +00:00
|
|
|
${imported_location})
|
2020-07-08 12:17:06 +00:00
|
|
|
endif()
|
2024-07-02 10:23:56 +00:00
|
|
|
endif()
|
2024-07-10 15:11:32 +00:00
|
|
|
|
2024-07-08 14:37:51 +00:00
|
|
|
if(TARGET Qt6::windeployqt)
|
2024-07-02 10:23:56 +00:00
|
|
|
# execute windeployqt in a tmp directory after build
|
|
|
|
|
add_custom_command(
|
|
|
|
|
TARGET synergy
|
|
|
|
|
POST_BUILD
|
2024-07-08 14:37:51 +00:00
|
|
|
COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}/bin
|
|
|
|
|
COMMAND Qt6::windeployqt
|
2024-07-02 10:23:56 +00:00
|
|
|
"$<TARGET_FILE_DIR:synergy>/$<TARGET_FILE_NAME:synergy>")
|
|
|
|
|
endif()
|
2024-07-10 15:11:32 +00:00
|
|
|
|
2021-02-15 11:44:46 +00:00
|
|
|
endif()
|