Skip to content
Snippets Groups Projects
Commit 50ed1acc authored by Nikiforos Nikiforou's avatar Nikiforos Nikiforou
Browse files

CMake fix for SimpleDetector example

parent 2bfbde72
No related branches found
No related tags found
No related merge requests found
......@@ -36,5 +36,4 @@ dd4hep_package ( DD4hepExample MAJOR 0 MINOR 0 PATCH 1
[DD4hep REQUIRED COMPONENTS DDCore]
)
#
dd4hep_enable_tests ( AlignDet CLICSiD ClientTests )
###SimpleDetector )
dd4hep_enable_tests ( AlignDet CLICSiD ClientTests SimpleDetector )
......@@ -10,125 +10,22 @@
#
#==========================================================================
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
#---------------------------
set( PackageName SimpleDetector )
#---------------------------
project(${PackageName})
# project version
SET( ${PackageName}_VERSION_MAJOR 0 )
SET( ${PackageName}_VERSION_MINOR 0 )
SET( ${PackageName}_VERSION_PATCH 1 )
SET( ${PackageName}_VERSION "${${PackageName}_VERSION_MAJOR}.${${PackageName}_VERSION_MINOR}" )
SET( ${PackageName}_SOVERSION "${${PackageName}_VERSION_MAJOR}.${${PackageName}_VERSION_MINOR}" )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake )
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
#------------- set the default installation directory to be the source directory
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET( CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH
"install prefix path - overwrite with -D CMAKE_INSTALL_PREFIX = ..."
FORCE )
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX} - overwrite with -D CMAKE_INSTALL_PREFIX" )
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
find_package( DD4hep REQUIRED COMPONENTS DDRec )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_DIR}/cmake )
include( DD4hep )
find_package( ROOT REQUIRED )
set( ROOT_COMPONENT_LIBRARIES Geom )
#-------------------------------------------------------------
# add additional packages here
include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
#-----------------------------------------------------------------------------------
dd4hep_configure_output ()
dd4hep_package ( SimpleDetector MAJOR 0 MINOR 0 PATCH 1
USES [ROOT REQUIRED COMPONENTS Geom]
[DD4hep REQUIRED COMPONENTS DDCore]
)
dd4hep_install_dir( compact DESTINATION examples/SimpleDetector )
#---Testing-------------------------------------------------------------------------
if(BUILD_TESTING)
include(CTest)
enable_testing()
endif(BUILD_TESTING)
configure_file( ${DD4hep_DIR}/cmake/run_test_package.sh run_test_${PackageName}.sh @ONLY)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/run_test_${PackageName}.sh
DESTINATION bin )
#-------------------------------------------------------------
include_directories( ${CMAKE_SOURCE_DIR}/include
include
${DD4hep_INCLUDE_DIRS}
${ROOT_INCLUDE_DIR}
)
file(GLOB sources src/*.cpp )
include(DD4hep_XML_setup)
add_library(${PackageName} SHARED ${sources})
target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} ${DD4hep_COMPONENT_LIBRARIES} ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} )
#---Rootmap generation--------------------------------------------------------------
if(APPLE)
dd4hep_generate_rootmap_apple(${PackageName} )
else()
dd4hep_generate_rootmap(${PackageName} )
endif()
#---- configure run environment ---------------
configure_file( ${DD4hep_DIR}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh
DESTINATION bin
)
#--- install target-------------------------------------
install(TARGETS ${PackageName}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
install(DIRECTORY compact
DESTINATION examples/${PackageName}
PATTERN ".svn" EXCLUDE )
#install(DIRECTORY scripts
# DESTINATION examples/${PackageName}
# PATTERN ".svn" EXCLUDE )
# to do: add corresponding uninstall...
#-------------------------------------------------------
####################################
#
# Add Tests here
#
####################################
SET( test_name "test_converter_simple_lcdd" )
ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
geoConverter -compact2lcdd -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml -output file:Simple_ILD.lcdd )
#----- here we simply require that at least 100 volumes have been converted
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION " Handled [0-9]?[0-9][0-9]+ volumes" )
SET( test_name "test_converter_simple_gdml" )
ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
geoConverter -compact2gdml -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml -output file:Simple_ILD.gdml )
#----- here we simply require that at least 100 volumes have been converted
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION " Handled [0-9]?[0-9][0-9]+ volumes" )
SET( test_name "test_converter_simple_vis" )
ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
geoConverter -compact2vis -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml -output file:Simple_ILD.vis )
#----- here we simply require that at least 100 volumes have been converted
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION " Handled [0-9]?[0-9][0-9]+ volumes" )
SET( test_name "test_simulation_simple" )
ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
dd_sim file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml file:${CMAKE_CURRENT_SOURCE_DIR}/examples/sequences.xml )
#----- here we simply require that at least 100 volumes have been converted
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "Event 9 Begin event action")
dd4hep_configure_scripts ( SimpleDetector DEFAULT_SETUP WITH_TESTS )
#----- Tests for CLICSid: here we simply require that at least 100 volumes have been converted
foreach ( typ lcdd gdml vis )
dd4hep_add_test_reg ( "test_converter_SimpleDetector_${typ}"
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_SimpleDetector.sh"
EXEC_ARGS geoConverter -compact2${typ} -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/compact.xml -output file:SimpleDetector.${typ}
REGEX_PASS " Handled [1-9][0-9][0-9]+ volumes" )
endforeach()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment