Warning, /geant4/examples/extended/medical/DICOM2/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001
0002 #----------------------------------------------------------------------------
0003 # Setup the project
0004 cmake_minimum_required(VERSION 3.16...3.27)
0005 project(DICOM2)
0006
0007 #----------------------------------------------------------------------------
0008 # Find Geant4 package, activating all available UI and Vis drivers by default
0009 # You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
0010 # to build a batch mode only executable
0011 #
0012 option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
0013 if(WITH_GEANT4_UIVIS)
0014 find_package(Geant4 REQUIRED ui_all vis_all)
0015 else()
0016 find_package(Geant4 REQUIRED)
0017 endif()
0018
0019 # append CMAKE_PREFIX_PATH to help find DICOM in recommended installation
0020 # location (${Geant4_DIR}) and the location found when testing
0021 if(NOT DEFINED DICOM_DIR)
0022 # recommended installation place
0023 list(APPEND CMAKE_PREFIX_PATH ${Geant4_DIR})
0024 # found here when internally testing
0025 list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/../DICOM")
0026 endif()
0027
0028 # find DICOM package
0029 find_package(DICOM REQUIRED)
0030
0031 #----------------------------------------------------------------------------
0032 # Setup Geant4 include directories and compile definitions
0033 # Setup include directory for this project
0034 #
0035 include(${Geant4_USE_FILE})
0036 include_directories(${PROJECT_SOURCE_DIR}/include ${DICOM_INCLUDE_DIRS})
0037
0038 #----------------------------------------------------------------------------
0039 # Locate sources and headers for this project
0040 # NB: headers are included so they will show up in IDEs
0041 #
0042 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0043 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0044
0045 #----------------------------------------------------------------------------
0046 # Add the executable, and link it to the Geant4 libraries
0047 #
0048 add_executable(dicom2 dicom2.cc ${sources} ${headers})
0049 target_link_libraries(dicom2 ${Geant4_LIBRARIES} ${DICOM_LIBRARIES})
0050
0051 #----------------------------------------------------------------------------
0052 # Copy all scripts to the build directory, i.e. the directory in which we
0053 # build B1. This is so that we can run the executable directly because it
0054 # relies on these scripts being in the current working directory.
0055 #
0056 # the macros
0057 set(DICOM_MACROS run.mac vis.mac)
0058
0059 # original set of DICOM data
0060 set(DICOM_SCRIPTS
0061 1.dcm 2.dcm 3.dcm
0062 1.g4 2.g4 3.g4
0063 1.g4dcm 2.g4dcm 3.g4dcm
0064 ColourMap.dat CT2Density.dat
0065 Data.dat.new Data.dat.old
0066 Data.dat.new_dens Data.partial.dat
0067 )
0068
0069 foreach(_script ${DICOM_SCRIPTS})
0070 configure_file(
0071 ${PROJECT_SOURCE_DIR}/data/${_script}
0072 ${PROJECT_BINARY_DIR}/${_script}
0073 COPYONLY)
0074 endforeach()
0075
0076 if(DICOM_USE_DCMTK)
0077 configure_file(${PROJECT_SOURCE_DIR}/data/Data.dat.new
0078 ${PROJECT_BINARY_DIR}/Data.dat COPYONLY)
0079 else()
0080 configure_file(${PROJECT_SOURCE_DIR}/data/Data.dat.old
0081 ${PROJECT_BINARY_DIR}/Data.dat COPYONLY)
0082 endif()
0083
0084 foreach(_script ${DICOM_MACROS})
0085 configure_file(
0086 ${PROJECT_SOURCE_DIR}/${_script}
0087 ${PROJECT_BINARY_DIR}/${_script}
0088 COPYONLY)
0089 endforeach()
0090
0091 #----------------------------------------------------------------------------
0092 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0093 #
0094 install(TARGETS dicom2 DESTINATION bin)