Skip to content

EDGEML-14581 - Fix copy_headers to use build-time GLOB via cmake -P - #5

Open
jhoyamd wants to merge 1 commit into
Xilinx:mainfrom
jhoyamd:jhoy-cmake-cache
Open

EDGEML-14581 - Fix copy_headers to use build-time GLOB via cmake -P#5
jhoyamd wants to merge 1 commit into
Xilinx:mainfrom
jhoyamd:jhoy-cmake-cache

Conversation

@jhoyamd

@jhoyamd jhoyamd commented Jul 27, 2026

Copy link
Copy Markdown

[Why]
The previous aie_codegen_setup_build_include_layout() implementation collected headers at cmake configure time using file(GLOB CONFIGURE_DEPENDS) then copied or symlinked each one via configure_file COPYONLY or file(CREATE_LINK). The resolved file paths were baked into the generated build system (MSBuild .rule files under the Visual Studio generator) at configure time. In CI environments where the build directory is reused across runs, stale .rule files from a prior configure can contain paths that no longer exist or that point through defunct filesystem junctions, triggering MSB8066 errors and breaking incremental builds without requiring a full reconfigure.

[How]
Replace the configure-time header materialization with a build-time add_custom_target(copy_headers ALL) that invokes a new cmake -P script (cmake/CopyHeaders.cmake). The script GLOBs headers and copies them using file(COPY_FILE ... ONLY_IF_DIFFERENT) at build time, so the generated .rule file contains only stable variable-expanded paths that remain valid across build-directory reuse. The aie_codegen target gains an add_dependencies(... copy_headers) link so headers are always present before compilation begins. The AieCodegenHeaders.cmake module is retained for install-time use by AieCodegenInstall.cmake.

[Why]
The previous aie_codegen_setup_build_include_layout() implementation
collected headers at cmake configure time using file(GLOB
CONFIGURE_DEPENDS) then copied or symlinked each one via configure_file
COPYONLY or file(CREATE_LINK). The resolved file paths were baked into
the generated build system (MSBuild .rule files under the Visual Studio
generator) at configure time. In CI environments where the build
directory is reused across runs, stale .rule files from a prior
configure can contain paths that no longer exist or that point through
defunct filesystem junctions, triggering MSB8066 errors and breaking
incremental builds without requiring a full reconfigure.

[How]
Replace the configure-time header materialization with a build-time
add_custom_target(copy_headers ALL) that invokes a new cmake -P script
(cmake/CopyHeaders.cmake). The script GLOBs headers and copies them
using file(COPY_FILE ... ONLY_IF_DIFFERENT) at build time, so the
generated .rule file contains only stable variable-expanded paths that
remain valid across build-directory reuse. The aie_codegen target gains
an add_dependencies(... copy_headers) link so headers are always present
before compilation begins. The AieCodegenHeaders.cmake module is
retained for install-time use by AieCodegenInstall.cmake.

Signed-off-by: John Hoy <John.Hoy@amd.com>
Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant