builder: Add the cache file for the development version

This commit is contained in:
Sameer Rahmani 2023-03-07 13:40:33 +00:00
parent a8d8de611a
commit 1d26409923
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
2 changed files with 66 additions and 19 deletions

35
builder
View File

@ -120,16 +120,6 @@ export LSAN_OPTIONS
source "$ME/scripts/deps.sh"
CMAKEARGS_DEBUG=(
"-DCMAKE_BUILD_TYPE=Debug"
)
CMAKEARGS=(
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
"-DSERENE_CCACHE_DIR=$HOME/.ccache"
)
# -----------------------------------------------------------------------------
# Initialization
# -----------------------------------------------------------------------------
@ -166,8 +156,15 @@ function popd_build() {
function build-gen() {
pushed_build
info "Running: "
info "cmake -G Ninja" "$ME" "${CMAKEARGS[*]} ${CMAKEARGS_DEBUG[*]}" "$@"
cmake -G Ninja "$ME" "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$@"
info "cmake -G Ninja" -C "$ME/cmake/caches/serene_$1.cmake" "$ME" "${@:2}"
cmake -G Ninja \
-DSERENE_CONFIG_HOME="$SERENE_HOME_DIR" \
-DLLVM_VERSION="$LLVM_VERSION" \
-DBDWGC_VERSION="$BDWGC_VERSION" \
-DMUSL_VERSION="$MUSL_VERSION" \
-C "$ME/cmake/caches/serene_$1.cmake" \
"$ME" \
"${@:2}"
popd_build
}
@ -189,7 +186,7 @@ function build() { ## Builds the project by regenerating the build scripts
local cpus
rm -rf "$BUILD_DIR"
build-gen "$@"
build-gen "dev" "$@"
pushed_build
cpus=$(nproc)
@ -200,7 +197,7 @@ function build() { ## Builds the project by regenerating the build scripts
function build-20() { ## Builds the project using C++20 (will regenerate the build)
rm -rf "$BUILD_DIR"
pushed_build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCPP_20_SUPPORT=ON "$@" "$ROOT_DIR"
build-gen "dev" -DCPP_20_SUPPORT=ON "$@"
cmake --build .
popd_build
}
@ -212,7 +209,7 @@ function build-tidy() { ## Builds the project using clang-tidy (It takes longer
function build-release() { ## Builds the project in "Release" mode
rm -rf "$BUILD_DIR"
pushed_build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release "${CMAKEARGS[@]}" "$ROOT_DIR"
build-gen "prod" "$@"
cmake --build . --config Release
popd_build
}
@ -221,8 +218,8 @@ function build-docs() { ## Builds the documentation of Serene
rm -rf "$BUILD_DIR"
pip install -r "$ME/docs/requirements.txt"
pushed_build
cmake -G Ninja -DSERENE_ENABLE_DOCS=ON "$ROOT_DIR"
cmake --build .
build-gen "dev" -DSERENE_ENABLE_DOCS=ON "$@"
cmake --build . --parallel
popd_build
}
@ -272,8 +269,8 @@ function tests() { ## Runs all the test cases
function build-tests() { ## Generates and build the project including the test cases
rm -rf "$BUILD_DIR"
pushed_build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DSERENE_BUILD_TESTING=ON "$ROOT_DIR"
cmake --build .
build-gen "dev" -DSERENE_BUILD_TESTING=ON "$@"
cmake --build . --parallel
popd_build
}

View File

@ -0,0 +1,50 @@
# Serene Programming Language
#
# Copyright (c) 2019-2023 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file sets up a CMakeCache to build serene for development
# Where to find the packages. Packages can be built from source
# or downloaded via the builder script.
message(STATUS "[SERENE] SET THE CONFIG DIR TO: ${SERENE_CONFIG_HOME}")
set(SERENE_PKG_DIR "${SERENE_CONFIG_HOME}/env")
set(SERENE_LLVM_DIR "${SERENE_PKG_DIR}/llvm.${LLVM_VERSION}"
CACHE STRING "Where to find the llvm installation.")
set(SERENE_LLVM_BIN "${SERENE_LLVM_DIR}/bin")
if(EXISTS ${SERENE_LLVM_DIR})
message(STATUS "Setting LLVM DIR to: '${SERENE_LLVM_DIR}'")
else()
message(FATAL_ERROR "Can't find the LLVM dir at: '${SERENE_LLVM_DIR}'")
endif()
# Setting the PATH env var to include the bin dir from the LLVM build
# this is the same as `export PATH="blah/:$PATH". it will not propegate
# to the host shell.
set(ENV{PATH} "${SERENE_LLVM_BIN}:$ENV{PATH}")
set(CMAKE_C_COMPILER "${SERENE_LLVM_BIN}/clang" CACHE PATH "")
set(CMAKE_CXX_COMPILER "${SERENE_LLVM_BIN}/clang++" CACHE PATH "")
# The name of this variable has to be like this(a mix of upper and
# lower case letters). That's due to the package name and it is not
# a mistake
set(BDWgc_DIR "${SERENE_PKG_DIR}/bdwgc.${BDWGC_VERSION}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "")
set(SERENE_CCACHE_DIR "$ENV{HOME}/.ccache" CACHE STRING "")
set(CMAKE_BUILD_TYPE "Debug")