Skip to content

Instantly share code, notes, and snippets.

@tommymcm
Created February 25, 2026 20:37
Show Gist options
  • Select an option

  • Save tommymcm/1d1446869b7b9e43ff1b4303cc10c7be to your computer and use it in GitHub Desktop.

Select an option

Save tommymcm/1d1446869b7b9e43ff1b4303cc10c7be to your computer and use it in GitHub Desktop.
#!/bin/bash
BUILD_TYPE="$1"
shift
# Configure the build options.
# TODO: make these options.
PROJECTS="clang;lldb"
TARGETS="X86;AArch64"
# Get all the relevant directories.
SRC_DIR="./llvm/"
BUILD_DIR="./build/${BUILD_TYPE}"
INSTALL_DIR="./install/${BUILD_TYPE}"
# Create the build and install directories.
mkdir -p ${BUILD_DIR} ${INSTALL_DIR}
# Setup cmake.
cmake -G Ninja \
-S "${SRC_DIR}" \
-B "${BUILD_DIR}" \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DLLVM_ENABLE_PROJECTS="${PROJECTS}" \
-DLLVM_TARGETS_TO_BUILD="${TARGETS}" \
$@ # pass along all extra arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment