diff options
author | Stephen Hines <srhines@google.com> | 2014-07-21 00:49:56 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-07-21 00:49:56 -0700 |
commit | 6a211c5814e25d6745a5058cc0e499e5235d3821 (patch) | |
tree | 12956caa69324b4f169a58e88ca3dd95f518317b /cmake | |
parent | 65e7b1d5aa3878e95eab8772d7c299660b8e7d0c (diff) | |
download | compiler-rt-6a211c5814e25d6745a5058cc0e499e5235d3821.tar.gz |
Update compiler-rt for rebase to r212749.
Includes a cherry-pick of:
r213309 - fixes umodsi3
Change-Id: Ic7367e3586b6af7ef74bee6a8cf437d5f28d975a
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 21 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTCompile.cmake | 10 |
2 files changed, 27 insertions, 4 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index 69c30e364..0f6260ae5 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -113,15 +113,33 @@ macro(add_compiler_rt_darwin_dynamic_runtime name os) LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}) endmacro() +set(COMPILER_RT_TEST_CFLAGS) + # Unittests support. set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest) set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc) set(COMPILER_RT_GTEST_CFLAGS -DGTEST_NO_LLVM_RAW_OSTREAM=1 + -DGTEST_HAS_RTTI=0 -I${COMPILER_RT_GTEST_PATH}/include -I${COMPILER_RT_GTEST_PATH} ) +if(MSVC) + # clang doesn't support exceptions on Windows yet. + list(APPEND COMPILER_RT_TEST_CFLAGS + -D_HAS_EXCEPTIONS=0) + + # We should teach clang to understand "#pragma intrinsic", see PR19898. + list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline) + + # Clang doesn't support SEH on Windows yet. + list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0) + + # gtest use a lot of stuff marked as deprecated on Windows. + list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations) +endif() + # Link objects into a single executable with COMPILER_RT_TEST_COMPILER, # using specified link flags. Make executable a part of provided # test_suite. @@ -147,9 +165,8 @@ macro(add_compiler_rt_test test_suite test_name) separate_arguments(TEST_LINK_FLAGS) endif() add_custom_target(${test_name} - # MSVS CL doesn't allow a space between -Fe and the output file name. COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS} - ${COMPILER_RT_TEST_COMPILER_EXE}"${output_bin}" + -o "${output_bin}" ${TEST_LINK_FLAGS} DEPENDS ${TEST_DEPS}) # Make the test suite depend on the binary. diff --git a/cmake/Modules/CompilerRTCompile.cmake b/cmake/Modules/CompilerRTCompile.cmake index 4885c82e7..2d1dd22e3 100644 --- a/cmake/Modules/CompilerRTCompile.cmake +++ b/cmake/Modules/CompilerRTCompile.cmake @@ -17,15 +17,21 @@ macro(clang_compile object_file source) else() string(REPLACE " " ";" global_flags "${CMAKE_C_FLAGS}") endif() + # On Windows, CMAKE_*_FLAGS are built for MSVC but we use the GCC clang.exe + # which doesn't support flags starting with "/smth". Replace those with + # "-smth" equivalents. + if(MSVC) + string(REGEX REPLACE "^/" "-" global_flags "${global_flags}") + string(REPLACE ";/" ";-" global_flags "${global_flags}") + endif() # Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options # which are not supported by Clang. list(APPEND global_flags -Wno-unknown-warning-option) set(compile_flags ${global_flags} ${SOURCE_CFLAGS}) add_custom_command( OUTPUT ${object_file} - # MSVS CL doesn't allow a space between -Fo and the object file name. COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c - ${COMPILER_RT_TEST_COMPILER_OBJ}"${object_file}" + -o "${object_file}" ${source_rpath} MAIN_DEPENDENCY ${source} DEPENDS ${SOURCE_DEPS}) |