Skip to content

Commit

Permalink
[CMake] Updating Xcode Toolchain creation to support Xcode 7
Browse files Browse the repository at this point in the history
Recent changes to Xcode have changed the structure of Xcode toolchains. This patch makes the xcode-toolchain goop construct a new-format Xcode toolchain that is compatible with Xcode 7.

The new format has a compatibility version key, so when a new format comes out we can support multiple formats in parallel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276718 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chris Bieneman committed Jul 26, 2016
1 parent 2970c22 commit a6b4cd4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tools/xcode-toolchain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ if(NOT toolchains_match)
endif()
set(toolchains_dir ${CMAKE_MATCH_1})

set(XcodeDefaultInfo "${toolchains_dir}/XcodeDefault.xctoolchain/ToolchainInfo.plist")
set(LLVMToolchainDir "${CMAKE_INSTALL_PREFIX}/Toolchains/LLVM${PACKAGE_VERSION}.xctoolchain/")

add_custom_command(OUTPUT ${LLVMToolchainDir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVMToolchainDir})

add_custom_command(OUTPUT ${LLVMToolchainDir}/ToolchainInfo.plist
add_custom_command(OUTPUT ${LLVMToolchainDir}/Info.plist
DEPENDS ${LLVMToolchainDir}
COMMAND ${CMAKE_COMMAND} -E copy "${XcodeDefaultInfo}" "${LLVMToolchainDir}/ToolchainInfo.plist"
COMMAND /usr/libexec/PlistBuddy -c "Set:Identifier org.llvm.${PACKAGE_VERSION}" "${LLVMToolchainDir}/ToolchainInfo.plist")
COMMAND ${CMAKE_COMMAND} -E remove ${LLVMToolchainDir}/Info.plist
COMMAND /usr/libexec/PlistBuddy -c "Add:CFBundleIdentifier string org.llvm.${PACKAGE_VERSION}" "${LLVMToolchainDir}/Info.plist"
COMMAND /usr/libexec/PlistBuddy -c "Add:CompatibilityVersion integer 1" "${LLVMToolchainDir}/Info.plist"
)

add_custom_target(install-xcode-toolchain
DEPENDS ${LLVMToolchainDir}/ToolchainInfo.plist
DEPENDS ${LLVMToolchainDir}/Info.plist
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
Expand All @@ -77,7 +78,7 @@ if(LLVM_DISTRIBUTION_COMPONENTS)
endif()

add_custom_target(install-distribution-toolchain
DEPENDS ${LLVMToolchainDir}/ToolchainInfo.plist distribution)
DEPENDS ${LLVMToolchainDir}/Info.plist distribution)

foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
add_custom_target(install-distribution-${target}
Expand Down

0 comments on commit a6b4cd4

Please sign in to comment.