From 23fc88babe69db2a02602b1ddfcd994ac4669116 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jul 2024 09:23:01 -0400 Subject: [PATCH] Fix MinGW issues --- libcxx/CMakeLists.txt | 6 ++++- .../configs/llvm-libc++-shared-clangcl.cfg.in | 2 +- ...cfg.in => llvm-libc++-shared-mingw.cfg.in} | 2 +- ...-libc++-shared-no-vcruntime-clangcl.cfg.in | 2 +- .../configs/llvm-libc++-static-mingw.cfg.in | 25 +++++++++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) rename libcxx/test/configs/{llvm-libc++-mingw.cfg.in => llvm-libc++-shared-mingw.cfg.in} (94%) create mode 100644 libcxx/test/configs/llvm-libc++-static-mingw.cfg.in diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 332816b15260a9f..5d6bad420844590 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -128,7 +128,11 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in") elseif(MINGW) - set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-mingw.cfg.in") + if (LIBCXX_ENABLE_SHARED) + set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-mingw.cfg.in") + else() + set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-static-mingw.cfg.in") + endif() elseif(WIN32) # clang-cl if (LIBCXX_ENABLE_SHARED) set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-clangcl.cfg.in") diff --git a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in index 33095f46d715e39..5fa99bc697d6222 100644 --- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in @@ -22,7 +22,7 @@ config.substitutions.append(('%{compile_flags}', '-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{install-prefix}/bin -lc++ -l' + cxx_lib + '-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- ' diff --git a/libcxx/test/configs/llvm-libc++-mingw.cfg.in b/libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in similarity index 94% rename from libcxx/test/configs/llvm-libc++-mingw.cfg.in rename to libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in index 8ccb1d5da8d4390..01c4d58ca05f961 100644 --- a/libcxx/test/configs/llvm-libc++-mingw.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-mingw.cfg.in @@ -8,7 +8,7 @@ config.substitutions.append(('%{compile_flags}', '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support' )) config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L %{install-prefix}/bin -lc++' + '-nostdlib++ -L %{lib-dir} -lc++' )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- ' diff --git a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in index 7cc98ff9688577a..e95999d52653d9d 100644 --- a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in @@ -23,7 +23,7 @@ config.substitutions.append(('%{compile_flags}', '-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{install-prefix}/bin -lc++ -l' + cxx_lib + '-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- ' diff --git a/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in b/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in new file mode 100644 index 000000000000000..650b60c6536a9f9 --- /dev/null +++ b/libcxx/test/configs/llvm-libc++-static-mingw.cfg.in @@ -0,0 +1,25 @@ +# This testing configuration handles running the test suite against LLVM's libc++ +# using either a DLL or a static library, with MinGW/Clang on Windows. + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L %{lib-dir} -lc++' +)) +config.substitutions.append(('%{exec}', + '%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- ' +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) +import libcxx.test.params, libcxx.test.config +libcxx.test.config.configure( + libcxx.test.params.DEFAULT_PARAMETERS, + libcxx.test.features.DEFAULT_FEATURES, + config, + lit_config +)