2018-01-27 21:48:17 +00:00
|
|
|
# Barrier -- mouse and keyboard sharing utility
|
|
|
|
# Copyright (C) 2018 Debauchee Open Source Group
|
2016-09-07 14:24:00 +00:00
|
|
|
# Copyright (C) 2012-2016 Symless Ltd.
|
2012-09-04 02:09:56 +00:00
|
|
|
# Copyright (C) 2009 Nick Bolton
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
2012-06-10 16:50:54 +00:00
|
|
|
# This package is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
# found in the file LICENSE that should have accompanied this file.
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
2012-06-10 16:50:54 +00:00
|
|
|
# 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/>.
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
cmake_minimum_required (VERSION 3.4)
|
2018-01-27 21:48:17 +00:00
|
|
|
project (barrier C CXX)
|
2017-03-08 15:33:35 +00:00
|
|
|
|
2018-03-11 16:48:59 +00:00
|
|
|
option (BARRIER_BUILD_GUI "Build the GUI" ON)
|
|
|
|
option (BARRIER_BUILD_INSTALLER "Build the installer" ON)
|
2020-08-21 21:22:48 +00:00
|
|
|
option (BARRIER_BUILD_TESTS "Build the tests" ON)
|
2020-08-21 22:13:58 +00:00
|
|
|
option (BARRIER_USE_EXTERNAL_GTEST "Use external installation of Google Test framework" OFF)
|
2017-02-10 12:37:20 +00:00
|
|
|
|
2019-07-25 12:46:00 +00:00
|
|
|
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2017-04-25 12:40:31 +00:00
|
|
|
set (CMAKE_CXX_STANDARD 14)
|
|
|
|
set (CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
2017-03-08 15:33:35 +00:00
|
|
|
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
|
2017-04-27 16:01:54 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_definitions (-DNDEBUG)
|
|
|
|
endif()
|
|
|
|
|
2017-05-27 13:01:49 +00:00
|
|
|
include (cmake/Version.cmake)
|
2018-03-19 17:16:06 +00:00
|
|
|
include (cmake/Package.cmake)
|
2017-05-21 22:29:25 +00:00
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
# TODO: Find out why we need these, and remove them
|
2012-06-10 16:50:54 +00:00
|
|
|
if (COMMAND cmake_policy)
|
2017-04-27 14:40:23 +00:00
|
|
|
cmake_policy (SET CMP0003 NEW)
|
2017-03-08 15:33:35 +00:00
|
|
|
cmake_policy (SET CMP0005 NEW)
|
2012-06-10 16:50:54 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
# Add headers to source list
|
2014-02-26 17:46:02 +00:00
|
|
|
if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
2018-01-27 21:48:17 +00:00
|
|
|
set (BARRIER_ADD_HEADERS FALSE)
|
2014-02-26 17:46:02 +00:00
|
|
|
else()
|
2018-01-27 21:48:17 +00:00
|
|
|
set (BARRIER_ADD_HEADERS TRUE)
|
2014-02-26 17:46:02 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
set (libs)
|
2016-11-16 16:55:20 +00:00
|
|
|
|
|
|
|
if (UNIX)
|
2017-03-08 15:33:35 +00:00
|
|
|
if (NOT APPLE)
|
2019-08-23 19:40:36 +00:00
|
|
|
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
2017-03-08 15:33:35 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# For config.h, detect the libraries, functions, etc.
|
|
|
|
include (CheckIncludeFiles)
|
|
|
|
include (CheckLibraryExists)
|
|
|
|
include (CheckFunctionExists)
|
|
|
|
include (CheckTypeSize)
|
|
|
|
include (CheckIncludeFileCXX)
|
|
|
|
include (CheckSymbolExists)
|
|
|
|
include (CheckCSourceCompiles)
|
2018-07-03 03:21:08 +00:00
|
|
|
include (FindPkgConfig)
|
2017-03-08 15:33:35 +00:00
|
|
|
|
|
|
|
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
|
2020-03-10 21:10:48 +00:00
|
|
|
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
set (THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
find_package (Threads REQUIRED)
|
|
|
|
list (APPEND libs Threads::Threads)
|
2017-03-08 15:33:35 +00:00
|
|
|
|
|
|
|
# curl is used on both Linux and Mac
|
|
|
|
find_package (CURL)
|
|
|
|
if (CURL_FOUND)
|
2018-08-02 12:39:59 +00:00
|
|
|
include_directories(${CURL_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${CURL_LIBRARIES})
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
else()
|
|
|
|
message (FATAL_ERROR "Missing library: curl")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set (CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
|
|
|
|
|
|
|
|
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}
|
|
|
|
)
|
|
|
|
|
|
|
|
else() # not-apple
|
2018-03-02 23:36:31 +00:00
|
|
|
# FreeBSD uses /usr/local for anything not part of base
|
|
|
|
# Also package avahi-libdns puts dns_sd.h a bit deeper
|
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/local/include;/usr/local/include/avahi-compat-libdns_sd")
|
|
|
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib")
|
|
|
|
include_directories("/usr/local/include" "/usr/local/include/avahi-compat-libdns_sd")
|
|
|
|
link_directories("/usr/local/lib")
|
|
|
|
endif()
|
2018-07-03 20:55:57 +00:00
|
|
|
|
2020-10-29 05:21:30 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/X11R6/include;/usr/local/include;/usr/local/include/avahi-compat-libdns_sd")
|
2019-10-16 23:35:30 +00:00
|
|
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib -L/usr/X11R6/lib")
|
2020-10-29 05:21:30 +00:00
|
|
|
include_directories("/usr/local/include" "/usr/X11R6/include" "/usr/local/include/avahi-compat-libdns_sd")
|
2019-10-16 23:35:30 +00:00
|
|
|
link_directories("/usr/local/lib")
|
|
|
|
link_directories("/usr/X11R6/lib")
|
|
|
|
endif()
|
|
|
|
|
2019-10-18 22:28:13 +00:00
|
|
|
if (BARRIER_BUILD_GUI AND ${PKG_CONFIG_FOUND})
|
2018-07-03 20:55:57 +00:00
|
|
|
pkg_check_modules (AVAHI_COMPAT REQUIRED avahi-compat-libdns_sd)
|
|
|
|
include_directories (BEFORE SYSTEM ${AVAHI_COMPAT_INCLUDE_DIRS})
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${AVAHI_COMPAT_INCLUDE_DIRS}")
|
|
|
|
endif ()
|
2017-03-08 15:33:35 +00:00
|
|
|
|
|
|
|
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)
|
2018-03-02 23:36:31 +00:00
|
|
|
check_include_files ("dns_sd.h" HAVE_DNSSD)
|
2017-03-08 15:33:35 +00:00
|
|
|
|
2020-12-09 04:29:33 +00:00
|
|
|
if (NOT HAVE_X11_EXTENSIONS_XTEST_H)
|
|
|
|
message (FATAL_ERROR "Missing header: X11/extensions/XTest.h")
|
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
if (NOT HAVE_X11_XKBLIB_H)
|
|
|
|
message (FATAL_ERROR "Missing header: " ${XKBlib})
|
|
|
|
endif()
|
|
|
|
|
2018-06-30 17:26:18 +00:00
|
|
|
if (BARRIER_BUILD_GUI AND NOT HAVE_DNSSD)
|
2018-03-02 23:36:31 +00:00
|
|
|
message (FATAL_ERROR "Missing header: dns_sd.h")
|
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
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 (HAVE_Xtst)
|
|
|
|
|
|
|
|
# Xtxt depends on X11.
|
2018-03-04 19:48:15 +00:00
|
|
|
set (HAVE_X11 1)
|
2017-03-08 15:33:35 +00:00
|
|
|
list (APPEND libs Xtst X11)
|
|
|
|
|
|
|
|
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 (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 (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
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 (
|
2020-12-10 00:10:36 +00:00
|
|
|
/DSYSAPI_WIN32=1
|
|
|
|
/DWINAPI_MSWINDOWS=1
|
2017-03-08 15:33:35 +00:00
|
|
|
/DWIN32
|
|
|
|
/D_WINDOWS
|
|
|
|
/D_CRT_SECURE_NO_WARNINGS
|
2018-01-27 21:48:17 +00:00
|
|
|
/DBARRIER_VERSION=\"${BARRIER_VERSION}\"
|
2017-03-08 15:33:35 +00:00
|
|
|
/D_XKEYCHECK_H
|
|
|
|
)
|
2016-11-16 16:55:20 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
|
|
|
# OpenSSL
|
|
|
|
#
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
set (OPENSSL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/ext/openssl/windows)
|
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set (OPENSSL_ROOT "${OPENSSL_ROOT}/x64")
|
|
|
|
else()
|
|
|
|
set (OPENSSL_ROOT "${OPENSSL_ROOT}/x86")
|
|
|
|
endif()
|
|
|
|
|
2017-03-09 14:32:41 +00:00
|
|
|
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
|
2017-03-08 15:33:35 +00:00
|
|
|
set (OPENSSL_LIBS
|
|
|
|
${OPENSSL_ROOT}/lib/libeay32.lib
|
|
|
|
${OPENSSL_ROOT}/lib/ssleay32.lib
|
|
|
|
)
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2021-05-13 15:41:29 +00:00
|
|
|
find_program(APT_PROGRAM "apt")
|
2018-12-29 02:05:20 +00:00
|
|
|
find_program(BREW_PROGRAM "brew")
|
2019-01-03 00:41:43 +00:00
|
|
|
find_program(PORT_PROGRAM "port")
|
2020-10-30 02:00:07 +00:00
|
|
|
|
2021-05-13 15:41:29 +00:00
|
|
|
if (IS_DIRECTORY /opt/procursus AND APT_PROGRAM)
|
|
|
|
# procursus/apt
|
|
|
|
set (OPENSSL_ROOT /opt/procursus)
|
|
|
|
|
|
|
|
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
|
|
|
|
|
|
|
|
set (OPENSSL_LIBS
|
|
|
|
${OPENSSL_ROOT}/lib/libssl.a
|
|
|
|
${OPENSSL_ROOT}/lib/libcrypto.a
|
|
|
|
)
|
|
|
|
elseif (IS_DIRECTORY /opt/local AND PORT_PROGRAM)
|
2018-07-02 17:50:28 +00:00
|
|
|
# macports
|
|
|
|
set (OPENSSL_ROOT /opt/local)
|
2018-07-01 12:14:55 +00:00
|
|
|
|
|
|
|
set (OPENSSL_LIBS
|
|
|
|
${OPENSSL_ROOT}/lib/libssl.a
|
|
|
|
${OPENSSL_ROOT}/lib/libcrypto.a
|
2018-07-02 17:50:28 +00:00
|
|
|
z
|
2018-07-01 12:14:55 +00:00
|
|
|
)
|
2018-12-29 02:05:20 +00:00
|
|
|
elseif (IS_DIRECTORY /usr/local/opt/openssl AND BREW_PROGRAM)
|
2018-07-02 17:50:28 +00:00
|
|
|
# brew
|
|
|
|
set (OPENSSL_ROOT /usr/local/opt/openssl)
|
|
|
|
|
|
|
|
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
|
2018-07-01 12:14:55 +00:00
|
|
|
|
2021-05-13 15:41:29 +00:00
|
|
|
set (OPENSSL_LIBS
|
|
|
|
${OPENSSL_ROOT}/lib/libssl.a
|
|
|
|
${OPENSSL_ROOT}/lib/libcrypto.a
|
|
|
|
)
|
|
|
|
elseif (IS_DIRECTORY /opt/homebrew/opt/openssl AND BREW_PROGRAM)
|
|
|
|
# brew
|
|
|
|
set (OPENSSL_ROOT /opt/homebrew/opt/openssl)
|
|
|
|
|
|
|
|
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
|
|
|
|
|
2018-07-01 12:14:55 +00:00
|
|
|
set (OPENSSL_LIBS
|
|
|
|
${OPENSSL_ROOT}/lib/libssl.a
|
|
|
|
${OPENSSL_ROOT}/lib/libcrypto.a
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set (OPENSSL_LIBS ssl crypto)
|
|
|
|
else()
|
2018-03-02 23:36:31 +00:00
|
|
|
find_library (lib_ssl ssl)
|
|
|
|
find_library (lib_crypto crypto)
|
|
|
|
if (NOT lib_ssl)
|
|
|
|
message(FATAL_ERROR "openssl library not found")
|
|
|
|
elseif (NOT lib_crypto)
|
|
|
|
message(FATAL_ERROR "crypto library not found")
|
|
|
|
endif()
|
|
|
|
set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto})
|
2012-06-10 16:50:54 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
|
|
|
# Configure_file... but for directories, recursively.
|
|
|
|
#
|
|
|
|
macro (configure_files srcDir destDir)
|
|
|
|
message (STATUS "Configuring directory ${destDir}")
|
|
|
|
make_directory (${destDir})
|
|
|
|
|
|
|
|
file (GLOB_RECURSE sourceFiles RELATIVE ${srcDir} ${srcDir}/*)
|
|
|
|
file (GLOB_RECURSE templateFiles LIST_DIRECTORIES false RELATIVE ${srcDir} ${srcDir}/*.in)
|
|
|
|
list (REMOVE_ITEM sourceFiles ${templateFiles})
|
|
|
|
|
|
|
|
foreach (sourceFile ${sourceFiles})
|
|
|
|
set (sourceFilePath ${srcDir}/${sourceFile})
|
|
|
|
if (IS_DIRECTORY ${sourceFilePath})
|
|
|
|
message (STATUS "Copying directory ${sourceFile}")
|
2020-10-17 06:43:11 +00:00
|
|
|
make_directory (${destDir}/${sourceFile})
|
2017-03-08 15:33:35 +00:00
|
|
|
else()
|
|
|
|
message (STATUS "Copying file ${sourceFile}")
|
|
|
|
configure_file (${sourceFilePath} ${destDir}/${sourceFile} COPYONLY)
|
|
|
|
endif()
|
|
|
|
endforeach (sourceFile)
|
|
|
|
|
|
|
|
foreach (templateFile ${templateFiles})
|
|
|
|
set (sourceTemplateFilePath ${srcDir}/${templateFile})
|
2017-02-10 14:45:56 +00:00
|
|
|
string (REGEX REPLACE "\.in$" "" templateFile ${templateFile})
|
2017-03-08 15:33:35 +00:00
|
|
|
message (STATUS "Configuring file ${templateFile}")
|
|
|
|
configure_file (${sourceTemplateFilePath} ${destDir}/${templateFile} @ONLY)
|
|
|
|
endforeach (templateFile)
|
2017-02-10 14:45:56 +00:00
|
|
|
endmacro (configure_files)
|
|
|
|
|
2018-03-11 16:48:59 +00:00
|
|
|
if (${BARRIER_BUILD_INSTALLER})
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
|
|
|
# macOS app Bundle
|
|
|
|
#
|
2017-02-10 14:45:56 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2017-03-08 15:33:35 +00:00
|
|
|
set (CMAKE_INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks")
|
2018-01-27 21:48:17 +00:00
|
|
|
set (BARRIER_BUNDLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dist/macos/bundle)
|
|
|
|
set (BARRIER_BUNDLE_DIR ${CMAKE_BINARY_DIR}/bundle)
|
|
|
|
set (BARRIER_BUNDLE_APP_DIR ${BARRIER_BUNDLE_DIR}/Barrier.app)
|
|
|
|
set (BARRIER_BUNDLE_BINARY_DIR ${BARRIER_BUNDLE_APP_DIR}/Contents/MacOS)
|
2017-03-08 15:33:35 +00:00
|
|
|
|
2018-01-27 21:48:17 +00:00
|
|
|
configure_files (${BARRIER_BUNDLE_SOURCE_DIR} ${BARRIER_BUNDLE_DIR})
|
2018-10-19 17:17:04 +00:00
|
|
|
|
2020-05-04 16:37:18 +00:00
|
|
|
add_custom_target(Barrier_MacOS ALL
|
2020-05-02 19:33:09 +00:00
|
|
|
bash build_dist.sh
|
|
|
|
DEPENDS barrier barriers barrierc
|
|
|
|
WORKING_DIRECTORY ${BARRIER_BUNDLE_DIR})
|
2012-06-10 16:50:54 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
#
|
|
|
|
# Windows installer
|
|
|
|
#
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
2019-04-12 14:29:27 +00:00
|
|
|
set (BARRIER_WIX_VERSION "${BARRIER_VERSION_MAJOR}.${BARRIER_VERSION_MINOR}.${BARRIER_VERSION_PATCH}")
|
2018-03-01 15:57:13 +00:00
|
|
|
message (STATUS "Configuring the wix installer")
|
|
|
|
configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/wix ${CMAKE_BINARY_DIR}/installer-wix)
|
|
|
|
message (STATUS "Configuring the inno installer")
|
|
|
|
configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/inno ${CMAKE_BINARY_DIR}/installer-inno)
|
2017-03-13 12:21:02 +00:00
|
|
|
endif()
|
|
|
|
|
2017-04-27 13:03:20 +00:00
|
|
|
#
|
|
|
|
# Linux installation
|
|
|
|
#
|
2017-03-17 14:07:36 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2017-04-27 11:26:01 +00:00
|
|
|
configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/rpm ${CMAKE_BINARY_DIR}/rpm)
|
2018-01-27 21:48:17 +00:00
|
|
|
install(FILES res/barrier.svg DESTINATION share/icons/hicolor/scalable/apps)
|
2020-10-30 02:00:07 +00:00
|
|
|
if("${VERSION_MAJOR}" STREQUAL "2")
|
2018-01-27 21:48:17 +00:00
|
|
|
install(FILES res/barrier2.desktop DESTINATION share/applications)
|
2017-04-25 14:47:17 +00:00
|
|
|
else()
|
2018-01-27 21:48:17 +00:00
|
|
|
install(FILES res/barrier.desktop DESTINATION share/applications)
|
2017-04-25 14:53:54 +00:00
|
|
|
endif()
|
2017-03-17 14:07:36 +00:00
|
|
|
endif()
|
|
|
|
|
2017-05-04 20:00:49 +00:00
|
|
|
else()
|
2018-03-11 16:48:59 +00:00
|
|
|
message (STATUS "NOT configuring the installer")
|
2017-05-04 20:00:49 +00:00
|
|
|
endif()
|
2021-01-07 21:43:54 +00:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2017-03-08 15:33:35 +00:00
|
|
|
add_subdirectory (src)
|