-
Notifications
You must be signed in to change notification settings - Fork 101
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
dd4hep_add_dictionary: use temporary file to create dictionary, needed for reasons (was 'Args') #1241
Conversation
4a10857
to
af67d62
Compare
Test Results 8 files 8 suites 3h 37m 44s ⏱️ For more details on these failures, see this check. Results for commit 2b8a3b6. ♻️ This comment has been updated with latest results. |
I also needed the following diff on my system to make this work: diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt
index ed180e53..855231b3 100644
--- a/DDDigi/CMakeLists.txt
+++ b/DDDigi/CMakeLists.txt
@@ -54,6 +54,7 @@ set(DDDigiIO_DEFINITIONS)
if(DD4HEP_USE_GEANT4)
list(APPEND DDDigiIO_DEFINITIONS "DD4HEP_USE_DDG4=1")
dd4hep_add_dictionary(G__DDDigi_DDG4_IO
+ TARGET DDDigiPlugins
SOURCES ../DDCore/include/ROOT/Warnings.h io/DDG4IO.cpp
LINKDEF ../DDCore/include/ROOT/LinkDef.h
USES DD4hep::DDG4 DD4hep::DDCore
diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt
index ab702943..3b67b9cb 100644
--- a/DDEve/CMakeLists.txt
+++ b/DDEve/CMakeLists.txt
@@ -52,6 +52,7 @@ dd4hep_add_plugin(DDEvePlugins SOURCES src/*.cpp ${DDEVE_LCIO_SOURCES} ${DDEVE_R
if(DD4HEP_USE_GEANT4)
dd4hep_add_dictionary(G__DDG4IO
+ TARGET DDEvePlugins
SOURCES ../DDCore/include/ROOT/Warnings.h DDEve/DDG4IO.C
LINKDEF ../DDCore/include/ROOT/LinkDef.h
USES DD4hep::DDG4
@@ -78,4 +79,4 @@ install(TARGETS ddeve DDEvePlugins DDEve_Interface EXPORT DD4hep
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
- )
\ No newline at end of file
+ )
diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt
index 5970ca03..95633409 100644
--- a/DDG4/CMakeLists.txt
+++ b/DDG4/CMakeLists.txt
@@ -57,10 +57,12 @@ dd4hep_add_dictionary( G__DDG4
if(TARGET Python::Python AND TARGET ${DD4HEP_ROOT_PYTHON})
dd4hep_print("|++> Python found, creating DDG4Python Dictionary")
dd4hep_add_dictionary(G__DDG4Python
+ TARGET DDG4Plugins
SOURCES src/python/DDG4Python.C
USES DD4hep::DDCore DD4hep::DDParsers DD4hep::DDG4 ROOT::Core Geant4::Interface
)
dd4hep_add_dictionary(G__DDPython
+ TARGET DDG4Plugins
SOURCES tpython/DDPython.C
USES DD4hep::DDCore Python::Python
)
diff --git a/examples/DDG4_MySensDet/CMakeLists.txt b/examples/DDG4_MySensDet/CMakeLists.txt
index 912fcf00..4b056bd0 100644
--- a/examples/DDG4_MySensDet/CMakeLists.txt
+++ b/examples/DDG4_MySensDet/CMakeLists.txt
@@ -36,12 +36,6 @@ include(CTest)
#
if (DD4HEP_USE_GEANT4)
#--------------------------- Plugin library for the simulation framework ---------
- dd4hep_add_dictionary(G__DDG4_MySensDet
- SOURCES ${DD4hep_DIR}/include/ROOT/Warnings.h src/MyTrackerHit.h
- LINKDEF ${DD4hep_DIR}/include/ROOT/LinkDef.h
- OUTPUT ${LIBRARY_OUTPUT_PATH}
- USES DD4hep::DDCore DD4hep::DDG4 Geant4::Interface
- )
#---- Example of a client library with user defined plugins --------------------
dd4hep_add_plugin( DDG4_MySensDet
@@ -49,6 +43,10 @@ if (DD4HEP_USE_GEANT4)
SOURCES src/*.cpp
USES DD4hep::DDCore DD4hep::DDG4 Geant4::Interface ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO
)
+ dd4hep_add_dictionary(G__DDG4_MySensDet
+ TARGET DDG4_MySensDet
+ SOURCES ${DD4hep_DIR}/include/ROOT/Warnings.h src/MyTrackerHit.h
+ LINKDEF ${DD4hep_DIR}/include/ROOT/LinkDef.h
+ OUTPUT ${LIBRARY_OUTPUT_PATH}
+ USES DD4hep::DDCore DD4hep::DDG4 Geant4::Interface
+ )
install(TARGETS DDG4_MySensDet DESTINATION lib)
# Geant4 material scan. From position=0,0,0 to end-of-world |
Thanks @wdconinc ! Now I have to figure out why the dependency resolution in the CI doesn't work |
Not a dependency issue. ENV{SHELL} isn't set
Nothing before |
We don't actually have to pass a target to file(GENERATE it just creates the file N-times for C and CXX, and we can just use the CXX one to continue. |
because add_custom_command does not know the COMPILE_LANGUAGE we are not allowed to treat definitions with that genex inside. We cannot use add_custom_command(TARGET because that fails with the same error, even though it maybe shouldn't For compatibility with ninja(?) we need to use these $<CONFIG>$<COMPILE_LANGUAGE> shenanigans add USE_COMMAND_FOR_GENERATION to fall back to old way
…ble since cmake 3.15)
Given we don't need a target in the end, I made the temporary file solution the default (args), so this should work without further changes. Could you try this again @wdconinc ? |
This indeed works now. Thanks! |
…y when any input changes I hope this will work fine. If the list of headers or linkdefs changes, then cmake should re-run anyway and that will call the file(Generate) to recreate the script, and if only the file content of headers or linkdefs changes, we only have to re-run the shell script.
BEGINRELEASENOTES
dd4hep_add_dictionary
fails when INTERFACE_COMPILE_DEFINITIONS contains COMPILE_LANGUAGE cmake genex #1239 . Add USE_COMMAND_TO_GENERATE option to fall back to previous implementationENDRELEASENOTES