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/Material.cpp
0016 src/Geometry.cpp
0017 src/ExampleAlgorithms.cpp
0018 src/MagneticField.cpp
0019 src/Output.cpp
0020 src/Input.cpp
0021 src/Propagation.cpp
0022 src/Generators.cpp
0023 src/Obj.cpp
0024 src/TruthTracking.cpp
0025 src/TrackFitting.cpp
0026 src/TrackFinding.cpp
0027 src/Vertexing.cpp
0028 src/AmbiguityResolution.cpp
0029 src/EventData.cpp
0030 )
0031 install(TARGETS ActsPythonBindings DESTINATION ${_python_install_dir})
0032
0033 set_target_properties(ActsPythonBindings PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
0034 set_target_properties(ActsPythonBindings PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts)
0035
0036 target_link_libraries(ActsPythonBindings PUBLIC
0037 ActsCore
0038 ActsPythonUtilities
0039 ActsExamplesFramework
0040 ActsExamplesGeometry
0041 ActsExamplesDetectorGeneric
0042 ActsExamplesDetectorContextual
0043 ActsExamplesDetectorTGeo
0044 ActsExamplesMagneticField
0045 ActsExamplesIoRoot
0046 ActsExamplesIoNuclearInteractions
0047 ActsExamplesIoCsv
0048 ActsExamplesIoObj
0049 ActsExamplesIoJson
0050 ActsExamplesIoPerformance
0051 ActsExamplesGenerators
0052 ActsExamplesTrackFinding
0053 ActsExamplesTrackFitting
0054 ActsExamplesVertexing
0055 ActsExamplesFatras
0056 ActsExamplesPrinters
0057 ActsExamplesDetectorTelescope
0058 ActsExamplesUtilities
0059 ActsExamplesAmbiguityResolution
0060 )
0061
0062 set(py_files
0063 __init__.py
0064 examples/__init__.py
0065 examples/simulation.py
0066 examples/reconstruction.py
0067 examples/itk.py
0068 examples/odd.py
0069 _adapter.py
0070 )
0071
0072 if(ACTS_BUILD_PLUGIN_JSON)
0073 target_link_libraries(ActsPythonBindings PUBLIC ActsPluginJson)
0074 target_sources(ActsPythonBindings PRIVATE src/Json.cpp)
0075 else()
0076 target_sources(ActsPythonBindings PRIVATE src/JsonStub.cpp)
0077 endif()
0078
0079 if(ACTS_BUILD_PLUGIN_ACTSVG)
0080 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesIoSvg)
0081 target_sources(ActsPythonBindings PRIVATE src/Svg.cpp)
0082 else()
0083 target_sources(ActsPythonBindings PRIVATE src/SvgStub.cpp)
0084 endif()
0085
0086 if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP)
0087 pybind11_add_module(ActsPythonBindingsDD4hep src/DD4hepComponent.cpp)
0088 target_link_libraries(ActsPythonBindingsDD4hep PUBLIC
0089 ActsPythonUtilities
0090 ActsExamplesDetectorDD4hep)
0091 add_dependencies(ActsPythonBindings ActsPythonBindingsDD4hep)
0092
0093 install(TARGETS ActsPythonBindingsDD4hep DESTINATION ${_python_install_dir})
0094 set_target_properties(ActsPythonBindingsDD4hep PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
0095 set_target_properties(ActsPythonBindingsDD4hep PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts)
0096 list(APPEND py_files examples/dd4hep.py)
0097 endif()
0098
0099 if(ACTS_BUILD_EXAMPLES_PYTHIA8)
0100 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesGeneratorsPythia8)
0101 target_sources(ActsPythonBindings PRIVATE src/Pythia8.cpp)
0102 else()
0103 target_sources(ActsPythonBindings PRIVATE src/Pythia8Stub.cpp)
0104 endif()
0105
0106 if(ACTS_BUILD_PLUGIN_IDENTIFICATION)
0107 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesDigitization)
0108 target_sources(ActsPythonBindings PRIVATE src/Digitization.cpp)
0109 else()
0110 target_sources(ActsPythonBindings PRIVATE src/DigitizationStub.cpp)
0111 endif()
0112
0113 if(ACTS_BUILD_EXAMPLES_GEANT4)
0114 pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp)
0115 target_link_libraries(ActsPythonBindingsGeant4 PUBLIC
0116 ActsExamplesGeant4 ActsExamplesDetectorGeant4
0117 ActsPythonUtilities ActsExamplesMuonSpectrometerMockupDetector)
0118 add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4)
0119
0120 install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir})
0121 set_target_properties(ActsPythonBindingsGeant4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
0122 set_target_properties(ActsPythonBindingsGeant4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts)
0123 list(APPEND py_files examples/geant4/__init__.py)
0124
0125 if(ACTS_BUILD_PLUGIN_DD4HEP AND ACTS_BUILD_EXAMPLES_DD4HEP)
0126 pybind11_add_module(ActsPythonBindingsDDG4 src/Geant4DD4hepComponent.cpp)
0127 target_link_libraries(ActsPythonBindingsDDG4 PUBLIC
0128 ActsPythonUtilities
0129 ActsExamplesGeant4
0130 ActsExamplesDetectorDD4hep)
0131 add_dependencies(ActsPythonBindings ActsPythonBindingsDDG4)
0132
0133 install(TARGETS ActsPythonBindingsDDG4 DESTINATION ${_python_install_dir})
0134 set_target_properties(ActsPythonBindingsDDG4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
0135 set_target_properties(ActsPythonBindingsDDG4 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts)
0136 list(APPEND py_files examples/geant4/dd4hep.py)
0137 endif()
0138
0139 if(ACTS_BUILD_EXAMPLES_HEPMC3)
0140 target_link_libraries(ActsPythonBindingsGeant4 PUBLIC ActsExamplesEventRecording)
0141 target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3.cpp)
0142 list(APPEND py_files examples/geant4/hepmc3.py)
0143 else()
0144 target_sources(ActsPythonBindingsGeant4 PRIVATE src/Geant4HepMC3Stub.cpp)
0145 endif()
0146
0147 endif()
0148
0149 if(ACTS_BUILD_EXAMPLES_HEPMC3)
0150 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesHepMC3)
0151 target_sources(ActsPythonBindings PRIVATE src/HepMC3.cpp)
0152 list(APPEND py_files examples/hepmc3.py)
0153 else()
0154 target_sources(ActsPythonBindings PRIVATE src/HepMC3Stub.cpp)
0155 endif()
0156
0157 if(ACTS_BUILD_EXAMPLES_EXATRKX)
0158 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesTrackFindingExaTrkX)
0159 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFinding.cpp)
0160 else()
0161 target_sources(ActsPythonBindings PRIVATE src/ExaTrkXTrackFindingStub.cpp)
0162 endif()
0163
0164 if(ACTS_BUILD_EXAMPLES_EDM4HEP)
0165 pybind11_add_module(ActsPythonBindingsEDM4hep src/EDM4hepComponent.cpp)
0166 target_link_libraries(ActsPythonBindingsEDM4hep PUBLIC
0167 ActsPythonUtilities ActsExamplesIoEDM4hep)
0168 add_dependencies(ActsPythonBindings ActsPythonBindingsEDM4hep)
0169 install(TARGETS ActsPythonBindingsEDM4hep DESTINATION ${_python_install_dir})
0170 set_target_properties(ActsPythonBindingsEDM4hep PROPERTIES INSTALL_RPATH "\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
0171 set_target_properties(ActsPythonBindingsEDM4hep PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_python_dir}/acts)
0172 list(APPEND py_files examples/edm4hep.py)
0173 endif()
0174
0175 if(ACTS_BUILD_PLUGIN_ONNX)
0176 target_link_libraries(ActsPythonBindings PUBLIC ActsExamplesFrameworkML ActsExamplesTrackFindingML)
0177 target_sources(ActsPythonBindings PRIVATE src/Onnx.cpp)
0178 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibrator.cpp)
0179 list(APPEND py_files examples/onnx/__init__.py)
0180
0181 else()
0182 target_sources(ActsPythonBindings PRIVATE src/OnnxStub.cpp)
0183 target_sources(ActsPythonBindings PRIVATE src/OnnxNeuralCalibratorStub.cpp)
0184 endif()
0185
0186 configure_file(setup.sh.in ${_python_dir}/setup.sh @ONLY)
0187 install(FILES ${_python_dir}/setup.sh DESTINATION "python")
0188
0189 foreach(f ${py_files})
0190 set(_target ${_python_dir}/acts/${f})
0191 get_filename_component(_dir ${_target} DIRECTORY)
0192 file(MAKE_DIRECTORY ${_dir})
0193
0194 file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/${f} ${_target} SYMBOLIC)
0195 endforeach()
0196
0197 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/acts/ DESTINATION ${_python_install_dir})