Last active
October 15, 2024 07:27
-
-
Save theoparis/9bfe099cd3aee6cbbecebc1b01de0322 to your computer and use it in GitHub Desktop.
llvm-project git build with nix (without runtimes, clangir enabled, using mold as the linker)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
src, | |
targets ? "host", | |
projects ? "clang;lld;mlir;libc", | |
stdenv, | |
cmakeMinimal, | |
ninja, | |
python313, | |
mold, | |
}: | |
{ | |
llvm-project = stdenv.mkDerivation { | |
name = "llvm-project"; | |
version = "20.0.0.git"; | |
src = src; | |
cmakeFlags = [ | |
"-DC_INCLUDE_DIRS=${stdenv.cc.libc.dev}/include" | |
"-GNinja" | |
"-DCMAKE_BUILD_TYPE=MinSizeRel" | |
"-DCMAKE_INSTALL_PREFIX=$out" | |
# Reduce installation size by using a single 'llvm' binary with symlinks | |
"-DLLVM_TOOL_LLVM_DRIVER_BUILD=ON" | |
"-DLLVM_ENABLE_PROJECTS=${projects}" | |
"-DLIBC_HDRGEN_ONLY=ON" | |
"-DLLVM_LIBC_FULL_BUILD=ON" | |
"-DLLVM_TARGETS_TO_BUILD=${targets}" | |
"-DCLANG_ENABLE_CIR=ON" | |
"-DCLANG_DEFAULT_CXX_STDLIB=libc++" | |
"-DCLANG_DEFAULT_UNWINDLIB=libunwind" | |
"-DCLANG_DEFAULT_RTLIB=compiler-rt" | |
"-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON" | |
"-DMLIR_ENABLE_EXECUTION_ENGINE=ON" | |
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=all" | |
"-DLLVM_USE_LINKER=mold" | |
"-S${src}/llvm" | |
]; | |
nativeBuildInputs = [ | |
cmakeMinimal | |
ninja | |
python313 | |
mold | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment