|
| 1 | +# ============================================================================== |
| 2 | +# |
| 3 | +# This file is part of the YUP library. |
| 4 | +# Copyright (c) 2026 - [email protected] |
| 5 | +# |
| 6 | +# YUP is an open source library subject to open-source licensing. |
| 7 | +# |
| 8 | +# The code included in this file is provided under the terms of the ISC license |
| 9 | +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
| 10 | +# To use, copy, modify, and/or distribute this software for any purpose with or |
| 11 | +# without fee is hereby granted provided that the above copyright notice and |
| 12 | +# this permission notice appear in all copies. |
| 13 | +# |
| 14 | +# YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
| 15 | +# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
| 16 | +# DISCLAIMED. |
| 17 | +# |
| 18 | +# ============================================================================== |
| 19 | + |
| 20 | +#============================================================================== |
| 21 | +# iOS Platform Configuration |
| 22 | +#============================================================================== |
| 23 | + |
| 24 | +# Handle iOS simulator builds when not using the full YUP iOS toolchain |
| 25 | +# This ensures the correct SDK is used even when using FetchContent |
| 26 | +if (DEFINED PLATFORM AND PLATFORM MATCHES "^SIMULATOR") |
| 27 | + # Determine the correct SDK name based on platform |
| 28 | + set (SDK_NAME "iphonesimulator") |
| 29 | + |
| 30 | + # Query xcodebuild for the simulator SDK path if sysroot is not set correctly |
| 31 | + if (NOT DEFINED CMAKE_OSX_SYSROOT OR CMAKE_OSX_SYSROOT STREQUAL "" OR CMAKE_OSX_SYSROOT MATCHES "iphoneos") |
| 32 | + find_program (XCODEBUILD_EXECUTABLE xcodebuild) |
| 33 | + if (XCODEBUILD_EXECUTABLE) |
| 34 | + execute_process ( |
| 35 | + COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk ${SDK_NAME} Path |
| 36 | + OUTPUT_VARIABLE SIMULATOR_SDK_PATH |
| 37 | + ERROR_QUIET |
| 38 | + OUTPUT_STRIP_TRAILING_WHITESPACE |
| 39 | + ) |
| 40 | + if (SIMULATOR_SDK_PATH) |
| 41 | + set (CMAKE_OSX_SYSROOT "${SIMULATOR_SDK_PATH}" CACHE PATH "iOS Simulator SDK path" FORCE) |
| 42 | + _yup_message (STATUS "Using iOS Simulator SDK: ${SIMULATOR_SDK_PATH}") |
| 43 | + endif() |
| 44 | + endif() |
| 45 | + endif() |
| 46 | +endif() |
0 commit comments