-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from lumag/meson
Switch to meson build system and add CI
- Loading branch information
Showing
5 changed files
with
154 additions
and
88 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
# Copyright (c) 2023 Linaro Ltd. | ||
# | ||
name: "Builds" | ||
on: | ||
pull_request: | ||
push: | ||
schedule: | ||
# Run periodically to check that it still compiles | ||
- cron: '13 13 * * 1' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
job: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
container: | ||
- debian:testing | ||
- debian:bookworm | ||
#- debian:bullseye | ||
#- debian:buster | ||
- ubuntu:lunar | ||
- ubuntu:jammy | ||
#- ubuntu:focal | ||
#- ubuntu:bionic | ||
#- ubuntu:xenial | ||
target: | ||
- native | ||
- aarch64-linux-gnu | ||
- arm-linux-gnueabihf | ||
|
||
container: | ||
image: ${{ matrix.container }} | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install meson | ||
run: | | ||
apt update | ||
apt -y install --no-install-recommends meson build-essential | ||
- name: Install cross-compilers | ||
if:${{ matrix.target }} != 'native' | ||
run: | | ||
apt -y install gcc-${{ matrix.target }} | ||
FAMILY=$(echo ${{ matrix.target }} | cut -d- -f 1) | ||
if [ "${FAMILY}" = "aarch64" ] ; then | ||
CPU="arm64" | ||
elif [ "${FAMILY}" = "arm" ] ; then | ||
CPU="arm" | ||
else | ||
echo "Unknown CPU family ${FAMILY}" | ||
exit 1 | ||
fi | ||
cat > cross.txt << EOF | ||
[binaries] | ||
c = '${{ matrix.target }}-gcc' | ||
strip = '${{ matrix.target }}-strip' | ||
pkgconfig = 'pkg-config' | ||
[host_machine] | ||
system = 'linux' | ||
cpu_family = '${FAMILY}' | ||
cpu = 'arm64' | ||
endian = 'litle' | ||
[properties] | ||
pkg_config_libdir = '/usr/lib/${{ matrix.target }}/pkgconfig' | ||
EOF | ||
cat cross.txt | ||
- name: Build | ||
run: | | ||
if [ ${{ matrix.target }} = "native" ] ; then | ||
meson setup . build --werror | ||
else | ||
meson setup --cross-file cross.txt . build --werror | ||
fi | ||
ninja -C build | ||
ninja -C build install |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
project('debugcc', | ||
'c', | ||
license: ['BSD-3-Clause'], | ||
meson_version : '>= 0.61.0', # for install_symlink | ||
default_options: [ | ||
'buildtype=release', | ||
] | ||
) | ||
|
||
platforms = [ | ||
'msm8936', | ||
'msm8994', | ||
'msm8996', | ||
'msm8998', | ||
'qcs404', | ||
'sc8280xp', | ||
'sdm845', | ||
'sm6115', | ||
'sm6125', | ||
'sm6350', | ||
'sm6375', | ||
'sm8150', | ||
'sm8250', | ||
'sm8350', | ||
'sm8450', | ||
'sm8550', | ||
] | ||
|
||
debugcc_srcs = [ | ||
'debugcc.c', | ||
] | ||
|
||
platform_defs = [] | ||
platform_array = ['const struct debugcc_platform *platforms[] = {'] | ||
|
||
foreach p: platforms | ||
debugcc_srcs += p + '.c' | ||
platform_defs += 'extern struct debugcc_platform ' + p + '_debugcc;' | ||
platform_array += '\t&' + p + '_debugcc,' | ||
|
||
install_symlink(p + '-debugcc', | ||
install_dir: get_option('bindir'), | ||
pointing_to: 'debugcc') | ||
endforeach | ||
|
||
platform_array += '\tNULL,' | ||
platform_array += '};' | ||
|
||
debugcc_srcs += configure_file( | ||
output: 'platforms.c', | ||
capture: true, | ||
command: ['echo', | ||
'/* Autogenerated file, do not edit */\n\n' + | ||
'#include <stdlib.h>\n\n' + | ||
'\n'.join(platform_defs) + | ||
'\n\n' + | ||
'\n'.join(platform_array) | ||
]) | ||
|
||
executable('debugcc', | ||
debugcc_srcs, | ||
install: true) |