comparison 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
comparison
equal deleted inserted replaced
5187:9466c95f70c8 5188:4c6f0211caaf
40 set(ENABLE_LOCALE ON) 40 set(ENABLE_LOCALE ON)
41 set(ENABLE_LUA ON) 41 set(ENABLE_LUA ON)
42 set(ENABLE_OPENSSL_ENGINES ON) # OpenSSL engines are necessary for PKCS11 42 set(ENABLE_OPENSSL_ENGINES ON) # OpenSSL engines are necessary for PKCS11
43 set(ENABLE_PNG ON) 43 set(ENABLE_PNG ON)
44 set(ENABLE_PROTOBUF ON) 44 set(ENABLE_PROTOBUF ON)
45 set(ENABLE_PROTOBUF_COMPILER ON)
45 set(ENABLE_PUGIXML ON) 46 set(ENABLE_PUGIXML ON)
46 set(ENABLE_SQLITE ON) 47 set(ENABLE_SQLITE ON)
47 set(ENABLE_WEB_CLIENT ON) 48 set(ENABLE_WEB_CLIENT ON)
48 set(ENABLE_WEB_SERVER ON) 49 set(ENABLE_WEB_SERVER ON)
49 set(ENABLE_ZLIB ON) 50 set(ENABLE_ZLIB ON)
360 361
361 ##################################################################### 362 #####################################################################
362 ## Build the core of Orthanc 363 ## Build the core of Orthanc
363 ##################################################################### 364 #####################################################################
364 365
366 add_custom_target(AutogeneratedTarget
367 DEPENDS
368 ${AUTOGENERATED_SOURCES}
369 )
370
365 # "CoreLibrary" contains all the third-party dependencies and the 371 # "CoreLibrary" contains all the third-party dependencies and the
366 # content of the "Core" folder 372 # content of the "OrthancFramework" folder
367 add_library(CoreLibrary 373 add_library(CoreLibrary
368 STATIC 374 STATIC
369 ${ORTHANC_CORE_PCH} 375 ${ORTHANC_CORE_PCH}
370 ${ORTHANC_CORE_SOURCES} 376 ${ORTHANC_CORE_SOURCES}
371 ${ORTHANC_DICOM_SOURCES} 377 ${ORTHANC_DICOM_SOURCES}
372 ${AUTOGENERATED_SOURCES} 378 ${AUTOGENERATED_SOURCES}
373 ) 379 )
374 380
381 add_dependencies(CoreLibrary AutogeneratedTarget)
382
375 if (LIBICU_LIBRARIES) 383 if (LIBICU_LIBRARIES)
376 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) 384 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES})
377 endif() 385 endif()
378 386
379 387
380 ##################################################################### 388 #####################################################################
381 ## Build the Orthanc server 389 ## Build the Orthanc server
382 ##################################################################### 390 #####################################################################
391
392 if (ENABLE_PLUGINS)
393 add_custom_command(
394 COMMAND
395 ${PROTOC_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto --cpp_out=${AUTOGENERATED_DIR} -I${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc
396 DEPENDS
397 ProtobufCompiler
398 ${CMAKE_SOURCE_DIR}/Plugins/Include/orthanc/OrthancDatabasePlugin.proto
399 OUTPUT
400 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc
401 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h
402 )
403
404 add_custom_target(OrthancDatabaseProtobuf
405 DEPENDS
406 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h
407 )
408
409 list(APPEND ORTHANC_SERVER_SOURCES
410 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc
411 )
412 else()
413 add_custom_target(OrthancDatabaseProtobuf)
414 endif()
383 415
384 add_library(ServerLibrary 416 add_library(ServerLibrary
385 STATIC 417 STATIC
386 ${ORTHANC_SERVER_PCH} 418 ${ORTHANC_SERVER_PCH}
387 ${ORTHANC_SERVER_SOURCES} 419 ${ORTHANC_SERVER_SOURCES}
388 ) 420 )
389 421
390 # Ensure autogenerated code is built before building ServerLibrary 422 # Ensure autogenerated code is built before building ServerLibrary
391 add_dependencies(ServerLibrary CoreLibrary) 423 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf)
392 424
393 add_executable(Orthanc 425 add_executable(Orthanc
394 ${CMAKE_SOURCE_DIR}/Sources/main.cpp 426 ${CMAKE_SOURCE_DIR}/Sources/main.cpp
395 ${ORTHANC_RESOURCES} 427 ${ORTHANC_RESOURCES}
396 ) 428 )
545 endif() 577 endif()
546 578
547 579
548 if (ENABLE_PLUGINS AND (BUILD_DELAYED_DELETION OR BUILD_CONNECTIVITY_CHECKS)) 580 if (ENABLE_PLUGINS AND (BUILD_DELAYED_DELETION OR BUILD_CONNECTIVITY_CHECKS))
549 include(ExternalProject) 581 include(ExternalProject)
550
551 endif() 582 endif()
552 583
553 584
554 ##################################################################### 585 #####################################################################
555 ## Build the "ConnectivityChecks" plugin 586 ## Build the "ConnectivityChecks" plugin