Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDG4Python: only build things if python and pyroot are found #631

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 25 additions & 27 deletions DDG4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dd4hep_add_plugin(DDG4Plugins
#--------------------------- Plugin library for the simulation framework ---------


if(TARGET Python::Python)
if(TARGET Python::Python AND TARGET ROOT::PyROOT)
dd4hep_print("|++> Python found, creating DDG4Python Dictionary")
dd4hep_add_dictionary(G__DDG4Python
SOURCES src/python/DDG4Python.C
Expand All @@ -60,33 +60,31 @@ if(TARGET Python::Python)
SOURCES tpython/DDPython.C
USES Python::Python
)
if(TARGET ROOT::PyROOT)
#--------------------------- Specialized python plugins --------------------------
dd4hep_print("|++> ROOT Has Python, creating DDPython library and plugins")
add_library(DDPython G__DDPython.cxx tpython/DDPython.cpp)
add_library(DD4hep::DDPython ALIAS DDPython)
target_link_libraries(DDPython DD4hep::DDG4 ROOT::Core Python::Python ROOT::PyROOT)
IF(${CMAKE_CXX_STANDARD} GREATER 16)
# python header not cxx17 compatible, gives error in clang
target_compile_options(DDPython PUBLIC -Wno-register)
ENDIF()
dd4hep_add_plugin(DDG4Python
SOURCES src/python/*.cpp
GENERATED G__DDG4Python.cxx
USES DD4hep::DDG4 DD4hep::DDPython
)
#---Helper to overcome deficiency of the python executable concerning multi-threading
add_executable(pyddg4 pyddg4.cpp)
target_link_libraries(pyddg4 PUBLIC DD4hep::DDPython ROOT::Core ROOT::PyROOT)

# install these libraries
set_target_properties(DDPython DDG4Python PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
INSTALL(TARGETS DDPython pyddg4 DDG4Python EXPORT DD4hep
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
#--------------------------- Specialized python plugins --------------------------
dd4hep_print("|++> ROOT Has Python, creating DDPython library and plugins")
add_library(DDPython G__DDPython.cxx tpython/DDPython.cpp)
add_library(DD4hep::DDPython ALIAS DDPython)
target_link_libraries(DDPython DD4hep::DDG4 ROOT::Core Python::Python ROOT::PyROOT)
IF(${CMAKE_CXX_STANDARD} GREATER 16)
# python header not cxx17 compatible, gives error in clang
target_compile_options(DDPython PUBLIC -Wno-register)
ENDIF()
dd4hep_add_plugin(DDG4Python
SOURCES src/python/*.cpp
GENERATED G__DDG4Python.cxx
USES DD4hep::DDG4 DD4hep::DDPython
)
#---Helper to overcome deficiency of the python executable concerning multi-threading
add_executable(pyddg4 pyddg4.cpp)
target_link_libraries(pyddg4 PUBLIC DD4hep::DDPython ROOT::Core ROOT::PyROOT)

# install these libraries
set_target_properties(DDPython DDG4Python PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
INSTALL(TARGETS DDPython pyddg4 DDG4Python EXPORT DD4hep
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
else()
dd4hep_print("|+++++> Python not found, not creating DDG4 Python Dictionaries")
dd4hep_print("|+++++> Python or PyROOT not found, not creating DDG4 Python Dictionaries")
endif()

#--------------------------- Plugin library for the simulation framework ---------
Expand Down