Back to home page

EIC code displayed by LXR

 
 

    


Warning, /acts/Detray/detectors/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 message(STATUS "Building 'detray::detectors' component")
0010 
0011 # Set the common C++ flags.
0012 include(detray-compiler-options-cpp)
0013 
0014 # Set up a detector library, which contains the different detector types that
0015 # are currently available by default.
0016 file(
0017     GLOB _detray_detector_headers
0018     RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
0019     "include/detray/detectors/*.hpp"
0020 )
0021 
0022 detray_add_library( detray_detectors detectors ${_detray_detectors_headers})
0023 target_link_libraries(
0024     detray_detectors
0025     INTERFACE vecmem::core detray::core detray::io
0026 )
0027 
0028 unset(_detray_detector_headers)
0029 
0030 # Create the metadata headers
0031 if(NOT "${DETRAY_GENERATE_METADATA}" STREQUAL "")
0032     message(STATUS "Configuring detray detector types...")
0033 
0034     find_package(Python COMPONENTS Interpreter REQUIRED)
0035 
0036     set(OUTPUT_DIR
0037         "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/detray/detectors"
0038     )
0039     file(MAKE_DIRECTORY ${OUTPUT_DIR})
0040 
0041     # Generate the custom metadata headers
0042     foreach(GENERATOR ${DETRAY_GENERATE_METADATA})
0043         set(GENERATED_HEADER "${OUTPUT_DIR}/${GENERATOR}.hpp")
0044         set(GENERATOR_SCRIPT
0045             "${PROJECT_SOURCE_DIR}/detectors/python/${GENERATOR}.py"
0046         )
0047 
0048         add_custom_command(
0049             OUTPUT "${GENERATED_HEADER}"
0050             COMMAND
0051                 ${CMAKE_CURRENT_SOURCE_DIR}/generate_metadata.sh -m
0052                 ${GENERATOR_SCRIPT} -o ${OUTPUT_DIR} -p ${CMAKE_BINARY_DIR}
0053             DEPENDS
0054                 "${GENERATOR_SCRIPT}"
0055                 "${PROJECT_SOURCE_DIR}/detectors/generate_metadata.sh"
0056                 "${CMAKE_BINARY_DIR}/python/setup.sh"
0057         )
0058 
0059         add_custom_target(
0060             ${GENERATOR}_generation
0061             ALL
0062             DEPENDS ${GENERATED_HEADER}
0063         )
0064 
0065         # Set up how clients should find its headers.
0066         target_include_directories(
0067             detray_detectors
0068             INTERFACE
0069                 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include>
0070                 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
0071         )
0072 
0073         install(
0074             DIRECTORY
0075                 "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/"
0076             DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
0077             OPTIONAL
0078         )
0079 
0080         add_dependencies(detray_detectors ${GENERATOR}_generation)
0081 
0082         message(STATUS "Creating metadata: ${GENERATOR}")
0083     endforeach()
0084 endif()