diff CMakeLists.txt @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children 3a584803783e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Thu Jul 19 14:32:22 2012 +0200
@@ -0,0 +1,170 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(Palantir)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake)
+include(CheckIncludeFiles)
+
+SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
+SET(RELEASE_BUILD OFF CACHE BOOL "Release build")
+
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H)
+else()
+  CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
+endif()
+
+if ("${HAVE_UUID_H}" STREQUAL "")
+  message(FATAL_ERROR "Please install the uuid-dev package")
+endif()
+
+
+SET(THIRD_PARTY_SOURCES)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
+
+
+if (${CMAKE_COMPILER_IS_GNUCXX})
+  set(CMAKE_C_FLAGS "-Wall -pedantic -Wno-implicit-function-declaration")  # --std=c99 makes libcurl not to compile
+  set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wno-long-long -Wno-variadic-macros")
+elseif (${MSVC})
+  add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)  
+endif()
+
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  add_definitions(
+    -D_LARGEFILE64_SOURCE=1 
+    -D_FILE_OFFSET_BITS=64
+    )
+  set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+  set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined")
+  set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
+
+  # http://www.mail-archive.com/cmake@cmake.org/msg08837.html
+  set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
+  link_libraries(uuid pthread rt)
+
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  add_definitions(
+    -DWINVER=0x0501
+    -D_CRT_SECURE_NO_WARNINGS=1
+    )
+  link_libraries(rpcrt4 ws2_32)
+endif()
+
+
+if (${STATIC_BUILD})
+  add_definitions(-DPALANTIR_STATIC=1)
+else()
+  add_definitions(-DPALANTIR_STATIC=0)
+endif()
+
+if (${RELEASE_BUILD})
+  add_definitions(
+    -DPALANTIR_RELEASE=1
+    )
+
+  EmbedResources(
+    PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
+    PALANTIR_EXPLORER PalantirExplorer
+    )
+
+else()
+  add_definitions(
+    -DPALANTIR_RELEASE=0
+    -DPALANTIR_PATH=\"${CMAKE_SOURCE_DIR}\"
+    )
+
+  EmbedResources(
+    PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
+    )
+endif()
+
+
+add_library(CoreLibrary
+  STATIC
+  ${AUTOGENERATED_SOURCES}
+  ${THIRD_PARTY_SOURCES}
+
+  Core/ChunkedBuffer.cpp
+  Core/Compression/BufferCompressor.cpp
+  Core/Compression/ZlibCompressor.cpp
+  Core/PalantirException.cpp
+  Core/DicomFormat/DicomArray.cpp
+  Core/DicomFormat/DicomMap.cpp
+  Core/DicomFormat/DicomTag.cpp
+  Core/FileStorage.cpp
+  Core/HttpServer/EmbeddedResourceHttpHandler.cpp
+  Core/HttpServer/FilesystemHttpHandler.cpp
+  Core/HttpServer/HttpHandler.cpp
+  Core/HttpServer/HttpOutput.cpp
+  Core/HttpServer/MongooseServer.cpp
+  Core/MultiThreading/BagOfRunnablesBySteps.cpp
+  Core/PngWriter.cpp
+  Core/SQLite/Connection.cpp
+  Core/SQLite/FunctionContext.cpp
+  Core/SQLite/Statement.cpp
+  Core/SQLite/StatementId.cpp
+  Core/SQLite/StatementReference.cpp
+  Core/SQLite/Transaction.cpp
+  Core/Toolbox.cpp
+  Core/Uuid.cpp
+
+  PalantirCppClient/HttpClient.cpp
+  PalantirCppClient/HttpException.cpp
+  )  
+
+add_library(ServerLibrary
+  PalantirServer/DicomIntegerPixelAccessor.cpp
+  PalantirServer/DicomProtocol/DicomFindAnswers.cpp
+  PalantirServer/DicomProtocol/DicomServer.cpp
+  PalantirServer/DicomProtocol/DicomUserConnection.cpp
+  PalantirServer/FromDcmtkBridge.cpp
+  PalantirServer/Internals/CommandDispatcher.cpp
+  PalantirServer/Internals/FindScp.cpp
+  PalantirServer/Internals/MoveScp.cpp
+  PalantirServer/Internals/StoreScp.cpp
+  PalantirServer/PalantirInitialization.cpp
+  PalantirServer/PalantirRestApi.cpp
+  PalantirServer/ServerIndex.cpp
+  PalantirServer/ToDcmtkBridge.cpp
+  PalantirServer/ToDcmtkBridge.cpp
+  PalantirServer/DicomIntegerPixelAccessor.cpp
+  )
+
+add_executable(Palantir
+  PalantirServer/main.cpp
+  )
+
+add_executable(UnitTests
+  ${GTEST_SOURCES}
+  UnitTests/main.cpp
+  UnitTests/SQLite.cpp
+  UnitTests/SQLiteChromium.cpp
+  UnitTests/Versions.cpp
+  )
+
+TARGET_LINK_LIBRARIES(Palantir ServerLibrary CoreLibrary)
+TARGET_LINK_LIBRARIES(UnitTests ServerLibrary CoreLibrary)
+
+
+find_package(Doxygen)
+if (DOXYGEN_FOUND)
+  configure_file(
+    ${CMAKE_SOURCE_DIR}/Resources/Palantir.doxygen
+    ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
+    @ONLY)
+  add_custom_target(doc
+    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Generating API documentation with Doxygen" VERBATIM
+    )
+endif(DOXYGEN_FOUND)