diff options
Diffstat (limited to 'Tests/RunCMake/Framework')
-rw-r--r-- | Tests/RunCMake/Framework/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/FrameworkLayout.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/RunCMakeTest.cmake | 33 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/foo.c | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/ios.cmake | 25 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/osx.cmake | 18 |
8 files changed, 125 insertions, 0 deletions
diff --git a/Tests/RunCMake/Framework/CMakeLists.txt b/Tests/RunCMake/Framework/CMakeLists.txt new file mode 100644 index 0000000..6dd8cdf --- /dev/null +++ b/Tests/RunCMake/Framework/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake new file mode 100644 index 0000000..107afdf --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.4) +enable_language(C) + +add_library(Framework SHARED foo.c) +set_target_properties(Framework PROPERTIES FRAMEWORK TRUE) diff --git a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake new file mode 100644 index 0000000..27d10d8 --- /dev/null +++ b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake @@ -0,0 +1,20 @@ +set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") +set(plist-file "${framework-dir}/Resources/Info.plist") +set(framework-library "${framework-dir}/Framework") +set(framework-versions "${framework-dir}/Versions") + +if(NOT IS_DIRECTORY ${framework-dir}) + message(SEND_ERROR "Framework not found at ${framework-dir}") +endif() + +if(NOT EXISTS ${plist-file}) + message(SEND_ERROR "plist file not found at ${plist-file}") +endif() + +if(NOT EXISTS ${framework-library}) + message(SEND_ERROR "Framework library not found at ${framework-library}") +endif() + +if(NOT EXISTS ${framework-versions}) + message(SEND_ERROR "Framework versions not found at ${framework-versions}") +endif() diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake new file mode 100644 index 0000000..d810283 --- /dev/null +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -0,0 +1,33 @@ +include(RunCMake) + +# iOS + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/iOSFrameworkLayout-build) +set(RunCMake_TEST_NO_CLEAN 1) +set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/ios.cmake") + +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + +run_cmake(FrameworkLayout) +run_cmake_command(iOSFrameworkLayout-build ${CMAKE_COMMAND} --build .) + +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_OPTIONS) + +# OSX + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/OSXFrameworkLayout-build) +set(RunCMake_TEST_NO_CLEAN 1) +set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/OSX.cmake") + +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + +run_cmake(FrameworkLayout) +run_cmake_command(OSXFrameworkLayout-build ${CMAKE_COMMAND} --build .) + +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/Framework/foo.c b/Tests/RunCMake/Framework/foo.c new file mode 100644 index 0000000..bf7759e --- /dev/null +++ b/Tests/RunCMake/Framework/foo.c @@ -0,0 +1 @@ +int foo() { return 42; } diff --git a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake new file mode 100644 index 0000000..373baad --- /dev/null +++ b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake @@ -0,0 +1,20 @@ +set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") +set(plist-file "${framework-dir}/Info.plist") +set(framework-library "${framework-dir}/Framework") +set(framework-versions "${framework-dir}/Versions") + +if(NOT IS_DIRECTORY ${framework-dir}) + message(SEND_ERROR "Framework not found at ${framework-dir}") +endif() + +if(NOT EXISTS ${plist-file}) + message(SEND_ERROR "plist file not found at ${plist-file}") +endif() + +if(NOT EXISTS ${framework-library}) + message(SEND_ERROR "Framework library not found at ${framework-library}") +endif() + +if(EXISTS ${framework-versions}) + message(SEND_ERROR "Framework versions found at ${framework-versions}") +endif() diff --git a/Tests/RunCMake/Framework/ios.cmake b/Tests/RunCMake/Framework/ios.cmake new file mode 100644 index 0000000..209a50d --- /dev/null +++ b/Tests/RunCMake/Framework/ios.cmake @@ -0,0 +1,25 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_VERSION 1) +set(UNIX True) +set(APPLE True) + +set(CMAKE_MACOSX_BUNDLE TRUE) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") + +find_program(XCRUN_EXECUTABLE xcrun) +if(NOT XCRUN_EXECUTABLE) + message(FATAL_ERROR "xcrun not found") +endif() + +execute_process( + COMMAND ${XCRUN_EXECUTABLE} --sdk iphoneos --show-sdk-path + OUTPUT_VARIABLE IOS_SDK_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(CMAKE_OSX_SYSROOT ${IOS_SDK_PATH} CACHE PATH "Sysroot used for iOS support") +set(CMAKE_OSX_ARCHITECTURES "armv7" CACHE STRING "Architectures to build for") +set(CMAKE_FIND_ROOT_PATH ${IOS_SDK_PATH} CACHE PATH "Find search path root") diff --git a/Tests/RunCMake/Framework/osx.cmake b/Tests/RunCMake/Framework/osx.cmake new file mode 100644 index 0000000..e021fcd --- /dev/null +++ b/Tests/RunCMake/Framework/osx.cmake @@ -0,0 +1,18 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_VERSION 1) +set(UNIX True) +set(APPLE True) + +find_program(XCRUN_EXECUTABLE xcrun) +if(NOT XCRUN_EXECUTABLE) + message(FATAL_ERROR "xcrun not found") +endif() + +execute_process( + COMMAND ${XCRUN_EXECUTABLE} --sdk macosx --show-sdk-path + OUTPUT_VARIABLE OSX_SDK_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH} CACHE PATH "Sysroot used for OSX support") + +set(CMAKE_FIND_ROOT_PATH ${OSX_SDK_PATH} CACHE PATH "Find search path root") |