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 ActsExamplesDetectorContextual
0056 ActsExamplesDetectorTGeo
0057 ActsExamplesMagneticField
0058 ActsExamplesIoRoot
0059 ActsExamplesIoCsv
0060 ActsExamplesIoObj
0061 ActsExamplesIoJson
0062 ActsExamplesGenerators
0063 ActsExamplesPrinters
0064 ActsExamplesTrackFinding
0065 ActsExamplesTrackFitting
0066 ActsExamplesVertexing
0067 ActsExamplesFatras
0068 ActsExamplesDetectorTelescope
0069 ActsExamplesUtilities
0070 ActsExamplesAmbiguityResolution
0071 ActsExamplesTruthTracking
0072 ActsExamplesDigitization
0073 ActsExamplesPropagation
0074 ActsExamplesMaterialMapping
0075 )
0076
0077 set(py_files
0078 __init__.py
0079 examples/__init__.py
0080 examples/simulation.py
0081 examples/reconstruction.py
0082 examples/itk.py
0083 examples/odd.py
0084 _adapter.py
0085 )
0086
0087 if(ACTS_BUILD_PLUGIN_JSON)
0088 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginJson)
0089 target_sources(ActsPythonBindings PRIVATE src/Json.cpp)
0090 else()
0091 target_sources(ActsPythonBindings PRIVATE src/JsonStub.cpp)
0092 endif()
0093
0094 if(ACTS_BUILD_PLUGIN_GEOMODEL)
0095 target_link_libraries(
0096 ActsPythonBindings
0097 PUBLIC ActsPluginGeoModel ActsExamplesDetectorGeoModel
0098 )
0099 target_sources(ActsPythonBindings PRIVATE src/GeoModel.cpp)
0100 else()
0101 target_sources(ActsPythonBindings PRIVATE src/GeoModelStub.cpp)
0102 endif()
0103
0104 if(ACTS_BUILD_PLUGIN_TGEO)
0105 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginTGeo)
0106 target_sources(ActsPythonBindings PRIVATE src/TGeo.cpp)
0107 else()
0108 target_sources(ActsPythonBindings PRIVATE src/TGeoStub.cpp)
0109 endif()
0110
0111 if(ACTS_BUILD_PLUGIN_TRACCC)
0112 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginDetray)
0113 target_sources(ActsPythonBindings PRIVATE src/Detray.cpp)
0114 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginCovfie)
0115 target_sources(ActsPythonBindings PRIVATE src/Covfie.cpp)
0116 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesTraccc)
0117 target_sources(ActsPythonBindings PRIVATE src/Traccc.cpp)
0118 else()
0119 target_sources(ActsPythonBindings PRIVATE src/DetrayStub.cpp)
0120 target_sources(ActsPythonBindings PRIVATE src/CovfieStub.cpp)
0121 target_sources(ActsPythonBindings PRIVATE src/TracccStub.cpp)
0122 endif()
0123
0124 if(ACTS_BUILD_PLUGIN_ACTSVG)
0125 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesIoSvg)
0126 target_sources(ActsPythonBindings PRIVATE src/Svg.cpp)
0127 else()
0128 target_sources(ActsPythonBindings PRIVATE src/SvgStub.cpp)
0129 endif()
0130
0131 if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP)
0132 pybind11_add_module(ActsPythonBindingsDD4hep src/DD4hepComponent.cpp)
0133 target_link_libraries(
0134 ActsPythonBindingsDD4hep
0135 PUBLIC ActsPythonUtilities ActsExamplesDetectorDD4hep
0136 )
0137 add_dependencies(ActsPythonBindings ActsPythonBindingsDD4hep)
0138
0139 install(TARGETS ActsPythonBindingsDD4hep DESTINATION ${_python_install_dir})
0140 set_target_properties(
0141 ActsPythonBindingsDD4hep
0142 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0143 )
0144 set_target_properties(
0145 ActsPythonBindingsDD4hep
0146 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0147 )
0148 list(APPEND py_files examples/dd4hep.py)
0149 endif()
0150
0151 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0152 target_link_libraries(
0153 ActsPythonBindings
0154 PUBLIC ActsExamplesGeneratorsPythia8
0155 )
0156 target_sources(ActsPythonBindings PRIVATE src/Pythia8.cpp)
0157 else()
0158 target_sources(ActsPythonBindings PRIVATE src/Pythia8Stub.cpp)
0159 endif()
0160
0161 if(ACTS_BUILD_EXAMPLES_GEANT4)
0162 pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp)
0163 target_link_libraries(
0164 ActsPythonBindingsGeant4
0165 PUBLIC
0166 ActsExamplesGeant4
0167 ActsExamplesDetectorGeant4
0168 ActsPythonUtilities
0169 ActsExamplesMuonSpectrometerMockupDetector
0170 )
0171 add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4)
0172
0173 install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir})
0174 set_target_properties(
0175 ActsPythonBindingsGeant4
0176 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0177 )
0178 set_target_properties(
0179 ActsPythonBindingsGeant4
0180 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0181 )
0182 list(APPEND py_files examples/geant4/__init__.py)
0183
0184 if(ACTS_BUILD_EXAMPLES_HEPMC3)
0185 target_link_libraries(
0186 ActsPythonBindingsGeant4
0187 PUBLIC ActsExamplesEventRecording
0188 )
0189 target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3.cpp)
0190 list(APPEND py_files examples/geant4/hepmc3.py)
0191 else()
0192 target_sources(
0193 ActsPythonBindingsGeant4
0194 PRIVATE src/Geant4HepMC3Stub.cpp
0195 )
0196 endif()
0197 endif()
0198
0199 if(ACTS_BUILD_EXAMPLES_HEPMC3)
0200 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesHepMC3)
0201 target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp)
0202 list(APPEND py_files examples/hepmc3.py)
0203 else()
0204 target_sources(ActsPythonBindings PRIVATE src/HepMC3Stub.cpp)
0205 endif()
0206
0207 if(ACTS_BUILD_EXAMPLES_EXATRKX)
0208 target_link_libraries(
0209 ActsPythonBindings
0210 PUBLIC ActsExamplesTrackFindingExaTrkX
0211 )
0212 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFinding.cpp)
0213 else()
0214 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFindingStub.cpp)
0215 endif()
0216
0217 if(ACTS_BUILD_EXAMPLES_EDM4HEP)
0218 pybind11_add_module(ActsPythonBindingsEDM4hep src/EDM4hepComponent.cpp)
0219 target_link_libraries(
0220 ActsPythonBindingsEDM4hep
0221 PUBLIC ActsPythonUtilities ActsExamplesIoEDM4hep
0222 )
0223 add_dependencies(ActsPythonBindings ActsPythonBindingsEDM4hep)
0224 install(
0225 TARGETS ActsPythonBindingsEDM4hep DESTINATION ${_python_install_dir}
0226 )
0227 set_target_properties(
0228 ActsPythonBindingsEDM4hep
0229 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}"
0230 )
0231 set_target_properties(
0232 ActsPythonBindingsEDM4hep
0233 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts
0234 )
0235 list(APPEND py_files examples/edm4hep.py)
0236 endif()
0237
0238 if(ACTS_BUILD_PLUGIN_ONNX)
0239 target_link_libraries(
0240 ActsPythonBindings
0241 PUBLIC ActsExamplesFrameworkML ActsExamplesTrackFindingML
0242 )
0243 target_sources(ActsPythonBindings PRIVATE src/Onnx.cpp)
0244 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibrator.cpp)
0245 list(APPEND py_files examples/onnx/__init__.py)
0246 else()
0247 target_sources(ActsPythonBindings PRIVATE src/OnnxStub.cpp)
0248 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibratorStub.cpp)
0249 endif()
0250
0251 if(ACTS_BUILD_EXAMPLES_HASHING)
0252 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginHashing)
0253 target_sources(ActsPythonBindings PRIVATE src/Hashing.cpp)
0254 list(APPEND py_files examples/hashing.py)
0255 else()
0256 target_sources(ActsPythonBindings PRIVATE src/HashingStub.cpp)
0257 endif()
0258
0259 configure_file(setup.sh.in ${_python_dir}/setup.sh @ONLY)
0260 install(FILES ${_python_dir}/setup.sh DESTINATION "python")
0261
0262 foreach(f ${py_files})
0263 set(_target ${_python_dir}/acts/${f})
0264 get_filename_component(_dir ${_target} DIRECTORY)
0265 file(MAKE_DIRECTORY ${_dir})
0266
0267 file(
0268 CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f} ${_target}
0269 SYMBOLIC
0270 )
0271
0272 get_filename_component(_rel ${f} DIRECTORY)
0273
0274 install(
0275 FILES ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f}
0276 DESTINATION ${_python_install_dir}/${_rel}
0277 )
0278 endforeach()