[SERVER-28004] Add SCons support for targeting iOS, tvOS, and associated simulators Created: 14/Feb/17  Updated: 27/Feb/18  Resolved: 15/Feb/17

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.5.4

Type: New Feature Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Related
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-03-06
Participants:

 Description   

It should be possible for us to target not just macOS, but the other Darwin variants like iOS, tvOS, and the associated simulators.



 Comments   
Comment by Githook User [ 15/Feb/17 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-28004 Add build system support for iOS-related Darwin variants

Use a SCons invocation like the following to attach to the correct SDK
and targeting options.

// macOS native build:
> python buildscripts/scons.py CCFLAGS="-isysroot `xcrun --sdk macosx --show-sdk-path` -mmacosx-version-min=10.10" LINKFLAGS="-Wl,-syslibroot,`xcrun --sdk macosx --show-sdk-path` -mmacosx-version-min=10.10" CC=`xcrun -f --sdk macosx clang` CXX=`xcrun -f --sdk macosx clang++`all

// iOS Cross:
> python buildscripts/scons.py CCFLAGS="-arch arm64 -isysroot `xcrun --sdk iphoneos --show-sdk-path` -miphoneos-version-min=10.2" LINKFLAGS="-arch arm64 -Wl,-syslibroot,`xcrun --sdk iphoneos --show-sdk-path` -miphoneos-version-min=10.2" CC=`xcrun -f --sdk iphoneos clang` CXX=`xcrun -f --sdk iphoneos clang++` TARGET_OS=iOS TARGET_ARCH=aarch64 all

// iOS Simulator Cross:
> python buildscripts/scons.py CCFLAGS="-isysroot `xcrun --sdk iphonesimulator --show-sdk-path` -miphoneos-version-min=10.2" LINKFLAGS="-Wl,-syslibroot,`xcrun --sdk iphonesimulator --show-sdk-path` -miphoneos-version-min=10.2" CC=`xcrun -f --sdk iphonesimulator clang` CXX=`xcrun -f --sdk iphonesimulator clang++` TARGET_OS=iOS-sim all

// tvOS Cross:
> python buildscripts/scons.py CCFLAGS="-arch arm64 -isysroot `xcrun --sdk appletvos --show-sdk-path` -mtvos-version-min=10.1" LINKFLAGS="-arch arm64 -Wl,-syslibroot,`xcrun --sdk appletvos --show-sdk-path` -mtvos-version-min=10.1" CC=`xcrun -f --sdk appletvos clang` CXX=`xcrun -f --sdk appletvos clang++` TARGET_OS=tvOS TARGET_ARCH=aarch64 all

// tvOS Simulator Cross:
> python buildscripts/scons.py CCFLAGS="-isysroot `xcrun --sdk appletvsimulator --show-sdk-path` -mtvos-version-min=10.1" LINKFLAGS="-Wl,-syslibroot,`xcrun --sdk appletvsimulator --show-sdk-path` -mtvos-version-min=10.1" CC=`xcrun -f --sdk appletvsimulator clang` CXX=`xcrun -f --sdk appletvsimulator clang++` TARGET_OS=tvOS-sim

To run the resulting binaries under the simulator, boot a particular
target machine with 'xcrun simctl':

> xcrun simctl boot 'Apple TV 1080p'

Find the ID of the instance that was booted:

> xcrun simctl list | grep 'Apple TV 1080p'

And then spawn the intended binary inside the simulator with that ID:

> xcrun simctl spawn CEEC6346-6D21-4092-A091-E5A3862A357F build/opt/mongo/mongod --dbpath=tmp
Branch: master
https://github.com/mongodb/mongo/commit/38c0eb538d0fd390c6cb9ce9ae9894153f6e8ef5

Generated at Thu Feb 08 04:16:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.