Skip to content

Commit 1b69df8

Browse files
ldionneAlexisPerry
authored andcommitted
[libc++] Remove Windows-specific configuration from libcxx/test/CMakeLists.txt (llvm#96330)
This is essentially a revert of 9853e9b which tried removing duplication in the Windows config files by moving it to the CMake. However, we want to decouple the CMake and the test suite as much as possible, so encoding additional (non-official) Lit parameters in the CMake only as a code reuse mechanism is not an approach we want to take.
1 parent 166be5b commit 1b69df8

File tree

4 files changed

+48
-31
lines changed

4 files changed

+48
-31
lines changed

libcxx/test/CMakeLists.txt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,6 @@ endif()
3434

3535
serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBCXX_TEST_PARAMS)
3636

37-
if (MSVC)
38-
# Shared code for initializing some parameters used by all
39-
# llvm-libc++-*-clangcl.cfg.in test configs.
40-
set(dbg_include "")
41-
42-
if (NOT CMAKE_MSVC_RUNTIME_LIBRARY OR CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL$")
43-
set(fms_runtime_lib "dll")
44-
set(cxx_lib "msvcprt")
45-
else()
46-
set(fms_runtime_lib "static")
47-
set(cxx_lib "libcpmt")
48-
endif()
49-
50-
if ((NOT CMAKE_MSVC_RUNTIME_LIBRARY AND uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
51-
OR (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "Debug"))
52-
set(dbg_include " -include set_windows_crt_report_mode.h")
53-
set(fms_runtime_lib "${fms_runtime_lib}_dbg")
54-
set(cxx_lib "${cxx_lib}d")
55-
endif()
56-
57-
serialize_lit_string_param(SERIALIZED_LIT_PARAMS dbg_include "${dbg_include}")
58-
serialize_lit_string_param(SERIALIZED_LIT_PARAMS fms_runtime_lib "${fms_runtime_lib}")
59-
serialize_lit_string_param(SERIALIZED_LIT_PARAMS cxx_lib "${cxx_lib}")
60-
endif()
61-
6237
if (LIBCXX_INCLUDE_TESTS)
6338
include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
6439

libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33

44
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
55

6+
dbg_include = ''
7+
runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
8+
if runtime_library == '' or runtime_library.endswith('DLL'):
9+
fms_runtime_lib = 'dll'
10+
cxx_lib = 'msvcprt'
11+
else:
12+
fms_runtime_lib = 'static'
13+
cxx_lib = 'libcpmt'
14+
15+
if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
16+
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
17+
fms_runtime_lib += '_dbg'
18+
cxx_lib += 'd'
19+
620
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
721
config.substitutions.append(('%{compile_flags}',
8-
'-fms-runtime-lib=' + config.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' + config.dbg_include
22+
'-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
923
))
1024
config.substitutions.append(('%{link_flags}',
11-
'-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib
25+
'-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
1226
))
1327
config.substitutions.append(('%{exec}',
1428
'%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- '

libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,26 @@
44

55
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
66

7+
dbg_include = ''
8+
runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
9+
if runtime_library == '' or runtime_library.endswith('DLL'):
10+
fms_runtime_lib = 'dll'
11+
cxx_lib = 'msvcprt'
12+
else:
13+
fms_runtime_lib = 'static'
14+
cxx_lib = 'libcpmt'
15+
16+
if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
17+
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
18+
fms_runtime_lib += '_dbg'
19+
cxx_lib += 'd'
20+
721
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
822
config.substitutions.append(('%{compile_flags}',
9-
'-fms-runtime-lib=' + config.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' + config.dbg_include
23+
'-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
1024
))
1125
config.substitutions.append(('%{link_flags}',
12-
'-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib
26+
'-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
1327
))
1428
config.substitutions.append(('%{exec}',
1529
'%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- '

libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33

44
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
55

6+
dbg_include = ''
7+
runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
8+
if runtime_library == '' or runtime_library.endswith('DLL'):
9+
fms_runtime_lib = 'dll'
10+
cxx_lib = 'msvcprt'
11+
else:
12+
fms_runtime_lib = 'static'
13+
cxx_lib = 'libcpmt'
14+
15+
if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
16+
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
17+
fms_runtime_lib += '_dbg'
18+
cxx_lib += 'd'
19+
620
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
721
config.substitutions.append(('%{compile_flags}',
8-
'-fms-runtime-lib=' + config.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' + config.dbg_include
22+
'-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
923
))
1024
config.substitutions.append(('%{link_flags}',
11-
'-nostdlib -L %{lib-dir} -llibc++ -l' + config.cxx_lib
25+
'-nostdlib -L %{lib-dir} -llibc++ -l' + cxx_lib
1226
))
1327
config.substitutions.append(('%{exec}',
1428
'%{executor} --execdir %T -- '

0 commit comments

Comments
 (0)