diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f88bd2cb..7227a2f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,12 +6,16 @@ name: Build On Changes on: [pull_request] +env: + SAC2C_URL: https://gitlab.sac-home.org/sac-group/sac2c.git + INTTEST_URL: https://github.com/SacBase/IntegrationTests.git + jobs: build-ubuntu24: runs-on: ubuntu-24.04 steps: - name: Get HEAD and submodules - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: fetch-depth: 0 submodules: 'recursive' @@ -21,23 +25,19 @@ jobs: sudo apt install xsltproc -y - name: Install sac2c run: | - git clone --single-branch --recursive https://gitlab.sac-home.org/sac-group/sac2c.git + git clone --single-branch --recursive ${SAC2C_URL} sac2c cd sac2c - make release -j2 - cp build_p/sac2c_p /usr/local/bin/sac2c + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RELEASE + cmake --build build -j4 + ln -s $PWD/build/sac2c_p /usr/local/bin/sac2c sac2c -V - - name: Create build dir + - name: Configure build system run: | - cmake -E make_directory ${{runner.workspace}}/build - - name: Configure build-system - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake -DLINKSETSIZE=200 $GITHUB_WORKSPACE + cmake -S . -B build -G Ninja - name: Build shell: bash - working-directory: ${{runner.workspace}}/build run: | - cmake --build . -j4 2>&1 | tee build.log + cmake --build build -j4 2>&1 | tee build.log if [ ${PIPESTATUS[0]} -ne 0 ]; then echo "!!! ERROR detected in build !!!"; exit 1; @@ -45,10 +45,9 @@ jobs: ${GITHUB_WORKSPACE}/ci/fail-on-warning.sh build.log - name: Test shell: bash - working-directory: ${{runner.workspace}}/build run: | - git clone --single-branch https://github.com/SacBase/IntegrationTests.git - cd IntegrationTests + git clone --single-branch --recursive ${INTTEST_URL} inttest + cd inttest make all ./test.sh @@ -56,7 +55,7 @@ jobs: runs-on: macos-latest steps: - name: Get HEAD and submodules - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: fetch-depth: 0 submodules: 'recursive' @@ -70,23 +69,19 @@ jobs: xcode-version: latest-stable - name: Install sac2c run: | - git clone --single-branch --recursive https://gitlab.sac-home.org/sac-group/sac2c.git + git clone --single-branch --recursive ${SAC2C_URL} sac2c cd sac2c - make release -j2 - cp build_p/sac2c_p /usr/local/bin/sac2c + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RELEASE + cmake --build build -j3 + ln -s $PWD/build/sac2c_p /usr/local/bin/sac2c sac2c -V - - name: Create build dir + - name: Configure build system run: | - cmake -E make_directory ${{runner.workspace}}/build - - name: Configure build-system - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake ${GITHUB_WORKSPACE} + cmake -S . -B build -G Ninja - name: Build shell: bash - working-directory: ${{runner.workspace}}/build run: | - cmake --build . -j3 2>&1 | tee build.log + cmake --build build -j3 2>&1 | tee build.log if [ ${PIPESTATUS[0]} -ne 0 ]; then echo "!!! ERROR detected in build !!!"; exit 1; @@ -94,9 +89,8 @@ jobs: ${GITHUB_WORKSPACE}/ci/fail-on-warning.sh build.log - name: Test shell: bash - working-directory: ${{runner.workspace}}/build run: | - git clone --single-branch https://github.com/SacBase/IntegrationTests.git - cd IntegrationTests + git clone --single-branch --recursive ${INTTEST_URL} inttest + cd inttest make all ./test.sh diff --git a/Makefile b/Makefile index 2affcfb4..583b511d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ BUILD_DIR ?= build -TARGETS ?= seq;mt_pth;seq_checks +TARGETS ?= "seq;mt_pth;seq_checks" + +GENERATOR ?= "Unix Makefiles" .PHONY: all build clean @@ -7,8 +9,8 @@ all: build build: git submodule update --init --recursive - mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && \ - cmake -DTARGETS="$(TARGETS)" .. && $(MAKE) + cmake -S . -B $(BUILD_DIR) -G ${GENERATOR} -DTARGETS=$(TARGETS) + +cmake --build $(BUILD_DIR_RELEASE) clean: $(RM) -r $(BUILD_DIR) diff --git a/README.md b/README.md index 535b7353..9f491c3d 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,19 @@ To build the system one requires an operational [CMake](https://cmake.org/) >= 3 The quick and dirty option is just -``` +```sh make -j4 ``` -You can also use the `cmake` build system for more control +To build with Ninja, change the `GENERATOR` environment variable. +```sh +GENERATOR=Ninja make -jN ``` + +You can also use the `cmake` build system for more control + +```sh mkdir build cd build cmake .. @@ -31,8 +37,8 @@ make -j4 **NOTE:** *When pulling the latest commit, remember to run `git submodule update` or you will be missing changes to the `cmake-common` repository.* -> [!TIP] -> An advantage of doing a cmake build is that the generated Makefile will get targets to build individual standard library modules. +> [!TIP] +> An advantage of doing a cmake build is that the generated Makefile will get targets to build individual standard library modules. > For instance `make seq-module-File` will then only build the File module for sequential code. Variables that can be passed to CMake