Warning, /acts/Python/Plugins/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # This macro adds the plugin binding as a separate library if configured to be built.
0002 # The plugin is then added to the _plugins_built list which is propagated to the parent scope
0003 # and used to populate the __init__.py file automatically.
0004 macro(add_plugin_binding_if _name _dependency _flag)
0005 string(TOLOWER ${_name} _name_lower)
0006
0007 if(${_flag})
0008 # automatically populate the init file with actually built modules
0009 list(APPEND _plugins_built "'${_name_lower}'")
0010 # automatically prefix the target name
0011 set(_target "ActsPluginsPythonBindings${_name}")
0012 pybind11_add_module(${_target} src/${_name}.cpp)
0013
0014 install(TARGETS ${_target} DESTINATION ${_python_install_dir})
0015
0016 set_target_properties(
0017 ${_target}
0018 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0019 )
0020 set_target_properties(
0021 ${_target}
0022 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0023 )
0024
0025 target_link_libraries(
0026 ${_target}
0027 PUBLIC Acts::Core Acts::PythonUtilities ${_dependency}
0028 )
0029 add_dependencies(ActsPythonBindings ${_target})
0030 endif()
0031
0032 set(PLUGIN_NAME "${_name}")
0033 set(PLUGIN_BUILD_FLAG "${_flag}")
0034
0035 configure_file(
0036 ${CMAKE_CURRENT_SOURCE_DIR}/python/plugin.py.in
0037 ${_python_dir}/acts/${_name_lower}.py
0038 @ONLY
0039 )
0040 install(
0041 FILES ${_python_dir}/acts/${_name_lower}.py
0042 DESTINATION ${_python_install_dir}
0043 )
0044 endmacro()
0045
0046 add_plugin_binding_if(Covfie Acts::PluginCovfie ACTS_BUILD_PLUGIN_TRACCC)
0047 add_plugin_binding_if(Detray Acts::PluginDetray ACTS_BUILD_PLUGIN_TRACCC)
0048 add_plugin_binding_if(DD4hep ActsPluginDD4hep ACTS_BUILD_PLUGIN_DD4HEP)
0049 add_plugin_binding_if(Geant4 ActsPluginGeant4 ACTS_BUILD_PLUGIN_GEANT4)
0050 add_plugin_binding_if(GeoModel Acts::PluginGeoModel ACTS_BUILD_PLUGIN_GEOMODEL)
0051 add_plugin_binding_if(Hashing Acts::PluginHashing ACTS_BUILD_PLUGIN_HASHING)
0052 add_plugin_binding_if(Json Acts::PluginJson ACTS_BUILD_PLUGIN_JSON)
0053 add_plugin_binding_if(Svg Acts::PluginActSVG ACTS_BUILD_PLUGIN_ACTSVG)
0054 add_plugin_binding_if(TGeo Acts::PluginRoot ACTS_BUILD_PLUGIN_ROOT)
0055 add_plugin_binding_if(Root Acts::PluginRoot ACTS_BUILD_PLUGIN_ROOT)
0056
0057 # Propagate the list of built plugins to the parent scope
0058 set(_plugins_built "${_plugins_built}" PARENT_SCOPE)