Warning, /acts/Examples/Python/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 acts_add_library(PythonUtilities INTERFACE)
0002 target_include_directories(ActsPythonUtilities INTERFACE include)
0003
0004 set(_python_dir "${CMAKE_BINARY_DIR}/python")
0005 file(MAKE_DIRECTORY ${_python_dir})
0006 file(MAKE_DIRECTORY ${_python_dir}/acts)
0007
0008 set(_python_install_dir "python/acts")
0009
0010 pybind11_add_module(ActsPythonBindings
0011 src/ModuleEntry.cpp
0012 src/Framework.cpp
0013 src/Base.cpp
0014 src/Alignment.cpp
0015 src/Detector.cpp
0016 src/Digitization.cpp
0017 src/Material.cpp
0018 src/Geometry.cpp
0019 src/GeometryBuildingGen1.cpp
0020 src/Blueprint.cpp
0021 src/ExampleAlgorithms.cpp
0022 src/MagneticField.cpp
0023 src/Output.cpp
0024 src/Input.cpp
0025 src/Propagation.cpp
0026 src/Navigation.cpp
0027 src/Generators.cpp
0028 src/Obj.cpp
0029 src/TruthTracking.cpp
0030 src/TrackFitting.cpp
0031 src/TrackFinding.cpp
0032 src/Vertexing.cpp
0033 src/AmbiguityResolution.cpp
0034 src/EventData.cpp
0035 src/Utilities.cpp
0036 )
0037 install(TARGETS ActsPythonBindings DESTINATION ${_python_install_dir})
0038
0039 set_target_properties(
0040 ActsPythonBindings
0041 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0042 )
0043 set_target_properties(
0044 ActsPythonBindings
0045 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0046 )
0047
0048 target_link_libraries(
0049 ActsPythonBindings
0050 PUBLIC
0051 Acts::PythonUtilities
0052 Acts::ExamplesFramework
0053 Acts::ExamplesGeometry
0054 Acts::ExamplesDetectorGeneric
0055 Acts::ExamplesDetectorTGeo
0056 Acts::ExamplesMagneticField
0057 Acts::ExamplesIoCsv
0058 Acts::ExamplesIoObj
0059 Acts::ExamplesIoJson
0060 Acts::ExamplesGenerators
0061 Acts::ExamplesPrinters
0062 Acts::ExamplesTrackFinding
0063 Acts::ExamplesTrackFitting
0064 Acts::ExamplesVertexing
0065 Acts::ExamplesFatras
0066 Acts::ExamplesDetectorTelescope
0067 Acts::ExamplesUtilities
0068 Acts::ExamplesAmbiguityResolution
0069 Acts::ExamplesTruthTracking
0070 Acts::ExamplesDigitization
0071 Acts::ExamplesPropagation
0072 Acts::ExamplesMaterialMapping
0073 )
0074
0075 set(py_files
0076 __init__.py
0077 examples/__init__.py
0078 examples/simulation.py
0079 examples/reconstruction.py
0080 examples/itk.py
0081 examples/odd.py
0082 _adapter.py
0083 )
0084
0085 if(ACTS_BUILD_EXAMPLES_ROOT)
0086 target_link_libraries(ActsPythonBindings PUBLIC Acts::ExamplesIoRoot)
0087 target_sources(
0088 ActsPythonBindings
0089 PRIVATE src/RootInput.cpp src/RootOutput.cpp
0090 )
0091 else()
0092 target_sources(ActsPythonBindings PRIVATE src/RootStub.cpp)
0093 endif()
0094
0095 if(ACTS_BUILD_PLUGIN_JSON)
0096 target_link_libraries(ActsPythonBindings PUBLIC Acts::PluginJson)
0097 target_sources(ActsPythonBindings PRIVATE src/Json.cpp)
0098 else()
0099 target_sources(ActsPythonBindings PRIVATE src/JsonStub.cpp)
0100 endif()
0101
0102 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0103 target_link_libraries(
0104 ActsPythonBindings
0105 PUBLIC
0106 Acts::PluginGeoModel
0107 Acts::ExamplesDetectorGeoModel
0108 Acts::ExamplesMuonSpectrometerMockupDetector
0109 )
0110 target_sources(ActsPythonBindings PRIVATE src/GeoModel.cpp)
0111 else()
0112 target_sources(ActsPythonBindings PRIVATE src/GeoModelStub.cpp)
0113 endif()
0114
0115 if(ACTS_BUILD_PLUGIN_ROOT)
0116 target_link_libraries(ActsPythonBindings PUBLIC Acts::PluginRoot)
0117 target_sources(ActsPythonBindings PRIVATE src/TGeo.cpp)
0118 else()
0119 target_sources(ActsPythonBindings PRIVATE src/TGeoStub.cpp)
0120 endif()
0121
0122 if(ACTS_BUILD_PLUGIN_TRACCC)
0123 target_link_libraries(ActsPythonBindings PUBLIC Acts::PluginDetray)
0124 target_sources(ActsPythonBindings PRIVATE src/Detray.cpp)
0125 target_link_libraries(ActsPythonBindings PUBLIC Acts::PluginCovfie)
0126 target_sources(ActsPythonBindings PRIVATE src/Covfie.cpp)
0127 target_link_libraries(ActsPythonBindings PUBLIC Acts::ExamplesTraccc)
0128 target_sources(ActsPythonBindings PRIVATE src/Traccc.cpp)
0129 else()
0130 target_sources(ActsPythonBindings PRIVATE src/DetrayStub.cpp)
0131 target_sources(ActsPythonBindings PRIVATE src/CovfieStub.cpp)
0132 target_sources(ActsPythonBindings PRIVATE src/TracccStub.cpp)
0133 endif()
0134
0135 if(ACTS_BUILD_PLUGIN_ACTSVG)
0136 target_link_libraries(ActsPythonBindings PUBLIC Acts::ExamplesIoSvg)
0137 target_sources(ActsPythonBindings PRIVATE src/Svg.cpp)
0138 else()
0139 target_sources(ActsPythonBindings PRIVATE src/SvgStub.cpp)
0140 endif()
0141
0142 if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP)
0143 pybind11_add_module(ActsPythonBindingsDD4hep src/DD4hepComponent.cpp)
0144 target_link_libraries(
0145 ActsPythonBindingsDD4hep
0146 PUBLIC Acts::PythonUtilities Acts::ExamplesDetectorDD4hep
0147 )
0148 add_dependencies(ActsPythonBindings ActsPythonBindingsDD4hep)
0149
0150 install(TARGETS ActsPythonBindingsDD4hep DESTINATION ${_python_install_dir})
0151 set_target_properties(
0152 ActsPythonBindingsDD4hep
0153 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0154 )
0155 set_target_properties(
0156 ActsPythonBindingsDD4hep
0157 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0158 )
0159 list(APPEND py_files examples/dd4hep.py)
0160 endif()
0161
0162 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0163 target_link_libraries(
0164 ActsPythonBindings
0165 PUBLIC Acts::ExamplesGeneratorsPythia8
0166 )
0167 target_sources(ActsPythonBindings PRIVATE src/Pythia8.cpp)
0168 else()
0169 target_sources(ActsPythonBindings PRIVATE src/Pythia8Stub.cpp)
0170 endif()
0171
0172 if(ACTS_BUILD_EXAMPLES_GEANT4)
0173 pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp)
0174 target_link_libraries(
0175 ActsPythonBindingsGeant4
0176 PUBLIC
0177 Acts::ExamplesGeant4
0178 Acts::ExamplesDetectorGeant4
0179 Acts::PythonUtilities
0180 Acts::ExamplesMuonSpectrometerMockupDetector
0181 )
0182 add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4)
0183
0184 install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir})
0185 set_target_properties(
0186 ActsPythonBindingsGeant4
0187 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0188 )
0189 set_target_properties(
0190 ActsPythonBindingsGeant4
0191 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0192 )
0193 list(APPEND py_files examples/geant4/__init__.py)
0194 endif()
0195
0196 target_link_libraries(ActsPythonBindings PUBLIC Acts::ExamplesIoHepMC3)
0197 target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp)
0198 list(APPEND py_files examples/hepmc3.py)
0199
0200 if(ACTS_BUILD_EXAMPLES_GNN)
0201 target_link_libraries(
0202 ActsPythonBindings
0203 PUBLIC Acts::ExamplesTrackFindingGnn
0204 )
0205 target_sources(ActsPythonBindings PRIVATE src/GnnTrackFinding.cpp)
0206 else()
0207 target_sources(ActsPythonBindings PRIVATE src/GnnTrackFindingStub.cpp)
0208 endif()
0209
0210 if(ACTS_BUILD_EXAMPLES_EDM4HEP)
0211 pybind11_add_module(ActsPythonBindingsEDM4hep src/EDM4hepComponent.cpp)
0212 target_link_libraries(
0213 ActsPythonBindingsEDM4hep
0214 PUBLIC Acts::PythonUtilities Acts::ExamplesIoEDM4hep
0215 )
0216 add_dependencies(ActsPythonBindings ActsPythonBindingsEDM4hep)
0217 install(
0218 TARGETS ActsPythonBindingsEDM4hep DESTINATION ${_python_install_dir}
0219 )
0220 set_target_properties(
0221 ActsPythonBindingsEDM4hep
0222 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0223 )
0224 set_target_properties(
0225 ActsPythonBindingsEDM4hep
0226 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0227 )
0228 list(APPEND py_files examples/edm4hep.py)
0229 endif()
0230
0231 if(ACTS_BUILD_EXAMPLES_PODIO)
0232 pybind11_add_module(ActsPythonBindingsPodio src/PodioComponent.cpp)
0233 target_link_libraries(
0234 ActsPythonBindingsPodio
0235 PUBLIC Acts::PythonUtilities Acts::ExamplesIoPodio
0236 )
0237 add_dependencies(ActsPythonBindings ActsPythonBindingsPodio)
0238 install(TARGETS ActsPythonBindingsPodio DESTINATION ${_python_install_dir})
0239 set_target_properties(
0240 ActsPythonBindingsPodio
0241 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0242 )
0243 set_target_properties(
0244 ActsPythonBindingsPodio
0245 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0246 )
0247 list(APPEND py_files examples/podio.py)
0248 endif()
0249
0250 if(ACTS_BUILD_PLUGIN_ONNX)
0251 target_link_libraries(
0252 ActsPythonBindings
0253 PUBLIC Acts::ExamplesFrameworkML Acts::ExamplesTrackFindingML
0254 )
0255 target_sources(ActsPythonBindings PRIVATE src/Onnx.cpp)
0256 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibrator.cpp)
0257 list(APPEND py_files examples/onnx/__init__.py)
0258 else()
0259 target_sources(ActsPythonBindings PRIVATE src/OnnxStub.cpp)
0260 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibratorStub.cpp)
0261 endif()
0262
0263 if(ACTS_BUILD_PLUGIN_FASTJET)
0264 target_link_libraries(ActsPythonBindings PUBLIC Acts::ExamplesJets)
0265 target_sources(ActsPythonBindings PRIVATE src/TruthJet.cpp)
0266 else()
0267 target_sources(ActsPythonBindings PRIVATE src/TruthJetStub.cpp)
0268 endif()
0269
0270 if(ACTS_BUILD_EXAMPLES_HASHING)
0271 target_link_libraries(ActsPythonBindings PUBLIC Acts::PluginHashing)
0272 target_sources(ActsPythonBindings PRIVATE src/Hashing.cpp)
0273 list(APPEND py_files examples/hashing.py)
0274 else()
0275 target_sources(ActsPythonBindings PRIVATE src/HashingStub.cpp)
0276 endif()
0277
0278 configure_file(setup.sh.in ${_python_dir}/setup.sh @ONLY)
0279 install(FILES ${_python_dir}/setup.sh DESTINATION "python")
0280
0281 foreach(f ${py_files})
0282 set(_target ${_python_dir}/acts/${f})
0283 get_filename_component(_dir ${_target} DIRECTORY)
0284 file(MAKE_DIRECTORY ${_dir})
0285
0286 file(
0287 CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f} ${_target}
0288 SYMBOLIC
0289 )
0290
0291 get_filename_component(_rel ${f} DIRECTORY)
0292
0293 install(
0294 FILES ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f}
0295 DESTINATION ${_python_install_dir}/${_rel}
0296 )
0297 endforeach()