Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/medical/dna/dnadamage1/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 #----------------------------------------------------------------------------
0002 # Setup the project
0003 cmake_minimum_required(VERSION 3.16...3.27)
0004 project(dnadamage1)
0005 
0006 #----------------------------------------------------------------------------
0007 # Find Geant4 package, activating all available Vis drivers by default
0008 # You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
0009 # to build a batch mode only executable
0010 #
0011 option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
0012 if(WITH_GEANT4_VIS)
0013   find_package(Geant4 REQUIRED vis_all)
0014 else()
0015   find_package(Geant4 REQUIRED)
0016 endif()
0017 
0018 #----------------------------------------------------------------------------
0019 # Setup Geant4 include directories and compile definitions
0020 #
0021 include(${Geant4_USE_FILE})
0022 
0023 #----------------------------------------------------------------------------
0024 # Dowload geometry data file
0025 
0026 set(GEOMETRY_NEEDS_DOWNLOAD TRUE)
0027 set(GEOMETRY_FILE_NAME "VoxelStraight.fab2g4dna")
0028 set(GEOMETRY_LOCAL_FILENAME "${PROJECT_BINARY_DIR}/${GEOMETRY_FILE_NAME}")
0029 set(GEOMETRY_DATASETS_URL 
0030 "https://cern.ch/geant4-data/examples/dna/dnadamage1/${GEOMETRY_FILE_NAME}")
0031 set(HASH_MD5 "3e28151dc4c4647af3ae37d0385fc443")
0032 
0033 if(EXISTS "${GEOMETRY_FILE_NAME}")
0034   set(GEOMETRY_NEEDS_DOWNLOAD FALSE)
0035 endif()
0036 
0037 
0038 if(GEOMETRY_NEEDS_DOWNLOAD)
0039   message(STATUS "Geometry-data: attempting download: ${GEOMETRY_DATASETS_URL}")
0040   file(DOWNLOAD "${GEOMETRY_DATASETS_URL}" "${GEOMETRY_LOCAL_FILENAME}"
0041     INACTIVITY_TIMEOUT 50
0042     TIMEOUT 50
0043     STATUS DownloadStatus
0044     )
0045 
0046   list(GET DownloadStatus 0 DownloadReturnStatus)
0047   if(DownloadReturnStatus)
0048     message(STATUS "Geometry-data: download FAILED: ${DownloadReturnStatus}, 
0049     This example needs internet for the geometry data file,
0050     even configuring done and complied. 
0051     Please, check your connection.
0052     ")
0053   else()
0054     message(STATUS "Geometry-data: download OK")
0055   endif()
0056 endif()
0057 
0058 #----------------------------------------------------------------------------
0059 # Locate sources and headers for this project
0060 #
0061 
0062 include_directories(${PROJECT_SOURCE_DIR}/include
0063                     ${Geant4_INCLUDE_DIR})
0064 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0065 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0066 
0067 #----------------------------------------------------------------------------
0068 # Add the executable, and link it to the Geant4 libraries
0069 #
0070 add_executable(dnadamage1 dnadamage1.cc ${sources} ${headers})
0071 target_link_libraries(dnadamage1 ${Geant4_LIBRARIES} )
0072 
0073 #----------------------------------------------------------------------------
0074 # Copy all scripts to the build directory, i.e. the directory in which we
0075 # build dnadamage1. This is so that we can run the executable directly because it
0076 # relies on these scripts being in the current working directory.
0077 #
0078 
0079 file(GLOB MAC_FILES ${PROJECT_SOURCE_DIR}/*.mac 
0080      ${PROJECT_SOURCE_DIR}/*.in
0081      ${PROJECT_SOURCE_DIR}/*.C
0082      ${PROJECT_SOURCE_DIR}/include/DNAVolumeType.hh
0083      ${PROJECT_SOURCE_DIR}/*.fab2g4dna)
0084 
0085 foreach(_script ${MAC_FILES})
0086   configure_file(
0087     ${_script}
0088     ${PROJECT_BINARY_DIR}/.
0089     COPYONLY
0090     )
0091 endforeach()
0092 
0093 #----------------------------------------------------------------------------
0094 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0095 #
0096 install(TARGETS dnadamage1 DESTINATION bin)
0097 
0098