Mercurial > hg > orthanc
changeset 543:fe796b053863 laaw
conditional
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 13 Sep 2013 11:10:58 +0200 |
parents | eaca3d38b2aa |
children | 0e510ea3de31 |
files | CMakeLists.txt |
diffstat | 1 files changed, 67 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Sep 12 12:55:07 2013 +0200 +++ b/CMakeLists.txt Fri Sep 13 11:10:58 2013 +0200 @@ -17,6 +17,7 @@ SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests") +SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library") SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)") # Advanced parameters (for Debian packaging) @@ -273,70 +274,82 @@ ## Create the standalone DLL containing the Orthanc Client API ##################################################################### -include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw) +if (BUILD_CLIENT_LIBRARY) + include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw) + + if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def) + elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def) + else() + message(FATAL_ERROR "Support your platform here") + endif() + else() + set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES}) + endif() -if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def) - elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def) + add_library(OrthancClient SHARED + ${ORTHANC_ROOT}/Core/OrthancException.cpp + ${ORTHANC_ROOT}/Core/Enumerations.cpp + ${ORTHANC_ROOT}/Core/Toolbox.cpp + ${ORTHANC_ROOT}/Core/HttpClient.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp + ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp + ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp + ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp + ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp + ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp + ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp + ${ORTHANC_ROOT}/OrthancCppClient/Package/SharedLibrary.cpp + ${ORTHANC_ROOT}/Resources/sha1/sha1.cpp + ${ORTHANC_ROOT}/Resources/md5/md5.c + ${ORTHANC_ROOT}/Resources/base64/base64.cpp + ${ORTHANC_CPP_CLIENT_AUX} + ${THIRD_PARTY_SOURCES} + ${CURL_SOURCES} + ) + + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set_target_properties(OrthancClient + PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map" + ) + target_link_libraries(OrthancClient pthread) + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(OrthancClient OpenSSL) + + if (${CMAKE_COMPILER_IS_GNUCXX}) + set_target_properties(OrthancClient + PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++" + ) + target_link_libraries(OrthancClient ws2_32) + else() + message(FATAL_ERROR "Support Visual Studio here") + endif() else() message(FATAL_ERROR "Support your platform here") endif() -else() - set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES}) -endif() -add_library(OrthancClient SHARED - ${ORTHANC_ROOT}/Core/OrthancException.cpp - ${ORTHANC_ROOT}/Core/Enumerations.cpp - ${ORTHANC_ROOT}/Core/Toolbox.cpp - ${ORTHANC_ROOT}/Core/HttpClient.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp - ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp - ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp - ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp - ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp - ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp - ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp - ${ORTHANC_ROOT}/OrthancCppClient/Package/SharedLibrary.cpp - ${ORTHANC_ROOT}/Resources/sha1/sha1.cpp - ${ORTHANC_ROOT}/Resources/md5/md5.c - ${ORTHANC_ROOT}/Resources/base64/base64.cpp - ${ORTHANC_CPP_CLIENT_AUX} - ${THIRD_PARTY_SOURCES} - ${CURL_SOURCES} - ) + # Copy the header file of the client library to the build directory + add_custom_command( + TARGET OrthancClient PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h + ${CMAKE_BINARY_DIR}) -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set_target_properties(OrthancClient - PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map" + install( + TARGETS OrthancClient + LIBRARY DESTINATION lib ) - target_link_libraries(OrthancClient pthread) -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_link_libraries(OrthancClient OpenSSL) - if (${CMAKE_COMPILER_IS_GNUCXX}) - set_target_properties(OrthancClient - PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++" - ) - target_link_libraries(OrthancClient ws2_32) - else() - message(FATAL_ERROR "Support Visual Studio here") - endif() -else() - message(FATAL_ERROR "Support your platform here") + install( + FILES ${CMAKE_BINARY_DIR}/OrthancCppClient.h + DESTINATION include/orthanc + ) endif() -# Copy the header file of the client library to the build directory -add_custom_command( - TARGET OrthancClient PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h - ${CMAKE_BINARY_DIR}) - ##################################################################### ## Generate the documentation if Doxygen is present