From 027b7d4d9c62d1941d9cc5ce7c654a6868234562 Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Mon, 3 Aug 2015 14:02:44 +0000 Subject: [PATCH] Fix build errors/warnings. --- DDRec/include/DDRec/DDGear.h | 6 +++--- DDRec/src/Surface.cpp | 2 +- DDRec/src/gear/DDGear.cpp | 8 ++++---- cmake/DD4hep.cmake | 6 ++++-- cmake/DD4hepBuild.cmake | 30 +++++++++++++++++++++++++---- cmake/DD4hepConfig.cmake.in | 2 +- examples/AlignDet/CMakeLists.txt | 8 +++----- examples/CLICSiD/CMakeLists.txt | 4 ++-- examples/CMakeLists.txt | 4 +++- examples/ClientTests/CMakeLists.txt | 6 ++---- 10 files changed, 49 insertions(+), 27 deletions(-) diff --git a/DDRec/include/DDRec/DDGear.h b/DDRec/include/DDRec/DDGear.h index 310ff7b17..2609b2d90 100644 --- a/DDRec/include/DDRec/DDGear.h +++ b/DDRec/include/DDRec/DDGear.h @@ -36,7 +36,7 @@ namespace DD4hep { /** User c'tor - specify a name (should be the canonical name used in gear, eg. TPCParameters, SITParameters, etc.) and the GearParametersImpl object */ - GearHandle( gear::GearParametersImpl* gearObj, const std::string& name ) : _gObj( gearObj ) , _name( name ) {} + GearHandle( gear::GearParametersImpl* gearObj, const std::string& nam ) : _gObj( gearObj ) , _name( nam ) {} /** D'tor deletes GearParametersImpl object if ownerhsip has not been taken away */ virtual ~GearHandle() { @@ -59,9 +59,9 @@ namespace DD4hep { /// add a SimpleMaterial object - void addMaterial(const std::string name, double A, double Z, double density, double radLen, double intLen){ + void addMaterial(const std::string nam, double A, double Z, double density, double radLen, double intLen){ - _materials.push_back( gear::SimpleMaterialImpl (name, A, Z, density, radLen, intLen) ) ; + _materials.push_back( gear::SimpleMaterialImpl (nam, A, Z, density, radLen, intLen) ) ; } /// get all materials assigned to this wrapper diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index 7db914be7..32a8afaac 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -783,7 +783,7 @@ namespace DD4hep { //all lengths are half length double dx1 = trapezoid->GetDx1(); double dx2 = trapezoid->GetDx2(); - double dy = trapezoid->GetDy1(); //dy1 == dy2 = thickness of the layer in CLIC + //Unused: double dy = trapezoid->GetDy1(); //dy1 == dy2 = thickness of the layer in CLIC double dz = trapezoid->GetDz(); //the normal vector is parallel to e_y for all geometry cases in CLIC diff --git a/DDRec/src/gear/DDGear.cpp b/DDRec/src/gear/DDGear.cpp index 69e2b1fdb..9a94d08fc 100644 --- a/DDRec/src/gear/DDGear.cpp +++ b/DDRec/src/gear/DDGear.cpp @@ -59,10 +59,10 @@ namespace DD4hep{ DetElement::Children grCh = subDet.children() ; - for ( DetElement::Children::const_iterator it=grCh.begin() ; it != grCh.end() ; ++it ){ - DetElement subDet = (*it).second ; - dets.push_back( subDet ) ; - // std::cout << " *** sub-subdetector : " << subDet.name() << std::endl ; + for ( DetElement::Children::const_iterator jt=grCh.begin() ; jt != grCh.end() ; ++jt ){ + DetElement subDet = (*jt).second ; + dets.push_back( subDet ) ; + // std::cout << " *** sub-subdetector : " << subDet.name() << std::endl ; } } diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index ea8831aeb..557d47b15 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -37,8 +37,10 @@ else() set ( DD4HEP_USE_BOOST OFF ) endif() # Main functional include file -include ( DD4hepBuild ) -include ( DD4hep_XML_setup ) +if ( "${DD4hepBuild_included}" STREQUAL "" ) + include ( DD4hepBuild ) + include ( DD4hep_XML_setup ) +endif() ##--------------------------------------------------------------------------------------------------- ## diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index de84714b7..bed154c93 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -12,8 +12,9 @@ #================================================================================= cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) ###set(DD4HEP_DEBUG_CMAKE 1) -message ( STATUS "INCLUDING DD4hep...." ) +message ( STATUS "INCLUDING DD4hepBuild...." ) include ( CMakeParseArguments ) +set ( DD4hepBuild_included ON ) #--------------------------------------------------------------------------------------------------- macro(dd4hep_to_parent_scope val) @@ -209,6 +210,26 @@ macro ( dd4hep_configure_output ) dd4hep_debug("|++> Installation goes to: ${CMAKE_INSTALL_PREFIX} <${ARG_INSTALL}>" ) endmacro ( dd4hep_configure_output ) +#--------------------------------------------------------------------------------------------------- +# dd4hep_list_to_string +# +# Create proper string from list +# +# \author M.Frank +# \version 1.0 +#--------------------------------------------------------------------------------------------------- +function ( dd4hep_list_to_string result ) + cmake_parse_arguments(ARG "" "PREFIX" "ENTRIES" ${ARGV} ) + set ( vals "" ) + foreach( v ${ARG_ENTRIES} ) + set ( vals "${vals} ${v}" ) + endforeach() + if ( NOT "${vals}" STREQUAL "" ) + set ( vals "${ARG_PREFIX}${vals}" ) + endif() + set ( ${result} "${vals}" PARENT_SCOPE ) +endfunction ( dd4hep_list_to_string ) + #--------------------------------------------------------------------------------------------------- # dd4hep_make_unique_list # @@ -1129,10 +1150,10 @@ endfunction() #--------------------------------------------------------------------------------------------------- macro( dd4hep_enable_tests ) cmake_parse_arguments(MACRO_ARG "" "" "" ${ARGV} ) - #dd4hep_print ( "***|++> Test environment: BUILD_TESTING:${BUILD_TESTING} DIRS:${MACRO_ARG_UNPARSED_ARGUMENTS}" ) if (BUILD_TESTING) set ( BUILDNAME "${CMAKE_SYSTEM}-${CMAKE_CXX_COMPILER}-${CMAKE_BUILD_TYPE}" CACHE STRING "set build string for cdash") - dd4hep_print ( "***|++> Enable CTest environment....BUILD:${BUILD_TESTING} DIRS:${MACRO_ARG_UNPARSED_ARGUMENTS}" ) + dd4hep_list_to_string( _dir_entries PREFIX "DIRS:" ENTRIES ${MACRO_ARG_UNPARSED_ARGUMENTS} ) + dd4hep_print ( "|++> Enable CTest environment....BUILD:${BUILD_TESTING} ${_dir_entries}" ) include(CTest) enable_testing () if ( NOT "${MACRO_ARG_UNPARSED_ARGUMENTS}" STREQUAL "" ) @@ -1149,7 +1170,8 @@ macro ( dd4hep_configure_scripts _pkg ) # PackageName is a variable required by existing LC build scripts. # Set it here and unset it at the end of the scope... set( PackageName ${_pkg} ) - dd4hep_print ( "|++> Setting up test environment for ${PackageName}: Testing:${BUILD_TESTING} Setup:${MACRO_ARG_DEFAULT_SETUP} With Tests(${WITH_TESTS}): ${MACRO_ARG_UPARSED_ARGUMENTS}" ) + dd4hep_list_to_string( _dir_entries PREFIX "DIRS:" ENTRIES ${MACRO_ARG_UNPARSED_ARGUMENTS} ) + dd4hep_print ( "|++> Setting up test environment for ${PackageName}: Testing:${BUILD_TESTING} Setup:${MACRO_ARG_DEFAULT_SETUP} With Tests(${MACRO_ARG_WITH_TESTS}): ${_dir_entries}" ) if ( (NOT "${MACRO_ARG_DEFAULT_SETUP}" STREQUAL "") OR (NOT "${_pkg}" STREQUAL "") ) configure_file( ${DD4hep_DIR}/cmake/run_test_package.sh ${EXECUTABLE_OUTPUT_PATH}/run_test_${_pkg}.sh @ONLY) INSTALL(PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/run_test_${_pkg}.sh DESTINATION bin ) diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index ef0f6ebc5..a6048c6dc 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -66,7 +66,7 @@ endif() CHECK_PACKAGE_LIBS(DD4hep DDCore) IF(DD4hep_FIND_COMPONENTS) - MESSAGE( STATUS "Looking for these Components ${DD4hep_FIND_COMPONENTS}" ) + MESSAGE( STATUS "DD4hep: Looking for Components: ${DD4hep_FIND_COMPONENTS}" ) FOREACH(comp ${DD4hep_FIND_COMPONENTS}) #CHECK_PACKAGE_LIBS is looking for components too, just need to check if they were found, if requested diff --git a/examples/AlignDet/CMakeLists.txt b/examples/AlignDet/CMakeLists.txt index ba44f6587..f923993f1 100644 --- a/examples/AlignDet/CMakeLists.txt +++ b/examples/AlignDet/CMakeLists.txt @@ -11,18 +11,16 @@ #========================================================================== cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) + #----------------------------------------------------------------------------------- dd4hep_configure_output() dd4hep_package ( AlignDet MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom] + USES [ROOT REQUIRED COMPONENTS Geom MathCore] [DD4hep REQUIRED COMPONENTS DDCore] OPTIONAL XERCESC INCLUDE_DIRS include ) dd4hep_add_plugin( AlignDet SOURCES src/*.cpp ) -dd4hep_configure_scripts( AlignDet DEFAULT_SETUP ) dd4hep_install_dir( compact DESTINATION examples/AlignDet ) -# -#---Testing------------------------------------------------------------------------- -dd4hep_enable_tests() +dd4hep_configure_scripts( AlignDet DEFAULT_SETUP WITH_TESTS) diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt index 450770f22..88c947029 100644 --- a/examples/CLICSiD/CMakeLists.txt +++ b/examples/CLICSiD/CMakeLists.txt @@ -18,10 +18,10 @@ dd4hep_package ( CLICSiD MAJOR 0 MINOR 0 PATCH 1 USES [ROOT REQUIRED COMPONENTS Geom] [DD4hep REQUIRED COMPONENTS DDCore] ) -dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP ) dd4hep_install_dir( compact DESTINATION examples/CLICSiD ) #---Testing------------------------------------------------------------------------- -dd4hep_enable_tests() +dd4hep_configure_scripts ( CLICSiD 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_CLICSiD_${typ}" diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index cb2c22ab4..3f22d95fd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -29,6 +29,8 @@ find_package ( DD4hep REQUIRED ) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) # dd4hep_package ( DD4hepExample MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom] ) + USES [ROOT REQUIRED COMPONENTS Geom MathCore] + [DD4hep REQUIRED COMPONENTS DDCore] +) # dd4hep_enable_tests ( AlignDet CLICSiD ClientTests SimpleDetector ) diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index a14507e29..ecccd9e38 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -15,7 +15,7 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #----------------------------------------------------------------------------------- dd4hep_configure_output() dd4hep_package (ClientTests MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom] + USES [ROOT REQUIRED COMPONENTS Geom MathCore] [DD4hep REQUIRED COMPONENTS DDCore] OPTIONAL XERCESC INCLUDE_DIRS include ) @@ -23,11 +23,9 @@ dd4hep_package (ClientTests MAJOR 0 MINOR 0 PATCH 1 dd4hep_add_plugin( ClientTests SOURCES src/*.cpp ) dd4hep_install_dir( compact scripts DESTINATION ${DD4hep_DIR}/examples/ClientTests ) #----------------------------------------------------------------------------------- -dd4hep_configure_scripts( ClientTests DEFAULT_SETUP ) +dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS) #*** Testing ********************************************************************* -dd4hep_enable_tests() -#----------------------------------------------------------------------------------- foreach (test Assemblies BoxTrafos IronCylinder LheD_tracker MagnetFields MaterialTester MiniTel SectorBarrelCalorimeter SiliconBlock NestedDetectors ) foreach( type lcdd gdml vis ) dd4hep_add_test_reg( ClientTests_converter_simple_${type}_${test} -- GitLab