-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[CMake] Don't wrap command in ROOTTEST_COMPILE_MACRO
in CMake target
#19780
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
base: master
Are you sure you want to change the base?
Conversation
Test Results 19 files 19 suites 3d 9h 1m 51s ⏱️ For more details on these failures, see this check. Results for commit c273e07. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping to command inside a Cmake target doesn't seem to be necessary, because in the test, the target is forced to be built without dependencies anyway (e.g.
cmake --build . --target my_macro_test/fast --always-make
when using makefiles).
This is only partially true, for Unix Makefiles
. With Ninja
, we don't use /fast
nor --always-make
AFAICT
The intention of the original macro is apparently to only build this one target that runs the command. The fact that this was not done correctly for Ninja doesn't mean that rebuilding all dependencies was the intended behavior. I suppose it was just not correctly implemented. |
94f401c
to
f215e1f
Compare
cmake/modules/RootMacros.cmake
Outdated
@@ -2340,36 +2340,18 @@ macro(ROOTTEST_COMPILE_MACRO filename) | |||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | |||
|
|||
if(ARG_DEPENDS) | |||
set(deps ${ARG_DEPENDS}) | |||
message(WARNING "Specifying DEPENDS in ROOTTEST_COMPILE_MACRO has no effect.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this warning is never hit. Nowhere in the codebase to we specify DEPENDS
in a ROOTTEST_COMPILE_MACRO
. Together with the dependencies being ignored via the \fast
target when using Makefiles, that makes it clear to me that it was never the intention to have dependencies for these macro tests.
The problem is that even with no dependencies, a re-configuration will still be triggered if the CMake code was changed, which is the reason thy the RUN_SERIAL true
workaround was needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest removing DEPENDS
from the allowed arguments altogether.
f215e1f
to
c4ce0be
Compare
In principle makes sense to me; maybe rephrase the first commit message because it still sounds wrong that dependencies would be ignored "anyway". Also adding @hageboeck because it's related to #19702 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the explanation confusing. I'll come discuss this in person.
cmake/modules/RootMacros.cmake
Outdated
@@ -2340,36 +2340,18 @@ macro(ROOTTEST_COMPILE_MACRO filename) | |||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | |||
|
|||
if(ARG_DEPENDS) | |||
set(deps ${ARG_DEPENDS}) | |||
message(WARNING "Specifying DEPENDS in ROOTTEST_COMPILE_MACRO has no effect.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest removing DEPENDS
from the allowed arguments altogether.
Instead of running the `root ... <macro>.C+` build step as the command associated with a custom CMake target, just run the command directly in the test added with `add_test`. This simplification is possible because for the custom CMake target, no dependencies are ever specified. This makes building it not different from just running the underlying command directly.
* Remove preprocessor variables that were always defined and hence carried no information * Add include path and library path via environment variables * Remove redundant `gROOT->SetMacroPath()` call with path to source directory, because the `${realfp}` variable passed to the `build.C` script already contains the full path
c4ce0be
to
c273e07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much clearer, thank you!
@@ -75,9 +75,6 @@ void build(const char *filename, const char *lib = 0, const char *obj = 0, const | |||
} | |||
// fprintf(stderr,"from %s to %s\n",filename,fname.Data()); | |||
int result = gSystem->CompileMacro(fname,"kc"); | |||
#elif defined(CMakeEnvironment) && defined(CMakeBuildDir) | |||
// fprintf(stderr,"CmakeBuildDir: %s filename: %s", CMakeBuildDir, filename); | |||
int result = gSystem->CompileMacro(filename,"kc-", libname, CMakeBuildDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be an unintentional behavior change. If I read correctly, before this PR, ROOTTEST_COMPILE_MACRO
was always setting CMakeEnvironment
and CMakeBuildDir
and thus always passing "kc-"
, while it now passes "only" "kc"
thus removing the -
and changing the output directory layout.
How does switching from an argument to an environment variable concretely help? If one ever tries to reproduce the failing compilation 'exactly', one now needs to copy paste (the extended version of):
instead of the extended version of:
|
Instead of running the
root ... <macro>.C+
build step as the commandassociated with a custom CMake target, just run the command directly in
the test added with
add_test
.This simplification is possible because for the custom CMake target, no
dependencies are ever specified. This makes building it not different
from just running the underlying command directly.
Do some further CMake code simplifications in a second commit (more detail in the commit description).