2014-09-30 00:08:08 +04:00
|
|
|
# RdTk: Remote Desktop Toolkit
|
|
|
|
# rdtk cmake build script
|
|
|
|
#
|
|
|
|
# Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
# Soname versioning
|
|
|
|
set(RDTK_VERSION_MAJOR "0")
|
|
|
|
set(RDTK_VERSION_MINOR "2")
|
|
|
|
set(RDTK_VERSION_REVISION "0")
|
|
|
|
set(RDTK_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}.${RDTK_VERSION_REVISION}")
|
|
|
|
set(RDTK_VERSION_FULL "${RDTK_VERSION}")
|
|
|
|
set(RDTK_API_VERSION "${RDTK_VERSION_MAJOR}")
|
2014-09-30 00:08:08 +04:00
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
if (NOT FREERDP_UNIFIED_BUILD)
|
2022-05-25 14:44:30 +03:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
2021-06-10 10:54:35 +03:00
|
|
|
project(RdTk VERSION ${RDTK_VERSION} LANGUAGES C)
|
2014-09-30 00:08:08 +04:00
|
|
|
|
2022-05-25 16:14:36 +03:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2022-02-24 14:19:10 +03:00
|
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_C_EXTENSIONS ON)
|
|
|
|
|
2022-05-25 14:44:30 +03:00
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported(RESULT supported OUTPUT error)
|
|
|
|
if (supported)
|
|
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
2022-02-10 11:53:02 +03:00
|
|
|
set(WINPR_VERSION_MAJOR 3)
|
2021-06-10 10:54:35 +03:00
|
|
|
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
|
|
|
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
|
|
|
|
option(BUILD_TESTING "Build library unit tests" ON)
|
|
|
|
option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
|
|
|
|
|
|
|
|
# Default to release build type
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
if(NOT EXPORT_ALL_SYMBOLS)
|
|
|
|
message(STATUS "GCC default symbol visibility: hidden")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
|
|
|
endif()
|
|
|
|
endif()
|
2022-02-10 11:53:02 +03:00
|
|
|
else()
|
|
|
|
set(WINPR_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
|
2021-06-10 10:54:35 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Include our extra modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/)
|
2014-09-30 00:08:08 +04:00
|
|
|
|
|
|
|
# Include cmake modules
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckStructHasMember)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
include(TestBigEndian)
|
|
|
|
|
|
|
|
# Check for cmake compatibility (enable/disable features)
|
|
|
|
include(CheckCmakeCompat)
|
|
|
|
include(FindFeature)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(GNUInstallDirsWrapper)
|
|
|
|
include(CMakePackageConfigHelpers)
|
2021-06-10 10:54:35 +03:00
|
|
|
include (SetFreeRDPCMakeInstallDir)
|
2014-09-30 00:08:08 +04:00
|
|
|
|
2022-02-28 18:26:57 +03:00
|
|
|
add_definitions(-DRDTK_EXPORTS)
|
2014-09-30 00:08:08 +04:00
|
|
|
|
2021-06-18 11:15:23 +03:00
|
|
|
if (NOT IOS)
|
2022-04-29 11:36:37 +03:00
|
|
|
check_include_files(stdbool.h HAVE_STDBOOL_H)
|
|
|
|
if (NOT HAVE_STDBOOL_H)
|
2021-06-28 15:29:32 +03:00
|
|
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool)
|
2021-06-18 11:15:23 +03:00
|
|
|
endif()
|
|
|
|
else()
|
2022-04-29 11:36:37 +03:00
|
|
|
set(HAVE_STDBOOL_H 1)
|
2021-06-18 11:15:23 +03:00
|
|
|
endif()
|
|
|
|
|
2014-09-30 00:08:08 +04:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
if (FREERDP_UNIFIED_BUILD)
|
2021-06-21 12:39:34 +03:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/winpr/include)
|
|
|
|
include_directories(${PROJECT_BINARY_DIR}/winpr/include)
|
2021-06-10 10:54:35 +03:00
|
|
|
else()
|
|
|
|
find_package(WinPR 3 REQUIRED)
|
|
|
|
include_directories(${WinPR_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
SetFreeRDPCMakeInstallDir(RDTK_CMAKE_INSTALL_DIR "rdtk${RDTK_VERSION_MAJOR}")
|
2021-06-28 15:29:32 +03:00
|
|
|
|
2022-02-16 13:10:11 +03:00
|
|
|
set(RDTK_INCLUDE_DIR include/rdtk${RDTK_API_VERSION})
|
2021-06-28 15:29:32 +03:00
|
|
|
|
2014-09-30 00:08:08 +04:00
|
|
|
add_subdirectory(librdtk)
|
2021-06-10 10:54:35 +03:00
|
|
|
add_subdirectory(templates)
|
2022-02-16 13:10:11 +03:00
|
|
|
add_subdirectory(include)
|
2021-06-28 15:29:32 +03:00
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
install(EXPORT rdtk DESTINATION ${RDTK_CMAKE_INSTALL_DIR})
|
2014-09-30 00:08:08 +04:00
|
|
|
|
2014-12-12 19:53:33 +03:00
|
|
|
if(WITH_SAMPLE)
|
|
|
|
if(WITH_X11)
|
|
|
|
add_subdirectory(sample)
|
|
|
|
endif()
|
2014-10-21 20:38:15 +04:00
|
|
|
endif()
|
2021-06-10 10:54:35 +03:00
|
|
|
|