feature/extend-tauri-generated-xcode-project-for-tvos-target
swift 132 lines 5.2 KB
Raw
1 import ProjectDescription
2
3 let project = Project(
4 name: "tauri-app",
5 settings: .settings(
6 base: [
7 "DEVELOPMENT_TEAM": "NADBSNEZWH",
8 "PRODUCT_NAME": "tauri-app",
9 "PRODUCT_BUNDLE_IDENTIFIER": "com.tauri.dev",
10 ]
11 ),
12 targets: [
13 // MARK: - iOS target (mirrors Tauri-generated project.yml)
14 .target(
15 name: "tauri-app_iOS",
16 destinations: .iOS,
17 product: .app,
18 bundleId: "com.tauri.dev",
19 deploymentTargets: .iOS("14.0"),
20 infoPlist: .file(path: "tauri-app_iOS/Info.plist"),
21 sources: [
22 "Sources/**",
23 "tauri-app_iOS/**",
24 ],
25 resources: [
26 "Assets.xcassets",
27 "LaunchScreen.storyboard",
28 .folderReference(path: "assets"),
29 ],
30 entitlements: .file(path: "tauri-app_iOS/tauri-app_iOS.entitlements"),
31 scripts: [
32 .pre(
33 script: """
34 cargo tauri ios xcode-script -v \
35 --platform ${PLATFORM_DISPLAY_NAME:?} \
36 --sdk-root ${SDKROOT:?} \
37 --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" \
38 --header-search-paths "${HEADER_SEARCH_PATHS:?}" \
39 --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" \
40 --configuration ${CONFIGURATION:?} \
41 ${FORCE_COLOR} ${ARCHS:?}
42 """,
43 name: "Build Rust Code",
44 outputPaths: [
45 "$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a",
46 "$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a",
47 ],
48 basedOnDependencyAnalysis: false
49 )
50 ],
51 dependencies: [
52 .sdk(name: "CoreGraphics", type: .framework),
53 .sdk(name: "Metal", type: .framework),
54 .sdk(name: "MetalKit", type: .framework),
55 .sdk(name: "QuartzCore", type: .framework),
56 .sdk(name: "Security", type: .framework),
57 .sdk(name: "UIKit", type: .framework),
58 .sdk(name: "WebKit", type: .framework),
59 ],
60 settings: .settings(
61 base: [
62 "ENABLE_BITCODE": "NO",
63 "ARCHS": "arm64",
64 "VALID_ARCHS": "arm64",
65 "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "YES",
66 "LIBRARY_SEARCH_PATHS[arch=arm64]": [
67 "$(inherited)",
68 "$(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION)",
69 "$(SDKROOT)/usr/lib/swift",
70 "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
71 "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
72 ],
73 "LIBRARY_SEARCH_PATHS[arch=x86_64]": [
74 "$(inherited)",
75 "$(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION)",
76 "$(SDKROOT)/usr/lib/swift",
77 "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
78 "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
79 ],
80 "EXCLUDED_ARCHS[sdk=iphoneos*]": "x86_64",
81 "OTHER_LDFLAGS": [
82 "$(inherited)",
83 "-lapp",
84 ],
85 ]
86 )
87 ),
88
89 // MARK: - tvOS placeholder target (no WebView on tvOS — native UI only)
90 .target(
91 name: "tauri-app_tvOS",
92 destinations: [.appleTv],
93 product: .app,
94 bundleId: "com.tauri.dev.tvos",
95 deploymentTargets: .tvOS("14.0"),
96 infoPlist: .file(path: "tauri-app_tvOS/Info.plist"),
97 sources: [
98 "tauri-app_tvOS/**"
99 ],
100 resources: [
101 "Assets.xcassets"
102 ],
103 dependencies: [
104 .sdk(name: "UIKit", type: .framework)
105 ],
106 settings: .settings(
107 base: [
108 "ENABLE_BITCODE": "NO",
109 "ARCHS": "arm64",
110 ]
111 )
112 ),
113 ],
114 schemes: [
115 .scheme(
116 name: "tauri-app_iOS",
117 buildAction: .buildAction(targets: ["tauri-app_iOS"]),
118 runAction: .runAction(configuration: .debug),
119 archiveAction: .archiveAction(configuration: .release),
120 profileAction: .profileAction(configuration: .release),
121 analyzeAction: .analyzeAction(configuration: .debug)
122 ),
123 .scheme(
124 name: "tauri-app_tvOS",
125 buildAction: .buildAction(targets: ["tauri-app_tvOS"]),
126 runAction: .runAction(configuration: .debug),
127 archiveAction: .archiveAction(configuration: .release),
128 profileAction: .profileAction(configuration: .release),
129 analyzeAction: .analyzeAction(configuration: .debug)
130 ),
131 ]
132 )