Files
deskflow/cmake/Definitions.cmake
Nick Bolton 7984535d38 Refactored core process management and IPC client (#7425)
* Also ignore `command_pre` for Fedora itself

* Improve warning message

* Fixed layout issues on main window

* Restore fusion theme for Windows dark mode

* Further correct main window layout

* Set CWD for launch on Windows to same dir as .env

* Use signals for tray icon instead of callback

* Reduce complexity for setting tray icon

* Further reduce tray icon complexity

* Reduce tray retry time

* Fixed tray not showing on macOS

* Refactor function names

* Move tray icon to lib

* Decouple server connection class

* Move server connection to lib

* Move client config to lib

* Remove redundant forward declarations

* Fixed some namespaces in the new lib

* Move core process code to new class

* Improve member names on new process class

* Remove copy/pasta code

* Move OSX helpers to lib

* Add .mm to lib config

* Fixed copyright

* Improve reliability of log line handling

* Fixed TLS certificate generate bugs

* Remove client list

* Refactor core process handling to fix various problems

* Fixed process/connection status bugs

* Fixed function signature issue on macOS

* Fixed override warnings

* Fixed string format warning

* Save `wasStarted` state and use that instead

* Use only filename in dialog

* Use lambda for simple slot

* Scroll to bottom if at bottome

* Set value based on position before text added and set horizontal scroll too

* Add 1px tollerance for Linux

* Simplify start/stop mutex

* Always stop service on restart

* Increase scroll bottom threshold to 2

* Log warning instead of critical

* Fixed long-standing dir CD-up hack

* Remove include

* Remove include

* Fixed rogue dumbisense includes

* Account for optional distro_like

* Add QAction include to solve incomplete type

* Remove rogue #pragma

* Static cast log value

* Solve event queue delete warning

* Fixed integ test on Windows 10

* Reduce enum verbosity

* Use static instance instead of global

* Make function const

* Use unique_ptr instead of new and delete, and made some functions const

* Fixed smart pointer use

* Fixed variable shadowing

* Fixed wrong use of using

* Fixed missing namespace using

* Simplify TLS error handling

* Improve UX around certificate errors and success

* Decouple app config from core process through interface

* First iteration of core process test

* Mark dtor as override

* Rename attach launch entry

* Add TODO

* Create proxy for process

* Move IPC client to deps

* Fixed warnings

* Reorganize new GUI lib dir structure

* Update includes to reflect new paths

* Reorg GUI tests

* Abstract IPC client

* Refactor about screen

* Fixed .ui warnings

* Remove redundant include

* Fixed typo

* Fixed typos and add spelling

* Fixed misleading function name

* Improve comment

* Improve code coverage for core process

* Remove noisy log line

* Make global const

* Use default dtor

* Use vector instead of new

* Make ctor explicit

* Make ctor explicit (2)

* Use enum class

* Fixed bad enum

* Stub out core tool

* Stub out dir operation

* Extract byte functions

* Add missing return path

* Simplify byte/int functions

* Fix truncation

* Use ctor member assignment

* Fixed segfault in process proxy

* Fixed print warning

* Make function const

* Cleanup header

* Fixed missing name

* Update ChangeLog

* Make more functions const
2024-08-07 15:05:18 +01:00

167 lines
5.2 KiB
CMake

# Synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2024 Symless Ltd.
# Copyright (C) 2009-2012 Nick Bolton
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file LICENSE that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
macro(configure_definitions)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
endif()
configure_ninja()
configure_options()
configure_python()
set(INTEG_TESTS_BIN integtests)
set(UNIT_TESTS_BIN unittests)
if("${VERSION_URL}" STREQUAL "")
set(VERSION_URL "https://api.symless.com/version?version=v1")
endif()
add_definitions(-DSYNERGY_VERSION_URL="${VERSION_URL}")
if(NOT "$ENV{GIT_SHA}" STREQUAL "")
# Shorten the Git SHA to 8 chars for readability
string(SUBSTRING "$ENV{GIT_SHA}" 0 8 GIT_SHA_SHORT)
message(STATUS "Short Git SHA: ${GIT_SHA_SHORT}")
add_definitions(-DGIT_SHA_SHORT="${GIT_SHA_SHORT}")
endif()
if(NOT "$ENV{SYNERGY_PRODUCT_NAME}" STREQUAL "")
set(PRODUCT_NAME $ENV{SYNERGY_PRODUCT_NAME})
endif()
if(LICENSED_PRODUCT)
message(STATUS "Licensed product")
add_definitions(-DSYNERGY_LICENSED_PRODUCT=1)
if(ENABLE_ACTIVATION)
message(STATUS "Activation enabled")
add_definitions(-DSYNERGY_ENABLE_ACTIVATION=1)
endif()
else()
set(PRODUCT_NAME "Synergy 1 Community Edition")
endif()
if(PRODUCT_NAME)
message(STATUS "Product name: ${PRODUCT_NAME}")
add_definitions(-DSYNERGY_PRODUCT_NAME="${PRODUCT_NAME}")
endif()
if(SHOW_DEV_THANKS)
message(STATUS "Enabling dev thanks message")
add_definitions(-DSYNERGY_SHOW_DEV_THANKS=1)
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Disabling debug build")
add_definitions(-DNDEBUG)
endif()
# TODO: find out why we need these, and remove them if we don't.
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 NEW)
endif()
# TODO: explain why we're adding headers to sources.
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set(ADD_HEADERS_TO_SOURCES FALSE)
else()
set(ADD_HEADERS_TO_SOURCES TRUE)
endif()
set(BIN_TEMP_DIR ${CMAKE_BINARY_DIR}/temp/bin)
endmacro()
macro(configure_ninja)
# use response files so that ninja can compile on windows, otherwise you get
# an error when linking qt: "The input line is too long."
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@")
set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
set(CMAKE_NINJA_FORCE_RESPONSE_FILE
1
CACHE INTERNAL "")
endmacro()
macro(configure_options)
set(DEFAULT_BUILD_GUI ON)
set(DEFAULT_BUILD_INSTALLER ON)
set(DEFAULT_BUILD_TESTS ON)
# unified binary is off by default for now, for backwards compatibility.
set(DEFAULT_BUILD_UNIFIED OFF)
# coverage is off by default because it's GCC only and a developer preference.
set(DEFAULT_ENABLE_COVERAGE OFF)
# licensed product is off by default to show links to github, etc.
set(DEFAULT_LICENSED_PRODUCT OFF)
# activation is off by default to make life easier for contributors.
set(DEFAULT_ENABLE_ACTIVATION OFF)
# by default, show the dev thanks message, guides contributions, etc.
set(DEFAULT_SHOW_DEV_THANKS ON)
if("$ENV{SYNERGY_BUILD_MINIMAL}" STREQUAL "true")
set(DEFAULT_BUILD_GUI OFF)
set(DEFAULT_BUILD_INSTALLER OFF)
endif()
if("$ENV{SYNERGY_BUILD_TESTS}" STREQUAL "false")
set(DEFAULT_BUILD_TESTS OFF)
endif()
if("$ENV{SYNERGY_BUILD_UNIFIED}" STREQUAL "true")
set(DEFAULT_BUILD_UNIFIED ON)
endif()
if("$ENV{SYNERGY_ENABLE_ACTIVATION}" STREQUAL "true")
set(DEFAULT_ENABLE_ACTIVATION ON)
endif()
if("$ENV{SYNERGY_LICENSED_PRODUCT}" STREQUAL "true")
set(DEFAULT_LICENSED_PRODUCT ON)
endif()
if("$ENV{SYNERGY_ENABLE_COVERAGE}" STREQUAL "true")
set(DEFAULT_ENABLE_COVERAGE ON)
endif()
if("$ENV{SYNERGY_SHOW_DEV_THANKS}" STREQUAL "false")
set(DEFAULT_SHOW_DEV_THANKS OFF)
endif()
option(BUILD_GUI "Build GUI" ${DEFAULT_BUILD_GUI})
option(BUILD_INSTALLER "Build installer" ${DEFAULT_BUILD_INSTALLER})
option(BUILD_TESTS "Build tests" ${DEFAULT_BUILD_TESTS})
option(BUILD_UNIFIED "Build unified binary" ${DEFAULT_BUILD_UNIFIED})
option(ENABLE_ACTIVATION "Enable activation" ${DEFAULT_ENABLE_ACTIVATION})
option(LICENSED_PRODUCT "Show licensing info" ${DEFAULT_LICENSED_PRODUCT})
option(ENABLE_COVERAGE "Enable test coverage" ${DEFAULT_ENABLE_COVERAGE})
option(SHOW_DEV_THANKS "Show dev thanks message" ${DEFAULT_SHOW_DEV_THANKS})
endmacro()