Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] Developer convenience MSBuild property #48381

Merged
merged 2 commits into from
Feb 17, 2021
Merged

Conversation

imhameed
Copy link
Contributor

@imhameed imhameed commented Feb 17, 2021

Adds a property, named MonoCMakeExtraArgs, which is passed through to the CMake configure command invocation.

Example usage:

MonoCMakeExtraArgs="-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_LINKER=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_AR=$HOME/clang-9.x/out/bin/llvm-ar -DCMAKE_RANLIB=$HOME/clang-9.x/out/bin/llvm-ranlib" \
./build.sh
    -configuration Release \
    --subset mono \
    /p:MonoLLVMUseCxx11Abi=true /p:MonoEnableLLVM=true \
    /p:MonoLLVMDir="$LLVM_PREFIX"

touch src/mono/mono/mini/mini-llvm.c && time ninja -C artifacts/obj/mono/Linux.x64.Release reports 5.3 seconds when using lld,
llvm-ar, and llvm-ranlib; this takes 18 seconds when using GNU tools.

Note that GCC doesn't support full paths for fuse-ld, unlike Clang.

…INKER_FLAGS, CMAKE_LINKER, CMAKE_AR, and CMAKE_RANLIB
@vargaz
Copy link
Contributor

vargaz commented Feb 17, 2021

Wouldn't be better to add a single MonoCMakeExtraArgs msbuild property ?

@imhameed
Copy link
Contributor Author

Cool:

./build.sh \
    -configuration Release \
    --subset mono \
    /p:MonoCMakeExtraArgs="-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_LINKER=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_AR=$HOME/clang-9.x/out/bin/llvm-ar -DCMAKE_RANLIB=$HOME/clang-9.x/out/bin/llvm-ranlib" \
    /p:MonoLLVMUseCxx11Abi=true /p:MonoEnableLLVM=true \
    /p:MonoLLVMDir="$LLVM_PREFIX"

yields:

MSBUILD : error MSB1001: Unknown switch.
Switch: -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=/home/imran/clang-9.x/out/bin/ld.lld

This works fine:

./dotnet.sh msbuild src/mono/mono.proj \
    /p:Configuration=Release \
    /p:MonoCMakeExtraArgs="-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_LINKER=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_AR=$HOME/clang-9.x/out/bin/llvm-ar -DCMAKE_RANLIB=$HOME/clang-9.x/out/bin/llvm-ranlib" \
    /p:MonoLLVMUseCxx11Abi=true /p:MonoEnableLLVM=true \
    /p:MonoLLVMDir="$LLVM_PREFIX"

And also: dotnet/msbuild#2999

@imhameed imhameed changed the title [mono] Developer convenience MSBuild properties [mono] Developer convenience MSBuild property Feb 17, 2021
@imhameed imhameed merged commit 1667fcd into dotnet:master Feb 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants