2011-07-02 21: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-26 00:49:12 +04:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2011-07-01 04:31:07 +04:00
|
|
|
project(FreeRDP C)
|
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
2011-07-04 07:40:26 +04:00
|
|
|
# Include cmake modules
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
2011-08-15 14:21:58 +04:00
|
|
|
include(FindPkgConfig)
|
2011-07-04 07:40:26 +04:00
|
|
|
include(TestBigEndian)
|
|
|
|
|
2011-07-01 04:31:07 +04:00
|
|
|
# Include our extra modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
|
|
|
|
2011-07-02 23:44:40 +04:00
|
|
|
include(AutoVersioning)
|
2011-07-04 13:01:06 +04:00
|
|
|
include(ConfigOptions)
|
2011-08-18 22:36:17 +04:00
|
|
|
include(FindOptionalPackage)
|
2011-09-20 07:02:07 +04:00
|
|
|
include(CheckCCompilerFlag)
|
2011-07-02 23:44:40 +04:00
|
|
|
|
2011-07-01 04:31:07 +04:00
|
|
|
# Soname versioning - 0.0.0 since it is not being managed yet
|
|
|
|
set(FREERDP_VERSION_MAJOR "0")
|
|
|
|
set(FREERDP_VERSION_MINOR "0")
|
|
|
|
set(FREERDP_VERSION_PATCH "0")
|
|
|
|
set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}")
|
|
|
|
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}.${FREERDP_VERSION_PATCH}")
|
|
|
|
|
|
|
|
# Default to release build type
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
2011-08-25 08:00:24 +04:00
|
|
|
# Set default libdir
|
|
|
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
|
|
|
set(CMAKE_INSTALL_LIBDIR "lib")
|
|
|
|
endif()
|
|
|
|
|
2011-09-25 11:12:29 +04:00
|
|
|
# Set default bindir
|
|
|
|
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
|
|
|
|
set(CMAKE_INSTALL_BINDIR "bin")
|
|
|
|
endif()
|
|
|
|
|
2011-09-01 18:18:58 +04:00
|
|
|
# build shared libs
|
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
|
|
|
set(BUILD_SHARED_LIBS ON)
|
|
|
|
endif()
|
|
|
|
|
2011-08-11 11:03:08 +04:00
|
|
|
# Compiler-specific flags
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2011-09-20 07:02:07 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|
|
|
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-25 06:53:06 +04:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
2011-08-11 11:03:08 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
|
|
|
endif()
|
2011-08-13 12:26:57 +04:00
|
|
|
if(WITH_SSE2)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
|
|
|
|
endif()
|
2011-08-11 11:03:08 +04:00
|
|
|
endif()
|
|
|
|
|
2011-08-16 22:41:12 +04:00
|
|
|
if(MSVC)
|
2011-08-31 12: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 22:41:12 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
|
2011-09-23 22:38:16 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE")
|
2011-08-17 05:08:14 +04:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
|
2011-08-17 01: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 11:12:29 +04:00
|
|
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
2011-08-16 22:41:12 +04:00
|
|
|
endif()
|
|
|
|
|
2011-07-04 07:40:26 +04:00
|
|
|
# Include files
|
|
|
|
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
|
|
|
|
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
|
|
|
|
check_include_files(netdb.h HAVE_NETDB_H)
|
|
|
|
check_include_files(fcntl.h HAVE_FCNTL_H)
|
2011-07-08 12:07:25 +04:00
|
|
|
check_include_files(unistd.h HAVE_UNISTD_H)
|
2011-07-04 07:40:26 +04:00
|
|
|
|
2011-07-31 05:22:09 +04:00
|
|
|
# Libraries that we have a hard dependency on
|
2011-08-31 00:39:46 +04:00
|
|
|
find_required_package(OpenSSL)
|
2011-08-16 01:05:48 +04:00
|
|
|
|
2011-08-16 06:34:15 +04:00
|
|
|
if(NOT WIN32)
|
2011-08-31 00:39:46 +04:00
|
|
|
find_required_package(ZLIB)
|
|
|
|
find_suggested_package(ALSA)
|
2011-08-18 22:36:17 +04:00
|
|
|
find_optional_package(PulseAudio)
|
2011-08-31 00:39:46 +04:00
|
|
|
find_suggested_package(Cups)
|
2011-09-20 10:27:10 +04:00
|
|
|
find_suggested_package(FFmpeg)
|
2011-08-16 01:05:48 +04:00
|
|
|
endif()
|
2011-07-31 05:22:09 +04:00
|
|
|
|
2011-07-04 07:40:26 +04:00
|
|
|
# Endian
|
|
|
|
test_big_endian(BIG_ENDIAN)
|
|
|
|
|
2011-07-01 04:31:07 +04:00
|
|
|
# Path to put keymaps
|
|
|
|
set(FREERDP_KEYMAP_PATH "${CMAKE_INSTALL_PREFIX}/freerdp/keymaps")
|
|
|
|
|
2011-07-08 10:28:52 +04:00
|
|
|
# Path to put plugins
|
2011-08-25 08:00:24 +04:00
|
|
|
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/freerdp")
|
2011-07-08 10:28:52 +04:00
|
|
|
|
2011-07-04 11:41:53 +04:00
|
|
|
# Include directories
|
2011-07-13 19:05:25 +04:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2011-07-04 11:41:53 +04:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
|
|
|
|
2011-07-04 07:40:26 +04:00
|
|
|
# Configure files
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
|
2011-07-06 04:44:26 +04:00
|
|
|
# Mac OS X
|
|
|
|
if(APPLE)
|
|
|
|
include_directories(/opt/local/include)
|
|
|
|
link_directories(/opt/local/lib)
|
|
|
|
endif()
|
|
|
|
|
2011-07-02 22:23:59 +04:00
|
|
|
# Build CUnit
|
2011-08-30 22:38:05 +04:00
|
|
|
find_optional_package(CUnit)
|
2011-07-02 22:23:59 +04:00
|
|
|
if(CUNIT_FOUND)
|
2011-07-26 05:50:45 +04:00
|
|
|
enable_testing()
|
2011-09-05 05:41:52 +04:00
|
|
|
add_subdirectory(cunit)
|
2011-07-02 22:23:59 +04:00
|
|
|
endif()
|
|
|
|
|
2011-07-04 07:40:26 +04:00
|
|
|
# Sub-directories
|
2011-07-01 04:31:07 +04:00
|
|
|
add_subdirectory(include)
|
|
|
|
add_subdirectory(libfreerdp-utils)
|
2011-08-16 22:41:12 +04:00
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
add_subdirectory(libfreerdp-kbd)
|
|
|
|
endif()
|
|
|
|
|
2011-07-01 05:23:36 +04:00
|
|
|
add_subdirectory(libfreerdp-gdi)
|
2011-08-16 07:37:43 +04:00
|
|
|
add_subdirectory(libfreerdp-rail)
|
2011-08-05 00:22:15 +04:00
|
|
|
add_subdirectory(libfreerdp-cache)
|
2011-09-13 23:39:40 +04:00
|
|
|
add_subdirectory(libfreerdp-common)
|
2011-07-28 09:04:01 +04:00
|
|
|
add_subdirectory(libfreerdp-chanman)
|
2011-07-02 22:40:03 +04:00
|
|
|
add_subdirectory(libfreerdp-core)
|
2011-08-10 11:13:39 +04:00
|
|
|
add_subdirectory(libfreerdp-rfx)
|
2011-08-17 07:54:42 +04:00
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
add_subdirectory(channels)
|
|
|
|
endif()
|
2011-07-18 07:16:31 +04:00
|
|
|
|
|
|
|
add_subdirectory(client)
|
2011-08-18 12:06:32 +04:00
|
|
|
add_subdirectory(server)
|
2011-09-01 18:05:31 +04:00
|
|
|
add_subdirectory(keymaps)
|