changeset 516:49a1228d6fe7 laaw

building the dll from the main CMakeLists
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jul 2013 16:12:29 +0200
parents a3d9acf37161
children 58841db7b64e
files CMakeLists.txt OrthancCppClient/Package/OrthancCppClient.cmake Resources/CMake/LibCurlConfiguration.cmake Resources/CMake/OpenSslConfiguration.cmake
diffstat 4 files changed, 122 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Jul 18 12:45:40 2013 +0200
+++ b/CMakeLists.txt	Fri Jul 19 16:12:29 2013 +0200
@@ -7,6 +7,11 @@
   -DORTHANC_VERSION="mainline"
   )
 
+
+#####################################################################
+## CMake parameters tunable at the command line
+#####################################################################
+
 # Parameters of the build
 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
@@ -43,6 +48,13 @@
 
 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR})
 
+
+
+
+#####################################################################
+## Inclusion of third-party dependencies
+#####################################################################
+
 # Configuration of the standalone builds
 if (${CMAKE_CROSSCOMPILING})
   # Cross-compilation implies the standalone build
@@ -80,6 +92,11 @@
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
 
 
+
+#####################################################################
+## Autogeneration of files
+#####################################################################
+
 # Prepare the embedded files
 set(EMBEDDED_FILES
   PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
@@ -106,11 +123,18 @@
 endif()
 
 
-# The main instructions to build the Orthanc binaries
+
+#####################################################################
+## Build the core of Orthanc
+#####################################################################
+
+add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
+
 add_library(CoreLibrary
   STATIC
   ${AUTOGENERATED_SOURCES}
   ${THIRD_PARTY_SOURCES}
+  ${CURL_SOURCES}
 
   Core/Cache/MemoryCache.cpp
   Core/ChunkedBuffer.cpp
@@ -167,6 +191,10 @@
 
 
 if(NOT ONLY_CORE_LIBRARY)
+  #####################################################################
+  ## Build the Orthanc server
+  #####################################################################
+
   add_library(ServerLibrary
     STATIC
     ${DCMTK_SOURCES}
@@ -195,14 +223,18 @@
     OrthancServer/main.cpp
     )
 
-  target_link_libraries(Orthanc ServerLibrary CoreLibrary)
+  target_link_libraries(Orthanc ServerLibrary CoreLibrary OpenSSL)
 
   install(
     TARGETS Orthanc
     RUNTIME DESTINATION bin
     )
 
-  # Build the unit tests if required
+
+  #####################################################################
+  ## Build the unit tests if required
+  #####################################################################
+
   if (BUILD_UNIT_TESTS)
     add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
     include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
@@ -220,12 +252,75 @@
       UnitTests/Lua.cpp
       UnitTests/main.cpp
       )
-    target_link_libraries(UnitTests ServerLibrary CoreLibrary)
+    target_link_libraries(UnitTests ServerLibrary CoreLibrary OpenSSL)
   endif()
 endif()
 
 
-# Generate the Doxygen documentation if Doxygen is present
+#####################################################################
+## Create the standalone DLL containing the Orthanc Client API
+#####################################################################
+
+# include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw)
+
+# if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+#   if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
+#     set(ORTHANC_CPP_CLIENT_DEF ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def)
+#   elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+#     set(ORTHANC_CPP_CLIENT_DEF ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def)
+#   else()
+#     message(FATAL_ERROR "Support your platform here")
+#   endif()
+# endif()
+
+# add_library(OrthancCppClient 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_DEF}
+#   ${THIRD_PARTY_SOURCES}
+#   ${OPENSSL_SOURCES}
+#   ${CURL_SOURCES}
+#   )
+
+# if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+#   set_target_properties(OrthancCppClient
+#     PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map"
+#     )
+#   target_link_libraries(OrthancCppClient pthread)
+# elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+#   if (${CMAKE_COMPILER_IS_GNUCXX})
+#     set_target_properties(OrthancCppClient
+#       PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
+#       )
+#     target_link_libraries(OrthancCppClient ws2_32)
+#   else()
+#     message(FATAL_ERROR "Support Visual Studio here")
+#   endif()
+# else()
+#   message(FATAL_ERROR "Support your platform here")
+# endif()
+
+
+
+#####################################################################
+## Generate the documentation if Doxygen is present
+#####################################################################
+
 find_package(Doxygen)
 if (DOXYGEN_FOUND)
   configure_file(
--- a/OrthancCppClient/Package/OrthancCppClient.cmake	Thu Jul 18 12:45:40 2013 +0200
+++ b/OrthancCppClient/Package/OrthancCppClient.cmake	Fri Jul 19 16:12:29 2013 +0200
@@ -50,9 +50,13 @@
   )
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map")
+  set_target_properties(OrthancCppClient
+    PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map"
+    )
   target_link_libraries(OrthancCppClient pthread)
 else()
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
+  set_target_properties(OrthancCppClient
+    PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
+    )
   target_link_libraries(OrthancCppClient ws2_32)
 endif()
--- a/Resources/CMake/LibCurlConfiguration.cmake	Thu Jul 18 12:45:40 2013 +0200
+++ b/Resources/CMake/LibCurlConfiguration.cmake	Fri Jul 19 16:12:29 2013 +0200
@@ -11,7 +11,6 @@
 
   #add_library(Curl STATIC ${CURL_SOURCES})
   #link_libraries(Curl)  
-  list(APPEND THIRD_PARTY_SOURCES ${CURL_SOURCES})
 
   add_definitions(
     -DCURL_STATICLIB=1
--- a/Resources/CMake/OpenSslConfiguration.cmake	Thu Jul 18 12:45:40 2013 +0200
+++ b/Resources/CMake/OpenSslConfiguration.cmake	Fri Jul 19 16:12:29 2013 +0200
@@ -164,6 +164,20 @@
     ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c
     ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c
     ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c
+
+    ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c
+    ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c
+    ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c
+    ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c
+    ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c
+    ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c
+    ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c
+    ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
     )
 
   #if (${MSVC})
@@ -174,8 +188,8 @@
       "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
   endif()
 
-  add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
-  link_libraries(OpenSSL)
+  #add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
+  #link_libraries(OpenSSL)
 
 else()
   include(FindOpenSSL)