Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yowl committed Nov 25, 2020
1 parent 641b281 commit 2ade99b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 25 deletions.
6 changes: 6 additions & 0 deletions docs/workflow/building/coreclr/nativeaot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<add key="local" value="C:\runtimelab\artifacts\packages\Debug\Shipping" />`
- 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.
Expand Down
6 changes: 1 addition & 5 deletions eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
)
Expand All @@ -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%
)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 0 additions & 14 deletions src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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!
Expand All @@ -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""
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/nativeaot/Runtime/Portable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/$<CONFIG>/PortableRuntime.pdb DESTINATION aotsdk)
Expand Down
4 changes: 1 addition & 3 deletions src/libraries/Native/build-native.cmd
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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%
Expand Down Expand Up @@ -172,6 +169,7 @@ IF ERRORLEVEL 1 (
goto :Failure
)

echo Done building Native components
exit /B 0

:Failure
Expand Down

0 comments on commit 2ade99b

Please sign in to comment.