Skip to content

[CMAKE] Automatically detect newly added source files#9611

Merged
masahi merged 2 commits into
apache:mainfrom
tkonolige:cmake_configure_depends
Dec 23, 2021
Merged

[CMAKE] Automatically detect newly added source files#9611
masahi merged 2 commits into
apache:mainfrom
tkonolige:cmake_configure_depends

Conversation

@tkonolige

Copy link
Copy Markdown
Contributor

Before this commit, newly added or removed source files were not detected by cmake. This manifested either as file not found errors from the compiler (when files were deleted) or packedfuncs not being found (when files were added). This commit uses the CONFIGURE_DEPENDS option of cmake's file(GLOB) function to ask the build system to check for new files on every rebuild. Checking for new files adds a slight but negligible overhead to each build, but is better than unexpected errors.

Note that the cmake documentation recommends avoiding CONFIGURE_DEPENDS in favor of manually listing all files. This approach has been proposed in the past, but the community did not want to do it.

@electriclilies @junrushao1994 @areusch @jroesch @tqchen @leandron

@junrushao

Copy link
Copy Markdown
Member

@tkonolige tkonolige force-pushed the cmake_configure_depends branch 2 times, most recently from 00879cb to a7b9051 Compare December 2, 2021 18:39
@areusch

areusch commented Dec 2, 2021

Copy link
Copy Markdown
Contributor

@tkonolige which platforms have you tested this on and with what versions of cmake?

@tkonolige

Copy link
Copy Markdown
Contributor Author

Tested on linux with cmake 3.18 and 3.10 (support for configure_depends was added in 3.12). Are there any more platforms you would like tested? CI should get windows and macOS, but I'm not sure what version there are using.

@tkonolige

tkonolige commented Dec 9, 2021

Copy link
Copy Markdown
Contributor Author

@areusch @junrushao1994 Could you review?

@masahi

masahi commented Dec 20, 2021

Copy link
Copy Markdown
Member

@tkonolige Please resolve the conflict.

Tristan Konolige added 2 commits December 21, 2021 08:23
Before this commit, newly added or removed source files were not
detected by cmake. This manifested either as file not found errors from
the compiler (when files were deleted) or packedfuncs not being found
(when files were added). This commit uses the CONFIGURE_DEPENDS option
of cmake's `file(GLOB)` function to ask the build system to check for
new files on every rebuild. Checking for new files adds a slight but
negligible overhead to each build, but is better than unexpected errors.
@tkonolige tkonolige force-pushed the cmake_configure_depends branch from 3aa47e6 to 965fd2d Compare December 21, 2021 16:23

@masahi masahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change, merging

@masahi masahi merged commit d486e21 into apache:main Dec 23, 2021
@masahi

masahi commented Dec 23, 2021

Copy link
Copy Markdown
Member

thanks @tkonolige @areusch @junrushao1994

ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [CMAKE] Automatically detect newly added source files

Before this commit, newly added or removed source files were not
detected by cmake. This manifested either as file not found errors from
the compiler (when files were deleted) or packedfuncs not being found
(when files were added). This commit uses the CONFIGURE_DEPENDS option
of cmake's `file(GLOB)` function to ask the build system to check for
new files on every rebuild. Checking for new files adds a slight but
negligible overhead to each build, but is better than unexpected errors.

* remove unnessesary configure_depends
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [CMAKE] Automatically detect newly added source files

Before this commit, newly added or removed source files were not
detected by cmake. This manifested either as file not found errors from
the compiler (when files were deleted) or packedfuncs not being found
(when files were added). This commit uses the CONFIGURE_DEPENDS option
of cmake's `file(GLOB)` function to ask the build system to check for
new files on every rebuild. Checking for new files adds a slight but
negligible overhead to each build, but is better than unexpected errors.

* remove unnessesary configure_depends
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants