-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[CMake] Split out libinfo.cc into a separate target. #8520
Conversation
be69c48
to
7ed93a9
Compare
@junrushao1994 Could I get a review from you, since you originally implemented the |
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.
Looks good to me if everything is green, I had complained that something was building too often, thanks so much for figuring it out!
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.
Thanks @Lunderberg for fixing this problem! I didn't know this issue before :-)
CC @comaniac who added the TVM_GIT_COMMIT_TIME :-) |
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.
LGTM. Thanks!
Not in the scope of this PR, I am thinking if we should add a cmake target for each subfolder like |
I think that would make a lot of sense. I could also imagine having a debug option for each target to generate a separate shared library. At least one my computer, linking the final |
Every `*.o` file in the cmake-generated makefiles have a dependency on the target's `flags.make` file. The `flags.make` file contains the compiler flags for all objects in a target, not just the `*.o` file currently being compiled. As a result, even though `libinfo.cc` is the only file that has the `TVM_GIT_COMMIT_TIME` and `TVM_GIT_COMMIT_HASH` definitions, every file in the `tvm_objs` target was recompiled whenever the commit id was changed. By splitting `libinfo.cc` out into a separate target, no other files need to be recompiled when committing or changing branches, unless there are actual changes to the file.
7ed93a9
to
99cb148
Compare
Every
*.o
file in the cmake-generated makefiles have a dependency on the target'sflags.make
file. Theflags.make
file contains the compiler flags for all objects in a target, not just the*.o
file currently being compiled. As a result, even thoughlibinfo.cc
is the only file that has theTVM_GIT_COMMIT_TIME
andTVM_GIT_COMMIT_HASH
definitions, every file in thetvm_objs
target was recompiled whenever the commit id was changed.By splitting
libinfo.cc
out into a separate target, no other files need to be recompiled when committing or changing branches, unless there are actual changes to a file.