diff --git a/README.md b/README.md index 124776d6f4..61a47922d8 100644 --- a/README.md +++ b/README.md @@ -26,19 +26,18 @@ For other versions, check the git tags of this repository. * C++ compiler capable of building LLVM, Clang, and LLD from source (GCC 5.1+ or Clang) * cmake 3.19 or later - * make + * make, ninja, or any other build system supported by cmake * POSIX system (bash, mkdir, cd) * Python 3 ## Build Instructions ``` -./build -j1 -- baseline +./build -- baseline ``` All parameters are required: - * `-j1`: Replace with your jobs parameter to make. * `--`: Replace with one of the Supported Triples below, or use `native` for the `` value (e.g. `native-linux-gnu`) to use the native architecture. @@ -46,6 +45,12 @@ All parameters are required: it will target a generic CPU for the target. `native` means it will target the native CPU. See the Zig documentation for more details. +To use a non-default cmake generator, export the `CMAKE_GENERATOR` environment +variable before calling `build`. + +If you aren't using a build system that builds in parallel by default (ie. make), +export `CMAKE_BUILD_PARALLEL_LEVEL` to parallelize the build. + If it succeeds, the output will be in `out/zig-triple-mcpu/`. ### Supported Triples diff --git a/build b/build index 1a42fb7683..6addead79c 100755 --- a/build +++ b/build @@ -2,9 +2,8 @@ set -eu -JOBS="$1" -TARGET="$2" # Example: riscv64-linux-gnu -MCPU="$3" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s` +TARGET="$1" # Example: riscv64-linux-gnu +MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s` ROOTDIR="$(pwd)" ZIG_VERSION="0.11.0-dev.78+28288dcbb" @@ -41,7 +40,7 @@ cmake "$ROOTDIR/llvm" \ -DCLANG_INCLUDE_DOCS=OFF \ -DLLVM_INCLUDE_DOCS=OFF \ -DCMAKE_BUILD_TYPE=Release -make "$JOBS" install +cmake --build . --target install # Now we build Zig, still with system C/C++ compiler, linking against LLVM, # Clang, LLD we just built from source. @@ -52,7 +51,7 @@ cmake "$ROOTDIR/zig" \ -DCMAKE_PREFIX_PATH="$ROOTDIR/out/host" \ -DCMAKE_BUILD_TYPE=Release \ -DZIG_VERSION="$ZIG_VERSION" -make "$JOBS" install +cmake --build . --target install # Now we have Zig as a cross compiler. ZIG="$ROOTDIR/out/host/bin/zig" @@ -73,7 +72,7 @@ cmake "$ROOTDIR/zlib" \ -DCMAKE_RC_COMPILER="$ROOTDIR/out/host/bin/llvm-rc" \ -DCMAKE_AR="$ROOTDIR/out/host/bin/llvm-ar" \ -DCMAKE_RANLIB="$ROOTDIR/out/host/bin/llvm-ranlib" -make "$JOBS" install +cmake --build . --target install # Same deal for zstd. # The build system for zstd is whack so I just put all the files here. @@ -161,13 +160,13 @@ cmake "$ROOTDIR/llvm" \ -DLIBCLANG_BUILD_STATIC=ON \ -DLLVM_DEFAULT_TARGET_TRIPLE="$TARGET" cd "$ROOTDIR/out/build-llvm-$TARGET-$MCPU/tools/lld" -make "$JOBS" install +cmake --build . --target install cd "$ROOTDIR/out/build-llvm-$TARGET-$MCPU/tools/clang/lib" -make "$JOBS" install +cmake --build . --target install cd "$ROOTDIR/out/build-llvm-$TARGET-$MCPU/lib" -make "$JOBS" install +cmake --build . --target install cd "$ROOTDIR/out/build-llvm-$TARGET-$MCPU" -make "$JOBS" install-llvm-headers install-clang-headers install-LLVMSupport install-LLVMDemangle +cmake --build . --target install-llvm-headers install-clang-headers install-LLVMSupport install-LLVMDemangle # Finally, we can cross compile Zig itself, with Zig. cd "$ROOTDIR/zig"