From 11f5f0920764a05260c9e9143a5f5fc1920d1503 Mon Sep 17 00:00:00 2001 From: William Moses Date: Sun, 28 Apr 2024 12:45:54 -0700 Subject: [PATCH] Bazel more bundle include fixes (#1854) --- enzyme/BUILD | 4 +++- enzyme/CMakeLists.txt | 2 +- enzyme/scripts/bundle-includes.sh | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/enzyme/BUILD b/enzyme/BUILD index 266eb1b0044d..a1c4d56ffecd 100644 --- a/enzyme/BUILD +++ b/enzyme/BUILD @@ -206,8 +206,10 @@ genrule( name = "bundled-includes", srcs = glob(["include/**"]) + ["scripts/bundle-includes.sh"], outs = ["bundled_includes.h"], - cmd = "$(location :scripts/bundle-includes.sh) ./include $@", + cmd = "$(location :scripts/bundle-includes.sh) $(location :include/enzyme/enzyme) $@" ) + + genrule( name = "gen_enzyme-clang++", srcs = [":enzyme-clang"], diff --git a/enzyme/CMakeLists.txt b/enzyme/CMakeLists.txt index a42db5c64ba2..c42d5736a5d4 100644 --- a/enzyme/CMakeLists.txt +++ b/enzyme/CMakeLists.txt @@ -310,7 +310,7 @@ set(bundled_includes "${CMAKE_CURRENT_BINARY_DIR}/Enzyme/Clang/bundled_includes. list(APPEND ENZYME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/bundle-includes.sh) add_custom_command(OUTPUT ${bundled_includes} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/bundle-includes.sh - ${CMAKE_CURRENT_SOURCE_DIR}/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/include/enzyme/enzyme ${bundled_includes} DEPENDS ${ENZYME_INCLUDES} COMMENT "Bundling includes" diff --git a/enzyme/scripts/bundle-includes.sh b/enzyme/scripts/bundle-includes.sh index 1cfb988518b7..e9a07d290928 100755 --- a/enzyme/scripts/bundle-includes.sh +++ b/enzyme/scripts/bundle-includes.sh @@ -2,9 +2,11 @@ set -e -INPUT_DIR=$1 +INPUT_DIR=$(dirname $1)/.. OUTPUT_FILE=$2 +echo $INPUT_FILE +echo $OUTPUT_FILE mkdir -p "$(dirname "$OUTPUT_FILE")" echo > "$OUTPUT_FILE"