Skip to content

[#90242] cmake: add MSVC compile options compatible with SystemC #153

[#90242] cmake: add MSVC compile options compatible with SystemC

[#90242] cmake: add MSVC compile options compatible with SystemC #153

Workflow file for this run

name: test-systemc-examples
on:
pull_request:
push:
workflow_dispatch:
inputs:
renode_gitrev:
description: 'Renode git revision'
required: false
renode_gitrepo:
description: 'Renode git repository'
required: false
env:
DEBIAN_FRONTEND: noninteractive
CMAKE_PREFIX_PATH: /opt/toolchains
jobs:
build-zephyr-binaries:
name: Build Zephyr Binaries
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Dependencies
shell: bash
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get -qqy update
sudo apt-get install -qqy cmake ninja-build
elif [ "${{ runner.os }}" = "Windows" ]; then
choco feature enable -n allowGlobalConfirmation
choco install ninja cmake
else
echo "Unknown runner!"
exit 1
fi
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: .
toolchains: arm-zephyr-eabi
- name: Build Zephyr
shell: bash
run: |
mkdir -p artifacts/zephyr_binaries
for example in examples/*/zephyr; do
example_name=$(echo $example | cut -f 2 -d '/')
west build -p -b stm32f401_mini $example
cp build/zephyr/zephyr.elf artifacts/zephyr_binaries/$example_name.elf
done
- name: Upload Zephyr binaries
uses: actions/upload-artifact@v4
with:
name: zephyr_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/zephyr_binaries
build-systemc:
name: Build SystemC
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
shell: bash
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get -qqy update
sudo apt-get install -qqy cmake
elif [ "${{ runner.os }}" = "Windows" ]; then
choco feature enable -n allowGlobalConfirmation
choco install cmake
else
echo "Unknown runner!"
exit 1
fi
- name: Set CMake generator
if: runner.os == 'Windows'
shell: bash
run: |
export CMAKE_GENERATOR="Visual Studio 17 2022"
- name: Build library
shell: bash
run: |
mkdir -p build
pushd build
cmake ../systemc -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_POLICY_VERSION_MINIMUM="3.5"
cmake --build . -j $(nproc)
popd
- name: Upload library (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.a
path: build/src/libsystemc.a
- name: Upload library (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.lib
path: build/src/Debug/systemc.lib
build-examples:
name: Build Examples
needs: build-systemc
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download SystemC library (Linux)
if: runner.os == 'Linux'
uses: actions/download-artifact@v4
with:
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.a
path: artifacts/systemc
- name: Download SystemC library (Windows)
if: runner.os == 'Windows'
uses: actions/download-artifact@v4
with:
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.lib
path: artifacts/systemc
- name: Install dependencies
shell: bash
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get -qqy update
sudo apt-get install -qqy cmake
elif [ "${{ runner.os }}" = "Windows" ]; then
choco feature enable -n allowGlobalConfirmation
choco install cmake openssl
else
echo "Unknown runner!"
exit 1
fi
- name: Download and build Renode
uses: antmicro/renode-test-action@v5.0.0
with:
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
renode-revision: 90242-add-windows
- name: Set CMake generator
if: runner.os == 'Windows'
shell: bash
run: |
export CMAKE_GENERATOR="Visual Studio 17 2022"
- name: Build examples
shell: bash
run: |
mkdir -p build
pushd build
cmake .. -DUSER_SYSTEMC_INCLUDE_DIR=$(pwd)/../systemc/src \
-DUSER_SYSTEMC_LIB_DIR=$(pwd)/../artifacts/systemc \
-DCMAKE_CXX_STANDARD=14
cmake --build . -j $(nproc)
popd
mkdir -p artifacts/example_binaries artifacts/test_binaries
if [ "${{ runner.os }}" = "Linux" ]; then
bin_path="bin"
elif [ "${{ runner.os }}" = "Windows" ]; then
bin_path="bin/Debug"
else
echo "Unknown runner!"
exit 1
fi
for example in examples/*/; do
example_name="$(basename $example)"
cp examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
done
for test in tests/*/; do
test_name="$(basename $test)"
cp tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
done
- name: Upload Example Binaries
uses: actions/upload-artifact@v4
with:
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/example_binaries
- name: Upload Test Binaries
uses: actions/upload-artifact@v4
with:
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/test_binaries
test-examples:
name: Test Examples
needs: build-examples
strategy:
matrix:
os:
# - ubuntu-22.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# - name: Install dependencies
# run: |
# sudo apt-get -qqy update
# sudo apt-get install -qqy libsystemc libsystemc-dev
- name: Download example binaries (Linux)
if: runner.os == 'Linux'
uses: actions/download-artifact@v4
with:
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/example_binaries
- name: Download test binaries (Linux)
if: runner.os == 'Linux'
uses: actions/download-artifact@v4
with:
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/test_binaries
- name: Download example binaries (Windows)
if: runner.os == 'Windows'
uses: actions/download-artifact@v4
with:
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/example_binaries
- name: Download test binaries (Windows)
if: runner.os == 'Windows'
uses: actions/download-artifact@v4
with:
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
path: artifacts/test_binaries
- name: Download and build Renode
uses: antmicro/renode-test-action@v5.0.0
with:
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
renode-revision: 90242-add-windows
# - name: Install dependencies
# shell: bash
# run: |
# if [ "${{ runner.os }}" = "Linux" ]; then
# sudo apt-get -qqy update
# sudo apt-get install -qqy cmake
# elif [ "${{ runner.os }}" = "Windows" ]; then
# choco feature enable -n allowGlobalConfirmation
# choco install cmake openssl
# else
# echo "Unknown runner!"
# exit 1
# fi
# - name: Add OpenSSL to PATH (Windows)
# if: runner.os == 'Windows'
# shell: bash
# run: |
# OPENSSL_BIN="/mingw64/bin/openssl"
# echo "Adding $OPENSSL_BIN to PATH"
# echo "PATH=$PATH:$OPENSSL_BIN" >> $GITHUB_ENV
# which openssl
# openssl version
# ls "/mingw64/bin/openssl"
- name: Run tests
shell: bash
continue-on-error: true
run: |
for example in artifacts/example_binaries/*; do
example_name="$(basename $example | sed -e 's/x64-systemc--//' -e 's/.elf//' -e 's/.exe//')"
mkdir -p examples/$example_name/bin
cp $example examples/$example_name/bin/$example_name
done
for test in artifacts/test_binaries/*; do
test_name="$(basename $test | sed -e 's/x64-systemc--//' -e 's/.elf//' -e 's/.exe//')"
mkdir -p tests/$test_name/bin
cp $test tests/$test_name/bin/$test_name
done
ls examples/timesync/bin
pushd examples
renode-test -t all_examples.yaml
popd
pushd tests
renode-test -t all_tests.yaml
popd
- name: Upload logs
uses: actions/upload-artifact@v4
with:
name: logs-${{ runner.os }}-${{ github.run_id }}
path: examples/logs