libwinpr: add support for monolithic build (single libwinpr.so)

This commit is contained in:
Marc-André Moreau 2012-08-14 14:37:31 -04:00
parent 65930bb9f8
commit cf7c65ba00
21 changed files with 257 additions and 77 deletions

View File

@ -99,10 +99,18 @@ endif()
set_target_properties(freerdp-core PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
set(FREERDP_CORE_LIBS
winpr-utils
winpr-rpc
winpr-sspi)
if(WITH_MONOLITHIC_BUILD)
set(FREERDP_CORE_LIBS winpr)
else()
set(FREERDP_CORE_LIBS
winpr-utils
winpr-rpc
winpr-sspi)
if(NOT WIN32)
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} winpr-registry)
endif()
endif()
if(WIN32)
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ws2_32)
@ -110,10 +118,6 @@ else()
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ${ZLIB_LIBRARIES})
endif()
if(NOT WIN32)
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} winpr-registry)
endif()
set(FREERDP_CORE_LIBS ${FREERDP_CORE_LIBS} ${OPENSSL_LIBRARIES})
if(WITH_MONOLITHIC_BUILD)

View File

@ -39,13 +39,21 @@ include_directories(${ZLIB_INCLUDE_DIRS})
set_target_properties(freerdp-crypto PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
set(FREERDP_CRYPTO_LIBS
${OPENSSL_LIBRARIES}
winpr-sspi)
${OPENSSL_LIBRARIES})
if(WITH_MONOLITHIC_BUILD)
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} winpr)
else()
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} winpr-sspi)
if(NOT WIN32)
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} winpr-library)
endif()
endif()
if(WIN32)
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} ws2_32)
else()
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} winpr-library)
set(FREERDP_CRYPTO_LIBS ${FREERDP_CRYPTO_LIBS} ${ZLIB_LIBRARIES})
endif()

View File

@ -62,6 +62,7 @@ endif()
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(xfreerdp-server freerdp)
target_link_libraries(xfreerdp-server winpr)
else()
target_link_libraries(xfreerdp-server
freerdp-core
@ -70,7 +71,7 @@ else()
freerdp-gdi
freerdp-crypto
freerdp-locale)
target_link_libraries(xfreerdp-server winpr-sspi)
endif()
target_link_libraries(xfreerdp-server ${X11_LIBRARIES})
target_link_libraries(xfreerdp-server winpr-sspi)

View File

@ -23,6 +23,10 @@ if (APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-flat_namespace,-undefined,warning")
endif()
if(WITH_MONOLITHIC_BUILD)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
add_subdirectory(crt)
add_subdirectory(utils)
add_subdirectory(heap)
@ -38,4 +42,24 @@ add_subdirectory(sspi)
add_subdirectory(registry)
add_subdirectory(library)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr
$<TARGET_OBJECTS:winpr-crt>
$<TARGET_OBJECTS:winpr-utils>
$<TARGET_OBJECTS:winpr-heap>
$<TARGET_OBJECTS:winpr-handle>
$<TARGET_OBJECTS:winpr-synch>
$<TARGET_OBJECTS:winpr-sysinfo>
$<TARGET_OBJECTS:winpr-bcrypt>
$<TARGET_OBJECTS:winpr-dsparse>
$<TARGET_OBJECTS:winpr-asn1>
$<TARGET_OBJECTS:winpr-rpc>
$<TARGET_OBJECTS:winpr-sspicli>
$<TARGET_OBJECTS:winpr-sspi>
$<TARGET_OBJECTS:winpr-registry>
$<TARGET_OBJECTS:winpr-library>)
target_link_libraries(winpr ${WINPR_LIBS})
endif()
add_subdirectory(tools)

View File

@ -20,9 +20,16 @@
set(WINPR_ASN1_SRCS
asn1.c)
add_library(winpr-asn1 ${WINPR_ASN1_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-asn1 OBJECT ${WINPR_ASN1_SRCS})
else()
add_library(winpr-asn1 ${WINPR_ASN1_SRCS})
endif()
set_target_properties(winpr-asn1 PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-asn1 DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-asn1 DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -299,4 +299,14 @@ ASN1error_e ASN1DecSetError(ASN1decoding_t dec, ASN1error_e err)
return status;
}
void ASN1_FreeEncoded(ASN1encoding_t pEncoderInfo, void* pBuf)
{
return;
}
void ASN1_FreeDecoded(ASN1decoding_t pDecoderInfo, void* pDataStruct, ASN1uint32_t nPduNum)
{
return;
}
#endif

View File

@ -20,19 +20,29 @@
set(WINPR_BCRYPT_SRCS
bcrypt.c)
add_library(winpr-bcrypt ${WINPR_BCRYPT_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-bcrypt OBJECT ${WINPR_BCRYPT_SRCS})
else()
add_library(winpr-bcrypt ${WINPR_BCRYPT_SRCS})
endif()
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${ZLIB_INCLUDE_DIRS})
set_target_properties(winpr-bcrypt PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if (NOT WIN32)
target_link_libraries(winpr-bcrypt winpr-crt)
set(WINPR_BCRYPT_LIBS
${ZLIB_LIBRARIES})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_BCRYPT_LIBS} PARENT_SCOPE)
else()
if(NOT WIN32)
set(WINPR_BCRYPT_LIBS ${WINPR_BCRYPT_LIBS} winpr-crt)
endif()
set(WINPR_BCRYPT_LIBS ${WINPR_BCRYPT_LIBS} winpr-utils)
target_link_libraries(winpr-bcrypt ${WINPR_BCRYPT_LIBS})
install(TARGETS winpr-bcrypt DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
target_link_libraries(winpr-bcrypt winpr-utils)
target_link_libraries(winpr-bcrypt ${ZLIB_LIBRARIES})
install(TARGETS winpr-bcrypt DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -21,9 +21,16 @@ set(WINPR_CRT_SRCS
memory.c
string.c)
add_library(winpr-crt ${WINPR_CRT_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-crt OBJECT ${WINPR_CRT_SRCS})
else()
add_library(winpr-crt ${WINPR_CRT_SRCS})
endif()
set_target_properties(winpr-crt PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-crt DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-crt DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_DSPARSE_SRCS
dsparse.c)
add_library(winpr-dsparse ${WINPR_DSPARSE_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-dsparse OBJECT ${WINPR_DSPARSE_SRCS})
else()
add_library(winpr-dsparse ${WINPR_DSPARSE_SRCS})
endif()
set_target_properties(winpr-dsparse PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-dsparse DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-dsparse DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_HANDLE_SRCS
handle.c)
add_library(winpr-handle ${WINPR_HANDLE_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-handle OBJECT ${WINPR_HANDLE_SRCS})
else()
add_library(winpr-handle ${WINPR_HANDLE_SRCS})
endif()
set_target_properties(winpr-handle PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-handle DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-handle DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_HEAP_SRCS
heap.c)
add_library(winpr-heap ${WINPR_HEAP_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-heap OBJECT ${WINPR_HEAP_SRCS})
else()
add_library(winpr-heap ${WINPR_HEAP_SRCS})
endif()
set_target_properties(winpr-heap PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-heap DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-heap DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_LIBRARY_SRCS
library.c)
add_library(winpr-library ${WINPR_LIBRARY_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-library OBJECT ${WINPR_LIBRARY_SRCS})
else()
add_library(winpr-library ${WINPR_LIBRARY_SRCS})
endif()
set_target_properties(winpr-library PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -22,11 +22,17 @@ set(WINPR_REGISTRY_SRCS
registry_reg.h
registry.c)
add_library(winpr-registry ${WINPR_REGISTRY_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-registry OBJECT ${WINPR_REGISTRY_SRCS})
else()
add_library(winpr-registry ${WINPR_REGISTRY_SRCS})
endif()
set_target_properties(winpr-registry PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(winpr-registry winpr-utils)
install(TARGETS winpr-registry DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
target_link_libraries(winpr-registry winpr-utils)
install(TARGETS winpr-registry DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -31,19 +31,29 @@ set(WINPR_RPC_SRCS
ndr_union.c ndr_union.h
midl.c)
add_library(winpr-rpc ${WINPR_RPC_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-rpc OBJECT ${WINPR_RPC_SRCS})
else()
add_library(winpr-rpc ${WINPR_RPC_SRCS})
endif()
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${ZLIB_INCLUDE_DIRS})
set_target_properties(winpr-rpc PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
set(WINPR_RPC_LIBS
${OPENSSL_LIBRARIES})
if(WIN32)
target_link_libraries(winpr-rpc ws2_32)
set(WINPR_RPC_LIBS ${WINPR_RPC_LIBS} ws2_32)
else()
target_link_libraries(winpr-rpc ${ZLIB_LIBRARIES})
set(WINPR_RPC_LIBS ${WINPR_RPC_LIBS} ${ZLIB_LIBRARIES})
endif()
target_link_libraries(winpr-rpc ${OPENSSL_LIBRARIES})
install(TARGETS winpr-rpc DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_RPC_LIBS} PARENT_SCOPE)
else()
target_link_libraries(winpr-rpc ${WINPR_RPC_LIBS})
install(TARGETS winpr-rpc DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -52,22 +52,37 @@ if(NOT WITH_NATIVE_SSPI)
${WINPR_SSPI_SRCS})
endif()
add_library(winpr-sspi ${WINPR_SSPI_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-sspi OBJECT ${WINPR_SSPI_SRCS})
else()
add_library(winpr-sspi ${WINPR_SSPI_SRCS})
endif()
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${OPENSSL_INCLUDE_DIR})
set_target_properties(winpr-sspi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if (NOT WIN32)
target_link_libraries(winpr-sspi winpr-crt)
target_link_libraries(winpr-sspi winpr-sysinfo)
target_link_libraries(winpr-sspi winpr-registry)
set(WINPR_SSPI_LIBS
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS} winpr)
else()
if (NOT WIN32)
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS}
winpr-crt
winpr-sysinfo
winpr-registry)
endif()
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS} winpr-utils)
endif()
target_link_libraries(winpr-sspi winpr-utils)
target_link_libraries(winpr-sspi ${ZLIB_LIBRARIES})
target_link_libraries(winpr-sspi ${OPENSSL_LIBRARIES})
install(TARGETS winpr-sspi DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_SSPI_LIBS} PARENT_SCOPE)
else()
target_link_libraries(winpr-sspi ${WINPR_SSPI_LIBS})
install(TARGETS winpr-sspi DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_SSPICLI_SRCS
sspicli.c)
add_library(winpr-sspicli ${WINPR_SSPICLI_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-sspicli OBJECT ${WINPR_SSPICLI_SRCS})
else()
add_library(winpr-sspicli ${WINPR_SSPICLI_SRCS})
endif()
set_target_properties(winpr-sspicli PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-sspicli DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-sspicli DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -17,6 +17,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_THREAD_PREFER_PTHREAD)
find_required_package(Threads)
set(WINPR_SYNCH_SRCS
critical.c
event.c
@ -24,13 +27,29 @@ set(WINPR_SYNCH_SRCS
semaphore.c
sleep.c)
add_library(winpr-synch ${WINPR_SYNCH_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-synch OBJECT ${WINPR_SYNCH_SRCS})
else()
add_library(winpr-synch ${WINPR_SYNCH_SRCS})
endif()
set_target_properties(winpr-synch PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if(NOT WIN32)
target_link_libraries(winpr-synch winpr-handle)
set(WINPR_SYNCH_LIBS
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
set(WINPR_SYNCH_LIBS ${WINPR_SYNCH_LIBS} rt)
endif()
install(TARGETS winpr-synch DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_SYNCH_LIBS} PARENT_SCOPE)
else()
if(NOT WIN32)
set(WINPR_SYNCH_LIBS ${WINPR_SYNCH_LIBS} winpr-handle)
endif()
target_link_libraries(winpr-synch ${WINPR_SYNCH_LIBS})
install(TARGETS winpr-synch DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,9 +20,16 @@
set(WINPR_SYSINFO_SRCS
sysinfo.c)
add_library(winpr-sysinfo ${WINPR_SYSINFO_SRCS})
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-sysinfo OBJECT ${WINPR_SYSINFO_SRCS})
else()
add_library(winpr-sysinfo ${WINPR_SYSINFO_SRCS})
endif()
set_target_properties(winpr-sysinfo PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-sysinfo DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-sysinfo DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -20,5 +20,9 @@
add_executable(winpr-hash
hash.c)
target_link_libraries(winpr-hash winpr-utils)
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(winpr-hash winpr)
else()
target_link_libraries(winpr-hash winpr-utils)
endif()

View File

@ -20,8 +20,12 @@
add_executable(winpr-reg
reg.c)
target_link_libraries(winpr-reg winpr-utils)
if(NOT WIN32)
target_link_libraries(winpr-reg winpr-registry)
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(winpr-reg winpr)
else()
target_link_libraries(winpr-reg winpr-utils)
if(NOT WIN32)
target_link_libraries(winpr-reg winpr-registry)
endif()
endif()

View File

@ -23,19 +23,28 @@ set(WINPR_UTILS_SRCS
sam.c
stream.c)
add_library(winpr-utils ${WINPR_UTILS_SRCS})
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${OPENSSL_INCLUDE_DIR})
set_target_properties(winpr-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if (NOT WIN32)
target_link_libraries(winpr-utils winpr-crt)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-utils OBJECT ${WINPR_UTILS_SRCS})
else()
add_library(winpr-utils ${WINPR_UTILS_SRCS})
endif()
target_link_libraries(winpr-utils ${ZLIB_LIBRARIES})
target_link_libraries(winpr-utils ${OPENSSL_LIBRARIES})
set_target_properties(winpr-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
install(TARGETS winpr-utils DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(WINPR_UTILS_LIBS
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES})
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_UTILS_LIBS} PARENT_SCOPE)
else()
if (NOT WIN32)
set(WINPR_UTILS_LIBS ${WINPR_UTILS_LIBS} winpr-crt)
endif()
target_link_libraries(winpr-utils ${WINPR_UTILS_LIBS})
install(TARGETS winpr-utils DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()