[ci] streamline workflow file by moving cmake commands to top-level makefile
This commit is contained in:
parent
20e6450e55
commit
704dba10e4
|
@ -68,7 +68,7 @@ jobs:
|
|||
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
|
||||
name: ${{ matrix.config.name }}
|
||||
runs-on: ubuntu-20.04
|
||||
container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
|
||||
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
|
||||
# Branch on different OS and settings
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -108,11 +108,6 @@ jobs:
|
|||
env:
|
||||
CC: ${{ matrix.config.cc }}
|
||||
CXX: ${{ matrix.config.cxx }}
|
||||
CCACHE_COMPRESS: "true"
|
||||
CCACHE_COMPRESSLEVEL: "6"
|
||||
CCACHE_MAXSIZE: "400M"
|
||||
CCACHE_LOGFILE: ccache_log
|
||||
CCACHE_DIR: /__w/OpenFPGA/.ccache
|
||||
steps:
|
||||
- name: Cancel previous
|
||||
uses: styfle/cancel-workflow-action@0.9.1
|
||||
|
@ -123,54 +118,22 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: ./.github/workflow/install_dependencies_build.sh
|
||||
|
||||
- name: Dump tool versions
|
||||
run: |
|
||||
cmake --version
|
||||
iverilog -V
|
||||
vvp -V
|
||||
${CC} -V
|
||||
${CXX} -V
|
||||
|
||||
- name: Prepare ccache timestamp
|
||||
id: ccache_cache_timestamp
|
||||
shell: cmake -P {0}
|
||||
run: |
|
||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
||||
message("::set-output name=timestamp::${current_date}")
|
||||
|
||||
- name: Create CMake build environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory build
|
||||
|
||||
- name: Setup ccache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
/__w/OpenFPGA/.ccache
|
||||
key: ${{ matrix.config.cc }}-ccache-${{ github.ref}}
|
||||
restore-keys: |
|
||||
${{ matrix.config.cc }}-ccache-
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
#
|
||||
run: |
|
||||
ccache -p
|
||||
ccache -z
|
||||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
- uses: hendrikmuhs/ccache-action@v1
|
||||
|
||||
- name: Build
|
||||
working-directory: build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: |
|
||||
cmake --build . --config $BUILD_TYPE
|
||||
make all BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
# Check the cache size and see if it is over the limit
|
||||
- name: Check ccache size
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
apt-get update && apt-get install -y \
|
||||
#!/usr/bin/env bash
|
||||
|
||||
apt-get update
|
||||
|
||||
apt-get install -y \
|
||||
autoconf \
|
||||
automake \
|
||||
bison \
|
||||
|
@ -40,4 +44,19 @@ apt-get update && apt-get install -y \
|
|||
wget \
|
||||
zip \
|
||||
swig \
|
||||
expect
|
||||
expect \
|
||||
g++-6 \
|
||||
gcc-6 \
|
||||
g++-7 \
|
||||
gcc-7 \
|
||||
g++-8 \
|
||||
gcc-8 \
|
||||
g++-9 \
|
||||
gcc-9 \
|
||||
g++-10 \
|
||||
gcc-10 \
|
||||
g++-11 \
|
||||
gcc-11 \
|
||||
clang-6.0 \
|
||||
clang-7 \
|
||||
clang-10
|
||||
|
|
31
Makefile
31
Makefile
|
@ -28,6 +28,10 @@ override CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -G 'Unix Makefiles' ${C
|
|||
# --output-sync target : For parallel compilation ensure output for each target is synchronized (make version >= 4.0)
|
||||
MAKEFLAGS := -s
|
||||
|
||||
# Directory to build the codes
|
||||
SOURCE_DIR :=${PWD}
|
||||
BUILD_DIR ?= build
|
||||
|
||||
# Find CMake command from system variable, otherwise use a default one
|
||||
ifeq ($(origin CMAKE_COMMAND),undefined)
|
||||
CMAKE_COMMAND := cmake
|
||||
|
@ -45,12 +49,7 @@ export COMMENT_EXTRACT
|
|||
help:
|
||||
@${PYTHON_EXEC} -c "$$COMMENT_EXTRACT"
|
||||
|
||||
.PHONY: all checkout compile
|
||||
|
||||
all: checkout
|
||||
# Update all the submodules and compile the codebase
|
||||
mkdir -p build && cd build && $(CMAKE_COMMAND) ${CMAKE_FLAGS} ..
|
||||
cd build && $(MAKE)
|
||||
.PHONY: all
|
||||
|
||||
checkout:
|
||||
# Update all the submodules
|
||||
|
@ -59,20 +58,18 @@ checkout:
|
|||
|
||||
compile:
|
||||
# Compile the code base
|
||||
mkdir -p build && cd build && $(CMAKE_COMMAND) ${CMAKE_FLAGS} ..
|
||||
cd build && $(MAKE)
|
||||
@mkdir -p ${BUILD_DIR}
|
||||
echo "cd ${BUILD_DIR} && ${CMAKE_COMMAND} ${CMAKE_FLAGS} ${SOURCE_DIR}"
|
||||
cd ${BUILD_DIR} && ${CMAKE_COMMAND} ${CMAKE_FLAGS} ${SOURCE_DIR}
|
||||
echo "Building target(s): ${MAKECMDGOALS}"
|
||||
@+${MAKE} -C ${BUILD_DIR} ${MAKECMDGOALS}
|
||||
|
||||
all: checkout compile
|
||||
# A shortcut command to run checkout and compile in serial
|
||||
|
||||
clean:
|
||||
# Remove current build results
|
||||
rm -rf build yosys/install
|
||||
|
||||
build/Makefile:
|
||||
make checkout
|
||||
|
||||
.PHONY: Makefile
|
||||
|
||||
%: build/Makefile
|
||||
cd build && $(MAKE) $@
|
||||
rm -rf ${BUILD_DIR} yosys/install
|
||||
|
||||
# Functions to extract comments from Makefiles
|
||||
define COMMENT_EXTRACT
|
||||
|
|
Loading…
Reference in New Issue