From 6a49d43b4bc7d6f7fde47f6507842d430b6d2d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 13 Aug 2012 12:32:41 -0400 Subject: [PATCH] cmake: started monolithic build option --- cmake/ConfigOptions.cmake | 4 ++++ libfreerdp-cache/CMakeLists.txt | 23 ++++++++++++++++------- libfreerdp-channels/CMakeLists.txt | 21 +++++++++++++++------ libfreerdp-codec/CMakeLists.txt | 17 +++++++++++++---- libfreerdp-core/CMakeLists.txt | 1 - libfreerdp-utils/CMakeLists.txt | 15 ++++++++++----- 6 files changed, 58 insertions(+), 23 deletions(-) diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index ef7c0ad6b..e5fd38a44 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -14,6 +14,10 @@ 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) diff --git a/libfreerdp-cache/CMakeLists.txt b/libfreerdp-cache/CMakeLists.txt index 89f9e3f85..dae7004fb 100644 --- a/libfreerdp-cache/CMakeLists.txt +++ b/libfreerdp-cache/CMakeLists.txt @@ -27,14 +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") -set(FREERDP_CACHE_LIBS - freerdp-core - freerdp-utils) +set(FREERDP_CACHE_LIBS) -target_link_libraries(freerdp-cache ${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() diff --git a/libfreerdp-channels/CMakeLists.txt b/libfreerdp-channels/CMakeLists.txt index c46fec445..0c2bfdbfd 100644 --- a/libfreerdp-channels/CMakeLists.txt +++ b/libfreerdp-channels/CMakeLists.txt @@ -23,13 +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") -set(FREERDP_CHANNELS_LIBS - freerdp-utils) - -target_link_libraries(freerdp-channels ${FREERDP_CHANNELS_LIBS}) +set(FREERDP_CHANNELS_LIBS) -install(TARGETS freerdp-channels DESTINATION ${CMAKE_INSTALL_LIBDIR}) +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() diff --git a/libfreerdp-codec/CMakeLists.txt b/libfreerdp-codec/CMakeLists.txt index 08f445453..39848c028 100644 --- a/libfreerdp-codec/CMakeLists.txt +++ b/libfreerdp-codec/CMakeLists.txt @@ -77,14 +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") set(FREERDP_CODEC_LIBS - freerdp-utils ${FREERDP_JPEG_LIBS}) -target_link_libraries(freerdp-codec ${FREERDP_CODEC_LIBS}) +if(WITH_MONOLITHIC_BUILD) -install(TARGETS freerdp-codec DESTINATION ${CMAKE_INSTALL_LIBDIR}) +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() diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 9da4ef88d..21bdf7590 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -119,4 +119,3 @@ 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}) - diff --git a/libfreerdp-utils/CMakeLists.txt b/libfreerdp-utils/CMakeLists.txt index f1b3e3335..a3c66aa37 100644 --- a/libfreerdp-utils/CMakeLists.txt +++ b/libfreerdp-utils/CMakeLists.txt @@ -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})