Skip to content

Commit

Permalink
Adding visionOS support
Browse files Browse the repository at this point in the history
Updated build script along with each plug-in for visionOS support. This includes the ability to build for Vision Pro as well as the Vision Simulator.
  • Loading branch information
jared-marsau authored and GitHub Enterprise committed Mar 13, 2024
1 parent b2208e6 commit c4e145e
Show file tree
Hide file tree
Showing 90 changed files with 2,145 additions and 263 deletions.
30 changes: 19 additions & 11 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@

argument_parser = argparse.ArgumentParser(description="Builds all native libraries, packages plug-ins, and moves packages to build folder.")
argument_parser.add_argument("-p", "--plugin-list", dest="plugin_list", nargs='*', default=[PluginID.ALL], help=f"Selects the plug-ins to process. Possible values are: {PluginID.ACCESSIBILITY}, {PluginID.CORE}, {PluginID.CORE_HAPTICS}, {PluginID.GAME_CONTROLLER}, {PluginID.GAME_KIT}, {PluginID.PHASE}, or {PluginID.ALL}. Default is: {PluginID.ALL}")
argument_parser.add_argument("-m", "--platforms", dest="platform_list", nargs='*', default=[PlatformID.ALL], help=f"Selects the desired platforms to target when building native libraries. Possible values are: {PlatformID.IOS}, {PlatformID.IOS_SIMULATOR}, {PlatformID.MACOS}, {PlatformID.TVOS}, {PlatformID.TVOS_SIMULATOR}, {PlatformID.SIMULATORS}, {PlatformID.DEVICES} or {PlatformID.ALL}. Default is: {PlatformID.ALL}")
argument_parser.add_argument("-m", "--platforms", dest="platform_list", nargs='*', default=[PlatformID.ALL], help=f"Selects the desired platforms to target when building native libraries. Possible values are: {PlatformID.IOS}, {PlatformID.IOS_SIMULATOR}, {PlatformID.MACOS}, {PlatformID.TVOS}, {PlatformID.TVOS_SIMULATOR}, {PlatformID.VISIONOS}, {PlatformID.VISIONOS_SIMULATOR}, {PlatformID.SIMULATORS}, {PlatformID.DEVICES} or {PlatformID.ALL}. Default is: {PlatformID.ALL}")
argument_parser.add_argument("-b", "--build-action", dest="build_actions", nargs='*', default=[BuildActionID.BUILD, BuildActionID.PACK], help=f"Sets the build actions for the selected plug-ins. Possible values are: {BuildActionID.BUILD}, {BuildActionID.PACK}, {BuildActionID.NONE} or {BuildActionID.ALL}. Defaults are: {BuildActionID.BUILD}, {BuildActionID.PACK}")
argument_parser.add_argument("-bc","--build-config", dest="build_config", default=ConfigID.ALL, help=f"Sets the build configuration to compile. Possible values are: {ConfigID.RELEASE}, {ConfigID.DEBUG}, or {ConfigID.ALL} which builds all other configs. Default is: {ConfigID.ALL}")
argument_parser.add_argument("-c", "--codesign-identity", dest="codesign_identity", default=str(), help=f"String which uniquely identifies your codesign identity, typically represented by a hash. Only applied if build actions include {BuildActionID.BUILD}")
argument_parser.add_argument("-sc", "--skip-codesign", dest="skip_codesign", action="store_true", help=f"Skips codesign and all user prompts.")
argument_parser.add_argument("-u", "--unity-installation-root", dest="unity_installation_root", default="/Applications/Unity", help="Root path to search for Unity installations when building tests. Note: performs a full recursive search of the given directory.")
argument_parser.add_argument("-u", "--unity-installation-root", dest="unity_installation_root", default="", help="Root path to search for Unity installations when building tests. Note: performs a full recursive search of the given directory.")
argument_parser.add_argument("-o", "--output-path", dest="output_path", default=CTX.build_output_path, help=f"Build result path for final packages. Default: {CTX.build_output_path}")
argument_parser.add_argument("-k", "--clean-action", dest="clean_actions", nargs='*', default=[CleanActionID.NONE], help=f"Sets the clean actions for the selected plug-ins. Possible values are: {CleanActionID.NATIVE}, {CleanActionID.PACKAGES}, {CleanActionID.TESTS}, {CleanActionID.NONE}, or {CleanActionID.ALL}. Defaults to no clean action.")
argument_parser.add_argument("-f", "--force", dest="force_clean", action="store_true", help="Setting this option will not prompt user on file deletion during clean operations.")
Expand Down Expand Up @@ -110,16 +110,18 @@ def Main():
CTX.printer.SectionHeading("Command Line Option Summary")

print(f"\n Build Actions({Printer.Bold('-b')}): {CTX.printer.Context(' '.join(build_args.build_actions))}"
f"\n Selected Platforms({Printer.Bold('-m')}): {CTX.printer.Context(' '.join(filtered_user_platforms))} [Build System Support: {Printer.MultiDecorate(', '.join(supported_platforms), prompt_theme.info_bg_color, prompt_theme.info_color)}]"
f"\n Selected Platforms({Printer.Bold('-m')}): {CTX.printer.Context(' '.join(filtered_user_platforms))} (Build System Support: {Printer.MultiDecorate(', '.join(supported_platforms), prompt_theme.info_bg_color, prompt_theme.info_color)})"
f"\n Build Config({Printer.Bold('-bc')}): {CTX.printer.Context(build_args.build_config)}"
f"\n Package Output Path({Printer.Bold('-o')}): {CTX.printer.Context(build_args.output_path)}"
f"\n Selected Plug-Ins({Printer.Bold('-p')}): {CTX.printer.Context(' '.join(build_args.plugin_list))}"
f"\n Clean Actions({Printer.Bold('-k')}): {CTX.printer.Context(' '.join(build_args.clean_actions))}"
f"\n Force Clean({Printer.Bold('-f')}): {CTX.printer.Context('Yes (-f set)' if build_args.force_clean else 'No (-f not set)')}"
f"\n Unity Installation Root({Printer.Bold('-u')}): {CTX.printer.Context(build_args.unity_installation_root)}"
f"\n Build Tests({Printer.Bold('-t')}): {CTX.printer.Context('Yes (-t set)' if build_args.build_tests else 'No (-t not set)')}"
f"\n Skip Codesign({Printer.Bold('-sc')}): {CTX.printer.Context('Yes (-sc set)' if build_args.skip_codesign else 'No (-sc not set)')}")

if len(build_args.unity_installation_root) > 0:
print(f" Unity Installation Root({Printer.Bold('-u')}): {CTX.printer.Context(build_args.unity_installation_root)}")

if not build_args.skip_codesign:
print(f" Codesigning Identity({Printer.Bold('-c')}): {CTX.printer.Context(build_args.codesign_identity if len(build_args.codesign_identity) > 0 else 'None supplied.')}")

Expand Down Expand Up @@ -165,16 +167,21 @@ def Main():
PlatformID.IOS_SIMULATOR: False,
PlatformID.TVOS: False,
PlatformID.TVOS_SIMULATOR : False,
PlatformID.MACOS: False
PlatformID.MACOS: False,
PlatformID.VISIONOS: False,
PlatformID.VISIONOS_SIMULATOR: False
}

valid_platform_found = False
for platform_id in filtered_user_platforms:
if platform_id == PlatformID.ALL:
CTX.printer.Message(f"Platform '{PlatformID.ALL}' selected to build for all supported platforms and overrides all other platform ({Printer.Bold('-m')}) arguments.")
CTX.printer.InfoMessage(f"Unity lacks full support for {PlatformID.IOS_SIMULATOR} and {PlatformID.TVOS_SIMULATOR}; these platforms are skipped unless explicitly set as platform ({Printer.Bold('-m')}) arguments.")
valid_platform_found = True
for selected_platform_key in CTX.platforms.keys():
for selected_platform_key in CTX.platforms:
if selected_platform_key in supported_platforms:
CTX.platforms[selected_platform_key] = True
if selected_platform_key != PlatformID.IOS_SIMULATOR and selected_platform_key != PlatformID.TVOS_SIMULATOR:
CTX.platforms[selected_platform_key] = True
break
elif platform_id in CTX.platforms:
if platform_id in supported_platforms:
Expand All @@ -185,13 +192,14 @@ def Main():
if not utility.BooleanPrompt(CTX.printer, f"Would you like to continue building without {platform_id} support?"):
exit()
else:
CTX.printer.WarningMessage(f"Ignoring unknown platform '{platform_id}'. Valid options are {PlatformID.IOS}, {PlatformID.IOS_SIMULATOR}, {PlatformID.MACOS}, {PlatformID.TVOS}, {PlatformID.TVOS_SIMULATOR}, {PlatformID.SIMULATORS}, {PlatformID.DEVICES}, or {PlatformID.ALL} (default).")
CTX.printer.WarningMessage(f"Ignoring unknown platform '{platform_id}'. Valid options are {PlatformID.IOS}, {PlatformID.IOS_SIMULATOR}, {PlatformID.MACOS}, {PlatformID.TVOS}, {PlatformID.TVOS_SIMULATOR}, {PlatformID.VISIONOS}, {PlatformID.VISIONOS_SIMULATOR}, {PlatformID.SIMULATORS}, {PlatformID.DEVICES}, or {PlatformID.ALL} (default).")

if not valid_platform_found:
CTX.printer.WarningMessage(f"No valid platform passed to build script. Using default argument: {PlatformID.ALL}")
for selected_platform_key in CTX.platforms.keys():
if platform_id in supported_platforms:
CTX.platforms[selected_platform_key] = True
for selected_platform_key in CTX.platforms:
if selected_platform_key in supported_platforms:
if selected_platform_key != PlatformID.IOS_SIMULATOR and selected_platform_key != PlatformID.TVOS_SIMULATOR:
CTX.platforms[selected_platform_key] = True

if not CTX.platforms[PlatformID.MACOS]:
CTX.printer.WarningMessage(f"User selected to skip building for {PlatformID.MACOS}. Play mode (the play button) in the Unity Editor will not be supported by the plug-ins.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Apple.Accessibility/Demos/Scenes/MainMenu.unity
guid: 9569bb35777744e39be6b23a14eb7797
- enabled: 1
path: Assets/Apple.Accessibility/Demos/Scenes/3D Objects.unity
guid: a8f80b6a67e07497a82aecd6bbf8b08d
Expand All @@ -20,9 +23,6 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Apple.Accessibility/Demos/Scenes/Custom Action.unity
guid: c13af241370b14d439c4af6c86e92167
- enabled: 1
path: Assets/Apple.Accessibility/Demos/Scenes/MainMenu.unity
guid: 9569bb35777744e39be6b23a14eb7797
- enabled: 1
path: Assets/Apple.Accessibility/Demos/Scenes/Modal.unity
guid: e71b36d695eda474cbd255dc95a75c83
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@
isa = PBXAggregateTarget;
buildConfigurationList = 241B6AAB2947AC5500EC7B7A /* Build configuration list for PBXAggregateTarget "macOS_sentinel" */;
buildPhases = (
241B6AAC2947ACF700EC7B7A /* macOS Unsupported Message */,
241B6AAC2947ACF700EC7B7A /* ShellScript */,
);
dependencies = (
);
name = macOS_sentinel;
productName = macOS_sentinel;
};
24B064172B7EEEC7007ABBB8 /* visionOS_sentinel */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 24B064192B7EEEC7007ABBB8 /* Build configuration list for PBXAggregateTarget "visionOS_sentinel" */;
buildPhases = (
24B064182B7EEEC7007ABBB8 /* ShellScript */,
);
dependencies = (
);
name = visionOS_sentinel;
productName = macOS_sentinel;
};
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -240,6 +251,7 @@
C9729D39274324FC009BB169 /* AppleAccessibility_iOS */,
C9729E1127434953009BB169 /* AppleAccessibility_tvOS */,
241B6AA82947AC5500EC7B7A /* macOS_sentinel */,
24B064172B7EEEC7007ABBB8 /* visionOS_sentinel */,
);
};
/* End PBXProject section */
Expand All @@ -262,7 +274,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
241B6AAC2947ACF700EC7B7A /* macOS Unsupported Message */ = {
241B6AAC2947ACF700EC7B7A /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
Expand All @@ -272,7 +284,6 @@
);
inputPaths = (
);
name = "macOS Unsupported Message";
outputFileListPaths = (
);
outputPaths = (
Expand All @@ -282,6 +293,25 @@
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\necho \"\\n[Accessibility] macOS not currently supported by Accessibility plug-in. No native library built.\"\n";
showEnvVarsInLog = 0;
};
24B064182B7EEEC7007ABBB8 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\necho \"\\n[Accessibility] visionOS not currently supported by Accessibility plug-in. No native library built.\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -334,6 +364,26 @@
};
name = Release;
};
24B0641A2B7EEEC7007ABBB8 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 240646122B61FC3C00246067 /* Accessibility.xcconfig */;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = xros;
};
name = Debug;
};
24B0641B2B7EEEC7007ABBB8 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 240646122B61FC3C00246067 /* Accessibility.xcconfig */;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = xros;
};
name = Release;
};
93BB76BD25CB3A4600CF60ED /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 240646122B61FC3C00246067 /* Accessibility.xcconfig */;
Expand Down Expand Up @@ -556,6 +606,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
24B064192B7EEEC7007ABBB8 /* Build configuration list for PBXAggregateTarget "visionOS_sentinel" */ = {
isa = XCConfigurationList;
buildConfigurations = (
24B0641A2B7EEEC7007ABBB8 /* Debug */,
24B0641B2B7EEEC7007ABBB8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
93BB76B125CB3A4600CF60ED /* Build configuration list for PBXProject "Accessibility" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "24B064172B7EEEC7007ABBB8"
BuildableName = "visionOS_sentinel"
BlueprintName = "visionOS_sentinel"
ReferencedContainer = "container:Accessibility.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Debug"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "24B064172B7EEEC7007ABBB8"
BuildableName = "visionOS_sentinel"
BlueprintName = "visionOS_sentinel"
ReferencedContainer = "container:Accessibility.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# CHANGELOG
All notable changes to this project will be documented in this file.

## [3.1.0] - 2024-2-23
### Added
Support for visionOS

## [3.0.0] - 2024-2-15
### Added
- Support for iPhone simulator and AppleTV Simulator
Expand Down
Loading

0 comments on commit c4e145e

Please sign in to comment.