From 9cd2f2edc1907c35d9fe29fe08bff4bf23d7a024 Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Thu, 18 Jun 2020 10:19:31 -0700 Subject: [PATCH] Check in pristine copy of Clang iOS toolchain (#2703) --- third_party/clang/LICENSE.TXT | 70 ++++++++++++++++++++++++++ third_party/clang/iOS.cmake | 94 +++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 third_party/clang/LICENSE.TXT create mode 100644 third_party/clang/iOS.cmake diff --git a/third_party/clang/LICENSE.TXT b/third_party/clang/LICENSE.TXT new file mode 100644 index 0000000000..8b1585d9db --- /dev/null +++ b/third_party/clang/LICENSE.TXT @@ -0,0 +1,70 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2003-2016 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- +Autoconf llvm/autoconf + llvm/projects/ModuleMaker/autoconf +Google Test llvm/utils/unittest/googletest +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} +pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} +ARM contributions llvm/lib/Target/ARM/LICENSE.TXT +md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h diff --git a/third_party/clang/iOS.cmake b/third_party/clang/iOS.cmake new file mode 100644 index 0000000000..3d33465512 --- /dev/null +++ b/third_party/clang/iOS.cmake @@ -0,0 +1,94 @@ +# Toolchain config for iOS. +# +# Usage: +# mkdir build; cd build +# cmake ..; make +# mkdir ios; cd ios +# cmake -DLLVM_IOS_TOOLCHAIN_DIR=/path/to/ios/ndk \ +# -DCMAKE_TOOLCHAIN_FILE=../../cmake/platforms/iOS.cmake ../.. +# make + +SET(CMAKE_SYSTEM_NAME Darwin) +SET(CMAKE_SYSTEM_VERSION 13) +SET(CMAKE_CXX_COMPILER_WORKS True) +SET(CMAKE_C_COMPILER_WORKS True) +SET(DARWIN_TARGET_OS_NAME ios) + +SET(PLATFORM_NAME iphoneos) +SET(PLATFORM_FLAG_NAME ios) + +IF("$ENV{RC_APPLETV}" STREQUAL "YES") + MESSAGE(STATUS "Building for tvos") + STRING(TOLOWER $ENV{RC_APPLETV_PLATFORM_NAME} PLATFORM_NAME) + SET(PLATFORM_FLAG_NAME tvos) +ENDIF() + +IF("$ENV{RC_WATCH}" STREQUAL "YES") + MESSAGE(STATUS "Building for watchos") + STRING(TOLOWER $ENV{RC_WATCH_PLATFORM_NAME} PLATFORM_NAME) + STRING(TOLOWER $ENV{RC_WATCH_PLATFORM_NAME} PLATFORM_FLAG_NAME) +ENDIF() + +IF(NOT DEFINED ENV{SDKROOT}) + execute_process(COMMAND xcodebuild -version -sdk ${PLATFORM_NAME} Path + OUTPUT_VARIABLE SDKROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +ELSE() + execute_process(COMMAND xcodebuild -version -sdk $ENV{SDKROOT} Path + OUTPUT_VARIABLE SDKROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +ENDIF() + +IF(NOT EXISTS ${SDKROOT}) + MESSAGE(FATAL_ERROR "SDKROOT could not be detected!") +ENDIF() + +set(CMAKE_OSX_SYSROOT ${SDKROOT}) + +IF(NOT CMAKE_C_COMPILER) + execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang + OUTPUT_VARIABLE CMAKE_C_COMPILER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Using c compiler ${CMAKE_C_COMPILER}") +ENDIF() + +IF(NOT CMAKE_CXX_COMPILER) + execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang++ + OUTPUT_VARIABLE CMAKE_CXX_COMPILER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Using c compiler ${CMAKE_CXX_COMPILER}") +ENDIF() + +IF(NOT CMAKE_AR) + execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ar + OUTPUT_VARIABLE CMAKE_AR_val + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + SET(CMAKE_AR ${CMAKE_AR_val} CACHE FILEPATH "Archiver") + message(STATUS "Using ar ${CMAKE_AR}") +ENDIF() + +IF(NOT CMAKE_RANLIB) + execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ranlib + OUTPUT_VARIABLE CMAKE_RANLIB_val + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib") + message(STATUS "Using ranlib ${CMAKE_RANLIB}") +ENDIF() + +IF (NOT DEFINED IOS_MIN_TARGET) + execute_process(COMMAND xcodebuild -sdk ${SDKROOT} -version SDKVersion + OUTPUT_VARIABLE IOS_MIN_TARGET + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +ENDIF() + +SET(IOS_COMMON_FLAGS "-isysroot $ENV{SDKROOT} -m${PLATFORM_FLAG_NAME}-version-min=${IOS_MIN_TARGET}") +SET(CMAKE_C_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE) +SET(CMAKE_CXX_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE) +SET(CMAKE_LINK_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_linkflags" FORCE)