cmake: merging with cleanup branch

This commit is contained in:
Marc-André Moreau 2012-08-13 15:45:02 -04:00
commit c27d860eb2
13 changed files with 150 additions and 45 deletions

View File

@ -55,7 +55,7 @@ endif()
# Default to build shared libs
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
set(BUILD_SHARED_LIBS ON)
endif()
# Compiler-specific flags
@ -95,6 +95,23 @@ if(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()
# This forces the MSVC runtime to be statically linked
if(MSVC)
foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
endif()
# config.h definition for installable headers
check_include_files(limits.h FREERDP_HAVE_LIMITS_H)
check_include_files(stdint.h FREERDP_HAVE_STDINT_H)
@ -165,6 +182,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
# Configure files
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/winpr/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/freerdp/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/freerdp/config.h)
# Generate pkg-config

View File

@ -10,6 +10,14 @@ if(APPLE)
option(WITH_CLANG "Build using clang" OFF)
endif()
if(MSVC)
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
endif()
if(${CMAKE_VERSION} VERSION_GREATER 2.8.7)
option(WITH_MONOLITHIC_BUILD "Use monolithic build" OFF)
endif()
option(WITH_CLIENT "Build client binaries" ON)
option(WITH_SERVER "Build server binaries" OFF)
option(WITH_CHANNELS "Build virtual channel plugins" ON)

View File

@ -18,7 +18,7 @@
# limitations under the License.
file(GLOB HEADERS "freerdp/*.h")
install_files(/include/freerdp FILES ${HEADERS})
install(FILES ${HEADERS} DESTINATION include/freerdp)
install(DIRECTORY freerdp/utils DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/channels DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
@ -33,7 +33,6 @@ install(DIRECTORY freerdp/auth DESTINATION include/freerdp FILES_MATCHING PATTER
install(DIRECTORY freerdp/server DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
file(GLOB HEADERS "winpr/*.h")
install_files(/include/winpr FILES ${HEADERS})
install(FILES ${HEADERS} DESTINATION include/winpr)
file(GLOB HEADERS "${CMAKE_CURRENT_BINARY_DIR}/freerdp/*.h")
install_files(/include/freerdp FILES ${HEADERS})

32
include/winpr/config.h.in Normal file
View File

@ -0,0 +1,32 @@
/**
* WinPR: Windows Portable Runtime
* config.h definitions for installable headers
*
* Copyright 2012 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.
*/
#ifndef WINPR_CONFIG_H
#define WINPR_CONFIG_H
/*
* This generated config.h header is meant for installation, which is why
* all definitions MUST be prefixed to avoid conflicting with third-party
* libraries. Only add configurable definitions which really must be used
* from installable headers, such as the base type definition types.
*/
#cmakedefine WITH_NATIVE_SSPI
#endif /* WINPR_CONFIG_H */

View File

@ -20,7 +20,7 @@
#ifndef WINPR_SSPI_H
#define WINPR_SSPI_H
#include "config.h"
#include <winpr/config.h>
#include <wchar.h>
#include <winpr/winpr.h>

View File

@ -19,8 +19,6 @@
#ifndef WINPR_H
#define WINPR_H
#include "config.h"
#if defined _WIN32 || defined __CYGWIN__
#ifdef WINPR_EXPORTS
#ifdef __GNUC__

View File

@ -27,11 +27,23 @@ set(FREERDP_CACHE_SRCS
glyph.c
cache.c)
add_library(freerdp-cache ${FREERDP_CACHE_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(freerdp-cache OBJECT ${FREERDP_CACHE_SRCS})
else()
add_library(freerdp-cache ${FREERDP_CACHE_SRCS})
endif()
set_target_properties(freerdp-cache PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(freerdp-cache freerdp-core)
target_link_libraries(freerdp-cache freerdp-utils)
set(FREERDP_CACHE_LIBS)
install(TARGETS freerdp-cache DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
set(FREERDP_CACHE_LIBS ${FREERDP_CACHE_LIBS}
freerdp-core
freerdp-utils)
target_link_libraries(freerdp-cache ${FREERDP_CACHE_LIBS})
install(TARGETS freerdp-cache DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -23,10 +23,22 @@ set(FREERDP_CHANNELS_SRCS
wtsvc.c
wtsvc.h)
add_library(freerdp-channels ${FREERDP_CHANNELS_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(freerdp-channels OBJECT ${FREERDP_CHANNELS_SRCS})
else()
add_library(freerdp-channels ${FREERDP_CHANNELS_SRCS})
endif()
set_target_properties(freerdp-channels PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(freerdp-channels freerdp-utils)
install(TARGETS freerdp-channels DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(FREERDP_CHANNELS_LIBS)
if(WITH_MONOLITHIC_BUILD)
else()
set(FREERDP_CHANNELS_LIBS ${FREERDP_CHANNELS_LIBS}
freerdp-utils)
target_link_libraries(freerdp-channels ${FREERDP_CHANNELS_LIBS})
install(TARGETS freerdp-channels DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -77,9 +77,23 @@ if(WITH_JPEG)
set(FREERDP_JPEG_LIBS jpeg)
endif()
add_library(freerdp-codec ${FREERDP_CODEC_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(freerdp-codec OBJECT ${FREERDP_CODEC_SRCS})
else()
add_library(freerdp-codec ${FREERDP_CODEC_SRCS})
endif()
set_target_properties(freerdp-codec PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(freerdp-codec freerdp-utils ${FREERDP_JPEG_LIBS})
install(TARGETS freerdp-codec DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(FREERDP_CODEC_LIBS
${FREERDP_JPEG_LIBS})
if(WITH_MONOLITHIC_BUILD)
else()
set(FREERDP_CODEC_LIBS ${FREERDP_CODEC_LIBS}
freerdp-utils)
target_link_libraries(freerdp-codec ${FREERDP_CODEC_LIBS})
install(TARGETS freerdp-codec DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -3,7 +3,7 @@
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 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.
@ -22,7 +22,7 @@ add_definitions(-DEXT_PATH="${FREERDP_EXTENSION_PATH}")
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${ZLIB_INCLUDE_DIRS})
set(LIBFREERDP_CORE_SRCS
set(FREERDP_CORE_SRCS
activation.c
activation.h
extension.c
@ -89,33 +89,33 @@ set(LIBFREERDP_CORE_SRCS
listener.c
listener.h
peer.c
peer.h
)
peer.h)
add_library(freerdp-core ${LIBFREERDP_CORE_SRCS})
add_library(freerdp-core ${FREERDP_CORE_SRCS})
set_target_properties(freerdp-core PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
set(FREERDP_CORE_LIBS
freerdp-utils
freerdp-codec
freerdp-crypto
freerdp-locale
winpr-utils
winpr-rpc
winpr-sspi)
if(WIN32)
target_link_libraries(freerdp-core ws2_32)
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ws2_32)
else()
target_link_libraries(freerdp-core ${ZLIB_LIBRARIES})
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ${ZLIB_LIBRARIES})
endif()
target_link_libraries(freerdp-core freerdp-utils)
target_link_libraries(freerdp-core freerdp-codec)
target_link_libraries(freerdp-core freerdp-locale)
target_link_libraries(freerdp-core winpr-utils)
target_link_libraries(freerdp-core winpr-rpc)
target_link_libraries(freerdp-core winpr-sspi)
if(NOT WIN32)
target_link_libraries(freerdp-core winpr-registry)
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} winpr-registry)
endif()
target_link_libraries(freerdp-core freerdp-crypto)
target_link_libraries(freerdp-core ${OPENSSL_LIBRARIES})
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ${OPENSSL_LIBRARIES})
target_link_libraries(freerdp-core ${FREERDP_CORE_LIBS})
install(TARGETS freerdp-core DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -142,8 +142,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
* Though MS-RDPBCGR specifies bias as unsigned, two's complement
* (a negative integer) works fine for zones east of UTC.
*/
if (clientTimeZone->bias <= 720) bias = -(clientTimeZone->bias);
else bias = 1440 - clientTimeZone->bias;
if (clientTimeZone->bias <= 720)
bias = -1 * clientTimeZone->bias;
else
bias = 1440 - clientTimeZone->bias;
stream_write_uint32(s, bias); /* Bias */
/* standardName (64 bytes) */
@ -155,10 +159,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
bias, clientTimeZone->standardName, clientTimeZone->daylightName);
sbias = clientTimeZone->standardBias - clientTimeZone->bias;
if (sbias < 0)
bias2c = (uint32) sbias;
else
bias2c = ~((uint32) sbias) + 1;
/* Note that StandardBias is ignored if no valid standardDate is provided. */
stream_write_uint32(s, bias2c); /* StandardBias */
DEBUG_TIMEZONE("StandardBias=%d", bias2c);
@ -170,10 +176,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
rdp_write_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */
sbias = clientTimeZone->daylightBias - clientTimeZone->bias;
if (sbias < 0)
bias2c = (uint32) sbias;
else
bias2c = ~((uint32) sbias) + 1;
/* Note that DaylightBias is ignored if no valid daylightDate is provided. */
stream_write_uint32(s, bias2c); /* DaylightBias */
DEBUG_TIMEZONE("DaylightBias=%d", bias2c);

View File

@ -55,13 +55,18 @@ add_library(freerdp-utils ${FREERDP_UTILS_SRCS})
set_target_properties(freerdp-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(freerdp-utils ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
set(FREERDP_UTILS_LIBS
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(WIN32)
target_link_libraries(freerdp-utils ws2_32)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
target_link_libraries(freerdp-utils rt)
set(FREERDP_UTILS_LIBS ${FREERDP_UTILS_LIBS} ws2_32)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
set(FREERDP_UTILS_LIBS ${FREERDP_UTILS_LIBS} rt)
endif()
target_link_libraries(freerdp-utils ${FREERDP_UTILS_LIBS})
install(TARGETS freerdp-utils DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -39,4 +39,3 @@ add_subdirectory(registry)
add_subdirectory(library)
add_subdirectory(tools)