Warning, /acts/Python/Examples/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 set(_python_dir "${CMAKE_BINARY_DIR}/python")
0002 file(MAKE_DIRECTORY ${_python_dir})
0003 file(MAKE_DIRECTORY ${_python_dir}/acts)
0004
0005 set(_python_install_dir "python/acts/examples")
0006
0007 macro(
0008 add_examples_binding_if
0009 _name
0010 _link_libraries
0011 _add_dependencies
0012 _flag
0013 _plugin_import
0014 )
0015 # Create a lower case name version
0016 string(TOLOWER ${_name} _name_lower)
0017
0018 if(${_flag})
0019 # automatically populate the init file with actually built modules
0020 #list(APPEND _plugins_built "'${_name_lower}'")
0021 # automatically prefix the target name
0022 set(_target "ActsExamplesPythonBindings${_name}")
0023 pybind11_add_module(${_target} src/${_name}.cpp)
0024
0025 install(TARGETS ${_target} DESTINATION ${_python_install_dir})
0026
0027 set_target_properties(
0028 ${_target}
0029 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0030 )
0031 set_target_properties(
0032 ${_target}
0033 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts/examples
0034 )
0035
0036 target_link_libraries(
0037 ${_target}
0038 PUBLIC Acts::Core Acts::PythonUtilities ${_link_libraries}
0039 )
0040 # Add the dependencies
0041 add_dependencies(ActsPythonBindings ${_target})
0042 foreach(_dep IN LISTS ${_add_dependencies})
0043 add_dependencies(${_dep} ${_target})
0044 endforeach()
0045 endif()
0046
0047 set(EXAMPLE_NAME "${_name}")
0048 set(EXAMPLE_BUILD_FLAG "${_flag}")
0049 set(PLUGIN_IMPORT "")
0050 if(${_plugin_import})
0051 set(PLUGIN_IMPORT "from acts import ${_name_lower}")
0052 endif()
0053
0054 configure_file(
0055 ${CMAKE_CURRENT_SOURCE_DIR}/python/example.py.in
0056 ${_python_dir}/acts/examples/${_name_lower}.py
0057 @ONLY
0058 )
0059 install(
0060 FILES ${_python_dir}/acts/examples/${_name_lower}.py
0061 DESTINATION ${_python_install_dir}
0062 )
0063 endmacro()
0064
0065 add_examples_binding_if(DD4hep Acts::ExamplesDetectorDD4hep "" ACTS_BUILD_EXAMPLES_DD4HEP TRUE)
0066 add_examples_binding_if(EDM4hep Acts::ExamplesIoEDM4hep "" ACTS_BUILD_EXAMPLES_EDM4HEP FALSE)
0067 add_examples_binding_if(Geant4
0068 "Acts::ExamplesGeant4;Acts::ExamplesDetectorGeant4;Acts::ExamplesMuonSpectrometerMockupDetector"
0069 ""
0070 ACTS_BUILD_EXAMPLES_GEANT4
0071 TRUE
0072 )