Warning, /acts/Examples/Python/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 add_library(ActsPythonUtilities 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/Detector.cpp
0015 src/Digitization.cpp
0016 src/Material.cpp
0017 src/Geometry.cpp
0018 src/GeometryBuildingGen1.cpp
0019 src/Blueprint.cpp
0020 src/ExampleAlgorithms.cpp
0021 src/MagneticField.cpp
0022 src/Output.cpp
0023 src/Input.cpp
0024 src/Propagation.cpp
0025 src/Navigation.cpp
0026 src/Generators.cpp
0027 src/Obj.cpp
0028 src/TruthTracking.cpp
0029 src/TrackFitting.cpp
0030 src/TrackFinding.cpp
0031 src/Vertexing.cpp
0032 src/AmbiguityResolution.cpp
0033 src/EventData.cpp
0034 src/Utilities.cpp
0035 )
0036 install(TARGETS ActsPythonBindings DESTINATION ${_python_install_dir})
0037
0038 set_target_properties(
0039 ActsPythonBindings
0040 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0041 )
0042 set_target_properties(
0043 ActsPythonBindings
0044 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0045 )
0046
0047 target_link_libraries(
0048 ActsPythonBindings
0049 PUBLIC
0050 ActsCore
0051 ActsPythonUtilities
0052 ActsExamplesFramework
0053 ActsExamplesGeometry
0054 ActsExamplesDetectorGeneric
0055 ActsExamplesDetectorTGeo
0056 ActsExamplesMagneticField
0057 ActsExamplesIoCsv
0058 ActsExamplesIoObj
0059 ActsExamplesIoJson
0060 ActsExamplesGenerators
0061 ActsExamplesPrinters
0062 ActsExamplesTrackFinding
0063 ActsExamplesTrackFitting
0064 ActsExamplesVertexing
0065 ActsExamplesFatras
0066 ActsExamplesDetectorTelescope
0067 ActsExamplesUtilities
0068 ActsExamplesAmbiguityResolution
0069 ActsExamplesTruthTracking
0070 ActsExamplesDigitization
0071 ActsExamplesPropagation
0072 ActsExamplesMaterialMapping
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 ActsExamplesIoRoot)
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 ActsPluginJson)
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 ActsPluginGeoModel
0107 ActsExamplesDetectorGeoModel
0108 ActsExamplesMuonSpectrometerMockupDetector
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 ActsPluginRoot)
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 ActsPluginDetray)
0124 target_sources(ActsPythonBindings PRIVATE src/Detray.cpp)
0125 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginCovfie)
0126 target_sources(ActsPythonBindings PRIVATE src/Covfie.cpp)
0127 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesTraccc)
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 ActsExamplesIoSvg)
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 ActsPythonUtilities ActsExamplesDetectorDD4hep
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 ActsExamplesGeneratorsPythia8
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 ActsExamplesGeant4
0178 ActsExamplesDetectorGeant4
0179 ActsPythonUtilities
0180 ActsExamplesMuonSpectrometerMockupDetector
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 ActsExamplesIoHepMC3)
0197 target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp)
0198 list(APPEND py_files examples/hepmc3.py)
0199
0200 if(ACTS_BUILD_EXAMPLES_EXATRKX)
0201 target_link_libraries(
0202 ActsPythonBindings
0203 PUBLIC ActsExamplesTrackFindingExaTrkX
0204 )
0205 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFinding.cpp)
0206 else()
0207 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFindingStub.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 ActsPythonUtilities ActsExamplesIoEDM4hep
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 ActsPythonUtilities ActsExamplesIoPodio
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 ActsExamplesFrameworkML ActsExamplesTrackFindingML
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 ActsExamplesJets)
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 ActsPluginHashing)
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()