@@ -433,6 +433,7 @@ def convert_arg_line_to_args(self, arg_line):
433
433
platform_group = parser .add_mutually_exclusive_group ()
434
434
platform_group .add_argument ("--ios" , action = "store_true" , help = "build for ios" )
435
435
platform_group .add_argument ("--visionos" , action = "store_true" , help = "build for visionOS" )
436
+ platform_group .add_argument ("--tvos" , action = "store_true" , help = "build for tvOS" )
436
437
platform_group .add_argument (
437
438
"--macos" ,
438
439
choices = ["MacOSX" , "Catalyst" ],
@@ -452,6 +453,11 @@ def convert_arg_line_to_args(self, arg_line):
452
453
default = "" ,
453
454
help = "Path to visionos toolchain file, or cmake/onnxruntime_visionos.toolchain.cmake will be used" ,
454
455
)
456
+ parser .add_argument (
457
+ "--tvos_toolchain_file" ,
458
+ default = "" ,
459
+ help = "Path to tvos toolchain file, or cmake/onnxruntime_tvos.toolchain.cmake will be used" ,
460
+ )
455
461
parser .add_argument (
456
462
"--xcode_code_signing_team_id" , default = "" , help = "The development team ID used for code signing in Xcode"
457
463
)
@@ -945,7 +951,7 @@ def use_dev_mode(args):
945
951
return False
946
952
if args .use_armnn :
947
953
return False
948
- if (args .ios or args .visionos ) and is_macOS ():
954
+ if (args .ios or args .visionos or args . tvos ) and is_macOS ():
949
955
return False
950
956
SYSTEM_COLLECTIONURI = os .getenv ("SYSTEM_COLLECTIONURI" ) # noqa: N806
951
957
if SYSTEM_COLLECTIONURI and SYSTEM_COLLECTIONURI != "https://dev.azure.com/onnxruntime/" :
@@ -1617,12 +1623,12 @@ def generate_build_tree(
1617
1623
if args .use_snpe :
1618
1624
cmake_args += ["-Donnxruntime_USE_SNPE=ON" ]
1619
1625
1620
- if args .macos or args .ios or args .visionos :
1626
+ if args .macos or args .ios or args .visionos or args . tvos :
1621
1627
# Note: Xcode CMake generator doesn't have a good support for Mac Catalyst yet.
1622
1628
if args .macos == "Catalyst" and args .cmake_generator == "Xcode" :
1623
1629
raise BuildError ("Xcode CMake generator ('--cmake_generator Xcode') doesn't support Mac Catalyst build." )
1624
1630
1625
- if (args .ios or args .visionos or args .macos == "MacOSX" ) and not args .cmake_generator == "Xcode" :
1631
+ if (args .ios or args .visionos or args .tvos or args . macos == "MacOSX" ) and not args .cmake_generator == "Xcode" :
1626
1632
raise BuildError (
1627
1633
"iOS/MacOS framework build requires use of the Xcode CMake generator ('--cmake_generator Xcode')."
1628
1634
)
@@ -1682,6 +1688,12 @@ def generate_build_tree(
1682
1688
),
1683
1689
"-Donnxruntime_ENABLE_CPUINFO=OFF" ,
1684
1690
]
1691
+ if args .tvos :
1692
+ cmake_args += [
1693
+ "-DCMAKE_SYSTEM_NAME=tvOS" ,
1694
+ "-DCMAKE_TOOLCHAIN_FILE="
1695
+ + (args .tvos_toolchain_file if args .tvos_toolchain_file else "../cmake/onnxruntime_tvos.toolchain.cmake" ),
1696
+ ]
1685
1697
1686
1698
if args .build_wasm :
1687
1699
if not args .use_vcpkg :
@@ -3144,7 +3156,7 @@ def main():
3144
3156
3145
3157
if is_macOS ():
3146
3158
if (
3147
- not (args .ios or args .visionos )
3159
+ not (args .ios or args .visionos or args . tvos )
3148
3160
and args .macos != "Catalyst"
3149
3161
and not args .android
3150
3162
and args .osx_arch == "arm64"
0 commit comments