From 5b74e0253b67ea1c9f485b84a4b04885dd617684 Mon Sep 17 00:00:00 2001 From: Daniel Larraz Date: Tue, 5 Nov 2024 11:35:21 -0600 Subject: [PATCH] Add configure.sh script (#89) Add `configure.sh` script to simplify the build set up. --- .github/workflows/main.yml | 10 +--- README.md | 38 +++++-------- configure.sh | 109 +++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 31 deletions(-) create mode 100755 configure.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90462c2f..ac55e1db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: name: [linux-x86_64, macOS-x86_64, macOS-arm64, windows-x86_64] - build-type: [ Release, Debug ] + build-type: [ release, debug ] include: - name: linux-x86_64 os: ubuntu-20.04 @@ -64,12 +64,8 @@ jobs: - name: Build run: | - mkdir build + ./configure.sh ${{ matrix.build-type }} cd build - if [[ "$RUNNER_OS" == "Windows" ]]; then - export CMAKE_GENERATOR="MSYS Makefiles" - fi - cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} .. make -j2 - name: Test @@ -77,7 +73,7 @@ jobs: working-directory: build - name: Upload binary - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.build-type == 'production' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.build-type == 'release' uses: actions/upload-artifact@v4 with: name: ethos-${{ matrix.name }} diff --git a/README.md b/README.md index 45020bc0..1476c3b0 100644 --- a/README.md +++ b/README.md @@ -4,43 +4,33 @@ ## Building the Ethos checker -You need cmake (>= version 3.12) and gmp to build the Ethos Checker. +You need CMake (>= version 3.12) and GMP to build the Ethos Checker. To build a regular build, issue: ```bash cd /path/to/ethos_checker -mkdir build -cd build -cmake .. -make +./configure.sh + # use --prefix to specify an install prefix (default: /usr/local) + # use --name= for custom build directory +cd # default is ./build +make # use -jN for parallel build with N threads +make install # to install into the prefix specified above ``` -The executable, called `ethos`, will be created in the build/src folder. +The executable, called `ethos`, will be created in the `/src` folder. -Alternatively you can configure a regular build with +The ethos's build system provides the following pre-defined build profiles: -```bash -cmake -DCMAKE_BUILD_TYPE=Release .. -``` -To build a regular build and install it into /path/to/install, issue: +- *release*: Optimized, assertions and tracing disabled. -```bash -cd /path/to/ethos_checker -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install .. -make install -``` +- *debug*: Unoptimized, debug symbols, assertions, and tracing enabled. -To build a debug build, issue: +The default build profile is **release**, which you will get if you just run +`./configure.sh`. To choose a different build profile use: ```bash -cd /path/to/ethos_checker -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Debug .. -make +./configure.sh ``` ## Using the Ethos checker diff --git a/configure.sh b/configure.sh new file mode 100755 index 00000000..104f0a05 --- /dev/null +++ b/configure.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +#--------------------------------------------------------------------------# + +set -e -o pipefail + +usage () { +cat <] [