[llvm] [Offload] Explicitly create directories that contain tablegen output (PR #142817)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 10:12:53 PDT 2025


https://github.com/callumfare created https://github.com/llvm/llvm-project/pull/142817

This isn't required when building with Ninja, but with the Makefile generator these directories don't get implicitly created.

>From b0bfaa38962ae6f02854f51a04cea91103805499 Mon Sep 17 00:00:00 2001
From: Callum Fare <callum at codeplay.com>
Date: Wed, 4 Jun 2025 18:10:35 +0100
Subject: [PATCH] Explicitly create directories that contain tablegen output

---
 offload/liboffload/API/CMakeLists.txt         | 1 +
 offload/plugins-nextgen/common/CMakeLists.txt | 1 +
 2 files changed, 2 insertions(+)

diff --git a/offload/liboffload/API/CMakeLists.txt b/offload/liboffload/API/CMakeLists.txt
index 216710faa84f6..e4baa4772a1ef 100644
--- a/offload/liboffload/API/CMakeLists.txt
+++ b/offload/liboffload/API/CMakeLists.txt
@@ -7,6 +7,7 @@
 
 set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/OffloadAPI.td)
 set(files_to_copy "")
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 
 macro(offload_tablegen file)
     tablegen(OFFLOAD generated/${file}.gen ${ARGN})
diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt
index a28151d46f432..8c171df923823 100644
--- a/offload/plugins-nextgen/common/CMakeLists.txt
+++ b/offload/plugins-nextgen/common/CMakeLists.txt
@@ -1,6 +1,7 @@
 # The error codes in this header are shared with liboffload, so need to be
 # generated from the same source.
 include(TableGen)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)
 set(LLVM_TARGET_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/../../liboffload/API/OffloadAPI.td)
 tablegen(OFFLOAD include/OffloadErrcodes.inc -gen-errcodes -I ${CMAKE_CURRENT_SOURCE_DIR}/../../liboffload/API)
 add_public_tablegen_target(PluginErrcodes)



More information about the llvm-commits mailing list