30 add toolchain examples #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: # Keep empty to run on each branch when push the code. Otherwise use branches: [ master ] | |
branches: [ main ] | |
pull_request: # Set to master to run only when merge with master branch | |
branches: [ main ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Linux. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
jobs: | |
build-tests: | |
name: ${{matrix.config.name}} | |
runs-on: ${{matrix.config.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: # Create matrix with combinations | |
# compile AREG engine as a shared library with GNU g++ / gcc on Ubuntu Linux, enable AREG extensions and logs | |
- { name: linux-gnu-g++-shared, | |
os: ubuntu-latest, | |
lib: shared, | |
family: gnu, | |
cxx: g++, | |
comp: ON, | |
before: ON | |
} | |
# compile AREG engine as a shared library with GNU g++ / gcc on Ubuntu Linux, enable AREG extensions and no logs | |
- { name: linux-gnu-g++-static, | |
os: ubuntu-latest, | |
lib: static, | |
family: gnu, | |
cxx: g++, | |
comp: OFF, | |
before: OFF | |
} | |
# compile AREG engine as a static library with GNU g++ / gcc on Ubuntu Linux, enable AREG extensions and logs | |
- { name: linux-gnu-gcc-shared, | |
os: ubuntu-latest, | |
lib: shared, | |
family: gnu, | |
cxx: gcc, | |
comp: OFF, | |
before: ON | |
} | |
# compile AREG engine as a shared library with GNU g++ / gcc on Ubuntu Linux, disable AREG extensions and logs | |
- { name: linux-gnu-gcc-static, | |
os: ubuntu-latest, | |
lib: shared, | |
family: gnu, | |
cxx: gcc, | |
comp: ON, | |
before: OFF | |
} | |
# compile AREG engine as a shared library with clang on Ubuntu Linux, enable AREG extensions and logs | |
- { name: linux-llvm-clang++-shared, | |
os: ubuntu-latest, | |
lib: shared, | |
family: llvm, | |
cxx: clang++, | |
comp: ON, | |
before: ON | |
} | |
# compile AREG engine as a shared library with clang on Ubuntu Linux, enable AREG extensions and no logs | |
- { name: linux-llvm-clang++-static, | |
os: ubuntu-latest, | |
lib: static, | |
family: llvm, | |
cxx: clang++, | |
comp: OFF, | |
before: OFF | |
} | |
# compile AREG engine as a shared library with clang on Ubuntu Linux, enable AREG extensions and logs | |
- { name: linux-llvm-clang-shared, | |
os: ubuntu-latest, | |
lib: shared, | |
family: llvm, | |
cxx: clang, | |
comp: OFF, | |
before: ON | |
} | |
# compile AREG engine as a shared library with clang on Ubuntu Linux, enable AREG extensions and no logs | |
- { name: linux-llvm-clang-static, | |
os: ubuntu-latest, | |
lib: static, | |
family: llvm, | |
cxx: clang, | |
comp: ON, | |
before: OFF | |
} | |
# compile AREG engine as a shared with CYGWIN g++ / gcc on Windows, enable AREG extensions and logs | |
- { name: win-cygwin-g++-shared, | |
os: windows-latest, | |
lib: shared, | |
family: cygwin, | |
cxx: g++, | |
comp: ON, | |
before: ON | |
} | |
# compile AREG engine as a shared with CYGWIN g++ / gcc on Windows, enable AREG extensions and logs | |
- { name: win-cygwin-g++-static, | |
os: windows-latest, | |
lib: static, | |
family: cygwin, | |
cxx: g++, | |
comp: OFF, | |
before: OFF | |
} | |
# compile AREG engine as a shared with CYGWIN g++ / gcc on Windows, enable AREG extensions and logs | |
- { name: win-cygwin-gcc-shared, | |
os: windows-latest, | |
lib: shared, | |
family: cygwin, | |
cxx: gcc, | |
comp: OFF, | |
before: ON | |
} | |
# compile AREG engine as a shared with CYGWIN g++ / gcc on Windows, enable AREG extensions and logs | |
- { name: win-cygwin-gcc-static, | |
os: windows-latest, | |
lib: static, | |
family: cygwin, | |
cxx: gcc, | |
comp: ON, | |
before: OFF | |
} | |
# compile AREG engine as a shared with MSVC on Windows, enable AREG extensions and logs | |
- { name: win-msvc-cl-shared, | |
os: windows-latest, | |
lib: shared, | |
family: msvc, | |
cxx: cl, | |
comp: ON, | |
before: ON | |
} | |
# compile AREG engine as a shared with MSVC on Windows, enable AREG extensions and logs | |
- { name: win-msvc-cl-static, | |
os: windows-latest, | |
lib: static, | |
family: msvc, | |
cxx: cl, | |
comp: OFF, | |
before: OFF | |
} | |
steps: | |
- name: Checkout AREG SDK Demo project sources and dependencies | |
uses: actions/checkout@v4 | |
# The checkout of submodule is optional, can be escaped in case of cmake build | |
with: | |
submodules: recursive | |
- name: Setup Java JDK to run code generator | |
uses: actions/setup-java@v4.4.0 | |
with: | |
java-version: 17 | |
java-package: jre | |
distribution: temurin | |
- name: Update compilers on Linux | |
if: matrix.config.os == 'ubuntu-latest' | |
# Update compilers, set C/C++ compilers | |
run: sudo apt-get update | |
- name: Set Windows PATH environment variable for cygwin | |
if: matrix.config.os == 'windows-latest' && matrix.config.family == 'cygwin' | |
run: echo "PATH=C:\cygwin;C:\cygwin\bin;C:\cygwin\lib;%SYSTEMROOT%\system32;%PATH%" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install cygwin on Windows | |
if: matrix.config.os == 'windows-latest' && matrix.config.family == 'cygwin' | |
uses: cygwin/cygwin-install-action@v4 | |
with: | |
packages: cmake, dos2unix, flexdll, gcc-g++, git, ncurses, libncurses-devel, make | |
- name: Set cmake cache destination for Linux | |
if: matrix.config.os == 'ubuntu-latest' | |
run: echo "CACHE_DEST=./product/cache/${{matrix.config.name}}" >> "$GITHUB_ENV" | |
- name: Set cmake cache destination for Windows | |
if: matrix.config.os == 'windows-latest' | |
run: echo "CACHE_DEST=./product/cache/${{matrix.config.name}}" >> $env:GITHUB_ENV | |
- name: Configure CMake and pass compiler option | |
if: matrix.config.comp == 'ON' | |
working-directory: ${{github.workspace}} | |
run: | | |
cmake -B ${{env.CACHE_DEST}} -DAREG_COMPILER=${{matrix.config.cxx}} -DAREG_BUILD_TYPE=${{env.BUILD_TYPE}} -DAREG_BINARY=${{matrix.config.lib}} -DINTEGRATE_AREG_BEFORE_PROJECT:BOOL=${{matrix.config.before}} | |
- name: Configure CMake and pass compiler family option | |
if: matrix.config.comp == 'OFF' | |
working-directory: ${{github.workspace}} | |
run: | | |
cmake -B ${{env.CACHE_DEST}} -DAREG_COMPILER_FAMILY=${{matrix.config.family}} -DAREG_BUILD_TYPE=${{env.BUILD_TYPE}} -DAREG_BINARY=${{matrix.config.lib}} -DINTEGRATE_AREG_BEFORE_PROJECT:BOOL=${{matrix.config.before}} | |
- name: Build with CMake | |
working-directory: ${{github.workspace}} | |
# Build your program with the given configuration | |
run: cmake --build ${{env.CACHE_DEST}} -j 20 |