[msbuild/dotnet] Automatically link with Swift's system libraries if a binding project has the IsSwift=true property. (#20546)
Add support for the LinkWithSwiftSystemLibraries metadata to specify whether a native library is a Swift library, in which case we'll automatically set the `LinkWithSwiftSystemLibraries` MSBuild property to `true`. Also add a test.
This commit is contained in:
Родитель
d6ddfce412
Коммит
6dc1f4c69b
34
Make.config
34
Make.config
|
@ -390,6 +390,8 @@ IOS_PACKAGE_UTI=com.xamarin.$(IOS_PACKAGE_NAME_LOWER).pkg
|
|||
|
||||
IOS_COMMON_DEFINES=-DMONOTOUCH
|
||||
|
||||
SWIFTC=$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
|
||||
|
||||
IOS_CC=$(XCODE_CC)
|
||||
IOS_CXX=$(XCODE_CXX)
|
||||
SIMULATOR_BIN_PATH=$(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneSimulator.platform/Developer/usr/bin
|
||||
|
@ -502,6 +504,38 @@ MAC_OBJC_CFLAGS= -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -DMONOMAC -DMIN_X
|
|||
MAC_CFLAGS = -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -DMONOMAC -g -DMIN_XM_MONO_VERSION=\"$(MIN_XM_MONO_VERSION)\" $(CFLAGS)
|
||||
MAC_LDFLAGS = -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -framework AppKit
|
||||
|
||||
# Swift compiler flags
|
||||
|
||||
COMMON_SWIFTFLAGS=-g -emit-library
|
||||
|
||||
IOS_SIMULATOR_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(SIMULATOR_SDK)
|
||||
IOS_SIMULATOR_ARM64_SWIFTFLAGS=$(IOS_SIMULATOR_COMMON_SWIFTFLAGS) -target arm64-apple-ios$(MIN_IOS_SDK_VERSION)-simulator
|
||||
IOS_SIMULATOR_X64_SWIFTFLAGS=$(IOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86_64-apple-ios$(MIN_IOS_SDK_VERSION)-simulator
|
||||
IOS_DEVICE_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(DEVICE_SDK)
|
||||
IOS_DEVICE_ARM64_SWIFTFLAGS=$(IOS_DEVICE_COMMON_SWIFTFLAGS) -target arm64-apple-ios$(MIN_IOS_SDK_VERSION)
|
||||
|
||||
TVOS_SIMULATOR_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(SIMULATORTV_SDK)
|
||||
TVOS_SIMULATOR_ARM64_SWIFTFLAGS=$(TVOS_SIMULATOR_COMMON_SWIFTFLAGS) -target arm64-apple-tvos$(MIN_TVOS_SDK_VERSION)-simulator
|
||||
TVOS_SIMULATOR_X64_SWIFTFLAGS=$(TVOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86_64-apple-tvos$(MIN_TVOS_SDK_VERSION)-simulator
|
||||
TVOS_DEVICE_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(DEVICETV_SDK)
|
||||
TVOS_DEVICE_ARM64_SWIFTFLAGS=$(TVOS_DEVICE_COMMON_SWIFTFLAGS) -target arm64-apple-tvos$(MIN_TVOS_SDK_VERSION)
|
||||
|
||||
WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(SIMULATORWATCH_SDK)
|
||||
WATCHOS_SIMULATOR_ARM64_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target arm64-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator
|
||||
WATCHOS_SIMULATOR_X64_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86_64-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator
|
||||
WATCHOS_SIMULATOR_X86_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator
|
||||
WATCHOS_DEVICE_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(DEVICEWATCH_SDK)
|
||||
WATCHOS_DEVICE_ARM64_32_SWIFTFLAGS=$(WATCHOS_DEVICE_COMMON_SWIFTFLAGS) -target arm64_32-apple-watchos$(MIN_WATCHOS_SDK_VERSION)
|
||||
WATCHOS_DEVICE_ARMV7K_SWIFTFLAGS=$(WATCHOS_DEVICE_COMMON_SWIFTFLAGS) -target armv7k-apple-watchos$(MIN_WATCHOS_SDK_VERSION)
|
||||
|
||||
MACCATALYST_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(XCODE_MAC_SDKROOT)
|
||||
MACCATALYST_ARM64_SWIFTFLAGS=$(MACCATALYST_COMMON_SWIFTFLAGS) -target arm64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi
|
||||
MACCATALYST_X64_SWIFTFLAGS=$(MACCATALYST_COMMON_SWIFTFLAGS) -target x86_64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi
|
||||
|
||||
MACOS_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(XCODE_MAC_SDKROOT)
|
||||
MACOS_ARM64_SWIFTFLAGS=$(MACOS_COMMON_SWIFTFLAGS) -target arm64-apple-macos$(MIN_MACOS_SDK_VERSION)
|
||||
MACOS_X64_SWIFTFLAGS=$(MACOS_COMMON_SWIFTFLAGS) -target x86_64-apple-macos$(MIN_MACOS_SDK_VERSION)
|
||||
|
||||
# paths to the modules we depend on, as variables, so people can put
|
||||
# things in other places if they absolutely must.
|
||||
MONO_PATH=$(TOP)/external/mono
|
||||
|
|
|
@ -1479,7 +1479,7 @@
|
|||
</_LinkNativeExecutableDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_AddSwiftLinkerFlags" Condition="'$(LinkWithSwiftSystemLibraries)' == 'true'" DependsOnTargets="_DetectSdkLocations">
|
||||
<Target Name="_AddSwiftLinkerFlags" DependsOnTargets="_DetectSdkLocations">
|
||||
<PropertyGroup>
|
||||
<_SwiftTargetPlatform Condition="'$(_PlatformName)' == 'iOS' And '$(_SdkIsSimulator)' == 'true'">iphonesimulator</_SwiftTargetPlatform>
|
||||
<_SwiftTargetPlatform Condition="'$(_PlatformName)' == 'iOS' And '$(_SdkIsSimulator)' != 'true'">iphoneos</_SwiftTargetPlatform>
|
||||
|
@ -1487,8 +1487,15 @@
|
|||
<_SwiftTargetPlatform Condition="'$(_PlatformName)' == 'tvOS' And '$(_SdkIsSimulator)' != 'true'">appletvos</_SwiftTargetPlatform>
|
||||
<_SwiftTargetPlatform Condition="'$(_PlatformName)' == 'MacCatalyst'">macosx</_SwiftTargetPlatform> <!-- yes, 'macosx' and not 'maccatalyst': even though the resulting maccatalyst directory exists, it doesn't have anything useful in it -->
|
||||
<_SwiftTargetPlatform Condition="'$(_PlatformName)' == 'macOS'">macosx</_SwiftTargetPlatform>
|
||||
|
||||
<_HasBindingLibraryWithSwift Condition="@(_BindingLibraryLinkWith->WithMetadataValue('LinkWithSwiftSystemLibraries', 'true')->Count()) > 0">true</_HasBindingLibraryWithSwift>
|
||||
<_HasFrameworkNativeReferenceWithSwift Condition="@(_FrameworkNativeReference->WithMetadataValue('LinkWithSwiftSystemLibraries', 'true')->Count()) > 0">true</_HasFrameworkNativeReferenceWithSwift>
|
||||
<_HasFileNativeReferenceWithSwift Condition="@(_FileNativeReference->WithMetadataValue('LinkWithSwiftSystemLibraries', 'true')->Count()) > 0">true</_HasFileNativeReferenceWithSwift>
|
||||
|
||||
<!-- Automatically link with Swift system libraries if any of the native libraries we link with has LinkWithSwiftSystemLibraries=true -->
|
||||
<LinkWithSwiftSystemLibraries Condition="'$(LinkWithSwiftSystemLibraries)' == '' And ('$(_HasBindingLibraryWithSwift)' == 'true' Or '$(_HasFrameworkNativeReferenceWithSwift)' == 'true' Or '$(_HasFileNativeReferenceWithSwift)' == 'true')">true</LinkWithSwiftSystemLibraries>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(LinkWithSwiftSystemLibraries)' == 'true'">
|
||||
<_MainLinkerFlags Include="-L$(_SdkDevPath)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(_SwiftTargetPlatform)/" />
|
||||
<_MainLinkerFlags Include="-L$(_SdkRoot)/usr/lib/swift/" />
|
||||
</ItemGroup>
|
||||
|
|
48
mk/rules.mk
48
mk/rules.mk
|
@ -49,6 +49,9 @@ define NativeCompilationTemplate
|
|||
.libs/iphonesimulator/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/iphonesimulator
|
||||
$$(call Q_2,ASM, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR64_CFLAGS) $(SIM64_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/iphonesimulator/%$(1).x86_64.dylib: %.swift | .libs/iphonesimulator
|
||||
$$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/iphonesimulator/%$(1).x86_64.dylib: | .libs/iphonesimulator
|
||||
$$(call Q_2,LD, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IOSSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -66,6 +69,9 @@ define NativeCompilationTemplate
|
|||
.libs/iphonesimulator/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/iphonesimulator
|
||||
$$(call Q_2,ASM, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR_ARM64_CFLAGS) $(SIM64_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/iphonesimulator/%$(1).arm64.dylib: %.swift | .libs/iphonesimulator
|
||||
$$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/iphonesimulator/%$(1).arm64.dylib: | .libs/iphonesimulator
|
||||
$$(call Q_2,LD, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IOSSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -108,6 +114,9 @@ define NativeCompilationTemplate
|
|||
.libs/iphoneos/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/iphoneos
|
||||
$$(call Q_2,ASM, [iphoneos]) $(DEVICE_CC) $(DEVICE64_CFLAGS) $$(EXTRA_DEFINES) $(DEV64_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/iphoneos/%$(1).arm64.dylib: %.swift | .libs/iphoneos
|
||||
$$(call Q_2,SWIFT, [iphoneos]) $(SWIFTC) $(IOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/iphoneos/%$(1).arm64.dylib: | .libs/iphoneos
|
||||
$$(call Q_2,LD, [iphoneos]) $(DEVICE_CC) $(DEVICE64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IPHONEOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -125,6 +134,9 @@ define NativeCompilationTemplate
|
|||
.libs/maccatalyst/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/maccatalyst
|
||||
$$(call Q_2,ASM, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_X86_64_CFLAGS) $(COMMON_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/maccatalyst/%$(1).x86_64.dylib: %.swift | .libs/maccatalyst
|
||||
$$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/maccatalyst/%$(1).x86_64.dylib: | .libs/maccatalyst
|
||||
$$(call Q_2,LD, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_X86_64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -140,6 +152,9 @@ define NativeCompilationTemplate
|
|||
.libs/maccatalyst/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/maccatalyst
|
||||
$$(call Q_2,ASM, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_ARM64_CFLAGS) $(COMMON_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/maccatalyst/%$(1).arm64.dylib: %.swift | .libs/maccatalyst
|
||||
$$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/maccatalyst/%$(1).arm64.dylib: | .libs/maccatalyst
|
||||
$$(call Q_2,LD, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -157,6 +172,9 @@ define NativeCompilationTemplate
|
|||
.libs/watchsimulator/%$(1).x86.o: %.s $(EXTRA_DEPENDENCIES) | .libs/watchsimulator
|
||||
$$(call Q_2,ASM, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_DEFINES) $(SIMW_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/watchsimulator/%$(1).x86.dylib: %.swift | .libs/watchsimulator
|
||||
$$(call Q_2,SWIFT, [watchsimulator]) $(SWIFTC) $(WATCHOS_SIMULATOR_X86_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/watchsimulator/%$(1).x86.dylib: | .libs/watchsimulator
|
||||
$$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -172,6 +190,9 @@ define NativeCompilationTemplate
|
|||
.libs/watchsimulator/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/watchsimulator
|
||||
$$(call Q_2,ASM, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_DEFINES) $(SIMW64_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/watchsimulator/%$(1).x86_64.dylib: %.swift | .libs/watchsimulator
|
||||
$$(call Q_2,SWIFT, [watchsimulator]) $(SWIFTC) $(WATCHOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/watchsimulator/%$(1).x86_64.dylib: | .libs/watchsimulator
|
||||
$$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -186,6 +207,9 @@ define NativeCompilationTemplate
|
|||
.libs/watchos/%$(1).armv7k.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchos
|
||||
$$(call Q_2,CC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_DEFINES) $(DEVW_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/watchos/%$(1).armv7k.dylib: %.swift | .libs/watchsimulator
|
||||
$$(call Q_2,SWIFT, [watchos]) $(SWIFTC) $(WATCHOS_DEVICE_ARMV7K_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/watchos/%$(1).armv7k.dylib: | .libs/watchos
|
||||
$$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -198,6 +222,9 @@ define NativeCompilationTemplate
|
|||
.libs/watchos/%$(1).arm64_32.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchos
|
||||
$$(call Q_2,CC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_DEFINES) $(DEVW64_32_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/watchos/%$(1).arm64_32.dylib: %.swift | .libs/watchsimulator
|
||||
$$(call Q_2,SWIFT, [watchos]) $(SWIFTC) $(WATCHOS_DEVICE_ARM64_32_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/watchos/%$(1).arm64_32.dylib: | .libs/watchos
|
||||
$$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -217,6 +244,9 @@ define NativeCompilationTemplate
|
|||
.libs/tvsimulator/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/tvsimulator
|
||||
$$(call Q_2,ASM, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_CFLAGS) $$(EXTRA_DEFINES) $(SIM_TV_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/tvsimulator/%$(1).x86_64.dylib: %.swift | .libs/tvsimulator
|
||||
$$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/tvsimulator/%$(1).x86_64.dylib: | .libs/tvsimulator
|
||||
$$(call Q_2,LD, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -234,6 +264,9 @@ define NativeCompilationTemplate
|
|||
.libs/tvsimulator/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/tvsimulator
|
||||
$$(call Q_2,ASM, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_ARM64_CFLAGS) $$(EXTRA_DEFINES) $(SIM_ARM64_TV_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/tvsimulator/%$(1).arm64.dylib: %.swift | .libs/tvsimulator
|
||||
$$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/tvsimulator/%$(1).arm64.dylib: | .libs/tvsimulator
|
||||
$$(call Q_2,LD, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -251,6 +284,9 @@ define NativeCompilationTemplate
|
|||
.libs/tvos/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/tvos
|
||||
$$(call Q_2,ASM, [tvos]) $(DEVICE_CC) $(DEVICETV_CFLAGS) $$(EXTRA_DEFINES) $(DEV_TV_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/tvos/%$(1).arm64.dylib: %.swift | .libs/tvos
|
||||
$$(call Q_2,SWIFT, [tvos]) $(SWIFTC) $(TVOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/tvos/%$(1).arm64.dylib: | .libs/tvos
|
||||
$$(call Q_2,LD, [tvos]) $(DEVICE_CC) $(DEVICETV_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -268,6 +304,12 @@ define NativeCompilationTemplate
|
|||
.libs/mac/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/mac
|
||||
$$(call Q_2,ASM, [mac]) $(MAC_CC) $(MAC_CFLAGS) -arch x86_64 $(COMMON_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/mac/%$(1).x86_64.dylib: %.swift | .libs/mac
|
||||
$$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/macos/%$(1).x86_64.dylib: %.swift | .libs/mac
|
||||
$$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/mac/%$(1).x86_64.dylib: | .libs/mac
|
||||
$$(call Q_2,LD, [mac]) $(MAC_CC) $(MAC_CFLAGS) $$(EXTRA_FLAGS) -arch x86_64 -dynamiclib -o $$@ $$^ -L$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
@ -283,6 +325,12 @@ define NativeCompilationTemplate
|
|||
.libs/mac/%$(1).arm64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/mac
|
||||
$$(call Q_2,ASM, [mac]) $(MAC_CC) $(MAC_CFLAGS) -arch arm64 $(COMMON_I) -g $(2) -c $$< -o $$@
|
||||
|
||||
.libs/mac/%$(1).arm64.dylib: %.swift | .libs/mac
|
||||
$$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/macos/%$(1).arm64.dylib: %.swift | .libs/mac
|
||||
$$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@
|
||||
|
||||
.libs/mac/%$(1).arm64.dylib: | .libs/mac
|
||||
$$(call Q_2,LD, [mac]) $(MAC_CC) $(MAC_CFLAGS) $$(EXTRA_FLAGS) -arch arm64 -dynamiclib -o $$@ $$^ -L$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib -fapplication-extension
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
return false;
|
||||
}
|
||||
|
||||
string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx" };
|
||||
string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx", "LinkWithSwiftSystemLibraries" };
|
||||
|
||||
string CreateManifest (string resourcePath)
|
||||
{
|
||||
|
|
|
@ -148,6 +148,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
text.AppendFormat ("[assembly: ObjCRuntime.LinkWith (\"{0}\"", logicalName);
|
||||
AppendLinkTargetProperty (text, NativeReferences [i]);
|
||||
AppendBooleanProperty (text, NativeReferences [i], "IsCxx");
|
||||
AppendBooleanProperty (text, NativeReferences [i], "LinkWithSwiftSystemLibraries");
|
||||
AppendBooleanProperty (text, NativeReferences [i], "NeedsGccExceptionHandling");
|
||||
AppendBooleanProperty (text, NativeReferences [i], "SmartLink", true);
|
||||
AppendBooleanProperty (text, NativeReferences [i], "ForceLoad");
|
||||
|
|
|
@ -352,6 +352,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
t.SetMetadata ("ForceLoad", "False");
|
||||
t.SetMetadata ("NeedsGccExceptionHandling", "False");
|
||||
t.SetMetadata ("IsCxx", "False");
|
||||
t.SetMetadata ("LinkWithSwiftSystemLibraries", "False");
|
||||
t.SetMetadata ("SmartLink", "True");
|
||||
|
||||
// values from manifest, overriding defaults if provided
|
||||
|
|
|
@ -104,6 +104,12 @@ namespace ObjCRuntime {
|
|||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the library uses Swift.</summary>
|
||||
/// <remarks>If this is true, the app will automatically link with the Swift system libraries.</remarks>
|
||||
public bool LinkWithSwiftSystemLibraries {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public bool SmartLink {
|
||||
get; set;
|
||||
}
|
||||
|
|
|
@ -456,4 +456,12 @@ namespace Bindings.Test {
|
|||
SimpleCallback MyOptionalStaticProperty { get; set; }
|
||||
}
|
||||
interface IProtocolWithBlockProperties { }
|
||||
|
||||
#if NET
|
||||
[BaseType (typeof (NSObject))]
|
||||
interface SwiftTestClass {
|
||||
[Export ("SayHello")]
|
||||
string SayHello ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -95,5 +95,15 @@ namespace Xamarin.Tests {
|
|||
completionHandler (42);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET
|
||||
[Test]
|
||||
public void SwiftTest ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (13, 0);
|
||||
using var obj = new SwiftTestClass ();
|
||||
Assert.AreEqual ("Hello from Swift", obj.SayHello (), "Hello");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
<Kind>Static</Kind>
|
||||
<Frameworks>CoreLocation Foundation ModelIO</Frameworks>
|
||||
</NativeReference>
|
||||
|
||||
<NativeReference Include="$(TestLibrariesDirectory)\.libs\SwiftTest.xcframework">
|
||||
<Kind>Framework</Kind>
|
||||
<LinkWithSwiftSystemLibraries>true</LinkWithSwiftSystemLibraries>
|
||||
</NativeReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace Xamarin.Tests {
|
|||
// Verify that there's one resource in the binding assembly, and its name
|
||||
var ad = AssemblyDefinition.ReadAssembly (asm, new ReaderParameters { ReadingMode = ReadingMode.Deferred });
|
||||
Assert.That (ad.MainModule.Resources.Count, Is.EqualTo (0), "no embedded resources");
|
||||
var resourceBundle = Path.Combine (project_dir, "bin", "Debug", platform.ToFramework (), assemblyName + ".resources");
|
||||
var resourceBundle = Path.Combine (project_dir, "bin", "Debug", platform.ToFramework (), assemblyName + ".resources.zip");
|
||||
Assert.That (resourceBundle, Does.Exist, "Bundle existence");
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
<IsCxx></IsCxx>
|
||||
<Kind></Kind>
|
||||
<LinkerFlags></LinkerFlags>
|
||||
<LinkWithSwiftSystemLibraries></LinkWithSwiftSystemLibraries>
|
||||
<NeedsGccExceptionHandling></NeedsGccExceptionHandling>
|
||||
<SmartLink></SmartLink>
|
||||
<WeakFrameworks></WeakFrameworks>
|
||||
|
@ -131,6 +132,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
<IsCxx></IsCxx>
|
||||
<Kind></Kind>
|
||||
<LinkerFlags></LinkerFlags>
|
||||
<LinkWithSwiftSystemLibraries></LinkWithSwiftSystemLibraries>
|
||||
<NeedsGccExceptionHandling></NeedsGccExceptionHandling>
|
||||
<SmartLink></SmartLink>
|
||||
<WeakFrameworks></WeakFrameworks>
|
||||
|
@ -141,6 +143,7 @@ namespace Xamarin.MacDev.Tasks {
|
|||
<IsCxx></IsCxx>
|
||||
<Kind></Kind>
|
||||
<LinkerFlags></LinkerFlags>
|
||||
<LinkWithSwiftSystemLibraries></LinkWithSwiftSystemLibraries>
|
||||
<NeedsGccExceptionHandling></NeedsGccExceptionHandling>
|
||||
<SmartLink></SmartLink>
|
||||
<WeakFrameworks></WeakFrameworks>
|
||||
|
|
|
@ -47,22 +47,22 @@ MACCATALYST_BINARY_INFIX=/Versions/A
|
|||
|
||||
define SymlinksTemplate
|
||||
|
||||
$(1)_XTEST_TARGETS += \
|
||||
.libs/$(1)/XTest.framework/XTest \
|
||||
.libs/$(1)/XTest.framework/Resources \
|
||||
.libs/$(1)/XTest.framework/Versions/Current \
|
||||
.libs/$(1)/XTest.framework/Versions/A/Resources/Info.plist \
|
||||
$(1)_$(4)_TARGETS += \
|
||||
.libs/$(1)/$(3).framework/$(3) \
|
||||
.libs/$(1)/$(3).framework/Resources \
|
||||
.libs/$(1)/$(3).framework/Versions/Current \
|
||||
.libs/$(1)/$(3).framework/Versions/A/Resources/Info.plist \
|
||||
|
||||
.libs/$(1)/XTest.framework$($(2)_BINARY_INFIX) .libs/$(1)/XTest.framework$($(2)_INFO_PLIST_INFIX):
|
||||
.libs/$(1)/$(3).framework$($(2)_BINARY_INFIX) .libs/$(1)/$(3).framework$($(2)_INFO_PLIST_INFIX):
|
||||
$$(Q) mkdir -p $$@
|
||||
|
||||
.libs/$(1)/XTest.framework/XTest: | .libs/$(1)/XTest.framework
|
||||
$$(Q) ln -fs Versions/A/XTest $$@
|
||||
.libs/$(1)/$(3).framework/$(3): | .libs/$(1)/$(3).framework
|
||||
$$(Q) ln -fs Versions/A/$(3) $$@
|
||||
|
||||
.libs/$(1)/XTest.framework/Resources: | .libs/$(1)/XTest.framework
|
||||
.libs/$(1)/$(3).framework/Resources: | .libs/$(1)/$(3).framework
|
||||
$$(Q) ln -fs Versions/Current/Resources $$@
|
||||
|
||||
.libs/$(1)/XTest.framework/Versions/Current: | .libs/$(1)/XTest.framework/Versions
|
||||
.libs/$(1)/$(3).framework/Versions/Current: | .libs/$(1)/$(3).framework/Versions
|
||||
$$(Q) ln -fs A $$@
|
||||
|
||||
x::
|
||||
|
@ -70,10 +70,12 @@ x::
|
|||
|
||||
endef
|
||||
ifdef INCLUDE_MAC
|
||||
$(eval $(call SymlinksTemplate,macos,MACOS))
|
||||
$(eval $(call SymlinksTemplate,macos,MACOS,XTest,XTEST))
|
||||
$(eval $(call SymlinksTemplate,macos,MACOS,SwiftTest,SWIFTTEST))
|
||||
endif
|
||||
ifdef INCLUDE_MACCATALYST
|
||||
$(eval $(call SymlinksTemplate,maccatalyst,MACCATALYST))
|
||||
$(eval $(call SymlinksTemplate,maccatalyst,MACCATALYST,XTest,XTEST))
|
||||
$(eval $(call SymlinksTemplate,maccatalyst,MACCATALYST,SwiftTest,SWIFTTEST))
|
||||
endif
|
||||
|
||||
define Template
|
||||
|
@ -82,8 +84,13 @@ $(1)_XTEST_TARGETS += \
|
|||
.libs/$(1)/XTest.framework$($(2)_BINARY_INFIX)/XTest \
|
||||
.libs/$(1)/XTest.framework$($(2)_INFO_PLIST_INFIX)/Info.plist \
|
||||
|
||||
$(1)_SWIFTTEST_TARGETS += \
|
||||
.libs/$(1)/SwiftTest.framework$($(2)_BINARY_INFIX)/SwiftTest \
|
||||
.libs/$(1)/SwiftTest.framework$($(2)_INFO_PLIST_INFIX)/Info.plist \
|
||||
|
||||
$(2)_TARGETS = \
|
||||
$$($(1)_XTEST_TARGETS) \
|
||||
$$($(1)_SWIFTTEST_TARGETS) \
|
||||
.libs/$(1)/XStaticObjectTest.framework/XStaticObjectTest \
|
||||
.libs/$(1)/XStaticArTest.framework/XStaticArTest \
|
||||
.libs/$(1)/libtest.dylib \
|
||||
|
@ -96,12 +103,17 @@ $(2)_TARGETS = \
|
|||
$$(foreach arch,$(3),.libs/$(1)/libtest-ar.$$(arch).a) \
|
||||
.libs/$(1)/XTest.framework \
|
||||
.libs/$(1)/XTest.framework.stamp \
|
||||
.libs/$(1)/SwiftTest.framework \
|
||||
.libs/$(1)/SwiftTest.framework.stamp \
|
||||
|
||||
all-local:: $$($(2)_TARGETS) $(GENERATED_FILES)
|
||||
|
||||
.libs/$(1)/XTest.framework.stamp: $$($(1)_XTEST_TARGETS)
|
||||
$$(Q) touch $$@
|
||||
|
||||
.libs/$(1)/SwiftTest.framework.stamp: $$($(1)_SWIFTTEST_TARGETS)
|
||||
$$(Q) touch $$@
|
||||
|
||||
clean-$(1):
|
||||
rm -Rf .libs/$(1)
|
||||
|
||||
|
@ -147,6 +159,17 @@ COMMON_DYLIB_ARGS=-g -dynamiclib -gdwarf-2 -fms-extensions libframework.m -o $$@
|
|||
.libs/$(1)/libtest.dylib: $$(foreach arch,$(3),.libs/$(1)/libtest.$$(arch).dylib)
|
||||
$$(call Q_2,LIPO [$(1)]) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo $$^ -create -output $$@
|
||||
|
||||
.libs/$(1)/libSwiftTest.dylib: $$(foreach arch,$(3),.libs/$(1)/libSwiftTest.$$(arch).dylib)
|
||||
$$(call Q_2,LIPO [$(1)]) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo $$^ -create -output $$@
|
||||
|
||||
# SwiftTest is a framework where the binary code is a (fat) dynamic library
|
||||
.libs/$(1)/SwiftTest.framework$($(2)_BINARY_INFIX)/SwiftTest: .libs/$(1)/libSwiftTest.dylib | .libs/$(1)/SwiftTest.framework$($(2)_BINARY_INFIX)
|
||||
$$(Q) $(CP) $$^ $$@
|
||||
$$(Q) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool -id @rpath/SwiftTest.framework/SwiftTest $$@
|
||||
|
||||
.libs/$(1)/SwiftTest.framework$($(2)_INFO_PLIST_INFIX)/Info.plist: SwiftTest-Info-$(1).plist | .libs/$(1)/SwiftTest.framework$($(2)_INFO_PLIST_INFIX)
|
||||
$$(Q) $(CP) $$^ $$@
|
||||
|
||||
# XTest is a framework where the binary code is a (fat) dynamic library
|
||||
.libs/$(1)/XTest.framework$($(2)_BINARY_INFIX)/XTest: .libs/$(1)/libtest.dylib | .libs/$(1)/XTest.framework$($(2)_BINARY_INFIX)
|
||||
$$(Q) $(CP) $$^ $$@
|
||||
|
@ -168,8 +191,10 @@ COMMON_DYLIB_ARGS=-g -dynamiclib -gdwarf-2 -fms-extensions libframework.m -o $$@
|
|||
$(1)_DIRECTORIES = \
|
||||
.libs/$(1)/XTest.framework \
|
||||
.libs/$(1)/XTest.framework/Versions \
|
||||
.libs/$(1)/SwiftTest.framework/Versions \
|
||||
.libs/$(1)/XStaticObjectTest.framework \
|
||||
.libs/$(1)/XStaticArTest.framework \
|
||||
.libs/$(1)/SwiftTest.framework \
|
||||
|
||||
$$($(1)_DIRECTORIES):
|
||||
$$(Q) mkdir -p $$@
|
||||
|
@ -405,6 +430,16 @@ LIBTEST2_XCFRAMEWORKS += $(foreach platform,$(XCPLATFORMS),.libs/$(platform)/lib
|
|||
|
||||
all-local:: .libs/libtest2.xcframework
|
||||
|
||||
SWIFTTEST_XCFRAMEWORKS += $(foreach platform,$(XCPLATFORMS),.libs/$(platform)/SwiftTest.framework)
|
||||
SWIFTTEST_XCTARGETS += \
|
||||
$(foreach platform,$(XCPLATFORMS),.libs/$(platform)/SwiftTest.framework.stamp) \
|
||||
|
||||
.libs/SwiftTest.xcframework: $(SWIFTTEST_XCTARGETS) Makefile
|
||||
$(Q) rm -rf $@
|
||||
$(Q_GEN) $(XCODE_DEVELOPER_ROOT)/usr/bin/xcodebuild -quiet -create-xcframework $(foreach fw,$(SWIFTTEST_XCFRAMEWORKS),-framework $(fw)) -output $@
|
||||
|
||||
all-local:: .libs/SwiftTest.xcframework
|
||||
|
||||
.libs/XTest.xcframework.zip: .libs/XTest.xcframework
|
||||
$(Q_ZIP) cd .libs && $(ZIP) -r "$(notdir $@)" "$(notdir $<)"
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>iPhoneOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>8.2</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>iphoneos8.2</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>iPhoneOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>8.2</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>iphoneos8.2</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>10.15</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>10.9</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.9</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>AppleTVOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>appletvos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>9.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>appletvos9.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>3</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>AppleTVOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>appletvos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>9.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>appletvos9.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>3</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>WatchOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>watchos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>2.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>watchos2.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>4.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>4</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>xamarin.ios.swifttest</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SwiftTest</string>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13F34</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>WatchOS</string>
|
||||
</array>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>watchos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>2.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12D508</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>watchos2.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0620</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6C131e</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>4.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>4</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,9 @@
|
|||
import Foundation
|
||||
|
||||
@objc(SwiftTestClass)
|
||||
public class SwiftTestClass : NSObject {
|
||||
@objc
|
||||
public func SayHello() -> String {
|
||||
return "Hello from Swift"
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ namespace Xamarin.Bundler {
|
|||
public LinkTarget LinkTarget;
|
||||
public bool NeedsGccExceptionHandling;
|
||||
public bool IsCxx;
|
||||
public bool LinkWithSwiftSystemLibraries;
|
||||
public bool SmartLink;
|
||||
public DlsymOption Dlsym;
|
||||
|
||||
|
@ -39,6 +40,7 @@ namespace Xamarin.Bundler {
|
|||
LinkTarget = attribute.LinkTarget;
|
||||
NeedsGccExceptionHandling = attribute.NeedsGccExceptionHandling;
|
||||
IsCxx = attribute.IsCxx;
|
||||
LinkWithSwiftSystemLibraries = attribute.LinkWithSwiftSystemLibraries;
|
||||
SmartLink = attribute.SmartLink;
|
||||
Dlsym = attribute.Dlsym;
|
||||
Attribute = attribute;
|
||||
|
@ -90,6 +92,7 @@ namespace Xamarin.Bundler {
|
|||
}
|
||||
|
||||
public bool EnableCxx;
|
||||
public bool LinkWithSwiftSystemLibraries;
|
||||
public bool NeedsGccExceptionHandling;
|
||||
public bool ForceLoad;
|
||||
public HashSet<string> Frameworks = new HashSet<string> ();
|
||||
|
@ -203,6 +206,7 @@ namespace Xamarin.Bundler {
|
|||
metadata.LinkerFlags = attributes ["LinkerFlags"];
|
||||
metadata.NeedsGccExceptionHandling = ParseAttributeWithDefault (attributes ["NeedsGccExceptionHandling"], false);
|
||||
metadata.IsCxx = ParseAttributeWithDefault (attributes ["IsCxx"], false);
|
||||
metadata.LinkWithSwiftSystemLibraries = ParseAttributeWithDefault (attributes ["LinkWithSwiftSystemLibraries"], false);
|
||||
metadata.SmartLink = ParseAttributeWithDefault (attributes ["SmartLink"], true);
|
||||
|
||||
// TODO - The project attributes do not contain these bits, is that OK?
|
||||
|
@ -325,6 +329,8 @@ namespace Xamarin.Bundler {
|
|||
if (metadata.IsCxx)
|
||||
EnableCxx = true;
|
||||
|
||||
if (metadata.LinkWithSwiftSystemLibraries)
|
||||
LinkWithSwiftSystemLibraries = true;
|
||||
#if MONOTOUCH
|
||||
if (metadata.Dlsym != DlsymOption.Default)
|
||||
App.SetDlsymOption (FullPath, metadata.Dlsym == DlsymOption.Required);
|
||||
|
@ -404,6 +410,7 @@ namespace Xamarin.Bundler {
|
|||
Driver.Log (3, " ForceLoad: {0}", metadata.ForceLoad);
|
||||
Driver.Log (3, " Frameworks: {0}", metadata.Frameworks);
|
||||
Driver.Log (3, " IsCxx: {0}", metadata.IsCxx);
|
||||
Driver.Log (3, " LinkWithSwiftSystemLibraries: {0}", metadata.LinkWithSwiftSystemLibraries);
|
||||
Driver.Log (3, " LinkerFlags: {0}", metadata.LinkerFlags);
|
||||
Driver.Log (3, " LinkTarget: {0}", metadata.LinkTarget);
|
||||
Driver.Log (3, " NeedsGccExceptionHandling: {0}", metadata.NeedsGccExceptionHandling);
|
||||
|
@ -455,6 +462,9 @@ namespace Xamarin.Bundler {
|
|||
case "IsCxx":
|
||||
linkWith.IsCxx = (bool) property.Argument.Value;
|
||||
break;
|
||||
case "LinkWithSwiftSystemLibraries":
|
||||
linkWith.LinkWithSwiftSystemLibraries = (bool) property.Argument.Value;
|
||||
break;
|
||||
case "SmartLink":
|
||||
linkWith.SmartLink = (bool) property.Argument.Value;
|
||||
break;
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Xamarin.Linker {
|
|||
arg,
|
||||
new Dictionary<string, string> {
|
||||
{ "ForceLoad", asm.ForceLoad ? "true" : "false" },
|
||||
{ "LinkWithSwiftSystemLibraries", asm.LinkWithSwiftSystemLibraries ? "true" : "false" },
|
||||
{ "Assembly", asm.Identity },
|
||||
}
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче