From 2ade99b495c68cf2649d6c85a158f64eb32de96d Mon Sep 17 00:00:00 2001 From: yowl Date: Wed, 25 Nov 2020 14:39:46 -0500 Subject: [PATCH] comments --- docs/workflow/building/coreclr/nativeaot.md | 6 ++++++ eng/native/gen-buildsys.cmd | 6 +----- src/coreclr/CMakeLists.txt | 1 - src/coreclr/build-runtime.cmd | 14 -------------- .../src/nativeaot/Runtime/Portable/CMakeLists.txt | 2 -- src/libraries/Native/build-native.cmd | 4 +--- 6 files changed, 8 insertions(+), 25 deletions(-) diff --git a/docs/workflow/building/coreclr/nativeaot.md b/docs/workflow/building/coreclr/nativeaot.md index 7cba07269c39..3e8f53ae1322 100644 --- a/docs/workflow/building/coreclr/nativeaot.md +++ b/docs/workflow/building/coreclr/nativeaot.md @@ -10,6 +10,12 @@ The Native AOT toolchain can be currently built for Linux, macOS and Windows x64 - Add the package directory to your `nuget.config` file. For example, replace `dotnet-experimental` line in `samples\HelloWorld\nuget.config` with `` - Run `dotnet publish --packages pkg -r [win-x64|linux-x64|osx-64] -c [Debug|Release]` to publish your project. `--packages pkg` option restores the package into a local directory that is easy to cleanup once you are done. It avoids polluting the global nuget cache with your locally built dev package. +## Building for Web Assembly +- Currently only tested on Windows +- Run `build nativeaot+libs+nativeaot.packages -rc [Debug|Release] -lc [Debug|Release] -a wasm -os Browser -runtimeFlavor CoreCLR` +- Add the package directory to your `nuget.config` as above. +- Run `dotnet publish -r browser-wasm -c [Debug|Release] /p:Platform=wasm` to publish. + ## Visual Studio Solutions The repository has a number of Visual Studio Solutions files (`*.sln`) that are useful for editing parts of the repository. Build the repo from command line first before building using the solution files. Remember to select the appropriate configuration that you built. By default, `build.cmd` builds Debug x64 and so `Debug` and `x64` must be selected in the solution build configuration drop downs. diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index 3f37580127f1..ce8bdb538c41 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -30,6 +30,7 @@ if /i "%__Ninja%" == "1" ( if /i NOT "%__Arch%" == "wasm" ( if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019) if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017) + if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64) if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM) if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64) @@ -45,7 +46,6 @@ if /i "%__Arch%" == "wasm" ( exit /B 1 ) - echo buildtype %CMAKE_BUILD_TYPE% if /i "%CMAKE_BUILD_TYPE%" == "debug" ( set __ExtraCmakeParams=%__ExtraCmakeParams% -g -O0 ) @@ -65,11 +65,7 @@ goto loop set __ExtraCmakeParams="-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%" %__ExtraCmakeParams% if /i "%__UseEmcmake%" == "1" ( - echo emc with -G %__CmakeGenerator% and %__ExtraCmakeParams% emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% - rem line before merge vvvv add these to __ExtraCmakeParams above? -rem emcmake cmake "-DCMAKE_REPO_ROOT=%__repoRoot%" "-DCMAKE_TOOLCHAIN_FILE=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" "-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%" -G "NMake Makefiles" %__sourceDir% -B. -H%__sourceDir% "-DCMAKE_REPO_ROOT=%__repoRoot%" "-DCLR_ENG_NATIVE_DIR=%__repoRoot%\eng\native" -DCLR_CMAKE_TARGET_ARCH=wasm -DCLR_CMAKE_HOST_ARCH=Windows_NT - ) else ( "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 875cbbbc441c..11c9485ae293 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -76,7 +76,6 @@ if(CLR_CMAKE_HOST_UNIX) add_subdirectory(src/hosts) else(CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_UNIX AND NOT CLR_CMAKE_HOST_UNIX_WASM) - message("host unix target unix") add_subdirectory(src/pal/src/libunwind) endif(CLR_CMAKE_TARGET_UNIX AND NOT CLR_CMAKE_HOST_UNIX_WASM) endif(CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 4c2007481997..c0ea5a936d9a 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -101,10 +101,8 @@ set __Ninja=0 @REM appears to CMD parsing as "-priority 1". Handle -priority specially to avoid problems, @REM and allow the "-priority=1" syntax. set __Priority= -echo args starting build-runtime.cmd configureonly %__ConfigureOnly% :Arg_Loop -echo arg is %1 if "%1" == "" goto ArgsDone if /i "%1" == "/?" goto Usage @@ -206,7 +204,6 @@ if [!processedArgs!]==[] ( :ArgsDone -echo args done configureonly %__ConfigureOnly% @REM Special handling for -priority=N argument. if defined __Priority ( if defined __PassThroughArgs ( @@ -239,7 +236,6 @@ if %__BuildArchArm64%==1 ( set __CrossArch=x64 ) if %__BuildArchWasm%==1 ( - echo build-runtime setting for __BuildARchWasm set __TargetOS=browser set __BuildArch=wasm set __BuildJit=0 @@ -346,10 +342,6 @@ if not defined NumberOfCores ( ) echo %__MsgPrefix%Number of processor cores %NumberOfCores% -echo commonmsbuild args - -echo %__CommonMSBuildArgs% - REM ========================================================================================= REM === REM === Start the build steps @@ -438,9 +430,6 @@ if NOT DEFINED PYTHON ( set __CMakeClrBuildSubsetArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=%__BuildJit%" "-DCLR_CMAKE_BUILD_SUBSET_ALLJITS=%__BuildAllJits%" "-DCLR_CMAKE_BUILD_SUBSET_RUNTIME=%__BuildRuntime%" -echo subset args -echo %__CMakeClrBuildSubsetArgs% - REM ========================================================================================= REM === REM === Build Cross-Architecture Native Components (if applicable) @@ -599,7 +588,6 @@ if %__BuildCrossArchNative% EQU 1 ( ) ) -REM TODO: where should this go? if "%__BuildArch%" == "wasm" ( echo Creating wasm verison.h/c set __versionSourceFile="%__IntermediatesDir%"\version.c @@ -654,7 +642,6 @@ if %__BuildNative% EQU 1 ( ) set __ExtraCmakeArgs=!__ExtraCmakeArgs! !___CrossBuildDefine! %__CMakeClrBuildSubsetArgs% "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% - echo gen-buildsys with !__ExtraCmakeArgs! %__VSVersion% call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project! @@ -671,7 +658,6 @@ if %__BuildNative% EQU 1 ( if defined __ConfigureOnly goto SkipNativeBuild - echo "not checking configure only" set __BuildLogRootName=CoreCLR set "__BuildLog="%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log"" set "__BuildWrn="%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn"" diff --git a/src/coreclr/src/nativeaot/Runtime/Portable/CMakeLists.txt b/src/coreclr/src/nativeaot/Runtime/Portable/CMakeLists.txt index 040c43a50c30..d7883ff4b961 100644 --- a/src/coreclr/src/nativeaot/Runtime/Portable/CMakeLists.txt +++ b/src/coreclr/src/nativeaot/Runtime/Portable/CMakeLists.txt @@ -28,10 +28,8 @@ add_custom_command( DEPENDS "${RUNTIME_DIR}/AsmOffsets.cpp" "${RUNTIME_DIR}/AsmOffsets.h" ) -message("install PortableRuntime") # Install the static Runtime library install (TARGETS PortableRuntime DESTINATION aotsdk) -message("installed PortableRuntime") if(WIN32) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/PortableRuntime.dir/$/PortableRuntime.pdb DESTINATION aotsdk) diff --git a/src/libraries/Native/build-native.cmd b/src/libraries/Native/build-native.cmd index d8f3eb75464a..bfdf3e3272c2 100644 --- a/src/libraries/Native/build-native.cmd +++ b/src/libraries/Native/build-native.cmd @@ -1,7 +1,6 @@ @if not defined _echo @echo off setlocal -echo build-native.cmd :SetupArgs :: Initialize the args that will be passed to cmake set __sourceDir=%~dp0\Windows @@ -98,8 +97,6 @@ goto :SetupDirs echo Commencing build of native components echo. -set - if /i "%__BuildArch%" == "wasm" set __sourceDir=%~dp0\Unix if [%__outConfig%] == [] set __outConfig=%__TargetOS%-%__BuildArch%-%CMAKE_BUILD_TYPE% @@ -172,6 +169,7 @@ IF ERRORLEVEL 1 ( goto :Failure ) +echo Done building Native components exit /B 0 :Failure