mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
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
This commit is contained in:
parent
88d1724d9b
commit
ed98676fa4
@ -19,6 +19,7 @@ try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
|
||||
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
|
||||
config.shlibdir = config.shlibdir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
key, = e.args
|
||||
|
@ -1,8 +1,11 @@
|
||||
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
|
||||
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
||||
set(LLVM_BUILD_MODE "%(build_mode)s")
|
||||
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
|
||||
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s")
|
||||
if (CMAKE_CFG_INTDIR STREQUAL ".")
|
||||
set(LLVM_BUILD_MODE ".")
|
||||
else ()
|
||||
set(LLVM_BUILD_MODE "%(build_mode)s")
|
||||
endif ()
|
||||
|
||||
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLD_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
|
||||
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLD_TOOLS_DIR "${LLVM_RUNTIME_OUTPUT_INTDIR}")
|
||||
|
||||
llvm_canonicalize_cmake_booleans(
|
||||
LLVM_ENABLE_ZLIB
|
||||
|
@ -8,8 +8,8 @@ config.llvm_build_mode = "@LLVM_BUILD_MODE@"
|
||||
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
||||
config.lld_obj_root = "@LLD_BINARY_DIR@"
|
||||
config.lld_src_root = "@LLD_SOURCE_DIR@"
|
||||
config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
|
||||
config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
|
||||
config.lld_libs_dir = "@LLD_LIBS_DIR@"
|
||||
config.lld_tools_dir = "@LLD_TOOLS_DIR@"
|
||||
config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.python_executable = "@Python3_EXECUTABLE@"
|
||||
|
||||
@ -19,6 +19,8 @@ try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
|
||||
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
|
||||
config.lld_libs_dir = config.lld_libs_dir % lit_config.params
|
||||
config.lld_tools_dir = config.lld_tools_dir % lit_config.params
|
||||
except KeyError as e:
|
||||
key, = e.args
|
||||
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
|
||||
|
@ -9,8 +9,8 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
||||
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
|
||||
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
||||
config.lld_obj_root = "@LLD_BINARY_DIR@"
|
||||
config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
|
||||
config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
|
||||
config.lld_libs_dir = "@LLD_LIBS_DIR@"
|
||||
config.lld_tools_dir = "@LLD_TOOLS_DIR@"
|
||||
config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.python_executable = "@Python3_EXECUTABLE@"
|
||||
config.have_zlib = @LLVM_ENABLE_ZLIB@
|
||||
@ -23,6 +23,8 @@ config.ld_lld_default_mingw = @LLD_DEFAULT_LD_LLD_IS_MINGW@
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
|
||||
config.lld_libs_dir = config.lld_libs_dir % lit_config.params
|
||||
config.lld_tools_dir = config.lld_tools_dir % lit_config.params
|
||||
except KeyError as e:
|
||||
key, = e.args
|
||||
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
|
||||
|
@ -54,6 +54,7 @@ try:
|
||||
config.lldb_executable = config.lldb_executable % lit_config.params
|
||||
config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params
|
||||
config.test_compiler = config.test_compiler % lit_config.params
|
||||
config.dsymutil = config.dsymutil % lit_config.params
|
||||
config.lldb_framework_dir = config.lldb_framework_dir % lit_config.params
|
||||
config.dotest_args_str = config.dotest_args_str % lit_config.params
|
||||
except KeyError as e:
|
||||
|
@ -1586,11 +1586,11 @@ function(configure_lit_site_cfg site_in site_out)
|
||||
|
||||
set_llvm_build_mode()
|
||||
|
||||
# They below might not be the build tree but provided binary tree.
|
||||
# The below might not be the build tree but provided binary tree.
|
||||
set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
|
||||
set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
|
||||
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
||||
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
|
||||
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
|
||||
|
||||
# SHLIBDIR points the build tree.
|
||||
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" SHLIBDIR "${LLVM_SHLIB_OUTPUT_INTDIR}")
|
||||
|
@ -29,7 +29,7 @@ configure_lit_site_cfg(
|
||||
"LLVM_SOURCE_DIR"
|
||||
"LLVM_BINARY_DIR"
|
||||
"LLVM_TOOLS_DIR"
|
||||
"LLVM_LIBRARY_DIR"
|
||||
"LLVM_LIBS_DIR"
|
||||
"SHLIBDIR"
|
||||
)
|
||||
configure_lit_site_cfg(
|
||||
|
@ -14,6 +14,7 @@ config.shlibdir = path(r"@SHLIBDIR@")
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
|
||||
config.shlibdir = config.shlibdir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
key, = e.args
|
||||
|
@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.llvm_src_root = path(r"@LLVM_SOURCE_DIR@")
|
||||
config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@")
|
||||
config.llvm_tools_dir = path(r"@LLVM_TOOLS_DIR@")
|
||||
config.llvm_lib_dir = path(r"@LLVM_LIBRARY_DIR@")
|
||||
config.llvm_lib_dir = path(r"@LLVM_LIBS_DIR@")
|
||||
config.llvm_shlib_dir = path(r"@SHLIBDIR@")
|
||||
config.llvm_shlib_ext = "@SHLIBEXT@"
|
||||
config.llvm_exe_ext = "@EXEEXT@"
|
||||
@ -56,6 +56,7 @@ config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
|
||||
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
|
@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
|
||||
config.llvm_shlib_dir = "@SHLIBDIR@"
|
||||
config.llvm_shlib_ext = "@SHLIBEXT@"
|
||||
config.llvm_exe_ext = "@EXEEXT@"
|
||||
@ -35,6 +35,7 @@ config.standalone_obj_root = "@CMAKE_BINARY_DIR@"
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
|
||||
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
|
@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
|
||||
config.llvm_shlib_dir = "@SHLIBDIR@"
|
||||
config.llvm_shlib_ext = "@SHLIBEXT@"
|
||||
config.llvm_exe_ext = "@EXEEXT@"
|
||||
@ -40,6 +40,7 @@ config.mlir_run_avx512_tests = "@MLIR_RUN_AVX512_TESTS@"
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
|
||||
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
|
@ -17,6 +17,7 @@ config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
|
||||
config.shlibdir = config.shlibdir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
key, = e.args
|
||||
|
@ -7,7 +7,7 @@ config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
|
||||
config.llvm_lib_dir = "@LLVM_LIBS_DIR@"
|
||||
config.llvm_shlib_dir = "@SHLIBDIR@"
|
||||
config.llvm_shlib_ext = "@SHLIBEXT@"
|
||||
config.llvm_exe_ext = "@EXEEXT@"
|
||||
@ -51,6 +51,7 @@ config.enable_bindings_python = @MLIR_BINDINGS_PYTHON_ENABLED@
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.llvm_lib_dir = config.llvm_lib_dir % lit_config.params
|
||||
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
|
||||
except KeyError:
|
||||
e = sys.exc_info()[1]
|
||||
|
Loading…
Reference in New Issue
Block a user