diff options
author | Brad King <brad.king@kitware.com> | 2015-10-26 17:13:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-10-26 17:13:02 (GMT) |
commit | d71920c45763fe15fa93c2fc1f5aceabba23975e (patch) | |
tree | 6533a1271f70a12006f3fa82a81265401af38241 | |
parent | 4c4da56b2eb22fd902a100b294ff2acb6d77fac3 (diff) | |
parent | a91eebebdb2a012c233db7869ec0ade534c4dd57 (diff) | |
download | CMake-d71920c45763fe15fa93c2fc1f5aceabba23975e.zip CMake-d71920c45763fe15fa93c2fc1f5aceabba23975e.tar.gz CMake-d71920c45763fe15fa93c2fc1f5aceabba23975e.tar.bz2 |
Merge topic 'xcode-watch-and-tvos'
a91eebeb Xcode: Recognise Watch and TV OS as embedded platforms
-rw-r--r-- | Source/cmMakefile.cxx | 21 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 32 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeBundles.cmake | 30 |
3 files changed, 73 insertions, 10 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 264b169..40e2892 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2407,10 +2407,23 @@ bool cmMakefile::PlatformIsAppleIos() const sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT"); sdkRoot = cmSystemTools::LowerCase(sdkRoot); - return sdkRoot.find("iphoneos") == 0 || - sdkRoot.find("/iphoneos") != std::string::npos || - sdkRoot.find("iphonesimulator") == 0 || - sdkRoot.find("/iphonesimulator") != std::string::npos; + const std::string embedded[] = + { + "appletvos", "appletvsimulator", + "iphoneos", "iphonesimulator", + "watchos", "watchsimulator", + }; + + for(size_t i = 0; i < sizeof(embedded) / sizeof(embedded[0]); ++i) + { + if(sdkRoot.find(embedded[i]) == 0 || + sdkRoot.find(std::string("/") + embedded[i]) != std::string::npos) + { + return true; + } + } + + return false; } const char* cmMakefile::GetSONameFlag(const std::string& language) const diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 7901ec0..f89d620 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -58,6 +58,38 @@ if(NOT XCODE_VERSION VERSION_LESS 5) endif() if(NOT XCODE_VERSION VERSION_LESS 7) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DTEST_WATCHOS=ON") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7.1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DTEST_TVOS=ON") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7) set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") run_cmake(XcodeTbdStub) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index 2cbccfa..0fdc6af 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -10,6 +10,22 @@ if(TEST_IOS) set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif(TEST_IOS) +if(TEST_WATCHOS) + set(CMAKE_OSX_SYSROOT watchos) + set(CMAKE_OSX_ARCHITECTURES "armv7k") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +if(TEST_TVOS) + set(CMAKE_OSX_SYSROOT appletvos) + set(CMAKE_OSX_ARCHITECTURES "arm64") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + # App Bundle add_executable(AppBundle MACOSX_BUNDLE main.m) @@ -35,11 +51,13 @@ endif() # Bundle -add_library(Bundle MODULE main.c) -set_target_properties(Bundle PROPERTIES BUNDLE TRUE) +if(NOT CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE) + add_library(Bundle MODULE main.c) + set_target_properties(Bundle PROPERTIES BUNDLE TRUE) -add_custom_target(BundleTest ALL - COMMAND ${CMAKE_COMMAND} -E copy - "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old") + add_custom_target(BundleTest ALL + COMMAND ${CMAKE_COMMAND} -E copy + "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old") -add_dependencies(BundleTest Bundle) + add_dependencies(BundleTest Bundle) +endif() |