Re-implement packaging for GitHub workflows (Linux) (#7361)

* Reorganize CMake Packaging module

* Match if statements to function order

* Cleanup root, res, and doc dirs

* Move deps to requirements.txt file

* Reorganize and format CMake files

* Rename changelog lint

* Add reccomended extension

* Workflow to lint CMake files

* Move CMake lint to script

* Try lighter dep

* Use venv

* Add --format arg

* Format all CMake files

* Convert bash script to Python

* Set CMake line ending format

* Restore formatting

* Add pyyaml dep

* Remove unused arg

* Rename config file

* Remove comment

* Repair copyrights (broken by defualt cmake-format)

* Restore 3rd party copyright

* Break up libs config into smaller macros

* Better macro name

* Load config after venv

* Make intentional noop clearer

* Only use upload step if required (make skip clearer)

* Use CPack for deb and rpm packaging

* Add upload step for Linux

* Remove cpack dep, doesn't exist

* Roll back presets version

* Fixed distro like match

* Update ChangeLog

* Legacy checkout for some distros

* All distros support v4

* Trying out newer Linux distros

* Install Git on Docker images

* Install without actions (not available before checkout)

* Delete useless action

* Install Python

* Support for Arch and OpenSUSE

* Add Arch and OpenSUSE to deps

* Name steps

* Full OpenSUSE names

* Mark Git dir safe

* Add pkgconf

* Legacy CMake for Debian 11

* Add OpenSSL to OpenSUSE

* Drop OpenSUSE Leap (no C++20 support)

* Skip packaging for Arch and OpenSUSE (for now)

* Shorten Arch/OpenSUSE names

* Clearer step name

* SImpler bootstrap

* Shell not needed

* Update apt

* Don't check return code

* Simplify python deps commands

* Add STGZ/.sh package type

* Prevent input prompt

* Only config git safe dir when needed

* Try cache v4

* Safe dir for Ubuntu

* Safe dir for Arch

* All Docker images seem to need safe dir config

* Refactor env var getters

* Make Ubuntu build extra packages

* Condense bootstep to single step

* Fixed var name

* Fixed bootstrap logic

* Simplify logic for upload condition (Windows and macOS)

* Make package/upload condition easier to understand

* Add Manjaro

* Generic names for Linux .tar.gz and .sh packages

* Add Manjaro deps

* Swap macOS matrix entries

* Add Red Hat UBI

* Remove RHEL subscription manager

* Throw on unsupported package distro

* Conditionally install pip and venv

* Remove extra pip arg

* Add config for RHEL

* Install EPEL for RHEL

* Back-out RHEL as EPEL requires subscription

* Restore Python deps logic

* Fixed bug: Packacking run twice

* Testing arm32v7 and arm64v8

* Revert "Testing arm32v7 and arm64v8"

This reverts commit cb3caf188d2b79ed083a62fc091de295f9889f3d.

* Re-add icon and shortcut file for Linux to package

* Support OpenSUSE RPM build

* Check return code

* Add `rpm-build` for OpenSUSE

* Reorg packages

* Remove busybox-which

* Add --non-interactive

* Move --non-interactive to correct position

* Experiment with makepkg

* Check and print package commands

* Make distro version optional

* Use 8 cores to build

* Default to distro name only

* Fixed bad PKGBUILD filename

* Use 4-part version for Arch

* Remove comma from conflicts

* Use .tar.gz from cwd

* Generate checksum for Arch

* Fixed file extension

* Use shell to print output

* Don't use shell

* Gaurd against bad cmd_utils.run

* Fixed bad import

* Use list command

* Fixed unable to run list commands

* Use source file name

* Simplify PKGBUILD to use make install

* Change install prefix

* Use DESTDIR

* Copy .desktop and .png to build dir

* Restore original `install(FILES...`

* Improving comments

* Fixed: makepkg runs from `src` by default

* Move error after command print

* Remove shell arg

* Package as a user instead of root (makepkg can't run as root)

* Fixed codesign runs in shell

* Allow list commands in shell on windows

* Don't use sudo on arch

* Install sudo on Arch

* Fixed typo

* Fix ownership of build directory for package user

* Improve example .env

* Change to depend on libstdc++6

* Add TODO

* Fixed Fedora version

* Remove libstdc++ deps (names vary between distros)

* Roll back to Fedora 40 and 39

* Improve comment

* Remove unneccesary default
This commit is contained in:
Nick Bolton
2024-07-02 11:23:56 +01:00
committed by GitHub
parent bec38ab47b
commit c8d9707857
80 changed files with 2013 additions and 1981 deletions

View File

@ -13,6 +13,12 @@
# Packaging (optional)
#
# [Linux] Build extra packages (self-extracting tar.gz and tar.gz)
# LINUX_EXTRA_PACKAGES=true
# [Linux] Run the package command as a different user (requires sudo)
# LINUX_PACKAGE_USER=build
# [Windows] Base64 encoded PFX code signing certificate
# WINDOWS_PFX_CERTIFICATE="very-long-base64-encoded-string"

View File

@ -26,6 +26,12 @@ runs:
using: "composite"
steps:
- if: ${{ inputs.use_gdrive == inputs.use_github }}
run: |
echo "Either 'use_github' or 'use_gdrive' must be true (and not both)"
exit 1
shell: bash
- if: ${{ inputs.use_gdrive == 'true' && !inputs.package-version }}
run: |
echo "Input 'package-version' is required when uploading to Google Drive"

View File

@ -17,6 +17,7 @@ on:
env:
SYNERGY_VERSION: ${{ github.event.inputs.version || github.event.release.tag_name }}
ENABLE_PACKAGING: ${{ !github.event.pull_request.draft }}
UPLOAD_TO_GITHUB: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
UPLOAD_TO_GDRIVE: ${{ github.event_name != 'pull_request' }}
@ -43,7 +44,7 @@ jobs:
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ env.QT_BASE_DIR }}
key: ${{ runner.os }}-Qt_${{ env.QT_VERSION }}
@ -61,20 +62,20 @@ jobs:
run: cmake -B build --preset=windows-release
- name: Build
run: cmake --build build
run: cmake --build build -j8
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
if: ${{ env.ENABLE_PACKAGING == 'true' }}
run: python ./scripts/package.py
env:
WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }}
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}
- name: Upload
if:
if: ${{ env.ENABLE_PACKAGING == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
@ -97,13 +98,6 @@ jobs:
strategy:
matrix:
runtime:
- name: "macos-10-intel"
timeout: 20
os: "macos-14-large"
arch: x64
target: "10.14"
shell: "bash"
- name: "macos-11-arm64"
timeout: 10
os: "macos-14"
@ -111,6 +105,13 @@ jobs:
target: "11"
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
- name: "macos-10-intel"
timeout: 20
os: "macos-14-large"
arch: x64
target: "10.14"
shell: "bash"
steps:
- name: Checkout
uses: actions/checkout@v4
@ -126,13 +127,13 @@ jobs:
run: cmake -B build --preset=macos-release -DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)
- name: Build
run: cmake --build build
run: cmake --build build -j8
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
if: ${{ env.ENABLE_PACKAGING == 'true' }}
run: ./scripts/package.py
env:
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
@ -143,7 +144,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload
if:
if: ${{ env.ENABLE_PACKAGING == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
@ -160,52 +161,84 @@ jobs:
name: linux-${{ matrix.distro.name }}
container: ${{ matrix.distro.container }}
env:
# Prevent apt prompting for input.
DEBIAN_FRONTEND: noninteractive
strategy:
matrix:
distro:
- name: centos-8
container: symless/synergy-core:centos8
- name: ubuntu-24.04
container: ubuntu:24.04
runs-on: ubuntu-latest
legacy-cmake: true
- name: debian-11
container: symless/synergy-core:debian11
runs-on: ubuntu-latest
legacy-cmake: true
- name: debian-12
container: symless/synergy-core:debiansid
runs-on: ubuntu-latest
- name: fedora-37
container: symless/synergy-core:fedora37
runs-on: ubuntu-latest
legacy-cmake: true
- name: fedora-38
container: symless/synergy-core:fedora38
runs-on: ubuntu-latest
legacy-cmake: true
- name: ubuntu-20.04
container: symless/synergy-core:ubuntu20.04
runs-on: ubuntu-latest
legacy-cmake: true
install-deps-apt: true
extra-packages: true
- name: ubuntu-22.04
container: symless/synergy-core:ubuntu22.04
container: ubuntu:22.04
runs-on: ubuntu-latest
install-deps-apt: true
- name: ubuntu-24.04
runs-on: ubuntu-24.04
- name: debian-12
container: debian:12
runs-on: ubuntu-latest
install-deps-apt: true
- name: debian-11
container: debian:11
runs-on: ubuntu-latest
install-deps-apt: true
legacy-cmake: true
- name: fedora-40
container: fedora:40
runs-on: ubuntu-latest
install-deps-dnf: true
- name: fedora-39
container: fedora:39
runs-on: ubuntu-latest
install-deps-dnf: true
- name: opensuse
container: opensuse/tumbleweed:latest
runs-on: ubuntu-latest
install-deps-zypper: true
- name: arch
container: archlinux:latest
runs-on: ubuntu-latest
install-deps-pacman: true
package-user: build
- name: manjaro
container: manjarolinux/base:latest
runs-on: ubuntu-latest
install-deps-pacman: true
package-user: build
steps:
# Use @v3 since some older Linux distro versions don't support @v4
- name: Bootstrap
run: |
if [ "${{ matrix.distro.install-deps-apt }}" = "true" ]; then
apt update && apt install -y git python3
elif [ "${{ matrix.distro.install-deps-dnf }}" = "true" ]; then
dnf install -y git python3
elif [ "${{ matrix.distro.install-deps-pacman }}" = "true" ]; then
pacman -Syu --noconfirm git python sudo
useradd -m build
elif [ "${{ matrix.distro.install-deps-zypper }}" = "true" ]; then
zypper install -y git python3
fi
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Config Git safe dir
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Install dependencies
run: ./scripts/install_deps.py
@ -219,11 +252,26 @@ jobs:
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build
run: cmake --build build -j8
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
if: ${{ !matrix.distro.skip-package && env.ENABLE_PACKAGING == 'true' }}
env:
LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }}
LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }}
run: ./scripts/package.py
- name: Upload
if: ${{ !matrix.distro.skip-package && env.ENABLE_PACKAGING == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
use_gdrive: ${{ env.UPLOAD_TO_GDRIVE }}
github-target-filename: "synergy-${{ matrix.distro.name }}"
gdrive-target-base-dir: "synergy1/personal"
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }}

View File

@ -5,37 +5,28 @@
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md
name: "Check ChangeLog"
name: "Lint ChangeLog"
on:
pull_request:
branches: [master]
jobs:
check-changelog:
lint-changelog:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Get changed files
- name: Get changes
id: file_changes
uses: trilom/file-changes-action@v1.2.4
with:
output: ","
- name: echo changes
run: |
echo Files
echo '${{ steps.file_changes.outputs.files}}'
echo Modified
echo '${{ steps.file_changes.outputs.files_modified}}'
echo Added
echo '${{ steps.file_changes.outputs.files_added}}'
echo Removed
echo '${{ steps.file_changes.outputs.files_removed}}'
- name: Show modified
run: echo '${{ steps.file_changes.outputs.files_modified}}'
- name: List files
- name: Check
run: |
if [[ "${{ steps.file_changes.outputs.files_modified}}" == *"ChangeLog"* ]]; then
echo "ChangeLog has been updated"

23
.github/workflows/lint-cmake-files.yml vendored Normal file
View File

@ -0,0 +1,23 @@
# Runs
name: "Lint CMake files"
on:
pull_request:
jobs:
lint-cmake-files:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv build/python
source build/python/bin/activate
pip install cmake_format pyyaml
- name: Lint CMake files
run: ./scripts/lint_cmake_files.py

View File

@ -4,6 +4,7 @@
"twxs.cmake",
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.cpptools",
"vadimcn.vscode-lldb"
"vadimcn.vscode-lldb",
"cheshirekow.cmake-format"
]
}

View File

@ -14,393 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required (VERSION 3.5)
project (synergy-core C CXX)
include (cmake/Version.cmake)
set_version()
# 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 "")
if (DEFINED ENV{SYNERGY_BUILD_MINIMAL})
option (SYNERGY_BUILD_GUI "Build the GUI" OFF)
option (SYNERGY_BUILD_INSTALLER "Build the installer" OFF)
else()
option (SYNERGY_BUILD_GUI "Build the GUI" ON)
option (SYNERGY_BUILD_INSTALLER "Build the installer" ON)
endif()
if (DEFINED ENV{SYNERGY_NO_TESTS})
option (BUILD_TESTS "Override building of tests" OFF)
else()
option (BUILD_TESTS "Override building of tests" ON)
option (ENABLE_COVERAGE "Build with coverage")
endif()
if (DEFINED ENV{SYNERGY_UNIFIED_CORE})
option (UNIFIED_CORE "Build a single core binary" ON)
else()
option (UNIFIED_CORE "Build a single core binary" OFF)
endif()
if ($ENV{SYNERGY_ENTERPRISE})
option (SYNERGY_ENTERPRISE "Build Enterprise" ON)
else()
option (SYNERGY_ENTERPRISE "Build Enterprise" OFF)
endif()
if ($ENV{SYNERGY_BUSINESS})
option (SYNERGY_BUSINESS "Build Business" ON)
else()
option (SYNERGY_BUSINESS "Build Business" OFF)
endif()
if (SYNERGY_DEVELOPER_MODE)
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
endif()
if (SYNERGY_ENTERPRISE)
add_definitions (-DSYNERGY_ENTERPRISE=1)
endif()
if (SYNERGY_BUSINESS)
add_definitions(-DSYNERGY_BUSINESS=1)
endif()
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 (ENABLE_COVERAGE)
# Add Code Coverage
include(cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
setup_target_for_coverage_gcovr_xml(
NAME coverage
EXECUTABLE unittests
BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
EXCLUDE "ext/*")
endif()
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions (-DNDEBUG)
endif()
# TODO: Find out why we need these, and remove them
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
cmake_policy (SET CMP0005 NEW)
endif()
# Add headers to source list
if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set (SYNERGY_ADD_HEADERS FALSE)
else()
set (SYNERGY_ADD_HEADERS TRUE)
endif()
set (libs)
include_directories (BEFORE SYSTEM ${PROJECT_SOURCE_DIR}/ext/googletest/googletest/include)
if (UNIX)
if (NOT APPLE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
# For config.h, detect the libraries, functions, etc.
include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckFunctionExists)
include (CheckTypeSize)
include (CheckIncludeFileCXX)
include (CheckSymbolExists)
include (CheckCSourceCompiles)
check_include_file_cxx (istream HAVE_ISTREAM)
check_include_file_cxx (ostream HAVE_OSTREAM)
check_include_file_cxx (sstream HAVE_SSTREAM)
check_include_files (inttypes.h HAVE_INTTYPES_H)
check_include_files (locale.h HAVE_LOCALE_H)
check_include_files (memory.h HAVE_MEMORY_H)
check_include_files (stdlib.h HAVE_STDLIB_H)
check_include_files (strings.h HAVE_STRINGS_H)
check_include_files (string.h HAVE_STRING_H)
check_include_files (sys/select.h HAVE_SYS_SELECT_H)
check_include_files (sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files (sys/stat.h HAVE_SYS_STAT_H)
check_include_files (sys/time.h HAVE_SYS_TIME_H)
check_include_files (sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files (unistd.h HAVE_UNISTD_H)
check_include_files (wchar.h HAVE_WCHAR_H)
check_function_exists (getpwuid_r HAVE_GETPWUID_R)
check_function_exists (gmtime_r HAVE_GMTIME_R)
check_function_exists (nanosleep HAVE_NANOSLEEP)
check_function_exists (poll HAVE_POLL)
check_function_exists (sigwait HAVE_POSIX_SIGWAIT)
check_function_exists (strftime HAVE_STRFTIME)
check_function_exists (vsnprintf HAVE_VSNPRINTF)
check_function_exists (inet_aton HAVE_INET_ATON)
# For some reason, the check_function_exists macro doesn't detect
# the inet_aton on some pure Unix platforms (e.g. sunos5). So we
# need to do a more detailed check and also include some extra libs.
if (NOT HAVE_INET_ATON)
set (CMAKE_REQUIRED_LIBRARIES nsl)
check_c_source_compiles (
"#include <arpa/inet.h>\n int main() { inet_aton (0, 0); }"
HAVE_INET_ATON_ADV)
set (CMAKE_REQUIRED_LIBRARIES)
if (HAVE_INET_ATON_ADV)
# Override the previous fail.
set (HAVE_INET_ATON 1)
# Assume that both nsl and socket will be needed,
# it seems safe to add socket on the back of nsl,
# since socket only ever needed when nsl is needed.
list (APPEND libs nsl socket)
endif()
endif()
check_type_size (char SIZEOF_CHAR)
check_type_size (int SIZEOF_INT)
check_type_size (long SIZEOF_LONG)
check_type_size (short SIZEOF_SHORT)
# pthread is used on both Linux and Mac
check_library_exists ("pthread" pthread_create "" HAVE_PTHREAD)
if (HAVE_PTHREAD)
list (APPEND libs pthread)
else()
message (FATAL_ERROR "Missing library: pthread")
endif()
if (APPLE)
set (CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
endif()
if(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 11.0)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1100)
elseif(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 10.15)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1015)
elseif(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 10.14)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1014)
else()
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1013)
endif()
add_compile_definitions(OSX_DEPLOYMENT_TARGET=${SYNERGY_OSX_DEPLOYMENT_TARGET})
find_library (lib_ScreenSaver ScreenSaver)
find_library (lib_IOKit IOKit)
find_library (lib_ApplicationServices ApplicationServices)
find_library (lib_Foundation Foundation)
find_library (lib_Carbon Carbon)
list (APPEND libs
${lib_ScreenSaver}
${lib_IOKit}
${lib_ApplicationServices}
${lib_Foundation}
${lib_Carbon}
)
if(SYNERGY_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 1014)
find_library (lib_UserNotifications UserNotifications)
list (APPEND libs
${lib_UserNotifications}
)
endif()
else() # not-apple
# add include dir for bsd (posix uses /usr/include/)
set (CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
set (XKBlib "X11/Xlib.h;X11/XKBlib.h")
set (CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
check_type_size ("XRRNotifyEvent" X11_EXTENSIONS_XRANDR_H)
set (HAVE_X11_EXTENSIONS_XRANDR_H "${X11_EXTENSIONS_XRANDR_H}")
set (CMAKE_EXTRA_INCLUDE_FILES)
check_include_files ("${XKBlib};X11/extensions/dpms.h" HAVE_X11_EXTENSIONS_DPMS_H)
check_include_files ("X11/extensions/Xinerama.h" HAVE_X11_EXTENSIONS_XINERAMA_H)
check_include_files ("${XKBlib};X11/extensions/XKBstr.h" HAVE_X11_EXTENSIONS_XKBSTR_H)
check_include_files ("X11/extensions/XKB.h" HAVE_XKB_EXTENSION)
check_include_files ("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H)
check_include_files ("${XKBlib}" HAVE_X11_XKBLIB_H)
check_include_files ("X11/extensions/XInput2.h" HAVE_XI2)
if (HAVE_X11_EXTENSIONS_DPMS_H)
# Assume that function prototypes declared, when include exists.
set (HAVE_DPMS_PROTOTYPES 1)
endif()
if (NOT HAVE_X11_XKBLIB_H)
message (FATAL_ERROR "Missing header: " ${XKBlib})
endif()
check_library_exists ("SM;ICE" IceConnectionNumber "" HAVE_ICE)
check_library_exists ("Xext;X11" DPMSQueryExtension "" HAVE_Xext)
check_library_exists ("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst)
check_library_exists ("Xinerama" XineramaQueryExtension "" HAVE_Xinerama)
check_library_exists ("Xi" XISelectEvents "" HAVE_Xi)
check_library_exists ("Xrandr" XRRQueryExtension "" HAVE_Xrandr)
if (HAVE_ICE)
# Assume we have SM if we have ICE.
set (HAVE_SM 1)
list (APPEND libs SM ICE)
endif()
if (!X11_xkbfile_FOUND)
message (FATAL_ERROR "Missing library: xkbfile")
endif()
if (HAVE_Xtst)
# Xtxt depends on X11.
set (HAVE_X11)
list (APPEND libs Xtst X11 xkbfile)
else()
message (FATAL_ERROR "Missing library: Xtst")
endif()
if (HAVE_Xext)
list (APPEND libs Xext)
endif()
if (HAVE_Xinerama)
list (APPEND libs Xinerama)
else (HAVE_Xinerama)
if (HAVE_X11_EXTENSIONS_XINERAMA_H)
set (HAVE_X11_EXTENSIONS_XINERAMA_H 0)
message (WARNING "Old Xinerama implementation detected, disabled")
endif()
endif()
if (HAVE_Xrandr)
list (APPEND libs Xrandr)
endif()
# this was outside of the linux scope,
# not sure why, moving it back inside.
if (HAVE_Xi)
list (APPEND libs Xi)
endif()
endif()
# For config.h, set some static values; it may be a good idea to make
# these values dynamic for non-standard UNIX compilers.
set (ACCEPT_TYPE_ARG3 socklen_t)
set (HAVE_CXX_BOOL 1)
set (HAVE_CXX_CASTS 1)
set (HAVE_CXX_EXCEPTIONS 1)
set (HAVE_CXX_MUTABLE 1)
set (HAVE_CXX_STDLIB 1)
set (HAVE_PTHREAD_SIGNAL 1)
set (SELECT_TYPE_ARG1 int)
set (SELECT_TYPE_ARG234 " (fd_set *)")
set (SELECT_TYPE_ARG5 " (struct timeval *)")
set (STDC_HEADERS 1)
set (TIME_WITH_SYS_TIME 1)
set (HAVE_SOCKLEN_T 1)
# For config.h, save the results based on a template (config.h.in).
configure_file (res/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/lib/config.h)
add_definitions (-DSYSAPI_UNIX=1 -DHAVE_CONFIG_H)
if (APPLE)
add_definitions (-DWINAPI_CARBON=1 -D_THREAD_SAFE)
else()
add_definitions (-DWINAPI_XWINDOWS=1)
endif()
elseif (WIN32)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
list (APPEND libs Wtsapi32 Userenv Wininet comsuppw Shlwapi)
add_definitions (
/DWIN32
/D_WINDOWS
/D_CRT_SECURE_NO_WARNINGS
/DSYNERGY_VERSION=\"${SYNERGY_VERSION}\"
/D_XKEYCHECK_H
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/res/win/version.rc.in
${CMAKE_BINARY_DIR}/src/version.rc
@ONLY)
endif()
#
# OpenSSL
#
# Apple has to use static libraries because
# "Use of the Apple-provided OpenSSL libraries by apps is strongly discouraged."
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
if(APPLE OR DEFINED ENV{SYNERGY_STATIC_OPENSSL})
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif()
find_package(OpenSSL REQUIRED)
#
# Check submodules
#
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMODULE_RESULT)
if(NOT GIT_SUBMODULE_RESULT EQUAL "0")
message(FATAL_ERROR "Git submodule update failed: ${GIT_SUBMODULE_RESULT}")
endif()
endif()
endif()
#
# Google Test
#
if(BUILD_TESTS AND NOT EXISTS "${PROJECT_SOURCE_DIR}/ext/googletest/CMakeLists.txt")
message(FATAL_ERROR "Git submodule for Google Test is missing")
endif()
cmake_minimum_required(VERSION 3.5)
project(synergy-core C CXX)
include(cmake/Version.cmake)
include(cmake/Definitions.cmake)
include(cmake/Libraries.cmake)
include(cmake/Packaging.cmake)
set_version()
configure_definitions()
configure_libs()
configure_packaging()
add_subdirectory (src)
add_subdirectory(src)

View File

@ -36,6 +36,7 @@ Enhancements:
- #7354 Re-implement CI auto version increment for packaging
- #7353 Re-implement packaging for GitHub workflows (macOS)
- #7360 Re-implement packaging for GitHub workflows (Windows)
- #7361 Re-implement packaging for GitHub workflows (Linux)
# 1.14.6

View File

@ -42,7 +42,7 @@ cmake -B build --preset=linux-release
**Build:**
```
cmake --build build
cmake --build build -j8
```
**Test:**

5
cmake-format.yaml Normal file
View File

@ -0,0 +1,5 @@
format:
line_ending: "auto"
markup:
first_comment_is_literal: true

View File

@ -116,322 +116,334 @@
include(CMakeParseArguments)
# Check prereqs
find_program( GCOV_PATH gcov )
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
find_program( CPPFILT_PATH NAMES c++filt )
find_program(GCOV_PATH gcov)
find_program(LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
find_program(GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat)
find_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
find_program(CPPFILT_PATH NAMES c++filt)
if(NOT GCOV_PATH)
message(FATAL_ERROR "gcov not found! Aborting...")
message(FATAL_ERROR "gcov not found! Aborting...")
endif() # NOT GCOV_PATH
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
# Do nothing; exit conditional without error if true
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
# Do nothing; exit conditional without error if true
else()
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
# Do nothing; exit conditional without error if true
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
# Do nothing; exit conditional without error if true
else()
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
endif()
set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
set(COVERAGE_COMPILER_FLAGS
"-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
set(CMAKE_Fortran_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
FORCE )
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
FORCE)
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds." FORCE)
set(CMAKE_C_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C compiler during coverage builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
""
CACHE STRING
"Flags used by the shared libraries linker during coverage builds."
FORCE)
mark_as_advanced(
CMAKE_Fortran_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
CMAKE_Fortran_FLAGS_COVERAGE CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
message(
WARNING
"Code coverage results with an optimised (non-Debug) build may be misleading"
)
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL
"GNU")
link_libraries(gcov)
endif()
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
# Defines a target for running and collection code coverage information Builds
# dependencies, runs the given executable and outputs reports. NOTE! The
# executable should always have a ZERO as exit code otherwise the coverage
# generation will not complete.
#
# setup_target_for_coverage_lcov(
# NAME testrunner_coverage # New target name
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES testrunner # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# NO_DEMANGLE # Don't demangle C++ symbols
# # even if c++filt is found
# )
# setup_target_for_coverage_lcov( NAME testrunner_coverage #
# New target name EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in
# PROJECT_BINARY_DIR DEPENDENCIES testrunner # Dependencies
# to build first BASE_DIRECTORY "../" # Base directory
# for report # (defaults to PROJECT_SOURCE_DIR) EXCLUDE "src/dir1/*"
# "src/dir2/*" # Patterns to exclude (can be relative # to
# BASE_DIRECTORY, with CMake 3.4+) NO_DEMANGLE #
# Don't demangle C++ symbols # even if c++filt is found )
function(setup_target_for_coverage_lcov)
set(options NO_DEMANGLE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(options NO_DEMANGLE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS
GENHTML_ARGS)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif() # NOT LCOV_PATH
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif() # NOT LCOV_PATH
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif() # NOT GENHTML_PATH
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif() # NOT GENHTML_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(LCOV_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES}
${COVERAGE_LCOV_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(LCOV_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
# Conditional arguments
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
endif()
# Conditional arguments
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
endif()
# Setup target
add_custom_target(
${Coverage_NAME}
# Cleanup lcov
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH}
-directory . -b ${BASEDIR} --zerocounters
# Create baseline to make sure untouched files show up in the report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d
. -b ${BASEDIR} -o ${Coverage_NAME}.base
# Run tests
COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Capturing lcov counters and generating report
COMMAND
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory .
-b ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
# add baseline counters
COMMAND
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a
${Coverage_NAME}.base -a ${Coverage_NAME}.capture --output-file
${Coverage_NAME}.total
# filter collected data to final coverage report
COMMAND
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove
${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file
${Coverage_NAME}.info
# Generate HTML output
COMMAND ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o
${Coverage_NAME} ${Coverage_NAME}.info
# Set output files as GENERATED (will be removed on 'make clean')
BYPRODUCTS ${Coverage_NAME}.base ${Coverage_NAME}.capture
${Coverage_NAME}.total ${Coverage_NAME}.info
${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT
"Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Setup target
add_custom_target(${Coverage_NAME}
# Show where to find the lcov info report
add_custom_command(
TARGET ${Coverage_NAME}
POST_BUILD
COMMAND ;
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info.")
# Cleanup lcov
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . -b ${BASEDIR} --zerocounters
# Create baseline to make sure untouched files show up in the report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b ${BASEDIR} -o ${Coverage_NAME}.base
# Run tests
COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
# add baseline counters
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base -a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total
# filter collected data to final coverage report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove ${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info
# Generate HTML output
COMMAND ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o ${Coverage_NAME} ${Coverage_NAME}.info
# Set output files as GENERATED (will be removed on 'make clean')
BYPRODUCTS
${Coverage_NAME}.base
${Coverage_NAME}.capture
${Coverage_NAME}.total
${Coverage_NAME}.info
${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show where to find the lcov info report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
# Show info where to find the report
add_custom_command(
TARGET ${Coverage_NAME}
POST_BUILD
COMMAND ;
COMMENT
"Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # setup_target_for_coverage_lcov
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
# Defines a target for running and collection code coverage information Builds
# dependencies, runs the given executable and outputs reports. NOTE! The
# executable should always have a ZERO as exit code otherwise the coverage
# generation will not complete.
#
# setup_target_for_coverage_gcovr_xml(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
# setup_target_for_coverage_gcovr_xml( NAME ctest_coverage #
# New target name EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in
# PROJECT_BINARY_DIR DEPENDENCIES executable_target # Dependencies to
# build first BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR) EXCLUDE "src/dir1/*" "src/dir2/*" #
# Patterns to exclude (can be relative # to BASE_DIRECTORY, with CMake 3.4+) )
function(setup_target_for_coverage_gcovr_xml)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES}
${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
add_custom_target(
${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Running gcovr
COMMAND ${GCOVR_PATH} --sonarqube -r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}.xml
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce Cobertura code coverage report.")
add_custom_target(${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Running gcovr
COMMAND ${GCOVR_PATH} --sonarqube
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}.xml
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
)
# Show info where to find the report
add_custom_command(
TARGET ${Coverage_NAME}
POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml.")
endfunction() # setup_target_for_coverage_gcovr_xml
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
# Defines a target for running and collection code coverage information Builds
# dependencies, runs the given executable and outputs reports. NOTE! The
# executable should always have a ZERO as exit code otherwise the coverage
# generation will not complete.
#
# setup_target_for_coverage_gcovr_html(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
# setup_target_for_coverage_gcovr_html( NAME ctest_coverage #
# New target name EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in
# PROJECT_BINARY_DIR DEPENDENCIES executable_target # Dependencies to
# build first BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR) EXCLUDE "src/dir1/*" "src/dir2/*" #
# Patterns to exclude (can be relative # to BASE_DIRECTORY, with CMake 3.4+) )
function(setup_target_for_coverage_gcovr_html)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES}
${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
add_custom_target(
${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Create folder
COMMAND ${CMAKE_COMMAND} -E make_directory
${PROJECT_BINARY_DIR}/${Coverage_NAME}
# Running gcovr
COMMAND
${GCOVR_PATH} --html --html-details -r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}/index.html
BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce HTML code coverage report.")
add_custom_target(${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Create folder
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
# Running gcovr
COMMAND ${GCOVR_PATH} --html --html-details
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}/index.html
BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce HTML code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
# Show info where to find the report
add_custom_command(
TARGET ${Coverage_NAME}
POST_BUILD
COMMAND ;
COMMENT
"Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # setup_target_for_coverage_gcovr_html
function(append_coverage_compiler_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}"
PARENT_SCOPE)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}"
PARENT_SCOPE)
set(CMAKE_Fortran_FLAGS
"${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}"
PARENT_SCOPE)
message(
STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # append_coverage_compiler_flags

99
cmake/Definitions.cmake Normal file
View File

@ -0,0 +1,99 @@
# 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")
configure_ninja()
configure_options()
if(SYNERGY_ENTERPRISE)
add_definitions(-DSYNERGY_ENTERPRISE=1)
endif()
if(SYNERGY_BUSINESS)
add_definitions(-DSYNERGY_BUSINESS=1)
endif()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
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()
# Add headers to source list
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set(SYNERGY_ADD_HEADERS FALSE)
else()
set(SYNERGY_ADD_HEADERS TRUE)
endif()
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)
if(DEFINED ENV{SYNERGY_BUILD_MINIMAL})
option(SYNERGY_BUILD_GUI "Build the GUI" OFF)
option(SYNERGY_BUILD_INSTALLER "Build the installer" OFF)
else()
option(SYNERGY_BUILD_GUI "Build the GUI" ON)
option(SYNERGY_BUILD_INSTALLER "Build the installer" ON)
endif()
if(DEFINED ENV{SYNERGY_NO_TESTS})
option(BUILD_TESTS "Override building of tests" OFF)
else()
option(BUILD_TESTS "Override building of tests" ON)
option(ENABLE_COVERAGE "Build with coverage")
endif()
if(DEFINED ENV{SYNERGY_UNIFIED_CORE})
option(UNIFIED_CORE "Build a single core binary" ON)
else()
option(UNIFIED_CORE "Build a single core binary" OFF)
endif()
if($ENV{SYNERGY_ENTERPRISE})
option(SYNERGY_ENTERPRISE "Build Enterprise" ON)
else()
option(SYNERGY_ENTERPRISE "Build Enterprise" OFF)
endif()
if($ENV{SYNERGY_BUSINESS})
option(SYNERGY_BUSINESS "Build Business" ON)
else()
option(SYNERGY_BUSINESS "Build Business" OFF)
endif()
endmacro()

370
cmake/Libraries.cmake Normal file
View File

@ -0,0 +1,370 @@
# 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_libs)
set(libs)
if(UNIX)
configure_unix_libs()
elseif(WIN32)
configure_windows_libs()
endif()
configure_openssl()
update_submodules()
configure_test_libs()
endmacro()
#
# Unix (Mac, Linux, BSD, etc)
#
macro(configure_unix_libs)
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
# For config.h, detect the libraries, functions, etc.
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckTypeSize)
include(CheckIncludeFileCXX)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
check_include_file_cxx(istream HAVE_ISTREAM)
check_include_file_cxx(ostream HAVE_OSTREAM)
check_include_file_cxx(sstream HAVE_SSTREAM)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(string.h HAVE_STRING_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(wchar.h HAVE_WCHAR_H)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_function_exists(nanosleep HAVE_NANOSLEEP)
check_function_exists(poll HAVE_POLL)
check_function_exists(sigwait HAVE_POSIX_SIGWAIT)
check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(inet_aton HAVE_INET_ATON)
# For some reason, the check_function_exists macro doesn't detect the
# inet_aton on some pure Unix platforms (e.g. sunos5). So we need to do a more
# detailed check and also include some extra libs.
if(NOT HAVE_INET_ATON)
set(CMAKE_REQUIRED_LIBRARIES nsl)
check_c_source_compiles(
"#include <arpa/inet.h>\n int main() { inet_aton (0, 0); }"
HAVE_INET_ATON_ADV)
set(CMAKE_REQUIRED_LIBRARIES)
if(HAVE_INET_ATON_ADV)
# Override the previous fail.
set(HAVE_INET_ATON 1)
# Assume that both nsl and socket will be needed, it seems safe to add
# socket on the back of nsl, since socket only ever needed when nsl is
# needed.
list(APPEND libs nsl socket)
endif()
endif()
check_type_size(char SIZEOF_CHAR)
check_type_size(int SIZEOF_INT)
check_type_size(long SIZEOF_LONG)
check_type_size(short SIZEOF_SHORT)
# pthread is used on both Linux and Mac
check_library_exists("pthread" pthread_create "" HAVE_PTHREAD)
if(HAVE_PTHREAD)
list(APPEND libs pthread)
else()
message(FATAL_ERROR "Missing library: pthread")
endif()
if(APPLE)
configure_mac_libs()
else()
configure_xorg_libs()
endif()
# For config.h, set some static values; it may be a good idea to make these
# values dynamic for non-standard UNIX compilers.
set(ACCEPT_TYPE_ARG3 socklen_t)
set(HAVE_CXX_BOOL 1)
set(HAVE_CXX_CASTS 1)
set(HAVE_CXX_EXCEPTIONS 1)
set(HAVE_CXX_MUTABLE 1)
set(HAVE_CXX_STDLIB 1)
set(HAVE_PTHREAD_SIGNAL 1)
set(SELECT_TYPE_ARG1 int)
set(SELECT_TYPE_ARG234 " (fd_set *)")
set(SELECT_TYPE_ARG5 " (struct timeval *)")
set(STDC_HEADERS 1)
set(TIME_WITH_SYS_TIME 1)
set(HAVE_SOCKLEN_T 1)
# For config.h, save the results based on a template (config.h.in).
configure_file(res/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/lib/config.h)
add_definitions(-DSYSAPI_UNIX=1 -DHAVE_CONFIG_H)
endmacro()
#
# Apple macOS
#
macro(configure_mac_libs)
set(CMAKE_CXX_FLAGS
"--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1"
)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
endif()
if(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 11.0)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1100)
elseif(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 10.15)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1015)
elseif(CMAKE_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 10.14)
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1014)
else()
set(SYNERGY_OSX_DEPLOYMENT_TARGET 1013)
endif()
add_compile_definitions(
OSX_DEPLOYMENT_TARGET=${SYNERGY_OSX_DEPLOYMENT_TARGET})
find_library(lib_ScreenSaver ScreenSaver)
find_library(lib_IOKit IOKit)
find_library(lib_ApplicationServices ApplicationServices)
find_library(lib_Foundation Foundation)
find_library(lib_Carbon Carbon)
list(
APPEND
libs
${lib_ScreenSaver}
${lib_IOKit}
${lib_ApplicationServices}
${lib_Foundation}
${lib_Carbon})
if(SYNERGY_OSX_DEPLOYMENT_TARGET GREATER_EQUAL 1014)
find_library(lib_UserNotifications UserNotifications)
list(APPEND libs ${lib_UserNotifications})
endif()
add_definitions(-DWINAPI_CARBON=1 -D_THREAD_SAFE)
endmacro()
#
# X.org/X11 for Linux, BSD, etc
#
macro(configure_xorg_libs)
# Add include dir for BSD (posix uses /usr/include/)
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
set(XKBlib "X11/Xlib.h;X11/XKBlib.h")
set(CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
check_type_size("XRRNotifyEvent" X11_EXTENSIONS_XRANDR_H)
set(HAVE_X11_EXTENSIONS_XRANDR_H "${X11_EXTENSIONS_XRANDR_H}")
set(CMAKE_EXTRA_INCLUDE_FILES)
check_include_files("${XKBlib};X11/extensions/dpms.h"
HAVE_X11_EXTENSIONS_DPMS_H)
check_include_files("X11/extensions/Xinerama.h"
HAVE_X11_EXTENSIONS_XINERAMA_H)
check_include_files("${XKBlib};X11/extensions/XKBstr.h"
HAVE_X11_EXTENSIONS_XKBSTR_H)
check_include_files("X11/extensions/XKB.h" HAVE_XKB_EXTENSION)
check_include_files("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H)
check_include_files("${XKBlib}" HAVE_X11_XKBLIB_H)
check_include_files("X11/extensions/XInput2.h" HAVE_XI2)
if(HAVE_X11_EXTENSIONS_DPMS_H)
# Assume that function prototypes declared, when include exists.
set(HAVE_DPMS_PROTOTYPES 1)
endif()
if(NOT HAVE_X11_XKBLIB_H)
message(FATAL_ERROR "Missing header: " ${XKBlib})
endif()
check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE)
check_library_exists("Xext;X11" DPMSQueryExtension "" HAVE_Xext)
check_library_exists("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst)
check_library_exists("Xinerama" XineramaQueryExtension "" HAVE_Xinerama)
check_library_exists("Xi" XISelectEvents "" HAVE_Xi)
check_library_exists("Xrandr" XRRQueryExtension "" HAVE_Xrandr)
if(HAVE_ICE)
# Assume we have SM if we have ICE.
set(HAVE_SM 1)
list(APPEND libs SM ICE)
endif()
if(!X11_xkbfile_FOUND)
message(FATAL_ERROR "Missing library: xkbfile")
endif()
if(HAVE_Xtst)
# Xtxt depends on X11.
set(HAVE_X11)
list(APPEND libs Xtst X11 xkbfile)
else()
message(FATAL_ERROR "Missing library: Xtst")
endif()
if(HAVE_Xext)
list(APPEND libs Xext)
endif()
if(HAVE_Xinerama)
list(APPEND libs Xinerama)
else(HAVE_Xinerama)
if(HAVE_X11_EXTENSIONS_XINERAMA_H)
set(HAVE_X11_EXTENSIONS_XINERAMA_H 0)
message(WARNING "Old Xinerama implementation detected, disabled")
endif()
endif()
if(HAVE_Xrandr)
list(APPEND libs Xrandr)
endif()
# this was outside of the linux scope, not sure why, moving it back inside.
if(HAVE_Xi)
list(APPEND libs Xi)
endif()
add_definitions(-DWINAPI_XWINDOWS=1)
endmacro()
#
# Windows
#
macro(configure_windows_libs)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
list(
APPEND
libs
Wtsapi32
Userenv
Wininet
comsuppw
Shlwapi)
add_definitions(/DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS
/DSYNERGY_VERSION=\"${SYNERGY_VERSION}\" /D_XKEYCHECK_H)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/res/win/version.rc.in
${CMAKE_BINARY_DIR}/src/version.rc @ONLY)
endmacro()
macro(configure_openssl)
# Apple has to use static libraries because "Use of the Apple-provided OpenSSL
# libraries by apps is strongly discouraged."
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
if(APPLE OR DEFINED ENV{SYNERGY_STATIC_OPENSSL})
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif()
find_package(OpenSSL REQUIRED)
endmacro()
macro(configure_test_libs)
if(BUILD_TESTS AND NOT EXISTS
"${PROJECT_SOURCE_DIR}/ext/googletest/CMakeLists.txt")
message(FATAL_ERROR "Git submodule for Google Test is missing")
endif()
if(ENABLE_COVERAGE)
include(cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
setup_target_for_coverage_gcovr_xml(
NAME
coverage
EXECUTABLE
unittests
BASE_DIRECTORY
"${PROJECT_SOURCE_DIR}/src"
EXCLUDE
"ext/*")
endif()
include_directories(BEFORE SYSTEM
${PROJECT_SOURCE_DIR}/ext/googletest/googletest/include)
endmacro()
macro(update_submodules)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMODULE_RESULT)
if(NOT GIT_SUBMODULE_RESULT EQUAL "0")
message(
FATAL_ERROR "Git submodule update failed: ${GIT_SUBMODULE_RESULT}")
endif()
endif()
endif()
endmacro()

View File

@ -18,103 +18,168 @@
# If enabled, configure packaging based on OS.
#
macro(configure_packaging)
if (${SYNERGY_BUILD_INSTALLER})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
configure_macos_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
configure_windows_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD|DragonFly")
configure_linux_packaging()
endif()
else()
message (STATUS "Not configuring installer")
if(${SYNERGY_BUILD_INSTALLER})
set(CPACK_PACKAGE_NAME "synergy")
set(CPACK_PACKAGE_CONTACT "Synergy <support@symless.com>")
set(CPACK_PACKAGE_DESCRIPTION "Mouse and keyboard sharing utility")
set(CPACK_PACKAGE_VENDOR "Symless")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
configure_windows_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
configure_macos_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD|DragonFly")
configure_linux_packaging()
endif()
include(CPack)
else()
message(STATUS "Not configuring installer")
endif()
endmacro()
#
# Windows installer
#
macro(configure_windows_packaging)
message(STATUS "Configuring Windows installer")
set(CPACK_PACKAGE_VERSION ${SYNERGY_VERSION_MS})
set(QT_PATH $ENV{CMAKE_PREFIX_PATH})
find_openssl_dir_win32(OPENSSL_PATH)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/res/dist/wix
${CMAKE_BINARY_DIR}/installer)
endmacro()
#
# macOS app bundle
#
macro(configure_macos_packaging)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (CMAKE_INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks")
set (SYNERGY_BUNDLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/res/dist/macos/bundle)
set (SYNERGY_BUNDLE_DIR ${CMAKE_BINARY_DIR}/bundle)
set (SYNERGY_BUNDLE_APP_DIR ${SYNERGY_BUNDLE_DIR}/Synergy.app)
set (SYNERGY_BUNDLE_BINARY_DIR ${SYNERGY_BUNDLE_APP_DIR}/Contents/MacOS)
configure_files (${SYNERGY_BUNDLE_SOURCE_DIR} ${SYNERGY_BUNDLE_DIR})
endif()
endmacro()
function(find_openssl_dir_win32 result)
execute_process(
COMMAND where openssl
OUTPUT_VARIABLE OPENSSL_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Configuring macOS app bundle")
# It's possible that there are multiple OpenSSL installations on the system,
# which is the case on GitHub runners.
# For now we'll pick the first one, but that's probably not very robust.
# Maybe our choco config could install to a specific location?
string(REGEX REPLACE "\r?\n" ";" OPENSSL_PATH_LIST ${OPENSSL_PATH})
message(STATUS "Found OpenSSL binaries at: ${OPENSSL_PATH_LIST}")
set(CPACK_PACKAGE_VERSION ${SYNERGY_VERSION})
list(GET OPENSSL_PATH_LIST 0 OPENSSL_FIRST_PATH)
message(STATUS "First OpenSSL binary: ${OPENSSL_FIRST_PATH}")
set(CMAKE_INSTALL_RPATH
"@loader_path/../Libraries;@loader_path/../Frameworks")
set(SYNERGY_BUNDLE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/res/dist/macos/bundle)
set(SYNERGY_BUNDLE_DIR ${CMAKE_BINARY_DIR}/bundle)
set(SYNERGY_BUNDLE_APP_DIR ${SYNERGY_BUNDLE_DIR}/Synergy.app)
set(SYNERGY_BUNDLE_BINARY_DIR ${SYNERGY_BUNDLE_APP_DIR}/Contents/MacOS)
get_filename_component(OPENSSL_BIN_DIR ${OPENSSL_FIRST_PATH} DIRECTORY)
message(STATUS "OpenSSL bin dir: ${OPENSSL_BIN_DIR}")
get_filename_component(OPENSSL_DIR ${OPENSSL_BIN_DIR} DIRECTORY)
message(STATUS "OpenSSL install root dir: ${OPENSSL_DIR}")
configure_files(${SYNERGY_BUNDLE_SOURCE_DIR} ${SYNERGY_BUNDLE_DIR})
set(${result} ${OPENSSL_DIR} PARENT_SCOPE)
endfunction()
#
# Windows installer
#
macro(configure_windows_packaging)
find_openssl_dir_win32(OPENSSL_PATH)
set(QT_PATH $ENV{CMAKE_PREFIX_PATH})
configure_files (${CMAKE_CURRENT_SOURCE_DIR}/res/dist/wix ${CMAKE_BINARY_DIR}/installer)
endmacro()
#
# Linux packages (including BSD and DragonFly)
#
macro(configure_linux_packaging)
configure_files (${CMAKE_CURRENT_SOURCE_DIR}/res/dist/rpm ${CMAKE_BINARY_DIR}/rpm)
install(FILES res/synergy.svg DESTINATION share/icons/hicolor/scalable/apps)
install(FILES res/synergy.desktop DESTINATION share/applications)
message(STATUS "Configuring Linux packaging")
set(CPACK_PACKAGE_VERSION ${SYNERGY_VERSION_LINUX})
set(CPACK_GENERATOR "DEB;RPM;TGZ;STGZ")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Synergy <developers@symless.com>")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
# The default for CMake seems to be /usr/local, which seems uncommon. While
# the default /usr/local prefix causes the app to appear on Debian and Fedora,
# it doesn't seem to appear on Arch Linux. Setting the prefix to /usr seems to
# work on a wider variety of distros, and that also seems to be where most
# apps install to.
set(CMAKE_INSTALL_PREFIX /usr)
install(FILES res/dist/linux/synergy.desktop DESTINATION share/applications)
install(FILES res/synergy.png DESTINATION share/pixmaps)
# Prepare PKGBUILD for Arch Linux
configure_file(res/dist/arch/PKGBUILD.in ${CMAKE_BINARY_DIR}/PKGBUILD @ONLY)
endmacro()
#
# Same as the `configure_file` command but for directories recursively.
#
macro (configure_files srcDir destDir)
message (STATUS "Configuring directory ${destDir}")
make_directory (${destDir})
macro(configure_files srcDir destDir)
file (GLOB_RECURSE sourceFiles RELATIVE ${srcDir} ${srcDir}/*)
file (GLOB_RECURSE templateFiles LIST_DIRECTORIES false RELATIVE ${srcDir} ${srcDir}/*.in)
list (REMOVE_ITEM sourceFiles ${templateFiles})
message(STATUS "Configuring directory ${destDir}")
make_directory(${destDir})
foreach (sourceFile ${sourceFiles})
set (sourceFilePath ${srcDir}/${sourceFile})
if (IS_DIRECTORY ${sourceFilePath})
message (STATUS "Copying directory ${sourceFile}")
make_directory (${destDir}/${sourceFile})
else()
message (STATUS "Copying file ${sourceFile}")
configure_file (${sourceFilePath} ${destDir}/${sourceFile} COPYONLY)
endif()
endforeach (sourceFile)
file(
GLOB_RECURSE sourceFiles
RELATIVE ${srcDir}
${srcDir}/*)
file(
GLOB_RECURSE templateFiles
LIST_DIRECTORIES false
RELATIVE ${srcDir}
${srcDir}/*.in)
list(REMOVE_ITEM sourceFiles ${templateFiles})
foreach (templateFile ${templateFiles})
set (sourceTemplateFilePath ${srcDir}/${templateFile})
string (REGEX REPLACE "\.in$" "" templateFile ${templateFile})
message (STATUS "Configuring file ${templateFile}")
configure_file (${sourceTemplateFilePath} ${destDir}/${templateFile} @ONLY)
endforeach (templateFile)
endmacro (configure_files)
foreach(sourceFile ${sourceFiles})
set(sourceFilePath ${srcDir}/${sourceFile})
if(IS_DIRECTORY ${sourceFilePath})
message(STATUS "Copying directory ${sourceFile}")
make_directory(${destDir}/${sourceFile})
else()
message(STATUS "Copying file ${sourceFile}")
configure_file(${sourceFilePath} ${destDir}/${sourceFile} COPYONLY)
endif()
endforeach(sourceFile)
foreach(templateFile ${templateFiles})
set(sourceTemplateFilePath ${srcDir}/${templateFile})
string(REGEX REPLACE "\.in$" "" templateFile ${templateFile})
message(STATUS "Configuring file ${templateFile}")
configure_file(${sourceTemplateFilePath} ${destDir}/${templateFile} @ONLY)
endforeach(templateFile)
endmacro(configure_files)
#
# Find the OpenSSL directory on Windows based on the location of the first
# `openssl` binary found.
#
function(find_openssl_dir_win32 result)
execute_process(
COMMAND where openssl
OUTPUT_VARIABLE OPENSSL_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
# It's possible that there are multiple OpenSSL installations on the system,
# which is the case on GitHub runners. For now we'll pick the first one, but
# that's probably not very robust. Maybe our choco config could install to a
# specific location?
string(REGEX REPLACE "\r?\n" ";" OPENSSL_PATH_LIST ${OPENSSL_PATH})
message(STATUS "Found OpenSSL binaries at: ${OPENSSL_PATH_LIST}")
list(GET OPENSSL_PATH_LIST 0 OPENSSL_FIRST_PATH)
message(STATUS "First OpenSSL binary: ${OPENSSL_FIRST_PATH}")
get_filename_component(OPENSSL_BIN_DIR ${OPENSSL_FIRST_PATH} DIRECTORY)
message(STATUS "OpenSSL bin dir: ${OPENSSL_BIN_DIR}")
get_filename_component(OPENSSL_DIR ${OPENSSL_BIN_DIR} DIRECTORY)
message(STATUS "OpenSSL install root dir: ${OPENSSL_DIR}")
set(${result}
${OPENSSL_DIR}
PARENT_SCOPE)
endfunction()

View File

@ -18,41 +18,77 @@
# On Windows, we also set a special 4-digit MSI version number.
macro(set_version)
set (SYNERGY_VERSION $ENV{SYNERGY_VERSION})
set(SYNERGY_VERSION $ENV{SYNERGY_VERSION})
string(STRIP "${SYNERGY_VERSION}" SYNERGY_VERSION)
if(NOT SYNERGY_VERSION)
file(READ "${CMAKE_SOURCE_DIR}/VERSION" SYNERGY_VERSION)
string(STRIP "${SYNERGY_VERSION}" SYNERGY_VERSION)
endif()
if (NOT SYNERGY_VERSION)
file(READ "${CMAKE_SOURCE_DIR}/VERSION" SYNERGY_VERSION)
string(STRIP "${SYNERGY_VERSION}" SYNERGY_VERSION)
endif()
message(STATUS "Version number (semver): " ${SYNERGY_VERSION})
add_definitions(-DSYNERGY_VERSION="${SYNERGY_VERSION}")
message (STATUS "Version number: " ${SYNERGY_VERSION})
add_definitions (-DSYNERGY_VERSION="${SYNERGY_VERSION}")
# Useful for copyright (e.g. in macOS bundle .plist.in and Windows version .rc file)
string(TIMESTAMP SYNERGY_BUILD_YEAR "%Y")
# Useful for copyright (e.g. in macOS bundle .plist.in and Windows version .rc
# file)
string(TIMESTAMP SYNERGY_BUILD_YEAR "%Y")
# MSI requires a 4-digit number and doesn't accept semver.
if (WIN32)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${SYNERGY_VERSION}")
set(VERSION_MAJOR "${CMAKE_MATCH_1}")
set(VERSION_MINOR "${CMAKE_MATCH_2}")
set(VERSION_PATCH "${CMAKE_MATCH_3}")
# Find the revision number, which is the number after the 'r'.
string(REGEX MATCH "r([0-9]+)$" _ "${SYNERGY_VERSION}")
set(VERSION_REVISION "${CMAKE_MATCH_1}")
if (NOT VERSION_REVISION)
set(VERSION_REVISION "0")
endif()
# Dot-separated version number for MSI and Windows version .rc file.
set(SYNERGY_VERSION_MS "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_REVISION}")
message (STATUS "Version number for Microsoft (dots): " ${SYNERGY_VERSION_MS})
# CSV version number for Windows version .rc file.
set(SYNERGY_VERSION_MS_CSV "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}")
message (STATUS "Version number for Microsoft (CSV): " ${SYNERGY_VERSION_MS_CSV})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set_windows_version()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set_linux_version()
endif()
endmacro()
macro(set_four_part_version)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${SYNERGY_VERSION}")
set(VERSION_MAJOR "${CMAKE_MATCH_1}")
set(VERSION_MINOR "${CMAKE_MATCH_2}")
set(VERSION_PATCH "${CMAKE_MATCH_3}")
# Find the revision number, which is the number after the 'r'.
string(REGEX MATCH "r([0-9]+)$" _ "${SYNERGY_VERSION}")
set(VERSION_REVISION "${CMAKE_MATCH_1}")
if(NOT VERSION_REVISION)
set(VERSION_REVISION "0")
endif()
set(SYNERGY_VERSION_FOUR_PART
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_REVISION}")
endmacro()
# MSI requires a 4-digit number and doesn't accept semver.
macro(set_windows_version)
set_four_part_version()
# Dot-separated version number for MSI and Windows version .rc file.
set(SYNERGY_VERSION_MS ${SYNERGY_VERSION_FOUR_PART})
message(STATUS "Version number for (Microsoft 4-part): "
${SYNERGY_VERSION_MS})
# CSV version number for Windows version .rc file.
set(SYNERGY_VERSION_MS_CSV
"${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}")
message(STATUS "Version number for (Microsoft CSV): "
${SYNERGY_VERSION_MS_CSV})
endmacro()
macro(set_linux_version)
# Replace the first occurrence of '-' with '~' for Linux versioning; the '-'
# char is reserved for use at at the end of the version string to indicate a
# package revision. Debian has always used this convention, but support for
# this was also introduced in RPM 4.10.0.
string(REGEX REPLACE "-" "~" SYNERGY_VERSION_LINUX "${SYNERGY_VERSION}")
message(STATUS "Version number (DEB/RPM): ${SYNERGY_VERSION_LINUX}")
# Arch does not support SemVer or DEB/RPM version format, so use the four-part
# version format which funnily enough is what Microsoft requires for MSI.
set_four_part_version()
message(STATUS "Version number (4-part): ${SYNERGY_VERSION_FOUR_PART}")
endmacro()

View File

@ -17,11 +17,11 @@ config:
dependencies:
command: brew bundle --file=Brewfile
# arch, opensuse, etc, patches welcome! :)
linux:
debian: &debian
dependencies:
command: sudo apt-get update; sudo apt-get install -y \
command: sudo apt-get update; \
sudo apt-get install -y \
cmake \
make \
g++ \
@ -29,35 +29,69 @@ config:
libx11-dev \
libxtst-dev \
libssl-dev \
pkg-config \
libglib2.0-dev \
libgdk-pixbuf-2.0-dev \
libnotify-dev \
libxkbfile-dev \
qtbase5-dev \
qttools5-dev \
libgtk-3-dev \
rpm
libgtk-3-dev
ubuntu:
<<: *debian
fedora: &fedora
dependencies:
command: sudo dnf check-update; sudo dnf install -y \
command: sudo dnf check-update; \
sudo dnf install -y \
cmake \
make \
gcc-c++ \
openssl-devel \
libXtst-devel \
glib2-devel \
gdk-pixbuf2-devel \
libXtst-devel \
libnotify-devel \
libxkbfile-devel \
qt5-qtbase-devel \
qt5-qttools-devel \
libxkbfile-devel \
gtk3-devel \
rpm-build
centos:
<<: *fedora
opensuse-tumbleweed: &opensuse-tumbleweed
dependencies:
command: sudo zypper refresh; \
sudo zypper --non-interactive remove busybox-which; \
sudo zypper install -y \
cmake \
make \
gcc-c++ \
openssl-devel \
glib2-devel \
gdk-pixbuf-devel \
libXtst-devel \
libnotify-devel \
libxkbfile-devel \
libqt5-qtbase-devel \
libqt5-qttools-devel \
gtk3-devel \
rpm-build
arch: &arch
dependencies:
command: sudo pacman -Syu --noconfirm \
base-devel \
cmake \
gcc \
openssl \
glib2 \
gdk-pixbuf2 \
libxtst \
libnotify \
libxkbfile \
qt5-base \
qt5-tools \
gtk3
manjaro:
<<: *arch

1
debian/compat vendored
View File

@ -1 +0,0 @@
9

17
debian/control vendored
View File

@ -1,17 +0,0 @@
Source: synergy
Section: utils
Priority: optional
Standards-Version: 3.9.7
Homepage: https://www.symless.com/
Maintainer: Symless <engineering@symless.com>
Package: synergy
Architecture: any
Section: utils
Priority: optional
Depends: ${shlibs:Depends},
${misc:Depends}
Description: Keyboard and mouse sharing solution
Synergy allows you to share one mouse and keyboard between multiple computers.
Work seamlessly across Windows, macOS and Linux.
Homepage: https://symless.com/synergy

5
debian/copyright vendored
View File

@ -1,5 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Synergy
Source: https://www.symless.com/synergy
Disclaimer: This package is not part of the Debian project as it contains closed source proprietary components
Copyright: Copyright (C) 2012-2017 Symless Ltd

5
debian/rules vendored
View File

@ -1,5 +0,0 @@
#!/usr/bin/make -f
%:
dh $@ --buildsystem=cmake --builddirectory=build --parallel

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -1,2 +0,0 @@
file-without-copyright-information
binary-without-manpage

View File

@ -1,234 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.0.1, 2014-02-14T09:50:24. -->
<qtcreator>
<data>
<variable>CodeStyleData</variable>
<valuemap type="QVariantMap">
<value type="bool" key="AlignAssignments">false</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="bool" key="BindStarToIdentifier">true</value>
<value type="bool" key="BindStarToLeftSpecifier">false</value>
<value type="bool" key="BindStarToRightSpecifier">false</value>
<value type="bool" key="BindStarToTypeName">false</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="int" key="IndentSize">4</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
<value type="int" key="PaddingMode">2</value>
<value type="bool" key="SpacesForTabs">false</value>
<value type="int" key="TabSize">4</value>
</valuemap>
</data>
<data>
<variable>DisplayName</variable>
<value type="QString">Synergy</value>
</data>
</qtcreator>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- Mac OSX only: Copy this plist file into [~]/Library/LaunchAgents to start synergy client automatically. Make sure you change the IP below. -->
<dict>
<key>Label</key>
<string>org.symless.com.synergyc.plist</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/synergyc</string>
<!-- Replace this IP with the IP of your synergys server -->
<string>192.168.0.2</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- Mac OSX only: Copy this plist file into [~]/Library/LaunchAgents to start synergy server automatically. Make sure you change configuration file below -->
<dict>
<key>Label</key>
<string>org.symless.com.synergys.plist</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/synergys</string>
<string>--no-daemon</string>
<string>--config</string>
<!-- Replace this path with the path to your synergy configuration -->
<string>/Users/snorp/.synergy.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

View File

@ -1,84 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.11.
.TH SYNERGYC "1" "February 2020" "synergyc 1.11.0-stable, protocol version 1.6" "User Commands"
.SH NAME
synergyc \- manual page for synergyc 1.11.0-stable, protocol version 1.6
.SH SYNOPSIS
.B synergyc
[\fI\,--yscroll <delta>\/\fR] [\fI\,--display <display>\/\fR] [\fI\,--no-xinitthreads\/\fR] [\fI\,--daemon|--no-daemon\/\fR] [\fI\,--name <screen-name>\/\fR] [\fI\,--restart|--no-restart\/\fR] [\fI\,--debug <level>\/\fR] \fI\,<server-address>\/\fR
.SH DESCRIPTION
Connect to a synergy mouse/keyboard sharing server.
.TP
\fB\-d\fR, \fB\-\-debug\fR <level>
filter out log messages with priority below level.
level may be: FATAL, ERROR, WARNING, NOTE, INFO,
DEBUG, DEBUG1, DEBUG2.
.TP
\fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify
this screen in the configuration.
.TP
\fB\-1\fR, \fB\-\-no\-restart\fR
do not try to restart on failure.
.PP
* \fB\-\-restart\fR restart the server automatically if it fails.
.TP
\fB\-l\fR \fB\-\-log\fR <file>
write log messages to file.
.TP
\fB\-\-no\-tray\fR
disable the system tray icon.
.TP
\fB\-\-enable\-drag\-drop\fR
enable file drag & drop.
.TP
\fB\-\-enable\-crypto\fR
enable the crypto (ssl) plugin.
.TP
\fB\-\-display\fR <display>
connect to the X server at <display>
.TP
\fB\-\-no\-xinitthreads\fR
do not call XInitThreads()
.TP
\fB\-f\fR, \fB\-\-no\-daemon\fR
run in the foreground.
.PP
* \fB\-\-daemon\fR run as a daemon.
.TP
\fB\-\-yscroll\fR <delta>
defines the vertical scrolling delta, which is
120 by default.
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit.
.TP
\fB\-\-version\fR
display version information and exit.
.PP
* marks defaults.
.PP
The server address is of the form: [<hostname>][:<port>]. The hostname
must be the address or hostname of the server. The port overrides the
default port, 24800.
.PP
synergyc: a server address or name is required
Try `synergyc \fB\-\-help\fR' for more information.
.SH COPYRIGHT
Copyright \(co 2012\-2019 Symless Ltd.
.br
Copyright \(co 2008\-2014 Nick Bolton
.br
Copyright \(co 2002\-2014 Chris Schoeneman
synergyc: a server address or name is required
Try `synergyc \fB\-\-help\fR' for more information.
.SH "SEE ALSO"
The full documentation for
.B synergyc
is maintained as a Texinfo manual. If the
.B info
and
.B synergyc
programs are properly installed at your site, the command
.IP
.B info synergyc
.PP
should give you access to the complete manual.

View File

@ -1,88 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.11.
.TH SYNERGYS "1" "February 2020" "synergys 1.11.0-stable, protocol version 1.6" "User Commands"
.SH NAME
synergys \- manual page for synergys 1.11.0-stable, protocol version 1.6
.SH SYNOPSIS
.B synergys
[\fI\,--address <address>\/\fR] [\fI\,--config <pathname>\/\fR] [\fI\,--display <display>\/\fR] [\fI\,--no-xinitthreads\/\fR] [\fI\,--daemon|--no-daemon\/\fR] [\fI\,--name <screen-name>\/\fR] [\fI\,--restart|--no-restart\/\fR] [\fI\,--debug <level>\/\fR]
.SH DESCRIPTION
Start the synergy mouse/keyboard sharing server.
.TP
\fB\-a\fR, \fB\-\-address\fR <address>
listen for clients on the given address.
.TP
\fB\-c\fR, \fB\-\-config\fR <pathname>
use the named configuration file instead.
.TP
\fB\-d\fR, \fB\-\-debug\fR <level>
filter out log messages with priority below level.
level may be: FATAL, ERROR, WARNING, NOTE, INFO,
DEBUG, DEBUG1, DEBUG2.
.TP
\fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify
this screen in the configuration.
.TP
\fB\-1\fR, \fB\-\-no\-restart\fR
do not try to restart on failure.
.PP
* \fB\-\-restart\fR restart the server automatically if it fails.
.TP
\fB\-l\fR \fB\-\-log\fR <file>
write log messages to file.
.TP
\fB\-\-no\-tray\fR
disable the system tray icon.
.TP
\fB\-\-enable\-drag\-drop\fR
enable file drag & drop.
.TP
\fB\-\-enable\-crypto\fR
enable the crypto (ssl) plugin.
.TP
\fB\-\-display\fR <display>
connect to the X server at <display>
.TP
\fB\-\-no\-xinitthreads\fR
do not call XInitThreads()
.TP
\fB\-f\fR, \fB\-\-no\-daemon\fR
run in the foreground.
.PP
* \fB\-\-daemon\fR run as a daemon.
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit.
.TP
\fB\-\-version\fR
display version information and exit.
.PP
* marks defaults.
.PP
The argument for \fB\-\-address\fR is of the form: [<hostname>][:<port>]. The
hostname must be the address or hostname of an interface on the system.
The default is to listen on all interfaces. The port overrides the
default port, 24800.
.PP
If no configuration file pathname is provided then the first of the
following to load successfully sets the configuration:
.IP
$HOME/.synergy.conf
\fI\,/etc/synergy.conf\/\fP
.SH COPYRIGHT
Copyright \(co 2012\-2019 Symless Ltd.
.br
Copyright \(co 2008\-2014 Nick Bolton
.br
Copyright \(co 2002\-2014 Chris Schoeneman
.SH "SEE ALSO"
The full documentation for
.B synergys
is maintained as a Texinfo manual. If the
.B info
and
.B synergys
programs are properly installed at your site, the command
.IP
.B info synergys
.PP
should give you access to the complete manual.

View File

@ -1,12 +0,0 @@
Thank you for chosing Synergy!
http://symless.com/
Synergy allows you to share your keyboard and mouse between computers over a network.
For FAQ, setup, and usage instructions, please visit our online Readme:
http://symless.com/pm/projects/synergy/wiki/Readme
Have fun!
Thanks,
The Synergy Team

33
res/dist/arch/PKGBUILD.in vendored Normal file
View File

@ -0,0 +1,33 @@
# Maintainer: Synergy team <developers@symless.com>
pkgname=synergy
pkgver=@SYNERGY_VERSION_FOUR_PART@
pkgrel=1
pkgdesc="Mouse and keyboard sharing utility"
url='https://symless.com/synergy/'
arch=('x86_64')
license=('GPL-2.0-only')
depends=(
'gcc-libs'
'glibc'
'openssl'
'libx11'
'libxi'
'libxkbfile'
'libxext'
'libxtst'
'libxinerama'
'libxkbcommon-x11'
'libnotify'
'hicolor-icon-theme'
'qt5-base'
)
conflicts=('synergy-git' 'synergy1-bin' 'synergy2-bin' 'synergy3-bin')
package() {
# By default, `makepkg` will run from the `src` directory, which would
# only install the binaries, and not the .desktop file, etc. To install
# everything, we need to run `make install` with the root Makefile.
cd $startdir
make install DESTDIR=$pkgdir
}

View File

@ -2,7 +2,7 @@
Type=Application
Version=1.0
Name=Synergy
Comment=Keyboard and mouse sharing solution
Comment=Mouse and keyboard sharing utility
Path=/usr/bin
Exec=/usr/bin/synergy
Icon=synergy

View File

@ -1,32 +0,0 @@
%define _rpmfilename %%{NAME}_%%{Version}-%%{Release}.rpm
Name: synergy-business
Version: @SYNERGY_VERSION@
Summary: Keyboard and mouse sharing solution
Group: Applications/Productivity
URL: https://symless.com/synergy
Source: https://symless.com/synergy/downloads
Vendor: Symless
Packager: Symless <engineering@symless.com>
License: GPLv2
Epoch: 1
Release: @SYNERGY_VERSION@%{?dist}
Requires: openssl
%description
Synergy allows you to share one mouse and keyboard between multiple computers.
Work seamlessly across Windows, macOS and Linux.
%files
%defattr(755,root,root,-)
%{_bindir}/synergy
%{_bindir}/synergyc
%{_bindir}/synergys
%{_bindir}/syntool
%attr(644,-,-) %{_datarootdir}/applications/synergy.desktop
%attr(644,-,-) %{_datarootdir}/icons/hicolor/scalable/apps/synergy.svg
%exclude %{_bindir}/synergy-core
%changelog
* Wed Apr 26 2017 Symless <engineering@symless.com>
- Initial version of the package

View File

@ -1,32 +0,0 @@
%define _rpmfilename %%{NAME}_%%{Version}-%%{Release}.rpm
Name: synergy-enterprise
Version: @SYNERGY_VERSION@
Summary: Keyboard and mouse sharing solution
Group: Applications/Productivity
URL: https://symless.com/synergy
Source: https://symless.com/synergy/downloads
Vendor: Symless
Packager: Symless <engineering@symless.com>
License: GPLv2
Epoch: 1
Release: @SYNERGY_VERSION@%{?dist}
Requires: openssl
%description
Synergy allows you to share one mouse and keyboard between multiple computers.
Work seamlessly across Windows, macOS and Linux.
%files
%defattr(755,root,root,-)
%{_bindir}/synergy
%{_bindir}/synergyc
%{_bindir}/synergys
%{_bindir}/syntool
%attr(644,-,-) %{_datarootdir}/applications/synergy.desktop
%attr(644,-,-) %{_datarootdir}/icons/hicolor/scalable/apps/synergy.svg
%exclude %{_bindir}/synergy-core
%changelog
* Wed Apr 26 2017 Symless <engineering@symless.com>
- Initial version of the package

View File

@ -1,32 +0,0 @@
%define _rpmfilename %%{NAME}_%%{VERSION}-%%{RELEASE}.rpm
Name: synergy
Version: @SYNERGY_VERSION@
Summary: Keyboard and mouse sharing solution
Group: Applications/Productivity
URL: https://symless.com/synergy
Source: https://symless.com/synergy/downloads
Vendor: Symless
Packager: Symless <engineering@symless.com>
License: GPLv2
Epoch: 1
Release: @SYNERGY_VERSION@%{?dist}
Requires: openssl
%description
Synergy allows you to share one mouse and keyboard between multiple computers.
Work seamlessly across Windows, macOS and Linux.
%files
%defattr(755,root,root,-)
%{_bindir}/synergy
%{_bindir}/synergyc
%{_bindir}/synergys
%{_bindir}/syntool
%attr(644,-,-) %{_datarootdir}/applications/synergy.desktop
%attr(644,-,-) %{_datarootdir}/icons/hicolor/scalable/apps/synergy.svg
%exclude %{_bindir}/synergy-core
%changelog
* Wed Apr 26 2017 Symless <engineering@symless.com>
- Initial version of the package

View File

@ -44,10 +44,10 @@
<?endif ?>
</DirectoryRef>
<Property Id="SynergyCommonBackground">common_background</Property>
<Binary Id="common_background" SourceFile="$(var.ResPath)\common_background.png"/>
<Binary Id="common_background" SourceFile="$(var.ResPath)\dist\wix\images\common_background.png"/>
<Icon Id="synergy.ico" SourceFile="$(var.ResPath)/synergy.ico"/>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ResPath)\banner.png"/>
<WixVariable Id="WixUIDialogBmp" Value="$(var.ResPath)\dialog.png"/>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ResPath)\dist\wix\images\banner.png"/>
<WixVariable Id="WixUIDialogBmp" Value="$(var.ResPath)\dist\wix\images\dialog.png"/>
<Property Id="ARPPRODUCTICON" Value="synergy.ico"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
<Property Id="LEGACY_UNINSTALL_EXISTS">

View File

@ -7,7 +7,7 @@
<Fragment>
<UI Id="SynergyWelcome">
<Property Id="SynergyWelcomeBackground">welcome_background</Property>
<Binary Id="welcome_background" SourceFile="$(var.ResPath)\welcome_background.png"/>
<Binary Id="welcome_background" SourceFile="$(var.ResPath)\dist\wix\images\welcome_background.png"/>
<Dialog Id="SynergyWelcome" Width="370" Height="270" Title="!(loc.WelcomeDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

BIN
res/synergy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,11 +0,0 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=Synergy
Comment=Keyboard and mouse sharing solution
Path=/usr/bin
Exec=/usr/bin/synergy2
Icon=synergy
Terminal=false
Categories=Utility;
Keywords=keyboard;mouse;sharing;network;share;

View File

@ -3,7 +3,6 @@
import argparse
import lib.env as env
import lib.github as github
from lib.config import Config
qt_version_key = "QT_VERSION"
@ -20,6 +19,8 @@ def main():
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
from lib.config import Config
if args.set_qt_version:
config = Config()
_qt_mirror, qt_version, _qt_install_dir = config.get_qt_config()

View File

@ -15,11 +15,9 @@ def main():
)
args = parser.parse_args()
# ensures that pip and venv are available for `ensure_module` function.
env.ensure_dependencies()
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
env.ensure_in_venv(__file__, auto_create=True)
env.install_requirements()
error = False
try:
@ -107,7 +105,7 @@ class Dependencies:
def linux(self):
"""Installs dependencies on Linux."""
distro = env.get_linux_distro()
distro, _distro_like, _distro_version = env.get_linux_distro()
if not distro:
raise RuntimeError("Unable to detect Linux distro")
@ -122,9 +120,9 @@ class Dependencies:
print("The 'sudo' command was not found, stripping sudo from command")
command = command.replace("sudo ", "").strip()
# don't check the return code, as some package managers return non-zero exit codes
# under normal circumstances (e.g. dnf returns 100 when there are updates available).
cmd_utils.run(command, check=False, shell=True, print_cmd=True)
# On Fedora, dnf update returns code 100 when updates are available, but the last command
# run should be dnf install, so the return code should always be 0.
cmd_utils.run(command, shell=True, print_cmd=True)
if __name__ == "__main__":

View File

@ -1,5 +1,6 @@
import subprocess
import sys
import lib.env as env
def has_command(command):
@ -34,7 +35,6 @@ def strip_continuation_sequences(command):
return command.replace(cmd_continuation, "")
# TODO: fix bug: often when using this function, only the first arg element is sent to subprocess.run
def run(
command,
check=True, # true by default to fail fast
@ -61,9 +61,11 @@ def run(
print_cmd (bool): Print the command before running it (false by default for security)
"""
is_list_cmd = isinstance(command, list)
# create string version of list command, only for debugging purposes
command_str = command
if isinstance(command, list):
if is_list_cmd:
command_str = " ".join(command)
if print_cmd:
@ -72,6 +74,19 @@ def run(
print("Running command...")
command_str = "***"
# TODO: You can definitely use a list command with shell=True on Windows,
# but can you use a string command with shell=False on Windows?
#
# The `subprocess.run` function has a little gotcha:
# - a string command must be used when `shell=True`
# - a list command must be used when shell isn't or `shell=False`
# however, it allows you to pass a string command when shell isn't used or `shell=False`
# then fails with a vague error message. same problem with list commands and `shell=True`
if not env.is_windows() and is_list_cmd and shell:
raise ValueError("List commands cannot be used when shell=True on Unix systems")
elif not is_list_cmd and not shell:
raise ValueError("String commands cannot be used when shell=False or not set")
# Flush the output to ensure the command is printed before the output of the command,
# which seems to happen in the GitHub runner logs.
sys.stdout.flush()
@ -89,6 +104,7 @@ def run(
)
else:
result = subprocess.run(command, check=check, shell=shell)
except subprocess.CalledProcessError as e:
# Take control of how failed commands are printed:
# - if `print_cmd` is false, it will print `***` instead of the command

View File

@ -1,7 +1,8 @@
import yaml
import lib.env as env
import lib.cmd_utils as cmd_utils
config_file = "config.yml"
config_file = "config.yaml"
root_key = "config"
deps_key = "dependencies"
@ -20,7 +21,7 @@ def _get(dict, key, key_parent=None):
if not value:
key_path = f"{root_key}:{key_parent}:{key}" if key_parent else key
raise ConfigKeyError(f"Missing key in {config_file}: {key_path}")
raise ConfigKeyError(config_file, key_path)
return value
@ -29,18 +30,18 @@ class Config:
"""Reads the project configuration YAML file."""
def __init__(self):
env.ensure_module("yaml", "pyyaml")
import yaml
with open(config_file, "r") as f:
data = yaml.safe_load(f)
self.os_name = env.get_os()
print("Config for OS:", self.os_name)
root = _get(data, root_key)
self.os = _get(root, self.os_name)
def get_os_value(self, key):
return _get(self.os, key, f"{self.os_name}:{key}")
return _get(self.os, key, self.os_name)
def get_qt_config(self):
qt_key = "qt"

View File

@ -2,8 +2,6 @@ import os, sys, subprocess
import lib.cmd_utils as cmd_utils
venv_path = "build/python"
version_file = "VERSION"
version_env_var = "SYNERGY_VERSION"
def check_module(module):
@ -47,22 +45,47 @@ def is_running_in_ci():
def get_linux_distro():
"""Detects the Linux distro."""
os_file = "/etc/os-release"
name = None
name_like = None
version = None
if os.path.isfile(os_file):
with open(os_file) as f:
for line in f:
if line.startswith("ID="):
return line.strip().split("=")[1].strip('"')
return None
name = line.strip().split("=")[1].strip('"')
elif line.startswith("ID_LIKE="):
name_like = line.strip().split("=")[1].strip('"')
elif line.startswith("VERSION_ID="):
version = line.strip().split("=")[1].strip('"')
return name, name_like, version
def get_env_var(name):
"""Returns an env var or raises an error if it is not set."""
def get_env(name, required=True):
"""Returns an env var (stripped) or optionally raises an error if not set."""
value = os.getenv(name)
if not value:
raise ValueError(f"Environment variable not set: {name}")
if value:
value = value.strip()
if required and not value:
raise ValueError(f"Required env var not set: {name}")
return value
def get_env_bool(name, default=False):
"""Returns a boolean value from an env var (stripped)."""
value = os.getenv(name)
if value:
value = value.strip()
if value is None:
return default
return value.lower() in ["true", "1", "yes"]
def get_python_executable(binary="python"):
if sys.platform == "win32":
return os.path.join(venv_path, "Scripts", binary)
@ -75,46 +98,47 @@ def in_venv():
return sys.prefix != sys.base_prefix
def ensure_in_venv(script_file):
def ensure_in_venv(script_file, auto_create=False):
"""
Ensures the script is running in a Python virtual environment (venv).
If the script is not running in a venv, it will create one and re-run the script in the venv.
"""
assert_dependencies()
check_dependencies(raise_error=True)
import venv
if not in_venv():
if not os.path.exists(venv_path):
if not auto_create:
print("Hint: Run the `install_deps.py` script first.")
raise RuntimeError(f"Virtual environment not found at: {venv_path}")
print(f"Creating virtual environment at {venv_path}")
venv.create(venv_path, with_pip=True)
print(f"Using virtual environment for {script_file}", flush=True)
script_file_abs = os.path.abspath(script_file)
print(f"Using virtual environment for: {script_file_abs}", flush=True)
python_executable = get_python_executable()
result = subprocess.run([python_executable, script_file] + sys.argv[1:])
result = subprocess.run([python_executable, script_file_abs] + sys.argv[1:])
sys.exit(result.returncode)
# TODO: Use requirements.txt or pyproject.toml to specify dependencies
def ensure_module(module, package):
def install_requirements():
"""
Ensures that a Python module is available, and installs the package if it is not.
Uses `pip` to install required Python modules from the `requirements.txt` file.
"""
assert_dependencies()
check_dependencies(raise_error=True)
try:
__import__(module)
except ImportError:
print(f"Python missing {module}, installing {package}...", file=sys.stderr)
cmd_utils.run(
[sys.executable, "-m", "pip", "install", package],
shell=False,
print_cmd=True,
)
print("Installing required modules...")
cmd_utils.run(
[sys.executable, "-m", "pip", "install", "-r", "scripts/requirements.txt"],
shell=False,
print_cmd=True,
)
def assert_dependencies(raise_error=True):
def check_dependencies(raise_error=False):
"""
Returns True if pip and venv are available.
"""
@ -137,7 +161,7 @@ def ensure_dependencies():
This is normally only installs on Linux, as Windows and Mac usually come with pip and venv.
"""
if assert_dependencies(raise_error=False):
if check_dependencies():
return
print("Installing Python dependencies...")
@ -150,38 +174,44 @@ def ensure_dependencies():
has_sudo = cmd_utils.has_command("sudo")
sudo = "sudo" if has_sudo else ""
distro = get_linux_distro()
if distro == "ubuntu" or distro == "debian":
cmd_utils.run(
f"{sudo} apt update".strip(), check=False, shell=True, print_cmd=True
)
cmd_utils.run(
f"{sudo} apt install -y python3-pip python3-venv".strip(),
shell=True,
print_cmd=True,
)
elif distro == "fedora" or distro == "centos":
cmd_utils.run(
f"{sudo} dnf check-update".strip(), check=False, shell=True, print_cmd=True
)
cmd_utils.run(
f"{sudo} dnf install -y python3-pip python3-virtualenv".strip(),
shell=True,
print_cmd=True,
)
distro, distro_like, _version = get_linux_distro()
if not distro_like:
distro_like = distro
update_cmd = None
install_cmd = None
if "debian" in distro_like:
update_cmd = "apt update"
install_cmd = "apt install -y python3-pip python3-venv"
elif "fedora" in distro_like:
update_cmd = "dnf check-update"
install_cmd = "dnf install -y python3-pip python3-virtualenv"
elif "arch" in distro_like:
install_cmd = "pacman -Syu --noconfirm python-pip python-virtualenv"
elif "opensuse" in distro_like:
update_cmd = "zypper refresh"
install_cmd = "zypper install -y python3-pip python3-virtualenv"
else:
# arch, opensuse, etc, patches welcome! :)
raise RuntimeError(f"Unable to install Python dependencies on {distro}")
if update_cmd:
# don't check the return code, as some package managers return non-zero exit codes
# under normal circumstances (e.g. dnf check-update returns 100 when there are
# updates available).
cmd_utils.run(
f"{sudo} {update_cmd}".strip(), check=False, shell=True, print_cmd=True
)
cmd_utils.run(f"{sudo} {install_cmd}".strip(), shell=True, print_cmd=True)
def get_app_version():
"""
Returns the version either from the env var, or from the version file.
"""
if version_env_var in os.environ:
version = os.environ[version_env_var].strip()
if version:
return version
version = get_env("SYNERGY_VERSION", required=False)
if version:
return version
with open(version_file, "r") as f:
with open("VERSION", "r") as f:
return f.read().strip()

87
scripts/lib/linux.py Normal file
View File

@ -0,0 +1,87 @@
import os, shutil, glob
import lib.cmd_utils as cmd_utils
import lib.env as env
dist_dir = "dist"
build_dir = "build"
def package(filename_base, build_distro=True, build_tgz=False, build_stgz=False):
extension, cmd = get_package_info(build_distro, build_tgz, build_stgz)
run_package_cmd(cmd)
package_filename = get_package_filename(extension)
target_file = f"{filename_base}.{extension}"
copy_to_dist_dir(package_filename, target_file)
def get_package_info(build_distro, build_tgz, build_stgz):
command = None
cpack_generator = None
file_extension = None
if build_tgz:
cpack_generator = "TGZ"
file_extension = "tar.gz"
elif build_stgz:
cpack_generator = "STGZ"
file_extension = "sh"
elif build_distro:
distro, distro_like, _distro_version = env.get_linux_distro()
if not distro_like:
distro_like = distro
if "debian" in distro_like:
cpack_generator = "DEB"
file_extension = "deb"
elif "fedora" in distro_like or "opensuse" in distro_like:
cpack_generator = "RPM"
file_extension = "rpm"
elif "arch" in distro_like:
command = ["makepkg", "-s"]
file_extension = "pkg.tar.zst"
else:
raise RuntimeError(f"Linux distro not yet supported: {distro_like}")
if not cpack_generator and not command:
raise RuntimeError("No package generator or command found")
if cpack_generator:
command = ["cpack", "-G", cpack_generator]
return file_extension, command
def run_package_cmd(command):
package_user = env.get_env("LINUX_PACKAGE_USER", required=False)
if package_user:
cmd_utils.run(["sudo", "chown", "-R", package_user, "build"], check=True)
command = ["sudo", "-u", package_user] + command
cwd = os.getcwd()
try:
os.chdir("build")
cmd_utils.run(command, check=True, print_cmd=True)
finally:
os.chdir(cwd)
def get_package_filename(extension):
files = glob.glob(f"build/*.{extension}")
if not files:
raise ValueError(f"No .{extension} file found in build directory")
return files[0]
def copy_to_dist_dir(source_file, target_file):
os.makedirs(dist_dir, exist_ok=True)
target_path = f"{dist_dir}/{target_file}"
print(f"Copying to: {target_path}")
shutil.copy(source_file, target_path)

View File

@ -1,3 +1,4 @@
import dmgbuild # type: ignore
import os, time, json
import lib.cmd_utils as cmd_utils
import lib.env as env
@ -39,9 +40,9 @@ def set_cmake_prefix_env_var(cmake_prefix_command):
def package(filename_base):
codesign_id = env.get_env_var("APPLE_CODESIGN_ID")
cert_base64 = env.get_env_var("APPLE_P12_CERTIFICATE")
cert_password = env.get_env_var("APPLE_P12_PASSWORD")
codesign_id = env.get_env("APPLE_CODESIGN_ID")
cert_base64 = env.get_env("APPLE_P12_CERTIFICATE")
cert_password = env.get_env("APPLE_P12_PASSWORD")
build_bundle()
install_certificate(cert_base64, cert_password)
@ -86,9 +87,6 @@ def assert_certificate_installed(codesign_id):
def build_dmg(filename_base):
env.ensure_module("dmgbuild", "dmgbuild")
import dmgbuild # type: ignore
settings_file_abs = os.path.abspath(settings_file)
app_path_abs = os.path.abspath(app_path)
@ -152,9 +150,9 @@ def notarize_package(dmg_path):
print(f"Notarizing package {dmg_path}...")
notary_tool = NotaryTool()
notary_tool.store_credentials(
env.get_env_var("APPLE_NOTARY_USER"),
env.get_env_var("APPLE_NOTARY_PASSWORD"),
env.get_env_var("APPLE_TEAM_ID"),
env.get_env("APPLE_NOTARY_USER"),
env.get_env("APPLE_NOTARY_PASSWORD"),
env.get_env("APPLE_TEAM_ID"),
)
notary_tool.submit_and_wait(dmg_path)

View File

@ -50,8 +50,8 @@ def set_env_var(name, value):
def package(filename_base):
cert_base64 = env.get_env_var("WINDOWS_PFX_CERTIFICATE")
cert_password = env.get_env_var("WINDOWS_PFX_PASSWORD")
cert_base64 = env.get_env("WINDOWS_PFX_CERTIFICATE")
cert_password = env.get_env("WINDOWS_PFX_PASSWORD")
sign_binaries(cert_base64, cert_password)
build_msi(filename_base)
@ -126,8 +126,7 @@ def run_codesign(path, cert_base64, cert_password):
"/fd",
hashing_algorithm,
path,
],
shell=True,
]
)
@ -166,7 +165,6 @@ class WindowsChoco:
value_arg = f'--value="{runner_temp}/choco"'
cmd_utils.run(
["choco", "config", "set", key_arg, value_arg],
shell=True,
print_cmd=True,
)
else:

51
scripts/lint_cmake_files.py Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env python3
import sys, os, argparse, fnmatch
import lib.env as env
include_files = [
"*.cmake",
"CMakeLists.txt",
]
exclude_dirs = [
"ext",
"build",
]
def find_files(base_dir, include_files, exclude_dirs):
"""Recursively find files, excluding specified directories"""
matches = []
for root, dirnames, filenames in os.walk(base_dir):
dirnames[:] = [d for d in dirnames if d not in exclude_dirs]
for pattern in include_files:
for filename in fnmatch.filter(filenames, pattern):
matches.append(os.path.join(root, filename))
return matches
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--format", action="store_true", help="Formats all CMake files")
args = parser.parse_args()
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
from cmakelang.format.__main__ import main as cmake_format_main
new_args = ["--in-place"] if args.format else ["--check"]
files_recursive = find_files(".", include_files, exclude_dirs)
if files_recursive:
sys.argv = [""] + new_args + files_recursive
sys.exit(cmake_format_main())
else:
print("No CMake files found to process.")
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -4,14 +4,13 @@ import platform
import lib.env as env
env_file = ".env"
package_filename_product = "synergy"
package_name = "synergy"
def main():
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
env.ensure_module("dotenv", "python-dotenv")
from dotenv import load_dotenv # type: ignore
load_dotenv(dotenv_path=env_file)
@ -25,15 +24,28 @@ def main():
elif env.is_mac():
mac_package(filename_base)
elif env.is_linux():
linux_package(filename_base)
linux_package(filename_base, version)
else:
raise RuntimeError(f"Unsupported platform: {env.get_os()}")
def get_filename_base(version):
def get_filename_base(version, use_linux_distro=True):
os = env.get_os()
machine = platform.machine().lower()
return f"{package_filename_product}-{os}-{machine}-{version}"
if os == "linux" and use_linux_distro:
distro_name, _distro_like, distro_version = env.get_linux_distro()
if not distro_name:
raise RuntimeError("Failed to detect Linux distro")
if distro_version:
version_for_filename = distro_version.replace(".", "_")
distro = f"{distro_name}-{version_for_filename}"
else:
distro = distro_name
return f"{package_name}-{distro}-{machine}-{version}"
else:
return f"{package_name}-{os}-{machine}-{version}"
def windows_package(filename_base):
@ -48,9 +60,17 @@ def mac_package(filename_base):
mac.package(filename_base)
def linux_package(filename_base):
"""TODO: Linux packaging"""
pass
def linux_package(filename_base, version):
import lib.linux as linux
extra_packages = env.get_env_bool("LINUX_EXTRA_PACKAGES", False)
linux.package(filename_base)
if extra_packages:
filename_base = get_filename_base(version, use_linux_distro=False)
linux.package(filename_base, build_tgz=True)
linux.package(filename_base, build_stgz=True)
if __name__ == "__main__":

4
scripts/requirements.txt Normal file
View File

@ -0,0 +1,4 @@
cmake_format
python-dotenv
pyyaml
dmgbuild; sys_platform == 'darwin'

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2011 Nick Bolton
#
# 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
@ -14,15 +14,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
include_directories (./lib)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/lib)
include_directories(./lib)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/lib)
add_subdirectory(lib)
add_subdirectory(cmd)
if (SYNERGY_BUILD_GUI)
add_subdirectory(gui)
endif (SYNERGY_BUILD_GUI)
if(SYNERGY_BUILD_GUI)
add_subdirectory(gui)
endif(SYNERGY_BUILD_GUI)
if (BUILD_TESTS)
add_subdirectory(test)
if(BUILD_TESTS)
add_subdirectory(test)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2011 Nick Bolton
#
# 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
@ -15,10 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(synergyd)
if (UNIFIED_CORE)
add_subdirectory(synergy-core)
if(UNIFIED_CORE)
add_subdirectory(synergy-core)
else()
add_subdirectory(synergyc)
add_subdirectory(synergys)
endif (UNIFIED_CORE)
add_subdirectory(synergyc)
add_subdirectory(synergys)
endif(UNIFIED_CORE)
add_subdirectory(syntool)

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2022 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -16,24 +16,30 @@
set(target synergy-core)
set(sources
${target}.cpp
)
set(sources ${target}.cpp)
if (WIN32)
list(APPEND sources
${target}.exe.manifest
${CMAKE_BINARY_DIR}/src/version.rc
)
if(WIN32)
list(APPEND sources ${target}.exe.manifest ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
add_executable(${target} ${sources})
target_link_libraries(${target}
arch base client common io mt net ipc platform server synlib ${libs})
target_link_libraries(
${target}
arch
base
client
common
io
mt
net
ipc
platform
server
synlib
${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install (TARGETS ${target} DESTINATION bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${target} DESTINATION bin)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -16,46 +16,56 @@
set(target synergyc)
set(sources
${target}.cpp
)
set(sources ${target}.cpp)
if (WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(APPEND sources
resource.h
${target}.ico
${target}.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
${target}.exe.manifest
${CMAKE_BINARY_DIR}/src/version.rc
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif (UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
if(WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(
APPEND
sources
resource.h
${target}.ico
${target}.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
${target}.exe.manifest
${CMAKE_BINARY_DIR}/src/version.rc)
elseif(APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif(UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
endif()
list(APPEND sources ${arch_sources})
list(APPEND headers ${arch_headers})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_executable(${target} ${sources})
target_link_libraries(${target}
arch base client common io mt net ipc platform server synlib ${libs})
target_link_libraries(
${target}
arch
base
client
common
io
mt
net
ipc
platform
server
synlib
${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install (TARGETS ${target} DESTINATION bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${target} DESTINATION bin)
endif()

View File

@ -1,6 +1,6 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2012 Nick Bolton
# 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
@ -19,16 +19,22 @@ set(target synergyd)
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (WIN32)
add_executable (
${target}
WIN32
${sources}
${CMAKE_BINARY_DIR}/src/version.rc
)
if(WIN32)
add_executable(${target} WIN32 ${sources} ${CMAKE_BINARY_DIR}/src/version.rc)
else()
add_executable (${target} ${sources})
add_executable(${target} ${sources})
endif()
target_link_libraries (${target}
arch base common io ipc mt net platform synlib shared ${libs})
target_link_libraries(
${target}
arch
base
common
io
ipc
mt
net
platform
synlib
shared
${libs})

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -16,47 +16,56 @@
set(target synergys)
set(sources
${target}.cpp
)
set(sources ${target}.cpp)
if (WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(APPEND sources
resource.h
${target}.ico
${target}.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
${target}.exe.manifest
${CMAKE_BINARY_DIR}/src/version.rc
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif (UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
if(WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(
APPEND
sources
resource.h
${target}.ico
${target}.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
${target}.exe.manifest
${CMAKE_BINARY_DIR}/src/version.rc)
elseif(APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif(UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
endif()
list(APPEND sources ${arch_sources})
list(APPEND headers ${arch_headers})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_executable(${target} ${sources})
target_link_libraries(${target}
arch base client common io mt net ipc platform server synlib ${libs})
target_link_libraries(
${target}
arch
base
client
common
io
mt
net
ipc
platform
server
synlib
${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install (TARGETS ${target} DESTINATION bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${target} DESTINATION bin)
endif()

View File

@ -1,10 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2014-2016 Symless Ltd.
#
# 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
@ -18,16 +19,28 @@ set(target syntool)
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
if(WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
add_executable(${target} ${sources})
target_link_libraries(${target}
synlib arch base client common io ipc mt net platform server ${libs})
target_link_libraries(
${target}
synlib
arch
base
client
common
io
ipc
mt
net
platform
server
${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install (TARGETS ${target} DESTINATION bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(TARGETS ${target} DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${target} DESTINATION bin)
endif()

View File

@ -1,108 +1,106 @@
find_package (Qt5 COMPONENTS Core Widgets Network LinguistTools)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
set (CMAKE_AUTOUIC ON)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 COMPONENTS Core Widgets Network LinguistTools)
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*)
file (GLOB ZEROCONF_FILES src/Zeroconf*)
file (GLOB LANGUAGE_FILES res/lang/*.ts)
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*)
file(GLOB ZEROCONF_FILES src/Zeroconf*)
file(GLOB LANGUAGE_FILES res/lang/*.ts)
configure_file(res/Languages.qrc res/Languages.qrc)
set_source_files_properties(${LANGUAGE_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/res/lang")
set_source_files_properties(
${LANGUAGE_FILES} PROPERTIES OUTPUT_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/res/lang")
qt5_add_translation(QM_FILES ${LANGUAGE_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file (GLOB GUI_MAC_SOURCE_FILES src/*.mm)
list (APPEND GUI_SOURCE_FILES ${GUI_MAC_SOURCE_FILES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB GUI_MAC_SOURCE_FILES src/*.mm)
list(APPEND GUI_SOURCE_FILES ${GUI_MAC_SOURCE_FILES})
endif()
# Retrieve the absolute path to qmake and then use that path to find
# the binaries
# 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}")
if (SYNERGY_ENTERPRISE)
list (REMOVE_ITEM GUI_SOURCE_FILES ${ACTIVATION_FILES})
list (REMOVE_ITEM GUI_UI_FILES ${ACTIVATION_FILES})
endif ()
list (REMOVE_ITEM GUI_SOURCE_FILES ${ZEROCONF_FILES})
if (WIN32)
set (GUI_RC_FILES
res/win/Synergy.rc
${CMAKE_BINARY_DIR}/src/version.rc
)
if(SYNERGY_ENTERPRISE)
list(REMOVE_ITEM GUI_SOURCE_FILES ${ACTIVATION_FILES})
list(REMOVE_ITEM GUI_UI_FILES ${ACTIVATION_FILES})
endif()
add_executable (synergy WIN32
${GUI_SOURCE_FILES}
${GUI_UI_FILES}
${GUI_RC_FILES}
res/Synergy.qrc
${CMAKE_CURRENT_BINARY_DIR}/res/Languages.qrc
${QM_FILES}
)
list(REMOVE_ITEM GUI_SOURCE_FILES ${ZEROCONF_FILES})
include_directories (./src)
target_link_libraries (synergy shared)
if(WIN32)
set(GUI_RC_FILES res/win/Synergy.rc ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
add_executable(
synergy WIN32
${GUI_SOURCE_FILES} ${GUI_UI_FILES} ${GUI_RC_FILES} res/Synergy.qrc
${CMAKE_CURRENT_BINARY_DIR}/res/Languages.qrc ${QM_FILES})
include_directories(./src)
target_link_libraries(synergy shared)
target_link_libraries(synergy Qt5::Core Qt5::Widgets Qt5::Network)
target_compile_definitions (synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
target_compile_definitions (synergy PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}")
target_compile_definitions(
synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}")
target_compile_definitions(synergy
PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}")
if (WIN32)
set_target_properties (synergy PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
if(WIN32)
set_target_properties(synergy PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS synergy DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
install (CODE "MESSAGE (\"Running macdeployqt to install frameworks in bundle\")")
install (CODE "execute_process(COMMAND ${MACDEPLOYQT_EXECUTABLE} ${SYNERGY_BUNDLE_APP_DIR} -always-overwrite)")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install (TARGETS synergy DESTINATION bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(TARGETS synergy DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})
install(
CODE "MESSAGE (\"Running macdeployqt to install frameworks in bundle\")")
install(
CODE "execute_process(COMMAND ${MACDEPLOYQT_EXECUTABLE} ${SYNERGY_BUNDLE_APP_DIR} -always-overwrite)"
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS synergy DESTINATION bin)
endif()
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)
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
)
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")
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
if(EXISTS ${imported_location})
add_executable(Qt5::windeployqt IMPORTED)
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>"
)
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()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,33 +17,33 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
# arch
if (WIN32)
file(GLOB arch_headers "win32/*.h")
file(GLOB arch_sources "win32/*.cpp")
elseif (UNIX)
file(GLOB arch_headers "unix/*.h")
file(GLOB arch_sources "unix/*.cpp")
if(WIN32)
file(GLOB arch_headers "win32/*.h")
file(GLOB arch_sources "win32/*.cpp")
elseif(UNIX)
file(GLOB arch_headers "unix/*.h")
file(GLOB arch_sources "unix/*.cpp")
endif()
list(APPEND sources ${arch_sources})
list(APPEND headers ${arch_headers})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(arch STATIC ${sources})
if (UNIX)
target_link_libraries(arch ${CMAKE_DL_LIBS} ${libs})
if(UNIX)
target_link_libraries(arch ${CMAKE_DL_LIBS} ${libs})
if (NOT APPLE)
find_package (Qt5 COMPONENTS DBus)
target_link_libraries (arch Qt5::DBus)
endif()
if(NOT APPLE)
find_package(Qt5 COMPONENTS DBus)
target_link_libraries(arch Qt5::DBus)
endif()
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,12 +17,12 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(base STATIC ${sources})
if (UNIX)
target_link_libraries(base common)
if(UNIX)
target_link_libraries(base common)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,12 +17,12 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(client STATIC ${sources})
if (UNIX)
target_link_libraries(client synlib io)
if(UNIX)
target_link_libraries(client synlib io)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,8 +17,8 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(common STATIC ${sources})

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,8 +17,8 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(io STATIC ${sources})

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,12 +17,20 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(ipc STATIC ${sources})
if (UNIX)
target_link_libraries(ipc arch base common mt io net synlib)
if(UNIX)
target_link_libraries(
ipc
arch
base
common
mt
io
net
synlib)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,8 +17,8 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(mt STATIC ${sources})

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -14,31 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
file(GLOB headers
"*.h"
"InverseSockets/*.h"
)
file(GLOB sources
"*.cpp"
"InverseSockets/*.cpp"
)
file(GLOB headers "*.h" "InverseSockets/*.h")
file(GLOB sources "*.cpp" "InverseSockets/*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(net STATIC ${sources})
target_link_libraries(net
PUBLIC
OpenSSL::SSL
PRIVATE
mt
io
)
target_link_libraries(
net
PUBLIC OpenSSL::SSL
PRIVATE mt io)
if(WIN32)
target_link_libraries(net
PRIVATE
Crypt32
ws2_32
)
target_link_libraries(net PRIVATE Crypt32 ws2_32)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -14,41 +14,46 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if (WIN32)
file(GLOB headers "MSWindows*.h")
file(GLOB sources "MSWindows*.cpp")
elseif (APPLE)
file(GLOB headers "OSX*.h" "IOSX*.h")
file(GLOB sources "OSX*.cpp" "IOSX*.cpp" "OSX*.m" "OSX*.mm")
elseif (UNIX)
file(GLOB headers "XWindows*.h")
file(GLOB sources "XWindows*.cpp")
if(WIN32)
file(GLOB headers "MSWindows*.h")
file(GLOB sources "MSWindows*.cpp")
elseif(APPLE)
file(GLOB headers "OSX*.h" "IOSX*.h")
file(GLOB sources "OSX*.cpp" "IOSX*.cpp" "OSX*.m" "OSX*.mm")
elseif(UNIX)
file(GLOB headers "XWindows*.h")
file(GLOB sources "XWindows*.cpp")
endif()
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
if (APPLE)
list(APPEND inc
/System/Library/Frameworks
)
if(APPLE)
list(APPEND inc /System/Library/Frameworks)
endif()
include_directories(${inc})
add_library(platform STATIC ${sources})
target_link_libraries(platform client ${libs})
if (UNIX)
target_link_libraries(platform io net ipc synlib client ${libs})
if(UNIX)
target_link_libraries(
platform
io
net
ipc
synlib
client
${libs})
if (NOT APPLE)
find_package (Qt5 COMPONENTS DBus)
target_link_libraries (platform Qt5::DBus)
endif()
if(NOT APPLE)
find_package(Qt5 COMPONENTS DBus)
target_link_libraries(platform Qt5::DBus)
endif()
endif()
if (APPLE)
find_library(COCOA_LIBRARY Cocoa)
target_link_libraries(platform ${COCOA_LIBRARY})
if(APPLE)
find_library(COCOA_LIBRARY Cocoa)
target_link_libraries(platform ${COCOA_LIBRARY})
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -17,14 +17,14 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(server STATIC ${sources})
target_link_libraries(server shared)
if (UNIX)
target_link_libraries(server synlib)
if(UNIX)
target_link_libraries(server synlib)
endif()

View File

@ -1,10 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2016 Symless Ltd.
#
# 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
@ -16,11 +17,10 @@
file(GLOB headers "*.h")
file(GLOB sources "*.cpp")
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(shared STATIC ${sources})
target_link_libraries(shared arch base)

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -18,46 +18,56 @@ file(GLOB headers "*.h" "languages/*.h")
file(GLOB sources "*.cpp" "languages/*.cpp")
# arch
if (WIN32)
file(GLOB arch_headers "win32/*.h")
file(GLOB arch_sources "win32/*.cpp")
include_directories("../../../ext/WinToast/src")
list(APPEND arch_sources "../../../ext/WinToast/src/wintoastlib.cpp")
elseif (UNIX)
file(GLOB arch_headers "unix/*.h")
file(GLOB arch_sources "unix/*.cpp")
if(WIN32)
file(GLOB arch_headers "win32/*.h")
file(GLOB arch_sources "win32/*.cpp")
include_directories("../../../ext/WinToast/src")
list(APPEND arch_sources "../../../ext/WinToast/src/wintoastlib.cpp")
elseif(UNIX)
file(GLOB arch_headers "unix/*.h")
file(GLOB arch_sources "unix/*.cpp")
endif()
option(SYSTEM_PUGIXML "Use system pugixml instead of vendored one" OFF)
if (SYSTEM_PUGIXML)
find_package(pugixml REQUIRED)
if(SYSTEM_PUGIXML)
find_package(pugixml REQUIRED)
else()
include_directories("../../../ext/pugixml/src")
list(APPEND arch_sources "../../../ext/pugixml/src/pugixml.cpp")
include_directories("../../../ext/pugixml/src")
list(APPEND arch_sources "../../../ext/pugixml/src/pugixml.cpp")
endif()
list(APPEND sources ${arch_sources})
list(APPEND headers ${arch_headers})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(synlib STATIC ${sources})
if (UNIX)
target_link_libraries(synlib arch client ipc net base platform mt server)
if (NOT APPLE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0)
pkg_search_module( PC_GDKPIXBUF gdk-pixbuf-2.0 )
include_directories(${PC_GDKPIXBUF_INCLUDE_DIRS})
pkg_check_modules(lib_gdkpixbuf REQUIRED IMPORTED_TARGET gdk-pixbuf-2.0 )
pkg_check_modules(lib_notify REQUIRED IMPORTED_TARGET libnotify)
target_link_libraries(synlib PkgConfig::lib_glib PkgConfig::lib_gdkpixbuf PkgConfig::lib_notify)
endif()
if(UNIX)
target_link_libraries(
synlib
arch
client
ipc
net
base
platform
mt
server)
if(NOT APPLE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0)
pkg_search_module(PC_GDKPIXBUF gdk-pixbuf-2.0)
include_directories(${PC_GDKPIXBUF_INCLUDE_DIRS})
pkg_check_modules(lib_gdkpixbuf REQUIRED IMPORTED_TARGET gdk-pixbuf-2.0)
pkg_check_modules(lib_notify REQUIRED IMPORTED_TARGET libnotify)
target_link_libraries(synlib PkgConfig::lib_glib PkgConfig::lib_gdkpixbuf
PkgConfig::lib_notify)
endif()
endif()
if (SYSTEM_PUGIXML)
target_link_libraries(synlib pugixml)
if(SYSTEM_PUGIXML)
target_link_libraries(synlib pugixml)
endif()

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2011 Nick Bolton
#
# 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
@ -15,18 +15,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
include_directories(
../../ext/googletest/googletest
../../ext/googletest/googletest/include
../../ext/googletest/googlemock
../../ext/googletest/googlemock/include)
../../ext/googletest/googletest ../../ext/googletest/googletest/include
../../ext/googletest/googlemock ../../ext/googletest/googlemock/include)
add_library(gtest STATIC ../../ext/googletest/googletest/src/gtest-all.cc)
add_library(gmock STATIC ../../ext/googletest/googlemock/src/gmock-all.cc)
if (UNIX)
# ignore warnings in gtest and gmock
set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w")
set_target_properties(gmock PROPERTIES COMPILE_FLAGS "-w")
if(UNIX)
# ignore warnings in gtest and gmock
set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w")
set_target_properties(gmock PROPERTIES COMPILE_FLAGS "-w")
endif()
add_subdirectory(integtests)

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -23,15 +23,15 @@ list(REMOVE_ITEM headers ${remove_platform})
list(REMOVE_ITEM sources ${remove_platform})
# platform
if (WIN32)
file(GLOB platform_sources "platform/MSWindows*.cpp")
file(GLOB platform_headers "platform/MSWindows*.h")
elseif (APPLE)
file(GLOB platform_sources "platform/OSX*.cpp")
file(GLOB platform_headers "platform/OSX*.h")
elseif (UNIX)
file(GLOB platform_sources "platform/XWindows*.cpp")
file(GLOB platform_headers "platform/XWindows*.h")
if(WIN32)
file(GLOB platform_sources "platform/MSWindows*.cpp")
file(GLOB platform_headers "platform/MSWindows*.h")
elseif(APPLE)
file(GLOB platform_sources "platform/OSX*.cpp")
file(GLOB platform_headers "platform/OSX*.h")
elseif(UNIX)
file(GLOB platform_sources "platform/XWindows*.cpp")
file(GLOB platform_headers "platform/XWindows*.h")
endif()
list(APPEND sources ${platform_sources})
@ -49,21 +49,32 @@ file(GLOB_RECURSE mock_sources "../../test/mock/*.cpp")
list(APPEND headers ${mock_headers})
list(APPEND sources ${mock_sources})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
if (WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
if(WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
include_directories(
../../
../../lib/
../../../ext/googletest/googletest/include
../../../ext/googletest/googlemock/include
)
../../ ../../lib/ ../../../ext/googletest/googletest/include
../../../ext/googletest/googlemock/include)
add_executable(integtests ${sources})
target_link_libraries(integtests
arch base client common io ipc mt net platform server synlib gtest gmock ${libs})
target_link_libraries(
integtests
arch
base
client
common
io
ipc
mt
net
platform
server
synlib
gtest
gmock
${libs})

View File

@ -1,11 +1,11 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
#
# 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
@ -36,36 +36,47 @@ list(APPEND headers ${mock_headers})
list(APPEND sources ${mock_sources})
# platform
if (WIN32)
file(GLOB platform_sources "platform/MSWindows*.cpp")
file(GLOB platform_headers "platform/MSWindows*.h")
elseif (APPLE)
file(GLOB platform_sources "platform/OSX*.cpp")
file(GLOB platform_headers "platform/OSX*.h")
elseif (UNIX)
file(GLOB platform_sources "platform/XWindows*.cpp")
file(GLOB platform_headers "platform/XWindows*.h")
if(WIN32)
file(GLOB platform_sources "platform/MSWindows*.cpp")
file(GLOB platform_headers "platform/MSWindows*.h")
elseif(APPLE)
file(GLOB platform_sources "platform/OSX*.cpp")
file(GLOB platform_headers "platform/OSX*.h")
elseif(UNIX)
file(GLOB platform_sources "platform/XWindows*.cpp")
file(GLOB platform_headers "platform/XWindows*.h")
endif()
list(APPEND sources ${platform_sources})
list(APPEND headers ${platform_headers})
include_directories(
../../
../../lib/
../../../ext/gtest/include
../../../ext/gmock/include
../../../ext
)
include_directories(../../ ../../lib/ ../../../ext/gtest/include
../../../ext/gmock/include ../../../ext)
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
if(SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
if (WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
if(WIN32)
list(APPEND sources ${CMAKE_BINARY_DIR}/src/version.rc)
endif()
add_executable(${target} ${sources})
target_link_libraries(${target}
arch base client server common io net platform server synlib mt ipc gtest gmock shared ${libs})
target_link_libraries(
${target}
arch
base
client
server
common
io
net
platform
server
synlib
mt
ipc
gtest
gmock
shared
${libs})