Mercurial > hg > orthanc
diff OrthancServer/CMakeLists.txt @ 5188:4c6f0211caaf db-protobuf
compiling the protobuf compiler
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 26 Mar 2023 21:09:13 +0200 |
parents | 9466c95f70c8 |
children | 50c4a18caa85 |
line wrap: on
line diff
--- a/OrthancServer/CMakeLists.txt Sun Mar 26 11:59:03 2023 +0200 +++ b/OrthancServer/CMakeLists.txt Sun Mar 26 21:09:13 2023 +0200 @@ -42,6 +42,7 @@ set(ENABLE_OPENSSL_ENGINES ON) # OpenSSL engines are necessary for PKCS11 set(ENABLE_PNG ON) set(ENABLE_PROTOBUF ON) +set(ENABLE_PROTOBUF_COMPILER ON) set(ENABLE_PUGIXML ON) set(ENABLE_SQLITE ON) set(ENABLE_WEB_CLIENT ON) @@ -362,8 +363,13 @@ ## Build the core of Orthanc ##################################################################### +add_custom_target(AutogeneratedTarget + DEPENDS + ${AUTOGENERATED_SOURCES} + ) + # "CoreLibrary" contains all the third-party dependencies and the -# content of the "Core" folder +# content of the "OrthancFramework" folder add_library(CoreLibrary STATIC ${ORTHANC_CORE_PCH} @@ -372,6 +378,8 @@ ${AUTOGENERATED_SOURCES} ) +add_dependencies(CoreLibrary AutogeneratedTarget) + if (LIBICU_LIBRARIES) target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) endif() @@ -381,6 +389,30 @@ ## Build the Orthanc server ##################################################################### +if (ENABLE_PLUGINS) + add_custom_command( + COMMAND + ${PROTOC_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto --cpp_out=${AUTOGENERATED_DIR} -I${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc + DEPENDS + ProtobufCompiler + ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto + OUTPUT + ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc + ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h + ) + + add_custom_target(OrthancDatabaseProtobuf + DEPENDS + ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h + ) + + list(APPEND ORTHANC_SERVER_SOURCES + ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc + ) +else() + add_custom_target(OrthancDatabaseProtobuf) +endif() + add_library(ServerLibrary STATIC ${ORTHANC_SERVER_PCH} @@ -388,7 +420,7 @@ ) # Ensure autogenerated code is built before building ServerLibrary -add_dependencies(ServerLibrary CoreLibrary) +add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf) add_executable(Orthanc ${CMAKE_SOURCE_DIR}/Sources/main.cpp @@ -547,7 +579,6 @@ if (ENABLE_PLUGINS AND (BUILD_DELAYED_DELETION OR BUILD_CONNECTIVITY_CHECKS)) include(ExternalProject) - endif()