-
Notifications
You must be signed in to change notification settings - Fork 101
/
SpacetimeDB.Runtime.targets
70 lines (58 loc) · 4.34 KB
/
SpacetimeDB.Runtime.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(EXPERIMENTAL_WASM_AOT)' == '1'">
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\bindings.c" />
<UnmanagedEntryPointsAssembly Include="SpacetimeDB.Runtime" />
<WasmImport Include="$(SpacetimeNamespace)!_console_log" />
<WasmImport Include="$(SpacetimeNamespace)!_get_table_id" />
<WasmImport Include="$(SpacetimeNamespace)!_create_index" />
<WasmImport Include="$(SpacetimeNamespace)!_iter_by_col_eq" />
<WasmImport Include="$(SpacetimeNamespace)!_insert" />
<WasmImport Include="$(SpacetimeNamespace)!_delete_by_col_eq" />
<WasmImport Include="$(SpacetimeNamespace)!_delete_by_rel" />
<WasmImport Include="$(SpacetimeNamespace)!_iter_start" />
<WasmImport Include="$(SpacetimeNamespace)!_iter_start_filtered" />
<WasmImport Include="$(SpacetimeNamespace)!_iter_next" />
<WasmImport Include="$(SpacetimeNamespace)!_iter_drop" />
<WasmImport Include="$(SpacetimeNamespace)!_schedule_reducer" />
<WasmImport Include="$(SpacetimeNamespace)!_cancel_reducer" />
<WasmImport Include="$(SpacetimeNamespace)!_buffer_len" />
<WasmImport Include="$(SpacetimeNamespace)!_buffer_consume" />
<WasmImport Include="$(SpacetimeNamespace)!_buffer_alloc" />
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="8.0.0-*" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM" Version="8.0.0-*" />
<PackageReference Include="Microsoft.NET.ILLink.Tasks" Version="8.0.0-*" Condition="'$(ILLinkTargetsPath)' == ''" />
<CustomLinkerArg Include="-DEXPERIMENTAL_WASM_AOT" />
</ItemGroup>
<ItemGroup Condition="'$(EXPERIMENTAL_WASM_AOT)' != '1'">
<NativeFileReference Include="$(MSBuildThisFileDirectory)..\bindings.c" />
<_WasmNativeFileForLinking Include="@(NativeFileReference)" />
</ItemGroup>
<!-- Auto-download WASI SDK on the first run. -->
<!-- Adapted from https://github.com/dotnet/dotnet-wasi-sdk/blob/2dbb00c779180873d3ed985e59e431f56404d8da/src/Wasi.Sdk/build/Wasi.Sdk.targets#L245-L262 -->
<!-- Executes before the errors in https://github.com/dotnet/runtime/blob/57fd56a99d4c97ac2f95fe84640f2a3f653f4dd7/src/mono/wasi/build/WasiApp.Native.targets#L41-L50. -->
<!-- TODO: remove when https://github.com/dotnet/runtime/issues/82788 is resolved. -->
<Target Name="ObtainWasiSdk" BeforeTargets="_SetupWasiSdk;CheckWasmSdks">
<PropertyGroup>
<WasiSdkVersion>20</WasiSdkVersion>
<WasiSdkDownloadTempFile>$([System.IO.Path]::Combine($(IntermediateOutputPath), "wasi-sdk.$(WasiSdkVersion).tar.gz"))</WasiSdkDownloadTempFile>
<WasiSdkFilenameSuffix Condition="$([MSBuild]::IsOSPlatform('Windows'))">.m-mingw</WasiSdkFilenameSuffix>
<WasiSdkFilenameSuffix Condition="$([MSBuild]::IsOSPlatform('Linux'))">-linux</WasiSdkFilenameSuffix>
<WasiSdkFilenameSuffix Condition="$([MSBuild]::IsOSPlatform('OSX'))">-macos</WasiSdkFilenameSuffix>
<WasiSdkUrl>https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0$(WasiSdkFilenameSuffix).tar.gz</WasiSdkUrl>
<WasiSdkRoot>$([System.IO.Path]::Combine($([System.Environment]::GetFolderPath(SpecialFolder.UserProfile)), '.wasi-sdk', "wasi-sdk-$(WasiSdkVersion)"))</WasiSdkRoot>
<WASI_SDK_PATH>$(WasiSdkRoot)</WASI_SDK_PATH>
<WasiSysRoot>$([System.IO.Path]::Combine($(WasiSdkRoot), 'share', 'wasi-sysroot'))</WasiSysRoot>
<WasiClang>$([System.IO.Path]::Combine($(WasiSdkRoot), 'bin', 'clang'))</WasiClang>
<WasiClang Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(WasiClang).exe</WasiClang>
</PropertyGroup>
<DownloadFile
SourceUrl="$(WasiSdkUrl)"
DestinationFolder="$(IntermediateOutputPath)"
DestinationFileName="$([System.IO.Path]::GetFileName('$(WasiSdkDownloadTempFile)'))"
Condition="!Exists('$(WasiSdkDownloadTempFile)')" />
<Message Importance="high" Text="Extracting $(WasiSdkDownloadTempFile) to $(WasiSdkRoot)..." Condition="!Exists('$(WasiClang)')" />
<MakeDir Directories="$(WasiSdkRoot)" />
<!-- Windows 10+ has tar built in, so this should work cross-platform -->
<Exec Command="tar -xf "$(WasiSdkDownloadTempFile)" -C "$(WasiSdkRoot)" --strip-components=1" Condition="!Exists('$(WasiClang)')" />
</Target>
</Project>