Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS support #6003

Closed
alcroito opened this issue Apr 8, 2019 · 2 comments
Closed

iOS support #6003

alcroito opened this issue Apr 8, 2019 · 2 comments
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@alcroito
Copy link
Contributor

alcroito commented Apr 8, 2019

Hi,
Any plans to add iOS support, now that CMake /somewhat/ supports iOS?

https://cmake.org/cmake/help/v3.14/release/3.14.html#platforms

@LilyWangL LilyWangL added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Apr 9, 2019
@jasjuang
Copy link
Contributor

jasjuang commented Apr 9, 2019

would like to have iOS support at some point in the future too

alcroito added a commit to alcroito/vcpkg that referenced this issue May 1, 2019
The toolchain is automatically picked up when CMAKE_SYSTEM_NAME
equals iOS. The toolchain sets the architectures for which to build
packages, as well as the processor type (because certain packages like
libpng depend on their value).

Automatic detection of triplets for iOS / tvOS / watchOS is added when
using the vcpkg.cmake toolchain while building your own application.
It uses the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES
to detect the triplet.

Fix (in a hacky way) find_package to find vcpkg installed packages.
Reset the CMAKE_FIND_ROOT_PATH value, until upstream CMake removes its
hardcoding of CMAKE_FIND_ROOT_PATH to Apple's SDK sysroot.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue May 1, 2019
@alcroito
Copy link
Contributor Author

alcroito commented May 1, 2019

A WIP initial implementation that I did can be found at #6275 if anybody is interested to test it.

alcroito added a commit to alcroito/vcpkg that referenced this issue Jun 17, 2019
The toolchain is automatically picked up when CMAKE_SYSTEM_NAME
equals iOS. The toolchain sets the architectures for which to build
packages, as well as the processor type (because certain packages like
libpng depend on their value).

Automatic detection of triplets for iOS / tvOS / watchOS is added when
using the vcpkg.cmake toolchain while building your own application.
It uses the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES
to detect the triplet.

Fix (in a hacky way) find_package to find vcpkg installed packages.
Reset the CMAKE_FIND_ROOT_PATH value, until upstream CMake removes its
hardcoding of CMAKE_FIND_ROOT_PATH to Apple's SDK sysroot.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue Jun 17, 2019
alcroito added a commit to alcroito/vcpkg that referenced this issue Nov 27, 2019
The toolchain is automatically picked up when CMAKE_SYSTEM_NAME
equals iOS. The toolchain sets the architectures for which to build
packages, as well as the processor type (because certain packages like
libpng depend on their value).

Automatic detection of triplets for iOS / tvOS / watchOS is added when
using the vcpkg.cmake toolchain while building your own application.
It uses the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES
to detect the triplet.

Fix (in a hacky way) find_package to find vcpkg installed packages.
This is done by resetting the CMAKE_FIND_ROOT_PATH value,
until upstream vcpkg upgrades to using CMake 3.15.0.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue Nov 27, 2019
alcroito added a commit to alcroito/vcpkg that referenced this issue Dec 5, 2019
The toolchain is automatically picked up when CMAKE_SYSTEM_NAME
equals iOS. The toolchain sets the architectures for which to build
packages, as well as the processor type (because certain packages like
libpng depend on their value).

Automatic detection of triplets for iOS / tvOS / watchOS is added when
using the vcpkg.cmake toolchain while building your own application.
It uses the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES
to detect the triplet.

Fix (in a hacky way) find_package to find vcpkg installed packages.
This is done by resetting the CMAKE_FIND_ROOT_PATH value,
until upstream vcpkg upgrades to using CMake 3.15.0.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue Dec 5, 2019
alcroito added a commit to alcroito/vcpkg that referenced this issue Jan 20, 2020
The toolchain is automatically picked up when CMAKE_SYSTEM_NAME
equals iOS. The toolchain selects the architectures for which to build
packages, as well as the processor type (because certain packages like
libpng depend on the processor type value).

Automatic detection of triplets for iOS / tvOS / watchOS in the
vcpkg.cmake toolchain when building your own application.
It uses the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES
to detect the triplet.

Added workaround so find_package finds vcpkg installed packages
when targeting iOS.
This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH
while also adding the vcpkg package root in the find_package override
macro.
The workaround can be removed once vcpkg upgrades to CMake 3.15.0
or higher where the issue is fixed.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue Jan 20, 2020
alcroito added a commit to alcroito/vcpkg that referenced this issue Apr 15, 2020
Added an iOS toolchain to enable building packages for iOS.
The toolchain is used when a triplet's VCPKG_CMAKE_SYSTEM_NAME is set
to iOS.

To configure which architecture should be built, as well as other
iOS specifics, the following triplet variables can be set:
- VCPKG_TARGET_ARCHITECTURE
- VCPKG_OSX_SYSROOT
- VCPKG_OSX_DEPLOYMENT_TARGET
- VCPKG_OSX_ARCHITECTURES

The following VCPKG_TARGET_ARCHITECTURE values are currently
supported:
 - arm, arm64, x64, x86.

The following VCPKG_OSX_SYSROOT values are currently supported:
 - iphoneos, iphonesimulator, or an absolute path to the device or
   simulator Xcode SDK.

VCPKG_OSX_DEPLOYMENT_TARGET can be set to control the minimum iOS
delopyment target for the built libraries.

CMAKE_OSX_ARCHITECTURES is derived from VCPKG_TARGET_ARCHITECTURE,
so generally it should not be set. In case if someone needs to target
a more specific architecture (like armv7k or arm64e), it can
be set in the triplet via VCPKG_OSX_ARCHITECTURES.

Note that only certain combinations of the architecture and sysroot
will work: simulator SDKs only provide x86-based libraries, etc.

The toolchain also sets CMAKE_SYSTEM_PROCESSOR for certain
configurations, because certain packages (like libpng) depend on the
processor type.

Added 4 community iOS triplets that build static libraries:
- arm-ios, arm64-ios, x86-ios, x64-ios.
The non-arm triplets target the iOS simulator.

The triplets build static libraries because they are easiest to
integrate into an iOS project. Dynamic libraries or frameworks require
code signing on iOS, which complicates integration.

Added heuristics to try and automatically detect what iOS triplet to
use when building your own CMake project (so when a CMake project sets
CMAKE_TOOLCHAIN_FILE to buildsystems/vcpkg.cmake), if no explicit
triplet is provided (VCPKG_TARGET_TRIPLET is undefined).

The heuristic checks for the values of CMAKE_SYSTEM_NAME and
CMAKE_OSX_ARCHITECTURES. Note that for this to work,
CMAKE_OSX_ARCHITECTURES needs to be set before the first project()
call in your CMake project.

Added workaround so find_package finds vcpkg installed packages
when targeting iOS.
This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH
while also adding the vcpkg package root in the find_package override
macro.
The workaround can be removed once vcpkg upgrades to CMake 3.15.0
or higher where the issue is fixed.

Fixes: microsoft#6003
alcroito added a commit to alcroito/vcpkg that referenced this issue Apr 15, 2020
alcroito added a commit to alcroito/vcpkg that referenced this issue Jul 10, 2020
Added mapping of CMAKE_SYSTEM_NAME == iOS to the bundled iOS toolchain
file.

This fixes the "Unable to determine toolchain to use for
triplet arm64-ios with CMAKE_SYSTEM_NAME iOS" error.
alcroito added a commit to alcroito/vcpkg that referenced this issue Jul 10, 2020
ras0219-msft pushed a commit that referenced this issue Jul 13, 2020
…lets (#12361)

* [vcpkg ios] Fix detection of iOS toolchain (#6003)

Added mapping of CMAKE_SYSTEM_NAME == iOS to the bundled iOS toolchain
file.

This fixes the "Unable to determine toolchain to use for
triplet arm64-ios with CMAKE_SYSTEM_NAME iOS" error.

* [vcpkg ios] Set the CMake system processor for the simulator arches (#6003)

So it's consistent for all architectures.
strega-nil pushed a commit to strega-nil/vcpkg that referenced this issue May 5, 2021
…lets (microsoft#12361)

* [vcpkg ios] Fix detection of iOS toolchain (microsoft#6003)

Added mapping of CMAKE_SYSTEM_NAME == iOS to the bundled iOS toolchain
file.

This fixes the "Unable to determine toolchain to use for
triplet arm64-ios with CMAKE_SYSTEM_NAME iOS" error.

* [vcpkg ios] Set the CMake system processor for the simulator arches (microsoft#6003)

So it's consistent for all architectures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

3 participants