Mercurial > hg > orthanc
view CMakeLists.txt @ 48:0a04c70747d9
renaming
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Sep 2012 15:36:45 +0200 |
parents | 042ac60f5bf9 |
children | e0cac5540668 |
line wrap: on
line source
cmake_minimum_required(VERSION 2.8) project(Palanthir) 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(STANDALONE_BUILD OFF CACHE BOOL "Standalone build (necessary for cross-compilation or binary releases)") SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") if (${CMAKE_CROSSCOMPILING}) SET(STANDALONE_BUILD ON) endif() 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 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp ) if (${ENABLE_SSL}) add_definitions(-DPALANTHIR_SSL_ENABLED=1) include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake) else() add_definitions(-DPALANTHIR_SSL_ENABLED=0) endif() 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 -Wno-long-long -Wno-implicit-function-declaration") # --std=c99 makes libcurl not to compile # -pedantic gives a lot of warnings on OpenSSL set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wno-long-long -Wno-variadic-macros") elseif (${MSVC}) # http://stackoverflow.com/a/6510446 foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") endforeach(flag_var) add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 -D_CRT_SECURE_NO_DEPRECATE=1 ) include_directories(${CMAKE_SOURCE_DIR}/Resources/VisualStudio) link_libraries(netapi32) 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(-DPALANTHIR_STATIC=1) else() add_definitions(-DPALANTHIR_STATIC=0) endif() if (${STANDALONE_BUILD}) add_definitions( -DPALANTHIR_STANDALONE=1 ) EmbedResources( PREPARE_DATABASE PalanthirServer/PrepareDatabase.sql PALANTHIR_EXPLORER PalanthirExplorer ) else() add_definitions( -DPALANTHIR_STANDALONE=0 -DPALANTHIR_PATH=\"${CMAKE_SOURCE_DIR}\" ) EmbedResources( PREPARE_DATABASE PalanthirServer/PrepareDatabase.sql ) endif() add_library(CoreLibrary STATIC ${AUTOGENERATED_SOURCES} ${THIRD_PARTY_SOURCES} Core/ChunkedBuffer.cpp Core/Compression/BufferCompressor.cpp Core/Compression/ZlibCompressor.cpp Core/PalanthirException.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 PalanthirCppClient/HttpClient.cpp PalanthirCppClient/HttpException.cpp ) add_library(ServerLibrary PalanthirServer/DicomIntegerPixelAccessor.cpp PalanthirServer/DicomProtocol/DicomFindAnswers.cpp PalanthirServer/DicomProtocol/DicomServer.cpp PalanthirServer/DicomProtocol/DicomUserConnection.cpp PalanthirServer/FromDcmtkBridge.cpp PalanthirServer/Internals/CommandDispatcher.cpp PalanthirServer/Internals/FindScp.cpp PalanthirServer/Internals/MoveScp.cpp PalanthirServer/Internals/StoreScp.cpp PalanthirServer/PalanthirInitialization.cpp PalanthirServer/PalanthirRestApi.cpp PalanthirServer/ServerIndex.cpp PalanthirServer/ToDcmtkBridge.cpp PalanthirServer/ToDcmtkBridge.cpp PalanthirServer/DicomIntegerPixelAccessor.cpp ) # Ensure autogenerated code is built before building ServerLibrary add_dependencies(ServerLibrary CoreLibrary) add_executable(Palanthir PalanthirServer/main.cpp ) add_executable(UnitTests ${GTEST_SOURCES} UnitTests/main.cpp UnitTests/SQLite.cpp UnitTests/SQLiteChromium.cpp UnitTests/Versions.cpp ) TARGET_LINK_LIBRARIES(Palanthir ServerLibrary CoreLibrary) TARGET_LINK_LIBRARIES(UnitTests ServerLibrary CoreLibrary) find_package(Doxygen) if (DOXYGEN_FOUND) configure_file( ${CMAKE_SOURCE_DIR}/Resources/Palanthir.doxygen ${CMAKE_CURRENT_BINARY_DIR}/Palanthir.doxygen @ONLY) add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Palanthir.doxygen WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM ) endif(DOXYGEN_FOUND)