Skip to content

Commit

Permalink
Fix MinGW issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ldionne committed Jul 25, 2024
1 parent e5a510e commit 23fc88b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
6 changes: 5 additions & 1 deletion libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- '
Expand Down
25 changes: 25 additions & 0 deletions libcxx/test/configs/llvm-libc++-static-mingw.cfg.in
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit 23fc88b

Please sign in to comment.