Warning, /DD4hep/examples/OpticalSurfaces/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 #==========================================================================
0002 # AIDA Detector description implementation
0003 #--------------------------------------------------------------------------
0004 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 # All rights reserved.
0006 #
0007 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 #
0010 #==========================================================================
0011 cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
0012
0013 IF(NOT TARGET DD4hep::DDCore)
0014 find_package ( DD4hep REQUIRED )
0015 include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
0016 include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
0017 dd4hep_configure_output()
0018 ENDIF()
0019
0020 dd4hep_set_compiler_flags()
0021 #==========================================================================
0022 dd4hep_print("|++> OpticalSurfaces: ROOT version: ${ROOT_VERSION}")
0023
0024 if(NOT ${ROOT_VERSION} VERSION_GREATER_EQUAL 6.18.00)
0025 dd4hep_print("|++> Not building optical surface test")
0026 return()
0027 endif()
0028 dd4hep_print("|++> Building optical surface test")
0029
0030 #--------------------------------------------------------------------------
0031 dd4hep_configure_output()
0032
0033 set(OpticalSurfaces_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/OpticalSurfaces)
0034 dd4hep_add_plugin(OpticalSurfacesExample SOURCES src/*.cpp
0035 USES DD4hep::DDCore DD4hep::DDCond ROOT::Core ROOT::Geom ROOT::GenVector ROOT::MathCore)
0036 install(TARGETS OpticalSurfacesExample LIBRARY DESTINATION lib)
0037 install(DIRECTORY compact scripts DESTINATION ${OpticalSurfaces_INSTALL} )
0038 dd4hep_configure_scripts( OpticalSurfaces DEFAULT_SETUP WITH_TESTS)
0039
0040 #
0041 #---Testing: Load ROOT GDMLMatrix objects from compact
0042 # and register them to the TGeoManager
0043 dd4hep_add_test_reg( Surfaces_read_GDMLMatrices
0044 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_OpticalSurfaces.sh"
0045 EXEC_ARGS geoPluginRun -volmgr -destroy
0046 -compact file:${OpticalSurfaces_INSTALL}/compact/ReadGDMLMatrices.xml
0047 -plugin DD4hep_Dump_GDMLTables
0048 REGEX_PASS "Successfully dumped 2 GDML tables with 42 elements."
0049 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0050 )
0051 #
0052 #---Testing: Load ROOT TGeoOpticalSurface objects from compact
0053 # and register them to the TGeoManager
0054 dd4hep_add_test_reg( Surfaces_read_OpticalSurfaces
0055 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_OpticalSurfaces.sh"
0056 EXEC_ARGS geoPluginRun -volmgr -destroy
0057 -compact file:${OpticalSurfaces_INSTALL}/compact/ReadOpticalSurfaces.xml
0058 -plugin DD4hep_Dump_GDMLTables
0059 -plugin DD4hep_Dump_OpticalSurfaces
0060 REGEX_PASS "Successfully dumped 2 Optical surfaces."
0061 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0062 )
0063 #
0064 #---Testing: Load ROOT material properties and dump material
0065 dd4hep_add_test_reg( Surfaces_read_MaterialProperties
0066 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_OpticalSurfaces.sh"
0067 EXEC_ARGS geoPluginRun -volmgr -destroy -print INFO
0068 -compact file:${OpticalSurfaces_INSTALL}/compact/ReadMaterialProperties.xml
0069 -plugin DD4hep_MaterialTable -name Water
0070 REGEX_PASS "Property: SLOWCOMPONENT \\[32 x 2\\] --> SLOWCOMPONENT__0x123aff00"
0071 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0072 )
0073 #
0074 # This plugins depends on the ROOT GDML readers. Hence, extra library
0075 IF(TARGET ROOT::Gdml)
0076 #---Testing: Load OpNovice and dump it to GDML
0077 dd4hep_add_test_reg( Surfaces_OpNovice_write_gdml
0078 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_OpticalSurfaces.sh"
0079 EXEC_ARGS geoPluginRun -volmgr -destroy
0080 -compact file:${OpticalSurfaces_INSTALL}/compact/OpNovice.xml
0081 -plugin DD4hep_ROOTGDMLExtract -output OpNovice.gdml -path /world/BubbleDevice
0082 REGEX_PASS "File OpNovice.gdml saved"
0083 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0084 )
0085 #
0086 #
0087 if ( "${ROOT_VERSION}" VERSION_GREATER_EQUAL "6.19.01" )
0088 #
0089 #---Testing: Load GDML and dump volumes
0090 dd4hep_add_test_reg( Surfaces_OpNovice_read_gdml
0091 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_OpticalSurfaces.sh"
0092 EXEC_ARGS geoPluginRun -volmgr -destroy
0093 -compact file:${OpticalSurfaces_INSTALL}/compact/OpNovice_gdml.xml
0094 -print INFO -destroy -volmgr
0095 -plugin DD4hep_ROOTGDMLParse -input OpNovice.gdml -path /world/BubbleDevice
0096 -plugin DD4hep_VolumeDump
0097 DEPENDS Surfaces_OpNovice_write_gdml
0098 REGEX_PASS "\\+\\+\\+ Checked 5 physical volume placements."
0099 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0100 )
0101 endif()
0102 ELSE()
0103 dd4hep_print("ROOT does not include GDML, not building OpticalSurfaces GDML tests")
0104 ENDIF()
0105 #