[llvm-commits] [compiler-rt] r170698 - /compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt

David Blaikie dblaikie at gmail.com
Thu Dec 20 12:46:20 PST 2012


On Thu, Dec 20, 2012 at 12:03 PM, Alexey Samsonov <samsonov at google.com> wrote:
> On Thu, Dec 20, 2012 at 9:19 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> On Thu, Dec 20, 2012 at 6:38 AM, Alexey Samsonov <samsonov at google.com>
>> wrote:
>> > Author: samsonov
>> > Date: Thu Dec 20 08:38:02 2012
>> > New Revision: 170698
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=170698&view=rev
>> > Log:
>> > [Sanitizer] Fix CMake build rules for sanitizer_common tests to respect
>> > universal static libraries on Mac
>> >
>> > Modified:
>> >     compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>>
>> I'm seeing warnings from ninja that appear to be related to this change:
>>
>> ninja: warning: multiple rules generate
>>
>> projects/compiler-rt/lib/sanitizer_common/tests/libRTSanitizerCommon.test.i386.a.
>> build will not be correct; continuing anyway
>> ninja: warning: multiple rules generate
>>
>> projects/compiler-rt/lib/sanitizer_common/tests/libRTSanitizerCommon.test.x86_64.a.
>> build will not be correct; continuing anyway
>
>
> Yes, I can reproduce this warning in a clean tree. Will take a look tomorrow
> (hope this doesn't block you badly).

Not too badly - I just revert to "make check-clang" when compiler-rt
doesn't function. (last I checked I was still seeing test failures in
compiler-rt in some way anyway)

- David

>
>>
>>
>> (I haven't tried a full clean rebuild yet, though)
>>
>> >
>> > Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=170698&r1=170697&r2=170698&view=diff
>> >
>> > ==============================================================================
>> > --- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>> > (original)
>> > +++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Thu Dec
>> > 20 08:38:02 2012
>> > @@ -15,6 +15,24 @@
>> >  include_directories(..)
>> >  include_directories(../..)
>> >
>> > +# Adds static library which contains sanitizer_common object file
>> > +# (universal binary on Mac and arch-specific object files on Linux).
>> > +macro(add_sanitizer_common_lib library)
>> > +  add_library(${library} STATIC ${ARGN})
>> > +  set_target_properties(${library} PROPERTIES
>> > +    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
>> > +  set(lib_name "lib${library}.a")
>> > +  add_custom_target(${lib_name} DEPENDS ${library})
>> > +endmacro()
>> > +
>> > +function(get_sanitizer_common_lib_for_arch arch lib_name)
>> > +  if(APPLE)
>> > +    set(${lib_name} "libRTSanitizerCommon.test.osx.a" PARENT_SCOPE)
>> > +  else()
>> > +    set(${lib_name} "libRTSanitizerCommon.test.${arch}.a" PARENT_SCOPE)
>> > +  endif()
>> > +endfunction()
>> > +
>> >  # Sanitizer_common unit tests testsuite.
>> >  add_custom_target(SanitizerUnitTests)
>> >  set_target_properties(SanitizerUnitTests PROPERTIES
>> > @@ -40,16 +58,7 @@
>> >                    DEPS gtest ${SANITIZER_RUNTIME_LIBRARIES})
>> >      list(APPEND SANITIZER_TEST_OBJECTS ${output_obj})
>> >    endforeach()
>> > -  # Add static library which contains sanitizer_common
>> > -  # object files for given arch.
>> > -  set(SANITIZER_COMMON_LIB "RTSanitizerCommon.test.${arch}")
>> > -  add_library(${SANITIZER_COMMON_LIB} STATIC
>> > -              $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>)
>> > -  set_target_properties(${SANITIZER_COMMON_LIB} PROPERTIES
>> > -    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
>> > -  set(SANITIZER_COMMON_LIB_NAME "lib${SANITIZER_COMMON_LIB}.a")
>> > -  add_custom_target(${SANITIZER_COMMON_LIB_NAME}
>> > -    DEPENDS ${SANITIZER_COMMON_LIB})
>> > +  get_sanitizer_common_lib_for_arch(${arch} SANITIZER_COMMON_LIB_NAME)
>> >    # Add unittest target.
>> >    set(SANITIZER_TEST_NAME "Sanitizer-${arch}-Test")
>> >    add_compiler_rt_test(SanitizerUnitTests ${SANITIZER_TEST_NAME}
>> > @@ -59,6 +68,19 @@
>> >  endmacro()
>> >
>> >  if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX AND NOT
>> > ANDROID)
>> > +  if(APPLE)
>> > +    add_sanitizer_common_lib("RTSanitizerCommon.test.osx"
>> > +                             $<TARGET_OBJECTS:RTSanitizerCommon.osx>)
>> > +  else()
>> > +    if(CAN_TARGET_X86_64)
>> > +      add_sanitizer_common_lib("RTSanitizerCommon.test.x86_64"
>> > +
>> > $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>)
>> > +    endif()
>> > +    if(CAN_TARGET_I386)
>> > +      add_sanitizer_common_lib("RTSanitizerCommon.test.i386"
>> > +
>> > $<TARGET_OBJECTS:RTSanitizerCommon.i386>)
>> > +    endif()
>> > +  endif()
>> >    if(CAN_TARGET_X86_64)
>> >      add_sanitizer_tests_for_arch(x86_64)
>> >    endif()
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>
> --
> Alexey Samsonov, MSK
>



More information about the llvm-commits mailing list