[PATCH] [ASan tests] Use clang-cl to build tests on Windows
Timur Iskhodzhanov
timurrrr at google.com
Thu May 8 08:25:45 PDT 2014
Hi samsonov,
Please note that COMPILER_RT_CAN_EXECUTE_TESTS is still OFF, so this only affects stuff when everything is ready to flip the switch.
http://reviews.llvm.org/D3680
Files:
CMakeLists.txt
cmake/Modules/AddCompilerRT.cmake
cmake/Modules/CompilerRTCompile.cmake
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -57,8 +57,17 @@
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
${LLVM_ENABLE_WERROR})
- # Use just-built Clang to compile/link tests.
- set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+ # Use just-built Clang to compile/link tests on all platforms, except for
+ # Windows where we need to use clang-cl instead.
+ if(NOT MSVC)
+ set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+ set(COMPILER_RT_TEST_COMPILER_EXE "-o")
+ set(COMPILER_RT_TEST_COMPILER_OUT "-o")
+ else()
+ set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl.exe)
+ set(COMPILER_RT_TEST_COMPILER_EXE "-Fe")
+ set(COMPILER_RT_TEST_COMPILER_OUT "-Fo")
+ endif()
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -136,7 +136,8 @@
list(APPEND TEST_DEPS clang)
endif()
add_custom_target(${test_name}
- COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
+ COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS}
+ ${COMPILER_RT_TEST_COMPILER_EXE}"${output_bin}"
${TEST_LINK_FLAGS}
DEPENDS ${TEST_DEPS})
# Make the test suite depend on the binary.
Index: cmake/Modules/CompilerRTCompile.cmake
===================================================================
--- cmake/Modules/CompilerRTCompile.cmake
+++ cmake/Modules/CompilerRTCompile.cmake
@@ -23,7 +23,8 @@
set(compile_flags ${global_flags} ${SOURCE_CFLAGS})
add_custom_command(
OUTPUT ${object_file}
- COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c -o "${object_file}"
+ COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c
+ ${COMPILER_RT_TEST_COMPILER_OUT}"${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
DEPENDS ${SOURCE_DEPS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3680.9226.patch
Type: text/x-patch
Size: 2236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140508/325133e5/attachment.bin>
More information about the llvm-commits
mailing list