<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 6, 2015, at 3:32 PM, Justin Bogner <<a href="mailto:mail@justinbogner.com" class="">mail@justinbogner.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Chris Bieneman <</span><a href="mailto:beanz@apple.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">beanz@apple.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> writes:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">beanz created this revision.<br class="">beanz added reviewers: zaks.anna, bogner, kubabrecka, samsonov, chandlerc.<br class="">beanz added a subscriber: llvm-commits.<br class=""><br class="">This is a reunification of three separate reviews D11073, D11082, D11083.<br class=""><br class="">Having them separate was not constructive even though the patches were<br class="">smaller because it led to fragmented conversations, and this is really<br class="">all about one change.<br class=""><br class="">This patch incorporates feedback from samsonov, and refactors the<br class="">hacky darwin code out of the root CMakeLists.txt and int<br class="">config-ix.cmake.<br class=""><br class=""><a href="http://reviews.llvm.org/D11820" class="">http://reviews.llvm.org/D11820</a><br class=""><br class="">Files:<br class=""> CMakeLists.txt<br class=""> cmake/Modules/AddCompilerRT.cmake<br class=""> cmake/Modules/CompilerRTDarwinUtils.cmake<br class=""> cmake/Modules/CompilerRTUtils.cmake<br class=""> cmake/config-ix.cmake<br class=""><br class="">Index: cmake/config-ix.cmake<br class="">===================================================================<br class="">--- cmake/config-ix.cmake<br class="">+++ cmake/config-ix.cmake<br class="">@@ -244,26 +244,164 @@<br class=""> endif()<br class="">endfunction()<br class=""><br class="">-# Architectures supported by compiler-rt libraries.<br class="">-filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH<br class="">- x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mips64 mipsel mips64el)<br class="">-# LSan and UBSan common files should be available on all architectures supported<br class="">-# by other sanitizers (even if they build into dummy object files).<br class="">-filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH<br class="">- ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">-filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH<br class="">- ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">-filter_available_targets(ASAN_SUPPORTED_ARCH<br class="">- x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el aarch64)<br class="">-filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64 mips64 mips64el aarch64)<br class="">-filter_available_targets(LSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)<br class="">-filter_available_targets(MSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)<br class="">-filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 i686 arm mips mips64<br class="">- mipsel mips64el aarch64 powerpc64 powerpc64le)<br class="">-filter_available_targets(TSAN_SUPPORTED_ARCH x86_64 mips64 mips64el aarch64)<br class="">-filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips<br class="">- mipsel mips64 mips64el powerpc64 powerpc64le)<br class="">-filter_available_targets(SAFESTACK_SUPPORTED_ARCH x86_64 i386 i686)<br class="">+set(ARM64 aarch64)<br class="">+set(ARM32 arm)<br class="">+set(X86_64 x86_64)<br class="">+if(APPLE)<br class="">+ set(ARM64 arm64)<br class="">+ set(ARM32 armv7 armv7s)<br class="">+ set(X86_64 x86_64 x86_64h)<br class="">+endif()<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Should we also set X86, PPC64, MIPS, and MIPS64 for consistency?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>The only reason I abstracted these is because they are different on Apple vs non-Apple platforms. We could do them all, but I don’t think that really adds any value.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">+<br class="">+set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86_64} i386 i686 powerpc64 powerpc64le<br class="">+ ${ARM32} ${ARM64} mips mips64 mipsel mips64el)<br class="">+set(ALL_ASAN_SUPPORTED_ARCH ${X86_64} i386 i686 powerpc64 powerpc64le ${ARM32}<br class="">+ ${ARM64} mips mipsel mips64 mips64el)<br class="">+set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64})<br class="">+set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el)<br class="">+set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el)<br class="">+set(ALL_PROFILE_SUPPORTED_ARCH ${X86_64} i386 i686 ${ARM32} mips mips64<br class="">+ mipsel mips64el aarch64 powerpc64 powerpc64le)<br class="">+set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64})<br class="">+set(ALL_UBSAN_SUPPORTED_ARCH ${X86_64} i386 i686 ${ARM32} ${ARM64} mips<br class="">+ mipsel mips64 mips64el powerpc64 powerpc64le)<br class="">+set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86_64} i386 i686)<br class="">+<br class="">+if(APPLE)<br class="">+ include(CompilerRTDarwinUtils)<br class="">+<br class="">+ option(COMPILER_RT_ENABLE_IOS "Enable building for iOS - Experimental" Off)<br class="">+<br class="">+ find_darwin_sdk_dir(OSX_SDK_DIR macosx)<br class="">+ find_darwin_sdk_dir(IOSSIM_SDK_DIR iphonesimulator)<br class="">+ find_darwin_sdk_dir(IOS_SDK_DIR iphoneos)<br class="">+<br class="">+ # Note: In order to target x86_64h on OS X the minimum deployment target must<br class="">+ # be 10.8 or higher.<br class="">+ set(SANITIZER_COMMON_SUPPORTED_OS osx)<br class="">+ string(REGEX MATCH "-mmacosx-version-min=([.0-9]+)"<br class="">+ MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")<br class="">+ if(MACOSX_VERSION_MIN_FLAG)<br class="">+ set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}")<br class="">+ elseif(CMAKE_OSX_DEPLOYMENT_TARGET)<br class="">+ set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})<br class="">+ else()<br class="">+ set(SANITIZER_MIN_OSX_VERSION 10.9)<br class="">+ endif()<br class="">+ if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")<br class="">+ message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}")<br class="">+ endif()<br class="">+<br class="">+ set(CMAKE_OSX_DEPLOYMENT_TARGET "") # We're setting the flag manually for each target OS<br class="">+ <br class="">+ set(DARWIN_COMMON_CFLAGS -stdlib=libc++)<br class="">+ set(DARWIN_COMMON_LINKFLAGS<br class="">+ -stdlib=libc++<br class="">+ -lc++<br class="">+ -lc++abi)<br class="">+ <br class="">+ set(DARWIN_osx_CFLAGS<br class="">+ ${DARWIN_COMMON_CFLAGS}<br class="">+ -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})<br class="">+ set(DARWIN_osx_LINKFLAGS<br class="">+ ${DARWIN_COMMON_LINKFLAGS}<br class="">+ -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})<br class="">+<br class="">+ if(OSX_SDK_DIR)<br class="">+ list(APPEND DARWIN_osx_CFLAGS -isysroot ${OSX_SDK_DIR})<br class="">+ list(APPEND DARWIN_osx_LINKFLAGS -isysroot ${OSX_SDK_DIR})<br class="">+ endif()<br class="">+<br class="">+ # Figure out which arches to use for each OS<br class="">+ darwin_get_toolchain_supported_archs(toolchain_arches)<br class="">+ message(STATUS "Toolchain supported arches: ${toolchain_arches}")<br class="">+ <br class="">+ if(NOT MACOSX_VERSION_MIN_FLAG)<br class="">+ darwin_test_archs(osx<br class="">+ DARWIN_osx_ARCHS<br class="">+ ${toolchain_arches})<br class="">+ message(STATUS "OSX supported arches: ${DARWIN_osx_ARCHS}")<br class="">+ foreach(arch ${DARWIN_osx_ARCHS})<br class="">+ list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})<br class="">+ endforeach()<br class="">+<br class="">+ if(IOSSIM_SDK_DIR)<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I feel like the IOSSIM and IOS stuff should happen whether or not</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">MACOSX_VERSION_MIN_FLAG is set, but maybe I'm missing something here.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Sadly we can’t. If the version min flag is specified on the CXX options it is quite painful to remove it, so we just opt out of iOS. This code is in tree today and opts out of building the simulator sanitizers.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">+ set(DARWIN_iossim_CFLAGS<br class="">+ ${DARWIN_COMMON_CFLAGS}<br class="">+ -mios-simulator-version-min=7.0<br class="">+ -isysroot ${IOSSIM_SDK_DIR})<br class="">+ set(DARWIN_iossim_LINKFLAGS<br class="">+ ${DARWIN_COMMON_LINKFLAGS}<br class="">+ -Wl,-ios_simulator_version_min,7.0.0<br class="">+ -mios-simulator-version-min=7.0<br class="">+ -isysroot ${IOSSIM_SDK_DIR})<br class="">+<br class="">+ list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim)<br class="">+ darwin_test_archs(iossim<br class="">+ DARWIN_iossim_ARCHS<br class="">+ ${toolchain_arches})<br class="">+ message(STATUS "iOS Simulator supported arches: ${DARWIN_iossim_ARCHS}")<br class="">+ foreach(arch ${DARWIN_iossim_ARCHS})<br class="">+ list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})<br class="">+ endforeach()<br class="">+ endif()<br class="">+<br class="">+ if(IOS_SDK_DIR AND COMPILER_RT_ENABLE_IOS)<br class="">+ set(DARWIN_ios_CFLAGS<br class="">+ ${DARWIN_COMMON_CFLAGS}<br class="">+ -miphoneos-version-min=7.0<br class="">+ -isysroot ${IOS_SDK_DIR})<br class="">+ set(DARWIN_ios_LINKFLAGS<br class="">+ ${DARWIN_COMMON_LINKFLAGS}<br class="">+ -Wl,-ios_version_min,7.0.0<br class="">+ -miphoneos-version-min=7.0<br class="">+ -isysroot ${IOS_SDK_DIR})<br class="">+<br class="">+ list(APPEND SANITIZER_COMMON_SUPPORTED_OS ios)<br class="">+ darwin_test_archs(ios<br class="">+ DARWIN_ios_ARCHS<br class="">+ ${toolchain_arches})<br class="">+ message(STATUS "iOS supported arches: ${DARWIN_ios_ARCHS}")<br class="">+ foreach(arch ${DARWIN_ios_ARCHS})<br class="">+ list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})<br class="">+ endforeach()<br class="">+ endif()<br class="">+ endif()<br class="">+<br class="">+ # for list_union<br class="">+ include(CompilerRTUtils)<br class="">+<br class="">+ list_union(SANITIZER_COMMON_SUPPORTED_ARCH ALL_SANITIZER_COMMON_SUPPORTED_ARCH toolchain_arches)<br class="">+ set(LSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ set(UBSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ set(ASAN_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ list_union(DFSAN_SUPPORTED_ARCH ALL_DFSAN_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class="">+ list_union(LSAN_SUPPORTED_ARCH ALL_LSAN_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class="">+ list_union(MSAN_SUPPORTED_ARCH ALL_MSAN_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class="">+ # Note: profiles is only built for OS X<br class="">+ list_union(PROFILE_SUPPORTED_ARCH ALL_PROFILE_SUPPORTED_ARCH DARWIN_osx_ARCHS)<br class="">+ list_union(TSAN_SUPPORTED_ARCH ALL_TSAN_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class="">+ list_union(UBSAN_SUPPORTED_ARCH ALL_UBSAN_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class="">+ list_union(SAFESTACK_SUPPORTED_ARCH ALL_SAFESTACK_SUPPORTED_ARCH SANITIZER_COMMON_SUPPORTED_ARCH)<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I don't know how line wrapping works in CMake, but it'd be nice to</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">follow 80-col here if that's at all reasonable.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div>Sure, I can clean that up. Generally CMake scripts don’t follow 80-col because some things can’t be split up, but all this can.</div><div><br class=""></div><div>-Chris</div><div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">+else()<br class="">+ # Architectures supported by compiler-rt libraries.<br class="">+ filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH<br class="">+ ${ALL_SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ # LSan and UBSan common files should be available on all architectures supported<br class="">+ # by other sanitizers (even if they build into dummy object files).<br class="">+ filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH<br class="">+ ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH<br class="">+ ${SANITIZER_COMMON_SUPPORTED_ARCH})<br class="">+ filter_available_targets(ASAN_SUPPORTED_ARCH ${ALL_ASAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(DFSAN_SUPPORTED_ARCH ${ALL_DFSAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(LSAN_SUPPORTED_ARCH ${ALL_LSAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(MSAN_SUPPORTED_ARCH ${ALL_MSAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(PROFILE_SUPPORTED_ARCH ${ALL_PROFILE_SUPPORTED_ARCH})<br class="">+ filter_available_targets(TSAN_SUPPORTED_ARCH ${ALL_TSAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(UBSAN_SUPPORTED_ARCH ${ALL_UBSAN_SUPPORTED_ARCH})<br class="">+ filter_available_targets(SAFESTACK_SUPPORTED_ARCH ${ALL_SAFESTACK_SUPPORTED_ARCH})<br class="">+endif()<br class=""><br class="">if(ANDROID)<br class=""> set(OS_NAME "Android")<br class="">Index: cmake/Modules/CompilerRTUtils.cmake<br class="">===================================================================<br class="">--- cmake/Modules/CompilerRTUtils.cmake<br class="">+++ cmake/Modules/CompilerRTUtils.cmake<br class="">@@ -57,3 +57,13 @@<br class=""> endif()<br class=""> list(APPEND ${list} "${varname}=${${varname}}")<br class="">endmacro()<br class="">+<br class="">+macro(list_union output input1 input2)<br class="">+ set(${output})<br class="">+ foreach(it ${${input1}})<br class="">+ list(FIND ${input2} ${it} index)<br class="">+ if( NOT (index EQUAL -1))<br class="">+ set(${output} ${${output}} ${it})<br class="">+ endif()<br class="">+ endforeach()<br class="">+endmacro()<br class="">Index: cmake/Modules/CompilerRTDarwinUtils.cmake<br class="">===================================================================<br class="">--- /dev/null<br class="">+++ cmake/Modules/CompilerRTDarwinUtils.cmake<br class="">@@ -0,0 +1,78 @@<br class="">+# On OS X SDKs can be installed anywhere on the base system and xcode-select can<br class="">+# set the default Xcode to use. This function finds the SDKs that are present in<br class="">+# the current Xcode.<br class="">+function(find_darwin_sdk_dir var sdk_name)<br class="">+ # Let's first try the internal SDK, otherwise use the public SDK.<br class="">+ execute_process(<br class="">+ COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path<br class="">+ OUTPUT_VARIABLE var_internal<br class="">+ OUTPUT_STRIP_TRAILING_WHITESPACE<br class="">+ ERROR_FILE /dev/null<br class="">+ )<br class="">+ if("" STREQUAL "${var_internal}")<br class="">+ execute_process(<br class="">+ COMMAND xcodebuild -version -sdk ${sdk_name} Path<br class="">+ OUTPUT_VARIABLE var_internal<br class="">+ OUTPUT_STRIP_TRAILING_WHITESPACE<br class="">+ ERROR_FILE /dev/null<br class="">+ )<br class="">+ endif()<br class="">+ set(${var} ${var_internal} PARENT_SCOPE)<br class="">+endfunction()<br class="">+<br class="">+# There isn't a clear mapping of what architectures are supported with a given<br class="">+# target platform, but ld's version output does list the architectures it can<br class="">+# link for.<br class="">+function(darwin_get_toolchain_supported_archs output_var)<br class="">+ execute_process(<br class="">+ COMMAND ld -v<br class="">+ ERROR_VARIABLE LINKER_VERSION)<br class="">+<br class="">+ string(REGEX MATCH "configured to support archs: (.*)\nLTO support.*"<br class="">+ ARCHES_MATCHED "${LINKER_VERSION}")<br class="">+ if(ARCHES_MATCHED)<br class="">+ set(ARCHES "${CMAKE_MATCH_1}")<br class="">+ message("Matched ARCHES: ${ARCHES}")<br class="">+ string(REPLACE " " ";" ARCHES ${ARCHES})<br class="">+ else()<br class="">+ # If auto-detecting fails, fall back to a default set<br class="">+ message(WARNING "Detecting supported architectures from 'ld -v' failed. Returning default set.")<br class="">+ set(ARCHES "i386;x86_64;armv7;armv7s;arm64")<br class="">+ endif()<br class="">+ <br class="">+ set(${output_var} ${ARCHES} PARENT_SCOPE)<br class="">+endfunction()<br class="">+<br class="">+# This function takes an OS and a list of architectures and identifies the<br class="">+# subset of the architectures list that the installed toolchain can target.<br class="">+function(darwin_test_archs os valid_archs)<br class="">+ set(archs ${ARGN})<br class="">+ message(STATUS "Finding valid architectures for ${os}...")<br class="">+ set(SIMPLE_CPP ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.cpp)<br class="">+ file(WRITE ${SIMPLE_CPP} "#include <iostream>\nint main() { return 0; }\n")<br class="">+<br class="">+ set(os_linker_flags)<br class="">+ foreach(flag ${DARWIN_${os}_LINKFLAGS})<br class="">+ set(os_linker_flags "${os_linker_flags} ${flag}")<br class="">+ endforeach()<br class="">+<br class="">+ # The simple program will build for x86_64h on the simulator because it is<span class="Apple-converted-space"> </span><br class="">+ # compatible with x86_64 libraries (mostly).<br class="">+ if(${os} STREQUAL "iossim")<br class="">+ list(REMOVE_ITEM archs "x86_64h")<br class="">+ endif()<br class="">+<br class="">+ set(WORKING_ARCHES)<br class="">+ foreach(arch ${archs})<br class="">+ <br class="">+ set(arch_linker_flags "-arch ${arch} ${os_linker_flags}")<br class="">+ try_compile(CAN_TARGET_${os}_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_CPP}<br class="">+ COMPILE_DEFINITIONS "-v -arch ${arch}" ${DARWIN_${os}_CFLAGS}<br class="">+ CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${arch_linker_flags}"<br class="">+ OUTPUT_VARIABLE TEST_OUTPUT)<br class="">+ if(${CAN_TARGET_${os}_${arch}})<br class="">+ list(APPEND WORKING_ARCHES ${arch})<br class="">+ endif()<br class="">+ endforeach()<br class="">+ set(${valid_archs} ${WORKING_ARCHES} PARENT_SCOPE)<br class="">+endfunction()<br class="">\ No newline at end of file<br class="">Index: cmake/Modules/AddCompilerRT.cmake<br class="">===================================================================<br class="">--- cmake/Modules/AddCompilerRT.cmake<br class="">+++ cmake/Modules/AddCompilerRT.cmake<br class="">@@ -19,6 +19,8 @@<br class=""> set(libname "${name}.${os}")<br class=""> set(libnames ${libnames} ${libname})<br class=""> set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS})<br class="">+ set(extra_linkflags_${libname} ${DARWIN_${os}_LINKFLAGS})<br class="">+ list_union(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS)<br class=""> endforeach()<br class=""> else()<br class=""> foreach(arch ${LIB_ARCHS})<br class="">@@ -39,7 +41,9 @@<br class=""> set_property(TARGET ${libname} APPEND PROPERTY<br class=""> COMPILE_DEFINITIONS ${LIB_DEFS})<br class=""> if(APPLE)<br class="">- set_target_properties(${libname} PROPERTIES OSX_ARCHITECTURES "${LIB_ARCHS}")<br class="">+ set_target_properties(${libname} PROPERTIES<br class="">+ OSX_ARCHITECTURES "${LIB_ARCHS_${libname}}"<br class="">+ LINK_FLAGS "${extra_linkflags_${libname}}")<br class=""> endif()<br class=""> endforeach()<br class="">endfunction()<br class="">@@ -118,8 +122,9 @@<br class=""> set_target_link_flags(${name} ${LIB_LINKFLAGS} ${DARWIN_${os}_LINKFLAGS})<br class=""> set_property(TARGET ${name} APPEND PROPERTY<br class=""> COMPILE_DEFINITIONS ${LIB_DEFS})<br class="">+ list_union(filtered_arches DARWIN_${os}_ARCHS LIB_ARCHS)<br class=""> set_target_properties(${name} PROPERTIES<br class="">- OSX_ARCHITECTURES "${LIB_ARCHS}"<br class="">+ OSX_ARCHITECTURES "${filtered_arches}"<br class=""> LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})<br class=""> install(TARGETS ${name}<br class=""> LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})<br class="">Index: CMakeLists.txt<br class="">===================================================================<br class="">--- CMakeLists.txt<br class="">+++ CMakeLists.txt<br class="">@@ -276,66 +276,6 @@<br class="">append_list_if(COMPILER_RT_HAS_WD4391_FLAG /wd4391 SANITIZER_COMMON_CFLAGS)<br class="">append_list_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS)<br class="">append_list_if(COMPILER_RT_HAS_WD4800_FLAG /wd4800 SANITIZER_COMMON_CFLAGS)<br class="">-if(APPLE)<br class="">- macro(find_darwin_sdk_dir var sdk_name)<br class="">- # Let's first try the internal SDK, otherwise use the public SDK.<br class="">- execute_process(<br class="">- COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path<br class="">- OUTPUT_VARIABLE ${var}<br class="">- OUTPUT_STRIP_TRAILING_WHITESPACE<br class="">- ERROR_FILE /dev/null<br class="">- )<br class="">- if(${var} STREQUAL "")<br class="">- execute_process(<br class="">- COMMAND xcodebuild -version -sdk ${sdk_name} Path<br class="">- OUTPUT_VARIABLE ${var}<br class="">- OUTPUT_STRIP_TRAILING_WHITESPACE<br class="">- ERROR_FILE /dev/null<br class="">- )<br class="">- endif()<br class="">- endmacro()<br class="">-<br class="">- find_darwin_sdk_dir(OSX_SDK_DIR macosx)<br class="">- find_darwin_sdk_dir(IOSSIM_SDK_DIR iphonesimulator)<br class="">-<br class="">- set(SANITIZER_COMMON_SUPPORTED_OS osx)<br class="">- if(NOT SANITIZER_MIN_OSX_VERSION)<br class="">- string(REGEX MATCH "-mmacosx-version-min=([.0-9]+)"<br class="">- MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")<br class="">- if(MACOSX_VERSION_MIN_FLAG)<br class="">- set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}")<br class="">- elseif(CMAKE_OSX_DEPLOYMENT_TARGET)<br class="">- set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})<br class="">- else()<br class="">- set(SANITIZER_MIN_OSX_VERSION 10.9)<br class="">- if(IOSSIM_SDK_DIR)<br class="">- list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim)<br class="">- endif()<br class="">- endif()<br class="">- endif()<br class="">- if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")<br class="">- message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}")<br class="">- endif()<br class="">-<br class="">- set(CMAKE_OSX_DEPLOYMENT_TARGET "") # We evaluate target OS X version above.<br class="">- set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}<br class="">- -stdlib=libc++)<br class="">- set(DARWIN_iossim_CFLAGS<br class="">- -stdlib=libc++<br class="">- -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})<br class="">- set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}<br class="">- -stdlib=libc++ -lc++ -lc++abi)<br class="">- set(DARWIN_iossim_LINKFLAGS<br class="">- -stdlib=libc++ -lc++ -lc++abi<br class="">- -Wl,-ios_simulator_version_min,7.0.0<br class="">- -mios-simulator-version-min=7.0<br class="">- -isysroot ${IOSSIM_SDK_DIR})<br class="">-<br class="">- if(OSX_SDK_DIR)<br class="">- list(APPEND DARWIN_osx_CFLAGS -isysroot ${OSX_SDK_DIR})<br class="">- list(APPEND DARWIN_osx_LINKFLAGS -isysroot ${OSX_SDK_DIR})<br class="">- endif()<br class="">-endif()<br class=""><br class="">if(APPLE AND SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.9")<br class=""> # Mac OS X prior to 10.9 had problems with exporting symbols from</blockquote></div></blockquote></div><br class=""></body></html>