mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-19 16:41:34 +03:00
fix(cli): add support to Xcode's archive (#8209)
This commit is contained in:
parent
977d0e52f1
commit
92b50a3a39
6
.changes/xcode-archive.md
Normal file
6
.changes/xcode-archive.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Added support to Xcode's archive. This requires regenerating the Xcode project.
|
@ -134,22 +134,17 @@ pub fn command(options: Options) -> Result<()> {
|
||||
|
||||
let isysroot = format!("-isysroot {}", options.sdk_root.display());
|
||||
|
||||
// when using Xcode, the arches will be ['Simulator', 'arm64'] instead of ['arm64-sim']
|
||||
let arches = if options.arches.contains(&"Simulator".into()) {
|
||||
vec![if cfg!(target_arch = "aarch64") {
|
||||
"arm64-sim".to_string()
|
||||
} else {
|
||||
"x86_64".to_string()
|
||||
}]
|
||||
} else {
|
||||
options.arches
|
||||
};
|
||||
for arch in arches {
|
||||
for arch in options.arches {
|
||||
// Set target-specific flags
|
||||
let (env_triple, rust_triple) = match arch.as_str() {
|
||||
"arm64" => ("aarch64_apple_ios", "aarch64-apple-ios"),
|
||||
"arm64-sim" => ("aarch64_apple_ios_sim", "aarch64-apple-ios-sim"),
|
||||
"x86_64" => ("x86_64_apple_ios", "x86_64-apple-ios"),
|
||||
"Simulator" => {
|
||||
// when using Xcode, the arches for a simulator build will be ['Simulator', 'arm64-sim'] instead of ['arm64-sim']
|
||||
// so we ignore that on our end
|
||||
continue;
|
||||
}
|
||||
_ => {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Arch specified by Xcode was invalid. {} isn't a known arch",
|
||||
@ -206,14 +201,11 @@ pub fn command(options: Options) -> Result<()> {
|
||||
}
|
||||
|
||||
let project_dir = config.project_dir();
|
||||
std::fs::create_dir_all(project_dir.join(format!("Externals/{}", profile.as_str())))?;
|
||||
let externals_lib_dir = project_dir.join(format!("Externals/{arch}/{}", profile.as_str()));
|
||||
std::fs::create_dir_all(&externals_lib_dir)?;
|
||||
std::fs::copy(
|
||||
lib_path,
|
||||
project_dir.join(format!(
|
||||
"Externals/{}/lib{}.a",
|
||||
profile.as_str(),
|
||||
config.app().lib_name()
|
||||
)),
|
||||
externals_lib_dir.join(format!("lib{}.a", config.app().lib_name())),
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
|
@ -75,10 +75,12 @@ targets:
|
||||
ENABLE_BITCODE: false
|
||||
ARCHS: [{{join ios-valid-archs}}]
|
||||
VALID_ARCHS: {{~#each ios-valid-archs}} {{this}} {{/each}}
|
||||
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true
|
||||
EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
|
||||
EXCLUDED_ARCHS[sdk=iphoneos*]: arm64-sim x86_64
|
||||
groups: [app]
|
||||
dependencies:
|
||||
- framework: lib{{app.lib-name}}.a
|
||||
|
Loading…
Reference in New Issue
Block a user