-
Notifications
You must be signed in to change notification settings - Fork 5k
/
Copy pathbrowser.proj
629 lines (556 loc) · 37 KB
/
browser.proj
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
<Project Sdk="Microsoft.Build.NoTargets">
<UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" TaskFactory="TaskHostFactory" />
<PropertyGroup>
<!-- FIXME: clean up the duplication with libraries Directory.Build.props -->
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</NativeBinDir>
<!-- only use for files that are not configuration dependent -->
<NativeGeneratedFilesDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', 'generated'))</NativeGeneratedFilesDir>
</PropertyGroup>
<PropertyGroup>
<PythonCmd Condition="'$(HostOS)' != 'windows'">python3</PythonCmd>
<PythonCmd Condition="'$(HostOS)' == 'windows'">python</PythonCmd>
</PropertyGroup>
<PropertyGroup>
<ICULibDir Condition="'$(WasmEnableThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir>
<ICULibDir Condition="'$(WasmEnableThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib'))</ICULibDir>
<InvariantTimezone Condition="'$(InvariantTimezone)' == ''">false</InvariantTimezone>
<WasmEnableStreamingResponse Condition="'$(WasmEnableStreamingResponse)' == ''">true</WasmEnableStreamingResponse>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
<WasmSingleFileBundle Condition="'$(WasmSingleFileBundle)' == ''">false</WasmSingleFileBundle>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">true</WasmEnableSIMD>
<WasmEnableExceptionHandling Condition="'$(WasmEnableExceptionHandling)' == ''">true</WasmEnableExceptionHandling>
<EmccMaximumHeapSize Condition="'$(EmccMaximumHeapSize)' == ''">2147483648</EmccMaximumHeapSize>
<WasmEnableJsInteropByValue Condition="'$(WasmEnableJsInteropByValue)' == '' and '$(WasmEnableThreads)' == 'true'">true</WasmEnableJsInteropByValue>
<WasmEnableJsInteropByValue Condition="'$(WasmEnableJsInteropByValue)' == ''">false</WasmEnableJsInteropByValue>
<WasmPerfTracing Condition="'$(WasmPerfTracing)' == ''">false</WasmPerfTracing>
<FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones>
<EmccCmd>emcc</EmccCmd>
<WasmObjDir>$(ArtifactsObjDir)wasm</WasmObjDir>
<_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp</_EmccDefaultsRspPath>
<_EmccCompileRspPath>$(NativeBinDir)src\emcc-compile.rsp</_EmccCompileRspPath>
<_EmccLinkRspPath>$(NativeBinDir)src\emcc-link.rsp</_EmccLinkRspPath>
<EmSdkLLVMAr>$(EMSDK_PATH)\bin\llvm-ar</EmSdkLLVMAr>
<EmSdkLLVMAr Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(EmSdkLLVMAr).exe</EmSdkLLVMAr>
</PropertyGroup>
<Target Name="CheckEnv">
<Error Condition="'$(TargetArchitecture)' != 'wasm'" Text="Expected TargetArchitecture==wasm, got '$(TargetArchitecture)'"/>
<Error Condition="'$(TargetOS)' != 'browser'" Text="Expected TargetOS==browser, got '$(TargetOS)'"/>
<Error Condition="'$(EMSDK_PATH)' == ''" Text="The EMSDK_PATH environment variable should be set pointing to the emscripten SDK root dir."/>
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Runtime.ICU.Transport" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" />
<PackageReference Include="System.Runtime.TimeZoneData" PrivateAssets="all" Version="$(SystemRuntimeTimeZoneDataVersion)" GeneratePathProperty="true" />
</ItemGroup>
<UsingTask TaskName="ManagedToNativeGenerator" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" TaskFactory="TaskHostFactory" />
<Target Name="GenerateManagedToNative" DependsOnTargets="CheckEnv;ResolveLibrariesFromLocalBuild">
<PropertyGroup>
<WasmPInvokeTablePath>$(WasmObjDir)\pinvoke-table.h</WasmPInvokeTablePath>
<WasmInterpToNativeTablePath>$(WasmObjDir)\wasm_m2n_invoke.g.h</WasmInterpToNativeTablePath>
</PropertyGroup>
<ItemGroup>
<WasmPInvokeModule Include="libSystem.Native" />
<WasmPInvokeModule Include="libSystem.IO.Compression.Native" />
<WasmPInvokeModule Include="libSystem.Globalization.Native" />
<WasmPInvokeModule Include="libz" />
<WasmPInvokeAssembly Include="@(LibrariesRuntimeFiles)" Condition="'%(Extension)' == '.dll' and '%(IsNative)' != 'true'" />
</ItemGroup>
<!-- Retrieve CoreLib's targetpath via GetTargetPath as it isn't binplaced yet. -->
<MSBuild Projects="$(CoreLibProject)"
Targets="GetTargetPath">
<Output TaskParameter="TargetOutputs" ItemName="WasmPInvokeAssembly" />
</MSBuild>
<MakeDir Directories="$(WasmObjDir)" Condition="!Exists('$(WasmObjDir)')" />
<ManagedToNativeGenerator
Assemblies="@(WasmPInvokeAssembly)"
PInvokeModules="@(WasmPInvokeModule)"
PInvokeOutputPath="$(WasmPInvokeTablePath)"
InterpToNativeOutputPath="$(WasmInterpToNativeTablePath)">
<Output TaskParameter="FileWrites" ItemName="FileWrites" />
</ManagedToNativeGenerator>
</Target>
<UsingTask TaskName="EmitBundleSourceFiles" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" TaskFactory="TaskHostFactory" />
<Target Name="GenerateTimezonesArchive" Returns="@(_WasmArchivedTimezones)" Condition="'$(InvariantTimezone)' != 'true'">
<PropertyGroup>
<_WasmTimezonesPath>$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))</_WasmTimezonesPath>
<_WasmTimezonesBundleSourceFile>wasm-bundled-timezones.c</_WasmTimezonesBundleSourceFile>
<_WasmTimezonesBundleArchive>$(WasmObjDir)\wasm-bundled-timezones.a</_WasmTimezonesBundleArchive>
<_WasmTimezonesSourcesRsp>$(WasmObjDir)\wasm-bundled-timezones-sources.rsp</_WasmTimezonesSourcesRsp>
<_WasmTimezonesArchiveRsp>$(WasmObjDir)\wasm-bundled-timezones-archive.rsp</_WasmTimezonesArchiveRsp>
</PropertyGroup>
<ItemGroup>
<_WasmTimezonesInternal Include="$(_WasmTimezonesPath)\**\*.*" WasmRole="Timezone"/>
</ItemGroup>
<ItemGroup>
<_WasmTimezonesInternal Update="@(_WasmTimezonesInternal)">
<RegisteredName>/usr/share/zoneinfo/$([MSBuild]::MakeRelative($(_WasmTimezonesPath), %(_WasmTimezonesInternal.Identity)).Replace('\','/'))</RegisteredName>
</_WasmTimezonesInternal>
</ItemGroup>
<!-- TODO make this incremental compilation -->
<EmitBundleSourceFiles
FilesToBundle="@(_WasmTimezonesInternal)"
BundleRegistrationFunctionName="mono_register_timezones_bundle"
BundleFile="$(_WasmTimezonesBundleSourceFile)"
OutputDirectory="$(WasmObjDir)">
<Output TaskParameter="BundledResources" ItemName="BundledWasmTimezones" />
</EmitBundleSourceFiles>
<ItemGroup>
<_WasmBundleTimezonesSources Include="$([MSBuild]::MakeRelative($(WasmObjDir), %(BundledWasmTimezones.DestinationFile)).Replace('\','/'))" />
<_WasmBundleTimezonesSources Include="$(_WasmTimezonesBundleSourceFile)" />
</ItemGroup>
<WriteLinesToFile File="$(_WasmTimezonesSourcesRsp)"
Overwrite="true"
Lines="@(_WasmBundleTimezonesSources, ' ')"
WriteOnlyWhenDifferent="true" />
<RunWithEmSdkEnv Command="$(EmccCmd) -xc -c @$(_WasmTimezonesSourcesRsp)"
WorkingDirectory="$(WasmObjDir)"
EmSdkPath="$(EMSDK_PATH)"
ConsoleToMsBuild="true"
IgnoreStandardErrorWarningFormat="true">
</RunWithEmSdkEnv>
<ItemGroup>
<WasmBundleTimezonesObjects Include="%(_WasmBundleTimezonesSources.Filename).o" />
</ItemGroup>
<WriteLinesToFile File="$(_WasmTimezonesArchiveRsp)"
Overwrite="true"
Lines="@(WasmBundleTimezonesObjects, ' ')"
WriteOnlyWhenDifferent="true" />
<RunWithEmSdkEnv Command="$(EmSdkLLVMAr) cs -r $(_WasmTimezonesBundleArchive) @$(_WasmTimezonesArchiveRsp)"
EmSdkPath="$(EMSDK_PATH)"
WorkingDirectory="$(WasmObjDir)"
ConsoleToMsBuild="true"
IgnoreStandardErrorWarningFormat="true">
</RunWithEmSdkEnv>
<ItemGroup>
<_WasmArchivedTimezones Include="$(WasmObjDir)\wasm-bundled-timezones.a" />
</ItemGroup>
<!-- Clean up the bundle-objects dir - remove anything we no longer need -->
<ItemGroup>
<_WasmBundleTimezonesToDelete Include="$(_WasmIntermediateOutputPath)*.o" />
<_WasmBundleTimezonesToDelete Include="$(_WasmIntermediateOutputPath)*.c" />
<_WasmBundleTimezonesToDelete Remove="$(WasmObjDir)\$(_WasmTimezonesBundleSourceFile)" />
<_WasmBundleTimezonesToDelete Remove="%(BundledWasmTimezones.DestinationFile)" />
<_WasmBundleTimezonesToDelete Remove="$(WasmObjDir)\%(WasmBundleTimezonesObjects)" />
</ItemGroup>
<Delete Files="@(_WasmBundleTimezonesToDelete)" />
</Target>
<Target Name="GenerateEmccPropsAndRspFiles">
<!-- Generate wasm-props.json -->
<RunWithEmSdkEnv Command="$(EmccCmd) --version"
ConsoleToMsBuild="true"
EmSdkPath="$(EMSDK_PATH)"
IgnoreStandardErrorWarningFormat="true">
<Output TaskParameter="ConsoleOutput" ItemName="_VersionLines" />
</RunWithEmSdkEnv>
<!-- we want to get the first line from the output, which has the version.
Rest of the lines are the license -->
<ItemGroup>
<_ReversedVersionLines Include="@(_VersionLines->Reverse())" />
</ItemGroup>
<PropertyGroup>
<_EmccVersionRaw>%(_ReversedVersionLines.Identity)</_EmccVersionRaw>
<_EmccVersionRegexPattern>^ *emcc \([^\)]+\) *([0-9\.]+).*\(([^\)]+)\)$</_EmccVersionRegexPattern>
<_EmccVersion>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[1].Value)</_EmccVersion>
<_EmccVersionHash>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[2].Value)</_EmccVersionHash>
</PropertyGroup>
<Error Text="Failed to parse emcc version, and hash from the full version string: '$(_EmccVersionRaw)'"
Condition="'$(_EmccVersion)' == '' or '$(_EmccVersionHash)' == ''" />
<ItemGroup>
<EmccExportedRuntimeMethod Include="FS" />
<EmccExportedRuntimeMethod Include="out" />
<EmccExportedRuntimeMethod Include="err" />
<EmccExportedRuntimeMethod Include="ccall" />
<EmccExportedRuntimeMethod Include="cwrap" />
<EmccExportedRuntimeMethod Include="setValue" />
<EmccExportedRuntimeMethod Include="getValue" />
<EmccExportedRuntimeMethod Include="UTF8ToString" />
<EmccExportedRuntimeMethod Include="UTF8ArrayToString" />
<EmccExportedRuntimeMethod Include="lengthBytesUTF8" />
<EmccExportedRuntimeMethod Include="stringToUTF8Array" />
<EmccExportedRuntimeMethod Include="FS_createPath" />
<EmccExportedRuntimeMethod Include="FS_createDataFile" />
<EmccExportedRuntimeMethod Include="removeRunDependency" />
<EmccExportedRuntimeMethod Include="addRunDependency" />
<EmccExportedRuntimeMethod Include="addFunction" />
<EmccExportedRuntimeMethod Include="safeSetTimeout" />
<EmccExportedRuntimeMethod Include="runtimeKeepalivePush" />
<EmccExportedRuntimeMethod Include="runtimeKeepalivePop" />
<EmccExportedRuntimeMethod Include="maybeExit" />
<EmccExportedRuntimeMethod Include="abort" />
<EmccExportedFunction Include="_free" />
<EmccExportedFunction Include="_htons" />
<EmccExportedFunction Include="_malloc" />
<EmccExportedFunction Include="_sbrk" />
<EmccExportedFunction Include="_memalign" />
<EmccExportedFunction Include="_posix_memalign" />
<EmccExportedFunction Include="_memset" />
<EmccExportedFunction Include="_ntohs" />
<EmccExportedFunction Include="stackAlloc" />
<EmccExportedFunction Include="stackRestore" />
<EmccExportedFunction Include="stackSave" />
<EmccExportedFunction Include="_emscripten_force_exit" />
</ItemGroup>
<!-- for the jiterpreter -->
<ItemGroup>
<EmccExportedRuntimeMethod Include="wasmExports" />
<EmccExportedFunction Include="_fmod" />
<EmccExportedFunction Include="_atan2" />
<EmccExportedFunction Include="_fma" />
<EmccExportedFunction Include="_pow" />
<EmccExportedFunction Include="_fmodf" />
<EmccExportedFunction Include="_atan2f" />
<EmccExportedFunction Include="_fmaf" />
<EmccExportedFunction Include="_powf" />
<EmccExportedFunction Include="_asin" />
<EmccExportedFunction Include="_asinh" />
<EmccExportedFunction Include="_acos" />
<EmccExportedFunction Include="_acosh" />
<EmccExportedFunction Include="_atan" />
<EmccExportedFunction Include="_atanh" />
<EmccExportedFunction Include="_cbrt" />
<EmccExportedFunction Include="_cos" />
<EmccExportedFunction Include="_cosh" />
<EmccExportedFunction Include="_exp" />
<EmccExportedFunction Include="_log" />
<EmccExportedFunction Include="_log2" />
<EmccExportedFunction Include="_log10" />
<EmccExportedFunction Include="_sin" />
<EmccExportedFunction Include="_sinh" />
<EmccExportedFunction Include="_tan" />
<EmccExportedFunction Include="_tanh" />
<EmccExportedFunction Include="_asinf" />
<EmccExportedFunction Include="_asinhf" />
<EmccExportedFunction Include="_acosf" />
<EmccExportedFunction Include="_acoshf" />
<EmccExportedFunction Include="_atanf" />
<EmccExportedFunction Include="_atanhf" />
<EmccExportedFunction Include="_cbrtf" />
<EmccExportedFunction Include="_cosf" />
<EmccExportedFunction Include="_coshf" />
<EmccExportedFunction Include="_expf" />
<EmccExportedFunction Include="_logf" />
<EmccExportedFunction Include="_log2f" />
<EmccExportedFunction Include="_log10f" />
<EmccExportedFunction Include="_sinf" />
<EmccExportedFunction Include="_sinhf" />
<EmccExportedFunction Include="_tanf" />
<EmccExportedFunction Include="_tanhf" />
</ItemGroup>
<ItemGroup Condition="'$(WasmEnableThreads)' == 'true'">
<EmccExportedFunction Include="_emscripten_main_runtime_thread_id" />
</ItemGroup>
<ItemGroup Condition="'$(WasmEnableThreads)' == 'true'">
<EmccExportedFunction Include="_emscripten_main_runtime_thread_id" />
</ItemGroup>
<PropertyGroup>
<_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]"</_EmccExportedLibraryFunction>
<_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]"</_EmccExportedRuntimeMethods>
<_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',')</_EmccExportedFunctions>
<!-- reserve at least enough space to complete initializing sgen without growing the heap -->
<EmccInitialHeapSize>33554432</EmccInitialHeapSize>
<EmccStackSize>5MB</EmccStackSize>
</PropertyGroup>
<ItemGroup>
<_EmccLinkFlags Include="-Wno-unused-command-line-argument" />
<_EmccLinkFlags Include="-s INITIAL_MEMORY=$(EmccInitialHeapSize)" />
<_EmccLinkFlags Include="-s STACK_SIZE=$(EmccStackSize)" />
<_EmccCommonFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-s USE_PTHREADS=1" />
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-Wno-pthreads-mem-growth" />
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE=0" />
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE_STRICT=0" />
<_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" />
<!-- for jiterpreter -->
<_EmccLinkFlags Include="-s ALLOW_TABLE_GROWTH=1" />
<_EmccLinkFlags Include="-s NO_EXIT_RUNTIME=0" />
<_EmccLinkFlags Include="-s FORCE_FILESYSTEM=1" />
<_EmccLinkFlags Condition="'$(_EmccExportedLibraryFunction)' != ''" Include="-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$(_EmccExportedLibraryFunction)" />
<_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS=$(_EmccExportedRuntimeMethods)" />
<_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=$(_EmccExportedFunctions)" />
<_EmccLinkFlags Include="--source-map-base http://example.com" />
<_EmccLinkFlags Include="-s WASM_BIGINT=1" />
<_EmccLinkFlags Include="-s EXPORT_NAME="'createDotnetRuntime'"" />
<_EmccLinkFlags Include="-s MODULARIZE=1" />
<_EmccLinkFlags Include="-s ENVIRONMENT="web,webview,worker,node,shell"" />
<!-- remove -Wno-limited-postlink-optimizations once below issue is fixed
active issue: https://github.com/emscripten-core/emscripten/pull/16727 -->
<_EmccLinkFlags Include="-Wno-limited-postlink-optimizations"/>
</ItemGroup>
<ItemGroup Condition="'$(WasmEnableThreads)' == 'true'">
<WasmOptConfigurationFlags Include="--enable-threads;--enable-bulk-memory;--enable-sign-ext" />
<!-- workaround for https://github.com/emscripten-core/emscripten/issues/18034 -->
<_EmccLinkFlags Include="-s TEXTDECODER=0"/>
</ItemGroup>
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<_EmccLinkFlags Include="--profiling-funcs" />
<_EmccFlags Include="@(_EmccCommonFlags)" />
</ItemGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<_EmccFlags Include="@(_EmccCommonFlags)" />
</ItemGroup>
<PropertyGroup>
<_EmccPropsJson>
<![CDATA[
{
"items": {
"EmccProperties": [
{ "identity": "RuntimeEmccVersion", "value": "$(_EmccVersion)" },
{ "identity": "RuntimeEmccVersionRaw", "value": "$(_EmccVersionRaw)" },
{ "identity": "RuntimeEmccVersionHash", "value": "$(_EmccVersionHash)" }
],
"WasmOptConfigurationFlags": [@(WasmOptConfigurationFlags -> '%22%(Identity)%22', ',')],
"EmccDefaultExportedFunctions": [@(EmccExportedFunction -> '%22%(Identity)%22', ',')],
"EmccDefaultExportedRuntimeMethods": [@(EmccExportedRuntimeMethod -> '%22%(Identity)%22', ',')],
"PropertiesThatTriggerRelinking": [
{ "identity": "InvariantTimezone", "defaultValueInRuntimePack": "$(InvariantTimezone)" },
{ "identity": "InvariantGlobalization", "defaultValueInRuntimePack": "$(InvariantGlobalization)" },
{ "identity": "WasmNativeStrip", "defaultValueInRuntimePack": "$(WasmNativeStrip)" },
{ "identity": "WasmSingleFileBundle", "defaultValueInRuntimePack": "$(WasmSingleFileBundle)" },
{ "identity": "WasmEnableSIMD", "defaultValueInRuntimePack": "$(WasmEnableSIMD)" },
{ "identity": "WasmEnableExceptionHandling", "defaultValueInRuntimePack": "$(WasmEnableExceptionHandling)" },
{ "identity": "WasmPerfTracing", "defaultValueInRuntimePack": "$(WasmPerfTracing)" },
{ "identity": "WasmProfilers", "defaultValueInRuntimePack": "$(WasmProfilers)" },
{ "identity": "EmccMaximumHeapSize", "defaultValueInRuntimePack": "$(EmccMaximumHeapSize)" }
]
}
}
]]>
</_EmccPropsJson>
</PropertyGroup>
<WriteLinesToFile File="$(NativeBinDir)src\wasm-props.json"
Lines="$(_EmccPropsJson)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
<WriteLinesToFile File="$(_EmccDefaultsRspPath)"
Lines="@(_EmccFlags)"
WriteOnlyWhenDifferent="true"
Overwrite="true" />
<WriteLinesToFile File="$(_EmccCompileRspPath)"
Lines="@(_EmccCompileFlags)"
WriteOnlyWhenDifferent="true"
Overwrite="true" />
<WriteLinesToFile File="$(_EmccLinkRspPath)"
Lines="@(_EmccLinkFlags)"
WriteOnlyWhenDifferent="true"
Overwrite="true" />
</Target>
<!-- This is a documented target that is invoked by developers in their innerloop work. -->
<Target Name="BuildWasmRuntimes"
AfterTargets="Build"
DependsOnTargets="GenerateEmccPropsAndRspFiles;GenerateManagedToNative;GenerateTimezonesArchive;InstallNpmPackages;BuildWithRollup">
<ItemGroup>
<ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a;
$(ICULibDir)/libicui18n.a;
$(ICULibDir)/libicudata.a" />
<ICULibFiles Include="$(ICULibDir)/*.dat" />
</ItemGroup>
<PropertyGroup>
<PInvokeTableFile>$(ArtifactsObjDir)wasm/pinvoke-table.h</PInvokeTableFile>
<InterpToNativeTableFile>$(ArtifactsObjDir)wasm/wasm_m2n_invoke.g.h</InterpToNativeTableFile>
<CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Debug'">-g -Os -DDEBUG=1</CMakeConfigurationEmccFlags>
<CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Release'">-Oz</CMakeConfigurationEmccFlags>
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Debug'" >$(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 </CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Release'">-O2</CMakeConfigurationLinkFlags>
<!-- -lexports.js has the magical property of disabling minification of export names -->
<CMakeConfigurationLinkFlags>$(CMakeConfigurationLinkFlags) -s EXPORT_ES6=1 -lexports.js</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(CMakeConfigurationLinkFlags) -msimd128</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(WasmEnableThreads)' == 'true'">$(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags >$(CMakeConfigurationLinkFlags) --emit-symbol-map</CMakeConfigurationLinkFlags>
<CMakeConfigurationEmsdkPath Condition="'$(Configuration)' == 'Release'"> -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))"</CMakeConfigurationEmsdkPath>
<CMakeBuildRuntimeConfigureCmd>emcmake cmake $(MSBuildThisFileDirectory)runtime</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCMAKE_BUILD_TYPE=$(Configuration)</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EMCC_FLAGS="$(CMakeConfigurationEmccFlags)"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_LINK_FLAGS="$(CMakeConfigurationLinkFlags)"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_WASM_OPT_FLAGS="@(WasmOptConfigurationFlags, ';')"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_INCLUDES="$(MonoArtifactsPath)include/mono-2.0"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES="$(MonoObjDir.TrimEnd('\/').Replace('\','/'))"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DICU_LIB_DIR="$(ICULibDir.TrimEnd('\/').Replace('\','/'))"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/').Replace('\','/'))"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/').Replace('\','/'))"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(WasmEnableSIMD)' == 'true'">$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(WasmEnableSIMD)' != 'true'">$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_INTERPSIMDTABLES_LIB="nosimd"</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(WasmEnableThreads)' == 'true'">$(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(WasmEnableJsInteropByValue)' == 'true'">$(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath)</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' == 'Windows_NT'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeConfigureCmd)</CMakeBuildRuntimeConfigureCmd>
<CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeConfigureCmd)'</CMakeBuildRuntimeConfigureCmd>
<CMakeOptions Condition="'$(MonoVerboseBuild)' != ''">-v</CMakeOptions>
<CMakeBuildRuntimeCmd>cmake --build . --config $(Configuration) $(CmakeOptions)</CMakeBuildRuntimeCmd>
<CMakeBuildRuntimeCmd Condition="'$(OS)' == 'Windows_NT'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeCmd)</CMakeBuildRuntimeCmd>
<CMakeBuildRuntimeCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)'</CMakeBuildRuntimeCmd>
</PropertyGroup>
<ItemGroup>
<_CmakeEnvironmentVariable Include="ENABLE_JS_INTEROP_BY_VALUE=1" Condition="'$(WasmEnableJsInteropByValue)' != 'false'"/>
<_CmakeEnvironmentVariable Include="ENABLE_JS_INTEROP_BY_VALUE=0" Condition="'$(WasmEnableJsInteropByValue)' == 'false'"/>
<_CmakeEnvironmentVariable Include="WASM_ENABLE_SIMD=1" Condition="'$(WasmEnableSIMD)' != 'false'" />
<_CmakeEnvironmentVariable Include="WASM_ENABLE_SIMD=0" Condition="'$(WasmEnableSIMD)' == 'false'" />
<_CmakeEnvironmentVariable Include="WASM_PERFTRACING=1" Condition="'$(WasmPerfTracing)' == 'true'" />
<_CmakeEnvironmentVariable Include="WASM_PERFTRACING=0" Condition="'$(WasmPerfTracing)' != 'true'" />
<_CmakeEnvironmentVariable Include="WASM_ENABLE_EH=1" Condition="'$(WasmEnableExceptionHandling)' != 'false'" />
<_CmakeEnvironmentVariable Include="WASM_ENABLE_EH=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<_CmakeEnvironmentVariable Include="RUN_AOT_COMPILATION=1" Condition="'$(RunAOTCompilation)' == 'true'" />
<_CmakeEnvironmentVariable Include="RUN_AOT_COMPILATION=0" Condition="'$(RunAOTCompilation)' != 'true'" />
<_CmakeEnvironmentVariable Include="EM_CACHE=$(WasmCachePath)" Condition="'$(WasmCachePath)' != ''" />
<_CmakeEnvironmentVariable Include="EM_FROZEN_CACHE=1" Condition="'$(WasmCachePath)' == '$(EmscriptenCacheSdkCacheDir)'" />
<_CmakeEnvironmentVariable Include="EM_FROZEN_CACHE=0" Condition="'$(WasmCachePath)' != '' and '$(WasmCachePath)' != '$(EmscriptenCacheSdkCacheDir)'" />
</ItemGroup>
<Copy SourceFiles="$(PInvokeTableFile)"
DestinationFolder="$(MonoObjDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="$(InterpToNativeTableFile)"
DestinationFolder="$(MonoObjDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="runtime/runtime.h;
runtime/runtime.c;
runtime/driver.c;
runtime/pinvoke.c;
runtime/corebindings.c;"
DestinationFolder="$(NativeBinDir)src"
SkipUnchangedFiles="true" />
<Copy SourceFiles="runtime/es6/dotnet.es6.pre.js;
runtime/es6/dotnet.es6.lib.js;
runtime/es6/dotnet.es6.extpost.js;"
DestinationFolder="$(NativeBinDir)src/es6"
SkipUnchangedFiles="true" />
<ReadLinesFromFile File="$(WasmObjDir)/exports-linker.js">
<Output TaskParameter="Lines" ItemName="_WasmImportedMethodNames" />
</ReadLinesFromFile>
<!-- append at the end of dotnet.es6.lib.js -->
<WriteLinesToFile File="$(NativeBinDir)src/es6/dotnet.es6.lib.js"
Lines="@(_WasmImportedMethodNames)"
Overwrite="false" />
<Copy SourceFiles="runtime\runtime.h;runtime\pinvoke.h;runtime\gc-common.h"
DestinationFolder="$(NativeBinDir)include\wasm"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(ICULibFiles);
@(ICULibNativeFiles);
@(_WasmArchivedTimezones);"
DestinationFolder="$(NativeBinDir)"
SkipUnchangedFiles="true" />
<Exec Command="$(CMakeBuildRuntimeConfigureCmd)" WorkingDirectory="$(NativeBinDir)"
EnvironmentVariables="@(_CmakeEnvironmentVariable)" />
<Exec Command="$(CMakeBuildRuntimeCmd)" WorkingDirectory="$(NativeBinDir)"
EnvironmentVariables="@(_CmakeEnvironmentVariable)" />
<ItemGroup>
<IcuDataFiles Include="$(NativeBinDir)*.dat" />
<WasmSrcFiles Include="$(NativeBinDir)src\*.c;
$(NativeBinDir)src\*.js;
$(_EmccDefaultsRspPath);
$(_EmccCompileRspPath);
$(_EmccLinkRspPath);
$(NativeBinDir)src\wasm-props.json" />
<WasmSrcFilesEs6 Include="$(NativeBinDir)src\es6\*.js;" />
<WasmHeaderFiles Include="$(NativeBinDir)include\wasm\*.h" />
</ItemGroup>
<Copy SourceFiles="$(NativeBinDir)dotnet.js;
$(NativeBinDir)dotnet.js.map;
$(NativeBinDir)dotnet.runtime.js;
$(NativeBinDir)dotnet.runtime.js.map;
$(NativeBinDir)dotnet.diagnostics.js;
$(NativeBinDir)dotnet.diagnostics.js.map;
$(NativeBinDir)dotnet.native.js;
$(NativeBinDir)dotnet.d.ts;
$(NativeBinDir)package.json;
$(NativeBinDir)dotnet.native.wasm;"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="$(NativeBinDir)dotnet.native.worker.mjs"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
Condition="Exists('$(NativeBinDir)dotnet.native.worker.mjs')"
SkipUnchangedFiles="true" />
<Copy SourceFiles="$(NativeBinDir)dotnet.native.js.symbols"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(IcuDataFiles);@(ICULibNativeFiles);@(_WasmArchivedTimezones)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(WasmSrcFiles)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(WasmSrcFilesEs6)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src\es6"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(WasmHeaderFiles)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\wasm"
SkipUnchangedFiles="true" />
</Target>
<Target Name="InstallNpmPackages"
Inputs="$(BrowserProjectRoot)runtime/package.json"
Outputs="$(BrowserProjectRoot)runtime/node_modules/.npm-stamp"
>
<!-- install typescript and rollup -->
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
<!-- npm install is faster on dev machine as it doesn't wipe node_modules folder -->
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' != 'true'" Command="npm install" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
<!-- Delete malformed package.json used for tests, it confuses Component Governance tooling -->
<Delete Files="$(BrowserProjectRoot)runtime/node_modules/resolve/test/resolver/malformed_package_json/package.json" ContinueOnError="true" />
<Touch Files="$(BrowserProjectRoot)runtime/node_modules/.npm-stamp" AlwaysCreate="true" />
</Target>
<ItemGroup>
<_RollupInputs Include="$(BrowserProjectRoot)runtime/**/*.ts"
Exclude="$(BrowserProjectRoot)runtime/dotnet.d.ts;$(BrowserProjectRoot)runtime/node_modules/**/*.ts" />
<_RollupInputs Include="$(BrowserProjectRoot)runtime/**/tsconfig.*"
Exclude="$(BrowserProjectRoot)runtime/node_modules/**/tsconfig.*" />
<_RollupInputs Include="$(BrowserProjectRoot)runtimetypes/*.d.ts"/>
<_RollupInputs Include="$(BrowserProjectRoot)runtime/*.json"/>
<_RollupInputs Include="$(BrowserProjectRoot)runtime/*.js"/>
</ItemGroup>
<Target Name="SetMonoRollupEnvironment">
<!-- Retrieve the runtime pack product version. -->
<MSBuild Projects="$(RepoRoot)src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Mono.sfxproj"
Targets="ReturnProductVersion"
Properties="Crossgen2SdkOverridePropsPath=;
Crossgen2SdkOverrideTargetsPath=">
<Output TaskParameter="TargetOutputs" PropertyName="RuntimePackProductVersion" />
</MSBuild>
<ItemGroup>
<_MonoRollupEnvironmentVariable Include="Configuration:$(Configuration)" />
<_MonoRollupEnvironmentVariable Include="NativeBinDir:$(NativeBinDir)" />
<_MonoRollupEnvironmentVariable Include="WasmObjDir:$(WasmObjDir)" />
<_MonoRollupEnvironmentVariable Include="ProductVersion:$(RuntimePackProductVersion)" />
<_MonoRollupEnvironmentVariable Include="WasmEnableThreads:$(WasmEnableThreads)" />
<_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:1" Condition="'$(WasmEnableSIMD)' != 'false'" />
<_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:0" Condition="'$(WasmEnableSIMD)' == 'false'" />
<_MonoRollupEnvironmentVariable Include="WASM_ENABLE_EH:1" Condition="'$(WasmEnableExceptionHandling)' != 'false'" />
<_MonoRollupEnvironmentVariable Include="WASM_ENABLE_EH:0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<_MonoRollupEnvironmentVariable Include="ENABLE_JS_INTEROP_BY_VALUE:1" Condition="'$(WasmEnableJsInteropByValue)' == 'true'" />
<_MonoRollupEnvironmentVariable Include="ENABLE_JS_INTEROP_BY_VALUE:0" Condition="'$(WasmEnableJsInteropByValue)' != 'true'" />
<_MonoRollupEnvironmentVariable Include="ContinuousIntegrationBuild:$(ContinuousIntegrationBuild)" />
</ItemGroup>
<PropertyGroup>
<MonoRollupEnvironment>@(_MonoRollupEnvironmentVariable, ',')</MonoRollupEnvironment>
</PropertyGroup>
<PropertyGroup>
<_RollupEnvIntermediateFile>$(WasmObjDir)\.rollup.env</_RollupEnvIntermediateFile>
</PropertyGroup>
</Target>
<Target Name="WriteRollupEnvToFile" DependsOnTargets="SetMonoRollupEnvironment">
<!-- the purpose of this file is to be an input to the BuildWithRollup target. That way if any
of the environment values change, we will do a new rollup build. For example if the
`WasmEnableThreads` property is changed between builds by a developer. -->
<WriteLinesToFile File="$(_RollupEnvIntermediateFile)"
Lines="$(MonoRollupEnvironment)"
WriteOnlyWhenDifferent="true"
Overwrite="true" />
</Target>
<Target Name="GenerateMintopsTS"
Inputs="$(MonoProjectRoot)wasm\runtime\genmintops.py;$(MonoProjectRoot)mono\mini\interp\mintops.def;$(MonoProjectRoot)mono\mini\interp\interp-simd-intrins.def"
Outputs="$(NativeGeneratedFilesDir)mintops.ts">
<Exec Command="$(PythonCmd) $(BrowserProjectRoot)runtime/genmintops.py $(MonoProjectRoot)mono/mini/interp/mintops.def $(MonoProjectRoot)mono/mini/interp/interp-simd-intrins.def $(NativeGeneratedFilesDir)mintops.ts" />
</Target>
<Target Name="BuildWithRollup"
Inputs="@(_RollupInputs);$(_RollupEnvIntermediateFile);$(NativeGeneratedFilesDir)mintops.ts"
Outputs="$(NativeBinDir).rollup-stamp"
DependsOnTargets="WriteRollupEnvToFile;GenerateMintopsTS"
>
<!-- code style check -->
<RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
<!-- compile typescript -->
<RunWithEmSdkEnv Command="npm run rollup -- --environment $(MonoRollupEnvironment)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
<Copy SourceFiles="runtime/package.json;"
DestinationFolder="$(NativeBinDir)"
SkipUnchangedFiles="true" />
<!-- set version -->
<RunWithEmSdkEnv Command="npm version $(PackageVersion)" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(NativeBinDir)"/>
<Touch Files="$(NativeBinDir).rollup-stamp" AlwaysCreate="true" />
</Target>
</Project>