Skip to content

Commit ed98676

Browse files
committed
Support multi-configuration generators correctly in several config files
Multi-configuration generators (such as Visual Studio and Xcode) allow the specification of a build flavor at build time instead of config time, so the lit configuration files need to support that - and they do for the most part. There are several places that had one of two issues (or both!): 1) Paths had %(build_mode)s set up, but then not configured, resulting in values that would not work correctly e.g. D:/llvm-build/%(build_mode)s/bin/dsymutil.exe 2) Paths did not have %(build_mode)s set up, but instead contained $(Configuration) (which is the value for Visual Studio at configuration time, for Xcode they would have had the equivalent) e.g. "D:/llvm-build/$(Configuration)/lib". This seems to indicate that we still have a lot of fragility in the configurations, but also that a number of these paths are never used (at least on Windows) since the errors appear to have been there a while. This patch fixes the configurations and it has been tested with Ninja and Visual Studio to generate the correct paths. We should consider removing some of these settings altogether. Reviewed By: JDevlieghere, mehdi_amini Differential Revision: https://reviews.llvm.org/D96427
1 parent 88d1724 commit ed98676

File tree

13 files changed

+31
-16
lines changed

13 files changed

+31
-16
lines changed

clang/test/Unit/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ try:
1919
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
2020
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
2121
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
22+
config.shlibdir = config.shlibdir % lit_config.params
2223
except KeyError:
2324
e = sys.exc_info()[1]
2425
key, = e.args

lld/test/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
2-
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
3-
set(LLVM_BUILD_MODE "%(build_mode)s")
4-
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
5-
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s")
1+
if (CMAKE_CFG_INTDIR STREQUAL ".")
2+
set(LLVM_BUILD_MODE ".")
3+
else ()
4+
set(LLVM_BUILD_MODE "%(build_mode)s")
5+
endif ()
6+
7+
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLD_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
8+
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLD_TOOLS_DIR "${LLVM_RUNTIME_OUTPUT_INTDIR}")
69

710
llvm_canonicalize_cmake_booleans(
811
LLVM_ENABLE_ZLIB

lld/test/Unit/lit.site.cfg.py.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ config.llvm_build_mode = "@LLVM_BUILD_MODE@"
88
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
99
config.lld_obj_root = "@LLD_BINARY_DIR@"
1010
config.lld_src_root = "@LLD_SOURCE_DIR@"
11-
config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
12-
config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
11+
config.lld_libs_dir = "@LLD_LIBS_DIR@"
12+
config.lld_tools_dir = "@LLD_TOOLS_DIR@"
1313
config.target_triple = "@TARGET_TRIPLE@"
1414
config.python_executable = "@Python3_EXECUTABLE@"
1515

@@ -19,6 +19,8 @@ try:
1919
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
2020
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
2121
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
22+
config.lld_libs_dir = config.lld_libs_dir % lit_config.params
23+
config.lld_tools_dir = config.lld_tools_dir % lit_config.params
2224
except KeyError as e:
2325
key, = e.args
2426
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))

lld/test/lit.site.cfg.py.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
99
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
1010
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
1111
config.lld_obj_root = "@LLD_BINARY_DIR@"
12-
config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
13-
config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
12+
config.lld_libs_dir = "@LLD_LIBS_DIR@"
13+
config.lld_tools_dir = "@LLD_TOOLS_DIR@"
1414
config.target_triple = "@TARGET_TRIPLE@"
1515
config.python_executable = "@Python3_EXECUTABLE@"
1616
config.have_zlib = @LLVM_ENABLE_ZLIB@
@@ -23,6 +23,8 @@ config.ld_lld_default_mingw = @LLD_DEFAULT_LD_LLD_IS_MINGW@
2323
try:
2424
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
2525
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
26+
config.lld_libs_dir = config.lld_libs_dir % lit_config.params
27+
config.lld_tools_dir = config.lld_tools_dir % lit_config.params
2628
except KeyError as e:
2729
key, = e.args
2830
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))

lldb/test/API/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ try:
5454
config.lldb_executable = config.lldb_executable % lit_config.params
5555
config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params
5656
config.test_compiler = config.test_compiler % lit_config.params
57+
config.dsymutil = config.dsymutil % lit_config.params
5758
config.lldb_framework_dir = config.lldb_framework_dir % lit_config.params
5859
config.dotest_args_str = config.dotest_args_str % lit_config.params
5960
except KeyError as e:

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,11 +1586,11 @@ function(configure_lit_site_cfg site_in site_out)
15861586

15871587
set_llvm_build_mode()
15881588

1589-
# They below might not be the build tree but provided binary tree.
1589+
# The below might not be the build tree but provided binary tree.
15901590
set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
15911591
set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
15921592
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
1593-
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
1593+
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
15941594

15951595
# SHLIBDIR points the build tree.
15961596
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" SHLIBDIR "${LLVM_SHLIB_OUTPUT_INTDIR}")

llvm/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ configure_lit_site_cfg(
2929
"LLVM_SOURCE_DIR"
3030
"LLVM_BINARY_DIR"
3131
"LLVM_TOOLS_DIR"
32-
"LLVM_LIBRARY_DIR"
32+
"LLVM_LIBS_DIR"
3333
"SHLIBDIR"
3434
)
3535
configure_lit_site_cfg(

llvm/test/Unit/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config.shlibdir = path(r"@SHLIBDIR@")
1414
try:
1515
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
1616
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
17+
config.shlibdir = config.shlibdir % lit_config.params
1718
except KeyError:
1819
e = sys.exc_info()[1]
1920
key, = e.args

llvm/test/lit.site.cfg.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
77
config.llvm_src_root = path(r"@LLVM_SOURCE_DIR@")
88
config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@")
99
config.llvm_tools_dir = path(r"@LLVM_TOOLS_DIR@")
10-
config.llvm_lib_dir = path(r"@LLVM_LIBRARY_DIR@")
10+
config.llvm_lib_dir = path(r"@LLVM_LIBS_DIR@")
1111
config.llvm_shlib_dir = path(r"@SHLIBDIR@")
1212
config.llvm_shlib_ext = "@SHLIBEXT@"
1313
config.llvm_exe_ext = "@EXEEXT@"
@@ -56,6 +56,7 @@ config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@
5656
# used when we can't determine the tool dir at configuration time.
5757
try:
5858
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
59+
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
5960
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
6061
except KeyError:
6162
e = sys.exc_info()[1]

mlir/examples/standalone/test/lit.site.cfg.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
77
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
88
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
99
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
10-
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
10+
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
1111
config.llvm_shlib_dir = "@SHLIBDIR@"
1212
config.llvm_shlib_ext = "@SHLIBEXT@"
1313
config.llvm_exe_ext = "@EXEEXT@"
@@ -35,6 +35,7 @@ config.standalone_obj_root = "@CMAKE_BINARY_DIR@"
3535
# used when we can't determine the tool dir at configuration time.
3636
try:
3737
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
38+
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
3839
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
3940
except KeyError:
4041
e = sys.exc_info()[1]

mlir/integration_test/lit.site.cfg.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
77
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
88
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
99
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
10-
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
10+
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
1111
config.llvm_shlib_dir = "@SHLIBDIR@"
1212
config.llvm_shlib_ext = "@SHLIBEXT@"
1313
config.llvm_exe_ext = "@EXEEXT@"
@@ -40,6 +40,7 @@ config.mlir_run_avx512_tests = "@MLIR_RUN_AVX512_TESTS@"
4040
# used when we can't determine the tool dir at configuration time.
4141
try:
4242
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
43+
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
4344
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
4445
except KeyError:
4546
e = sys.exc_info()[1]

mlir/test/Unit/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
1717
try:
1818
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
1919
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
20+
config.shlibdir = config.shlibdir % lit_config.params
2021
except KeyError:
2122
e = sys.exc_info()[1]
2223
key, = e.args

mlir/test/lit.site.cfg.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
77
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
88
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
99
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
10-
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
10+
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
1111
config.llvm_shlib_dir = "@SHLIBDIR@"
1212
config.llvm_shlib_ext = "@SHLIBEXT@"
1313
config.llvm_exe_ext = "@EXEEXT@"
@@ -51,6 +51,7 @@ config.enable_bindings_python = @MLIR_BINDINGS_PYTHON_ENABLED@
5151
# used when we can't determine the tool dir at configuration time.
5252
try:
5353
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
54+
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
5455
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
5556
except KeyError:
5657
e = sys.exc_info()[1]

0 commit comments

Comments
 (0)