2011-07-02 13:58:55 -04:00
|
|
|
# FreeRDP: A Remote Desktop Protocol Client
|
|
|
|
# FreeRDP cmake build script
|
|
|
|
#
|
|
|
|
# Copyright 2011 O.S. Systems Software Ltda.
|
|
|
|
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
|
|
|
|
# Copyright 2011 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.
|
|
|
|
|
2011-07-25 13:49:12 -07:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2011-06-30 20:31:07 -04:00
|
|
|
project(FreeRDP C)
|
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Include cmake modules
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
2012-02-15 16:28:47 -05:00
|
|
|
include(CheckStructHasMember)
|
2011-08-15 18:21:58 +08:00
|
|
|
include(FindPkgConfig)
|
2011-07-04 11:40:26 +08:00
|
|
|
include(TestBigEndian)
|
|
|
|
|
2011-06-30 20:31:07 -04:00
|
|
|
# Include our extra modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
|
|
|
|
2011-07-02 16:44:40 -03:00
|
|
|
include(AutoVersioning)
|
2011-07-04 17:01:06 +08:00
|
|
|
include(ConfigOptions)
|
2011-08-18 20:36:17 +02:00
|
|
|
include(FindOptionalPackage)
|
2011-09-20 12:02:07 +09:00
|
|
|
include(CheckCCompilerFlag)
|
2011-12-06 00:02:07 -05:00
|
|
|
include(GNUInstallDirsWrapper)
|
2011-07-02 16:44:40 -03:00
|
|
|
|
2012-01-14 13:33:04 -05:00
|
|
|
# Soname versioning
|
2011-11-11 04:46:46 +08:00
|
|
|
set(FREERDP_VERSION_MAJOR "1")
|
2011-06-30 20:31:07 -04:00
|
|
|
set(FREERDP_VERSION_MINOR "0")
|
2012-02-09 21:01:42 -05:00
|
|
|
set(FREERDP_VERSION_REVISION "1")
|
2011-06-30 20:31:07 -04:00
|
|
|
set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}")
|
2012-01-14 13:33:04 -05:00
|
|
|
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}.${FREERDP_VERSION_REVISION}")
|
2011-06-30 20:31:07 -04:00
|
|
|
|
|
|
|
# Default to release build type
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
2012-03-21 20:46:37 +01:00
|
|
|
# Default to build shared libs
|
|
|
|
if(NOT DEFINED BUILD_SHARED_LIBS)
|
2011-09-01 22:18:58 +08:00
|
|
|
set(BUILD_SHARED_LIBS ON)
|
|
|
|
endif()
|
|
|
|
|
2011-08-11 15:03:08 +08:00
|
|
|
# Compiler-specific flags
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2011-09-20 12:02:07 +09:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
2011-10-04 18:47:21 -04:00
|
|
|
CHECK_C_COMPILER_FLAG (-Wno-unused-result Wno-unused-result)
|
|
|
|
if(Wno-unused-result)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")
|
|
|
|
endif()
|
2011-09-20 12:02:07 +09:00
|
|
|
CHECK_C_COMPILER_FLAG (-Wno-unused-but-set-variable Wno-unused-but-set-variable)
|
|
|
|
if(Wno-unused-but-set-variable)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
|
|
|
|
endif()
|
2011-08-24 22:53:06 -04:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
2012-01-20 11:37:55 +01:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
|
2011-08-11 15:03:08 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
|
|
|
endif()
|
2011-10-23 13:51:26 -05:00
|
|
|
if(WITH_SSE2_TARGET)
|
2011-08-13 16:26:57 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
|
|
|
|
endif()
|
2011-08-11 15:03:08 +08:00
|
|
|
endif()
|
|
|
|
|
2011-08-16 14:41:12 -04:00
|
|
|
if(MSVC)
|
2011-08-31 04:35:50 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd /MT")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Ob2")
|
2011-08-16 14:41:12 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
|
2011-09-23 14:38:16 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE")
|
2012-05-04 19:36:35 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
|
2011-08-16 21:08:14 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
|
2011-08-16 17:40:29 -04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
|
2011-09-25 03:12:29 -04:00
|
|
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
2011-08-16 14:41:12 -04:00
|
|
|
endif()
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Include files
|
|
|
|
check_include_files(fcntl.h HAVE_FCNTL_H)
|
2011-07-08 16:07:25 +08:00
|
|
|
check_include_files(unistd.h HAVE_UNISTD_H)
|
2011-11-19 12:19:16 -05:00
|
|
|
check_include_files(limits.h HAVE_LIMITS_H)
|
|
|
|
check_include_files(stdint.h HAVE_STDINT_H)
|
|
|
|
check_include_files(stdbool.h HAVE_STDBOOL_H)
|
|
|
|
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
2011-07-04 11:40:26 +08:00
|
|
|
|
2012-02-15 16:28:47 -05:00
|
|
|
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
|
|
|
|
|
2011-07-31 11:22:09 +10:00
|
|
|
# Libraries that we have a hard dependency on
|
2012-03-21 23:15:46 +01:00
|
|
|
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
|
2011-08-30 22:39:46 +02:00
|
|
|
find_required_package(OpenSSL)
|
2012-03-21 23:15:46 +01:00
|
|
|
endif()
|
2011-08-15 17:05:48 -04:00
|
|
|
|
2011-11-15 23:21:53 -05:00
|
|
|
# Mac OS X
|
|
|
|
if(APPLE)
|
|
|
|
include_directories(/opt/local/include)
|
|
|
|
link_directories(/opt/local/lib)
|
2012-03-22 20:37:05 -04:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=10.4")
|
2011-11-15 23:21:53 -05:00
|
|
|
endif()
|
|
|
|
|
2011-08-16 10:34:15 +08:00
|
|
|
if(NOT WIN32)
|
2011-08-30 22:39:46 +02:00
|
|
|
find_required_package(ZLIB)
|
2011-08-18 20:36:17 +02:00
|
|
|
find_optional_package(PulseAudio)
|
2011-10-15 10:30:10 -05:00
|
|
|
find_optional_package(PCSC)
|
2011-08-30 22:39:46 +02:00
|
|
|
find_suggested_package(Cups)
|
2011-11-15 23:21:53 -05:00
|
|
|
|
|
|
|
if(NOT APPLE)
|
2012-01-27 02:32:06 +01:00
|
|
|
find_suggested_package(FFmpeg)
|
2011-11-15 23:21:53 -05:00
|
|
|
find_suggested_package(ALSA)
|
2012-01-27 02:32:06 +01:00
|
|
|
else(NOT APPLE)
|
|
|
|
find_optional_package(FFmpeg)
|
2011-11-15 23:21:53 -05:00
|
|
|
endif()
|
2011-08-15 17:05:48 -04:00
|
|
|
endif()
|
2011-07-31 11:22:09 +10:00
|
|
|
|
2012-02-18 22:04:28 -05:00
|
|
|
# Path to put FreeRDP data
|
|
|
|
set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp")
|
|
|
|
set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")
|
2011-06-30 20:31:07 -04:00
|
|
|
|
2011-07-08 14:28:52 +08:00
|
|
|
# Path to put plugins
|
2011-08-25 00:00:24 -04:00
|
|
|
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/freerdp")
|
2011-07-08 14:28:52 +08:00
|
|
|
|
2011-07-04 15:41:53 +08:00
|
|
|
# Include directories
|
2011-07-13 23:05:25 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2011-07-04 15:41:53 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Configure files
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
|
2011-10-15 18:25:34 -05:00
|
|
|
# Generate pkg-config
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc @ONLY)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
|
2011-07-02 15:23:59 -03:00
|
|
|
# Build CUnit
|
2011-08-30 20:38:05 +02:00
|
|
|
find_optional_package(CUnit)
|
2012-01-23 14:19:40 +01:00
|
|
|
if(WITH_CUNIT)
|
2011-07-26 11:50:45 +10:00
|
|
|
enable_testing()
|
2011-09-04 21:41:52 -04:00
|
|
|
add_subdirectory(cunit)
|
2011-07-02 15:23:59 -03:00
|
|
|
endif()
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Sub-directories
|
2011-06-30 20:31:07 -04:00
|
|
|
add_subdirectory(include)
|
|
|
|
add_subdirectory(libfreerdp-utils)
|
2011-06-30 21:23:36 -04:00
|
|
|
add_subdirectory(libfreerdp-gdi)
|
2011-08-15 23:37:43 -04:00
|
|
|
add_subdirectory(libfreerdp-rail)
|
2011-08-04 16:22:15 -04:00
|
|
|
add_subdirectory(libfreerdp-cache)
|
2011-10-02 20:28:20 -04:00
|
|
|
add_subdirectory(libfreerdp-codec)
|
2012-02-17 00:58:30 -05:00
|
|
|
add_subdirectory(libfreerdp-crypto)
|
2011-10-16 14:57:15 -04:00
|
|
|
add_subdirectory(libfreerdp-channels)
|
2012-02-18 22:04:28 -05:00
|
|
|
add_subdirectory(libfreerdp-locale)
|
2011-07-02 14:40:03 -04:00
|
|
|
add_subdirectory(libfreerdp-core)
|
2011-08-16 23:54:42 -04:00
|
|
|
|
2012-05-05 22:09:08 -04:00
|
|
|
add_subdirectory(libwinpr-crt)
|
2012-05-04 18:32:34 -04:00
|
|
|
add_subdirectory(libwinpr-rpc)
|
2012-05-04 19:48:53 -04:00
|
|
|
add_subdirectory(libwinpr-sspi)
|
2012-05-04 18:32:34 -04:00
|
|
|
|
2011-08-16 23:54:42 -04:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_subdirectory(channels)
|
|
|
|
endif()
|
2011-07-17 23:16:31 -04:00
|
|
|
|
2012-01-22 12:26:30 -05:00
|
|
|
option(WITH_CLIENT "Build client binaries" ON)
|
|
|
|
if(WITH_CLIENT)
|
2012-01-22 12:14:06 -05:00
|
|
|
add_subdirectory(client)
|
|
|
|
endif()
|
|
|
|
|
2012-01-22 12:26:30 -05:00
|
|
|
option(WITH_SERVER "Build server binaries" OFF)
|
|
|
|
if(WITH_SERVER)
|
2012-01-22 12:14:06 -05:00
|
|
|
add_subdirectory(server)
|
|
|
|
endif()
|
|
|
|
|
2011-09-01 22:05:31 +08:00
|
|
|
add_subdirectory(keymaps)
|
2011-10-02 20:31:52 -04:00
|
|
|
|
2011-10-19 07:21:14 -05:00
|
|
|
# Source package
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt")
|
|
|
|
|
|
|
|
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_lower)
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}")
|
|
|
|
|
|
|
|
include(CPack)
|
2012-02-17 17:12:21 -05:00
|
|
|
|