stella.stamenova created this revision. Herald added subscribers: teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, mgorny. Herald added a reviewer: JDevlieghere. Herald added a reviewer: aartbik. stella.stamenova requested review of this revision. Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, stephenneuendorffer, nicolasvasilache. Herald added projects: clang, LLDB, MLIR, LLVM.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D96427 Files: clang/test/Unit/lit.site.cfg.py.in lld/test/CMakeLists.txt lld/test/Unit/lit.site.cfg.py.in lld/test/lit.site.cfg.py.in lldb/test/API/lit.site.cfg.py.in llvm/cmake/modules/AddLLVM.cmake llvm/test/CMakeLists.txt llvm/test/Unit/lit.site.cfg.py.in llvm/test/lit.site.cfg.py.in mlir/examples/standalone/test/lit.site.cfg.py.in mlir/integration_test/lit.site.cfg.py.in mlir/test/Unit/lit.site.cfg.py.in mlir/test/lit.site.cfg.py.in
Index: mlir/test/lit.site.cfg.py.in =================================================================== --- mlir/test/lit.site.cfg.py.in +++ mlir/test/lit.site.cfg.py.in @@ -7,7 +7,7 @@ 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 @@ # 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] Index: mlir/test/Unit/lit.site.cfg.py.in =================================================================== --- mlir/test/Unit/lit.site.cfg.py.in +++ mlir/test/Unit/lit.site.cfg.py.in @@ -17,6 +17,7 @@ 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 Index: mlir/integration_test/lit.site.cfg.py.in =================================================================== --- mlir/integration_test/lit.site.cfg.py.in +++ mlir/integration_test/lit.site.cfg.py.in @@ -7,7 +7,7 @@ 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@" @@ -38,6 +38,7 @@ # 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] Index: mlir/examples/standalone/test/lit.site.cfg.py.in =================================================================== --- mlir/examples/standalone/test/lit.site.cfg.py.in +++ mlir/examples/standalone/test/lit.site.cfg.py.in @@ -7,7 +7,7 @@ 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 @@ # 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] Index: llvm/test/lit.site.cfg.py.in =================================================================== --- llvm/test/lit.site.cfg.py.in +++ llvm/test/lit.site.cfg.py.in @@ -7,7 +7,7 @@ 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 @@ # 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] Index: llvm/test/Unit/lit.site.cfg.py.in =================================================================== --- llvm/test/Unit/lit.site.cfg.py.in +++ llvm/test/Unit/lit.site.cfg.py.in @@ -14,6 +14,7 @@ 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 Index: llvm/test/CMakeLists.txt =================================================================== --- llvm/test/CMakeLists.txt +++ llvm/test/CMakeLists.txt @@ -29,7 +29,7 @@ "LLVM_SOURCE_DIR" "LLVM_BINARY_DIR" "LLVM_TOOLS_DIR" - "LLVM_LIBRARY_DIR" + "LLVM_LIBS_DIR" "SHLIBDIR" ) configure_lit_site_cfg( Index: llvm/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/cmake/modules/AddLLVM.cmake +++ llvm/cmake/modules/AddLLVM.cmake @@ -1588,11 +1588,11 @@ 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}") Index: lldb/test/API/lit.site.cfg.py.in =================================================================== --- lldb/test/API/lit.site.cfg.py.in +++ lldb/test/API/lit.site.cfg.py.in @@ -55,6 +55,7 @@ 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.server = config.server % 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 Index: lld/test/lit.site.cfg.py.in =================================================================== --- lld/test/lit.site.cfg.py.in +++ lld/test/lit.site.cfg.py.in @@ -9,8 +9,8 @@ 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 @@ 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)) Index: lld/test/Unit/lit.site.cfg.py.in =================================================================== --- lld/test/Unit/lit.site.cfg.py.in +++ lld/test/Unit/lit.site.cfg.py.in @@ -8,8 +8,8 @@ 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 @@ 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)) Index: lld/test/CMakeLists.txt =================================================================== --- lld/test/CMakeLists.txt +++ lld/test/CMakeLists.txt @@ -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 Index: clang/test/Unit/lit.site.cfg.py.in =================================================================== --- clang/test/Unit/lit.site.cfg.py.in +++ clang/test/Unit/lit.site.cfg.py.in @@ -19,6 +19,7 @@ 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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits