[clang] a98cafd - [CMake] Fix driver build on MacOS
Alex Brachet via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 19 15:42:35 PST 2023
Author: Alex Brachet
Date: 2023-02-19T23:42:11Z
New Revision: a98cafd1d0f1144bc9149f7781de41c1abf7c960
URL: https://github.com/llvm/llvm-project/commit/a98cafd1d0f1144bc9149f7781de41c1abf7c960
DIFF: https://github.com/llvm/llvm-project/commit/a98cafd1d0f1144bc9149f7781de41c1abf7c960.diff
LOG: [CMake] Fix driver build on MacOS
Added:
Modified:
clang/tools/driver/CMakeLists.txt
clang/utils/perf-training/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt
index 237ed453e28fb..2182486f93a55 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -84,7 +84,14 @@ if (APPLE)
set(TOOL_INFO_BUILD_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
set(TOOL_INFO_PLIST_OUT "${CMAKE_CURRENT_BINARY_DIR}/${TOOL_INFO_PLIST}")
- target_link_libraries(clang
+
+ if(LLVM_TOOL_LLVM_DRIVER_BUILD AND clang IN_LIST LLVM_DRIVER_TOOLS)
+ set(TARGET_NAME llvm-driver)
+ else()
+ set(TARGET_NAME clang)
+ endif()
+
+ target_link_libraries(${TARGET_NAME}
PRIVATE
"-Wl,-sectcreate,__TEXT,__info_plist,\"${TOOL_INFO_PLIST_OUT}\"")
configure_file("${TOOL_INFO_PLIST}.in" "${TOOL_INFO_PLIST_OUT}" @ONLY)
diff --git a/clang/utils/perf-training/CMakeLists.txt b/clang/utils/perf-training/CMakeLists.txt
index 4cd469ddde3ed..0d551baba2ccf 100644
--- a/clang/utils/perf-training/CMakeLists.txt
+++ b/clang/utils/perf-training/CMakeLists.txt
@@ -33,7 +33,9 @@ if(LLVM_BUILD_INSTRUMENTED)
endif()
find_program(DTRACE dtrace)
-if(APPLE AND DTRACE)
+# TODO: Look into supporting this for the driver build. It will require changing
+# the perf-helper.py file to understand to call `llvm` as `llvm clang`.
+if(APPLE AND DTRACE AND NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg
More information about the cfe-commits
mailing list