mirror of https://github.com/dotnet/runtime
393 lines
23 KiB
XML
393 lines
23 KiB
XML
<Project Sdk="Microsoft.Build.NoTargets">
|
|
|
|
<UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" />
|
|
|
|
<PropertyGroup>
|
|
<!-- FIXME: clean up the duplication with libraries Directory.Build.props -->
|
|
<PackageRID>browser-wasm</PackageRID>
|
|
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</NativeBinDir>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<MonoWasmThreads Condition="'$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread' or '$(MonoWasmBuildVariant)' == 'perftrace'">true</MonoWasmThreads>
|
|
<MonoWasmThreadsNoUser Condition="('$(WasmEnableThreads)' != 'true' and '$(WasmEnablePerfTracing)' == 'true') or '$(MonoWasmBuildVariant)' == 'perftrace'">true</MonoWasmThreadsNoUser>
|
|
<MonoDiagnosticsMock Condition="'$(MonoDiagnosticsMock)' == '' and '$(Configuration)' == 'Release'">false</MonoDiagnosticsMock>
|
|
<MonoDiagnosticsMock Condition="'$(MonoDiagnosticsMock)' == '' and '$(Configuration)' == 'Debug'">true</MonoDiagnosticsMock>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir>
|
|
<ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib'))</ICULibDir>
|
|
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">false</WasmEnableSIMD>
|
|
<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>
|
|
<WasmNativeStrip Condition="'$(ContinuousIntegrationBuild)' == 'true'">false</WasmNativeStrip>
|
|
<SystemCryptoNativeDir>$(RepoRoot)\src\native\libs\System.Security.Cryptography.Native.Browser</SystemCryptoNativeDir>
|
|
</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="GenerateWasmBundle"
|
|
AssemblyFile="$(WasmBuildTasksAssemblyPath)"/>
|
|
<Target Name="BundleTimeZones">
|
|
<PropertyGroup>
|
|
<TimeZonesDataPath>$(NativeBinDir)dotnet.timezones.blat</TimeZonesDataPath>
|
|
</PropertyGroup>
|
|
<GenerateWasmBundle
|
|
InputDirectory="$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))"
|
|
OutputFileName="$(TimeZonesDataPath)" />
|
|
</Target>
|
|
|
|
<UsingTask TaskName="ManagedToNativeGenerator" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" />
|
|
<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="libSystem.Security.Cryptography.Native.Browser" />
|
|
<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>
|
|
|
|
<Target Name="GenerateEmccPropsAndRspFiles">
|
|
|
|
<!-- Generate emcc-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)' == ''" />
|
|
|
|
<PropertyGroup>
|
|
<_DefaultExportedFunctions Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(_EmccVersion)', '3.1.7'))"
|
|
>_malloc,stackSave,stackRestore,stackAlloc,_memalign,_memset,_htons,_ntohs,_free</_DefaultExportedFunctions>
|
|
|
|
<!-- _htons,_ntohs,__get_daylight,__get_timezone,__get_tzname are exported temporarily, until the issue is fixed in emscripten, https://github.com/dotnet/runtime/issues/64724 -->
|
|
<_DefaultExportedFunctions Condition="'$(_DefaultExportedFunctions)' == '' and $([MSBuild]::VersionGreaterThan('$(_EmccVersion)', '3.0'))"
|
|
>g_free,_malloc,_memalign,_memset,_htons,_ntohs,__get_daylight,__get_timezone,__get_tzname</_DefaultExportedFunctions>
|
|
<_DefaultExportedFunctions Condition="'$(_DefaultExportedFunctions)' == '' and $([MSBuild]::VersionLessThan('$(_EmccVersion)', '3.0'))"
|
|
>g_free,_malloc,_htons,_ntohs,__get_daylight,__get_timezone,__get_tzname,_memalign</_DefaultExportedFunctions>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<_EmccCommonFlags Condition="'$(WasmEnableSIMD)' == 'true'" Include="-msimd128" />
|
|
<_EmccCommonFlags Condition="'$(MonoWasmThreads)' == 'true'" Include="-s USE_PTHREADS=1" />
|
|
<_EmccLinkFlags Condition="'$(MonoWasmThreads)' == 'true'" Include="-Wno-pthreads-mem-growth" />
|
|
<_EmccLinkFlags Condition="'$(MonoWasmThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE=4" />
|
|
<_EmccLinkFlags Condition="'$(MonoWasmThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE_STRICT=2" /> <!-- hard error if worker pool is exhausted -->
|
|
<_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" />
|
|
<_EmccLinkFlags Include="-s NO_EXIT_RUNTIME=1" />
|
|
<_EmccLinkFlags Include="-s FORCE_FILESYSTEM=1" />
|
|
<_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS="['FS','print','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency', 'FS_readFile']"" />
|
|
<_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=$(_DefaultExportedFunctions)" Condition="'$(_DefaultExportedFunctions)' != ''" />
|
|
<_EmccLinkFlags Include="--source-map-base http://example.com" />
|
|
<_EmccLinkFlags Include="-s STRICT_JS=1" />
|
|
<_EmccLinkFlags Include="-s EXPORT_NAME="'createDotnetRuntime'"" />
|
|
<_EmccLinkFlags Include="-s MODULARIZE=1"/>
|
|
<_EmccLinkFlags Include="-Wl,--allow-undefined"/>
|
|
<_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="'$(MonoWasmThreads)' == 'true'">
|
|
<WasmOptConfigurationFlags Include="--enable-threads;--enable-bulk-memory;--enable-sign-ext" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
|
|
<_EmccLinkFlags Include="--profiling-funcs" />
|
|
<_EmccFlags Include="@(_EmccCommonFlags)" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
|
<_EmccFlags Include="@(_EmccCommonFlags)" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<_WasmOptConfigurationFlags>@(WasmOptConfigurationFlags, '%3B ') </_WasmOptConfigurationFlags>
|
|
<_EmccPropsJson>
|
|
<![CDATA[
|
|
{
|
|
"items": {
|
|
"EmccProperties": [
|
|
{ "identity": "RuntimeEmccVersion", "value": "$(_EmccVersion)" },
|
|
{ "identity": "RuntimeEmccVersionRaw", "value": "$(_EmccVersionRaw)" },
|
|
{ "identity": "RuntimeEmccVersionHash", "value": "$(_EmccVersionHash)" }
|
|
],
|
|
"WasmOptConfigurationFlags": [
|
|
{ "identity": "WasmOptConfigurationFlags", "value": "$(_WasmOptConfigurationFlags)" }
|
|
]
|
|
}
|
|
}
|
|
]]>
|
|
</_EmccPropsJson>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(NativeBinDir)src\emcc-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;BundleTimeZones;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 -s -DDEBUG=1 -DENABLE_AOT_PROFILER=1</CMakeConfigurationEmccFlags>
|
|
<CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Release'">-Oz</CMakeConfigurationEmccFlags>
|
|
|
|
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Debug'" >$(CMakeConfigurationEmccFlags)</CMakeConfigurationLinkFlags>
|
|
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Release'">-O2</CMakeConfigurationLinkFlags>
|
|
<CMakeConfigurationLinkFlags>$(CMakeConfigurationLinkFlags) -s EXPORT_ES6=1</CMakeConfigurationLinkFlags>
|
|
<CMakeConfigurationLinkFlags Condition="'$(MonoWasmThreads)' == 'true'">$(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth</CMakeConfigurationLinkFlags>
|
|
<CMakeConfigurationLinkFlags >$(CMakeConfigurationLinkFlags) --emit-symbol-map</CMakeConfigurationLinkFlags>
|
|
|
|
<CMakeConfigurationEmsdkPath Condition="'$(Configuration)' == 'Release'"> -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/'))"</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('\/'))"</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DICU_LIB_DIR="$(ICULibDir.TrimEnd('\/'))"</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/'))"</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/'))"</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd Condition="'$(WasmEnableSIMD)' == 'true' and '$(Configuration)' == 'Release'">$(CMakeBuildRuntimeConfigureCmd) -DWASM_OPT_ADDITIONAL_FLAGS="--enable-simd"</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd Condition="'$(MonoWasmThreads)' == 'true'">$(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0</CMakeBuildRuntimeConfigureCmd>
|
|
<CMakeBuildRuntimeConfigureCmd Condition="'$(MonoWasmThreadsNoUser)' == 'true'">$(CMakeBuildRuntimeConfigureCmd) -DDISABLE_WASM_USER_THREADS=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.bat'))" && $(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.bat'))" && $(CMakeBuildRuntimeCmd)</CMakeBuildRuntimeCmd>
|
|
<CMakeBuildRuntimeCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)'</CMakeBuildRuntimeCmd>
|
|
</PropertyGroup>
|
|
|
|
<Copy SourceFiles="$(PInvokeTableFile)"
|
|
DestinationFolder="$(MonoObjDir)"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="$(InterpToNativeTableFile)"
|
|
DestinationFolder="$(MonoObjDir)"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="runtime/driver.c;
|
|
runtime/pinvoke.c;
|
|
runtime/corebindings.c;
|
|
$(SharedNativeRoot)libs\System.Native\pal_random.lib.js;"
|
|
DestinationFolder="$(NativeBinDir)src"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="runtime/es6/dotnet.es6.pre.js;
|
|
runtime/es6/dotnet.es6.lib.js;
|
|
runtime/es6/dotnet.es6.post.js;"
|
|
DestinationFolder="$(NativeBinDir)src/es6"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="runtime\pinvoke.h;runtime\gc-common.h"
|
|
DestinationFolder="$(NativeBinDir)include\wasm"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="@(ICULibFiles);
|
|
@(ICULibNativeFiles);"
|
|
DestinationFolder="$(NativeBinDir)"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Exec Command="$(CMakeBuildRuntimeConfigureCmd)" WorkingDirectory="$(NativeBinDir)" />
|
|
<Exec Command="$(CMakeBuildRuntimeCmd)" WorkingDirectory="$(NativeBinDir)" />
|
|
|
|
<ItemGroup>
|
|
<IcuDataFiles Include="$(NativeBinDir)*.dat" />
|
|
<WasmSrcFiles Include="$(NativeBinDir)src\*.c;
|
|
$(NativeBinDir)src\*.js;
|
|
$(_EmccDefaultsRspPath);
|
|
$(_EmccCompileRspPath);
|
|
$(_EmccLinkRspPath);
|
|
$(NativeBinDir)src\emcc-props.json" />
|
|
<WasmSrcFilesEs6 Include="$(NativeBinDir)src\es6\*.js;" />
|
|
<WasmHeaderFiles Include="$(NativeBinDir)include\wasm\*.h" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="$(NativeBinDir)dotnet.js;
|
|
$(NativeBinDir)dotnet.d.ts;
|
|
$(NativeBinDir)dotnet-legacy.d.ts;
|
|
$(NativeBinDir)package.json;
|
|
$(NativeBinDir)dotnet.wasm;
|
|
$(NativeBinDir)\src\dotnet-crypto-worker.js;
|
|
$(NativeBinDir)dotnet.timezones.blat"
|
|
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="$(NativeBinDir)dotnet.worker.js"
|
|
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
|
|
Condition="Exists('$(NativeBinDir)dotnet.worker.js')"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="$(NativeBinDir)dotnet.js.symbols"
|
|
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
|
|
SkipUnchangedFiles="true" />
|
|
|
|
<Copy SourceFiles="@(IcuDataFiles);@(ICULibNativeFiles)"
|
|
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="$(MonoProjectRoot)wasm/runtime/package.json"
|
|
Outputs="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp"
|
|
>
|
|
<!-- install typescript and rollup -->
|
|
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/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="$(MonoProjectRoot)wasm/runtime/"/>
|
|
|
|
<Touch Files="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" AlwaysCreate="true" />
|
|
</Target>
|
|
|
|
<ItemGroup>
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/**/*.ts"
|
|
Exclude="$(MonoProjectRoot)wasm/runtime/dotnet.d.ts;$(MonoProjectRoot)wasm/runtime/dotnet-legacy.d.ts;$(MonoProjectRoot)wasm/runtime/diagnostics-mock.d.ts;$(MonoProjectRoot)wasm/runtime/node_modules/**/*.ts" />
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/**/tsconfig.*"
|
|
Exclude="$(MonoProjectRoot)wasm/runtime/node_modules/**/tsconfig.*" />
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/workers/**/*.js"/>
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtimetypes/*.d.ts"/>
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.json"/>
|
|
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.js"/>
|
|
</ItemGroup>
|
|
|
|
<Target Name="SetMonoRollupEnvironment">
|
|
<PropertyGroup>
|
|
<MonoRollupEnvironment>Configuration:$(Configuration),NativeBinDir:$(NativeBinDir),ProductVersion:$(ProductVersion),MonoWasmThreads:$(MonoWasmThreads),MonoDiagnosticsMock:$(MonoDiagnosticsMock)</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
|
|
`MonoWasmThreads` property is changed between builds by a developer. -->
|
|
<WriteLinesToFile File="$(_RollupEnvIntermediateFile)"
|
|
Lines="$(MonoRollupEnvironment)"
|
|
WriteOnlyWhenDifferent="true"
|
|
Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="BuildWithRollup"
|
|
Inputs="@(_RollupInputs);$(_RollupEnvIntermediateFile)"
|
|
Outputs="$(NativeBinDir).rollup-stamp"
|
|
DependsOnTargets="WriteRollupEnvToFile"
|
|
>
|
|
<!-- code style check -->
|
|
<RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/>
|
|
|
|
<!-- compile typescript -->
|
|
<RunWithEmSdkEnv Command="npm run rollup -- --environment $(MonoRollupEnvironment)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/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>
|