Skip to content

Commit ea1b5b4

Browse files
committed
Fix static linking on windows
- xcspec condition needs to test for toplevel product type. - update objlib response file to use .o file in the Products dir instead of the Intermediates dir.
1 parent bc2e7d9 commit ea1b5b4

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

Sources/SWBTaskExecution/TaskActions/ObjectLibraryAssemblerTaskAction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public final class ObjectLibraryAssemblerTaskAction: TaskAction {
3939
_ = try await options.inputs.concurrentMap(maximumParallelism: 10) { input in
4040
try executionDelegate.fs.copy(input, to: options.output.join(input.basename))
4141
}
42-
let args = options.inputs.map { $0.strWithPosixSlashes }
42+
let args = options.inputs.map { options.output.join($0.basename).strWithPosixSlashes }
4343
try executionDelegate.fs.write(options.output.join("args.resp"), contents: ByteString(encodingAsUTF8: ResponseFiles.responseFileContents(args: args, format: options.linkerResponseFileFormat)))
4444
return .succeeded
4545
} catch {

Sources/SWBWindowsPlatform/Specs/Windows.xcspec

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@
109109
Domain = windows;
110110
Type = ProductType;
111111
Identifier = org.swift.product-type.common.object;
112-
BasedOn = org.swift.product-type.library.object;
113-
Class = XCStandaloneExecutableProductType;
114-
Name = "Object Library";
115-
Description = "Object library";
116-
IconNamePrefix = "TargetLibrary";
117-
DefaultTargetName = "Object Library";
112+
BasedOn = com.apple.product-type.library.static;
118113
},
119114
)

Sources/SWBWindowsPlatform/Specs/WindowsCompile.xcspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
Name = __WINDOWS_STATIC_FLAG;
103103
Type = Bool;
104104
DefaultValue = YES;
105-
Condition = "$(PRODUCT_TYPE) == 'com.apple.product-type.library.static'";
105+
Condition = "$(PRODUCT_TYPE) == 'com.apple.product-type.library.static' || $(PRODUCT_TYPE) == 'org.swift.product-type.common.object'";
106106
CommandLineArgs = ("-static");
107107
}
108108
);

0 commit comments

Comments
 (0)