Skip to content

Commit

Permalink
Merge pull request #361 from na-trium-144/meson
Browse files Browse the repository at this point in the history
mesonに移行
  • Loading branch information
na-trium-144 authored Jul 31, 2024
2 parents da90ce1 + 819346e commit 6369c9e
Show file tree
Hide file tree
Showing 184 changed files with 4,789 additions and 5,329 deletions.
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build*/**/*
subprojects/**/*
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Checks: >
-bugprone-easily-swappable-parameters,
-clang-analyzer-optin.performance.Padding,
-performance-enum-size,
-bugprone-unchecked-optional-access
-bugprone-unchecked-optional-access,
-performance-avoid-endl
WarningsAsErrors: '*'
CheckOptions:
- key: bugprone-empty-catch.IgnoreCatchWithKeywords
Expand Down
2 changes: 1 addition & 1 deletion .github/test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ int main() {
webcface::Client wcli{};
wcli.value("test") = 0;
wcli.log().append(webcface::level::info, "this is info");
wcli.onMemberEntry([](webcface::Member m) {});
wcli.onMemberEntry([](const webcface::Member &m) {});
int i;
wcli.func("func").set([&](int a) { i += a; });
}
41 changes: 14 additions & 27 deletions .github/workflows/cmake-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
push:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
test:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
Expand All @@ -23,39 +19,30 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
sudo apt-get install -y lcov
sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev
- name: Configure CMake
- name: Install meson
run: pip install meson || pip install --break-system-packages meson
- name: Setup Meson
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DWEBCFACE_TEST=on
-DWEBCFACE_COVERAGE=on
-DWEBCFACE_TEST_TIMEOUT=50
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

meson setup build
--buildtype=debug
-Dtest_wait=200
-Db_coverage=true
- name: Compile
run: meson compile -C build
- name: Test
env:
WEBCFACE_TRACE: 1
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --output-on-failure --timeout 5
run: meson test -C build -v

- name: Install gcovr
run: sudo apt-get update && sudo apt-get install -y gcovr

# https://stackoverflow.com/questions/59203704/how-to-create-a-badge-with-test-coverage-jacoco-on-github-actions
- name: Get coverage
id: coverage
run: |
gcovr -s -e src/example/ -e src/test/ -e external/ -e build/
COVERAGE=$(gcovr -e src/example/ -e src/test/ -e external/ -e build/ | grep TOTAL | awk '{print $4}')
ninja coverage -C build
COVERAGE=$(ninja coverage -C build | grep -A 1 Overall | grep lines | awk '{print $2}')
echo "##[set-output name=lines;]${COVERAGE}"
- uses: actions/checkout@v3
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/cmake-test-linux-clang.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: CMake Test (Linux Clang) and Clang-Tidy
name: Meson Test (Linux Clang) and Clang-Tidy

on:
push:
branches: [ "main" ]
pull_request:
branches: []

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
test-linux-clang:
strategy:
matrix:
dep: ["apt", "submodule"]
dep: ["apt", "source"]
clang: [7, 13, 15, 17]
include:
- os: ubuntu-20.04
Expand All @@ -23,40 +19,44 @@ jobs:
clang: 13
- os: ubuntu-22.04
clang: 15
- os: ubuntu-22.04
- os: ubuntu-24.04
clang: 17

runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- run: git submodule update --init
if: matrix.dep == 'submodule'
# - run: git submodule update --init
# if: matrix.dep == 'submodule'

- name: Install dependencies
run: |
sudo apt-get update
if [ ${{matrix.dep}} = apt ]; then sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev; fi
sudo apt-get install -y ninja-build
if [[ ${{matrix.dep}} = apt ]]; then sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev libopencv-dev; fi
if [[ ${{matrix.dep}} = apt ]] && [[ ${{matrix.os}} = ubuntu-22.04 ]]; then sudo apt-get install -y libcli11-dev; fi
if [[ ${{matrix.dep}} = apt ]] && [[ ${{matrix.os}} = ubuntu-24.04 ]]; then sudo apt-get install -y libcli11-dev libmsgpack-cxx-dev; fi
- name: Install meson
run: pip install meson || pip install --break-system-packages meson
- name: Install clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "${{matrix.clang}}"
- name: Configure CMake
- name: Setup Meson
env:
CC: ${{ env.LLVM_PATH }}/bin/clang
CXX: ${{ env.LLVM_PATH }}/bin/clang++
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DWEBCFACE_TEST=on
-DWEBCFACE_EXAMPLE=on
-DWEBCFACE_TEST_TIMEOUT=200
"-DWEBCFACE_CLANG_TIDY=$([[ ${{matrix.clang}} = 17 ]] && echo ${{env.LLVM_PATH}}/bin/clang-tidy)"
- name: Build
run: cmake --build build

meson setup build
--buildtype=debug
$([[ ${{matrix.dep}} = apt ]] && echo "-Dwrap_mode=default")
-Dtest_wait=200
- name: Compile
run: meson compile -C build || meson compile -C build
- name: Test
env:
WEBCFACE_TRACE: 1
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure --timeout 20
run: meson test -C build --print-errorlog
- name: clang-tidy
if: matrix.clang == '17' && matrix.dep == 'apt'
run: python3 scripts/clang-tidy.py 4
# - name: clang-format-check
# if: matrix.clang == '17' && matrix.dep == 'apt'
# run: ninja clang-format-check -Cbuild
60 changes: 27 additions & 33 deletions .github/workflows/cmake-test-linux-gcc.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: CMake Test (Linux GCC)
name: Meson Test (Linux GCC)

on:
push:
branches: [ "main" ]
pull_request:
branches: []

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug

jobs:
test-linux-gcc:
strategy:
matrix:
dep: ["apt", "submodule"]
dep: ["apt", "source"]
gcc-ver: [7, 9, 11, 13]
include:
- os: ubuntu-20.04
Expand All @@ -28,55 +24,53 @@ jobs:
- dep: static
os: ubuntu-20.04
gcc_ver: 9
- dep: source # dep=submoduleと役割が被っている
os: ubuntu-20.04
gcc_ver: 9
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- run: git submodule update --init
if: matrix.dep == 'submodule'
# - run: git submodule update --init
# if: matrix.dep == 'submodule'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
sudo apt-get install -y gcc-${{matrix.gcc_ver}} g++-${{matrix.gcc_ver}}
if [ ${{matrix.dep}} = apt ]; then sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev libopencv-dev; fi
- name: Configure CMake
if [[ ${{matrix.dep}} = apt ]]; then sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev; fi
if [[ ${{matrix.dep}} = apt ]]; then sudo apt-get install -y libopencv-dev googletest; fi
if [[ ${{matrix.dep}} = apt ]] && [[ ${{matrix.os}} = ubuntu-22.04 ]]; then sudo apt-get install -y libcli11-dev; fi
if [[ ${{matrix.dep}} = apt ]] && [[ ${{matrix.os}} = ubuntu-24.04 ]]; then sudo apt-get install -y libcli11-dev libmsgpack-cxx-dev; fi
- name: Install meson
run: pip install meson || pip install --break-system-packages meson
- name: Setup Meson
env:
CC: gcc-${{matrix.gcc_ver}}
CXX: g++-${{matrix.gcc_ver}}
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DWEBCFACE_TEST=on
-DWEBCFACE_EXAMPLE=on
-DWEBCFACE_TEST_TIMEOUT=200
"-DWEBCFACE_SHARED=$([[ ${{matrix.dep}} = static ]]; echo $?)"
"-DWEBCFACE_FIND_OPENCV=$([[ ${{matrix.dep}} != apt ]]; echo $?)"
"-DWEBCFACE_FIND_LIBS=$([[ ${{matrix.dep}} = submodule || ${{matrix.dep}} = static ]]; echo $?)"
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install
- name: Build
run: cmake --build build -t install

meson setup build
--buildtype=debug
$([[ ${{matrix.dep}} = apt ]] && echo -Dwrap_mode=default)
-Dtest_wait=200
$([[ ${{matrix.dep}} = static ]] && echo -Ddefault_library=static)
--prefix=${{github.workspace}}/build/install
- name: Compile
run: meson compile -C build || meson compile -C build
- name: Test
env:
WEBCFACE_TRACE: 1
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure --timeout 20
run: meson test -C build --print-errorlog

- name: Check Exported Symbol
if: matrix.dep == 'submodule'
if: matrix.dep == 'source'
run: |
bash -c "! nm -g --defined-only build/libwebcface.so | grep -v webcface | grep -v wcf | grep -v St | grep -v gnu_cxx"
bash -c "! nm -g --defined-only build/libwebcface.so | grep -v webcface | grep -v wcf | grep spdlog"
bash -c "! nm -g --defined-only build/libwebcface.so | grep -v webcface | grep -v wcf | grep crow"
bash -c "! nm -g --defined-only build/libwebcface.so | grep -v webcface | grep -v wcf | grep asio"
bash -c "! nm -g --defined-only build/libwebcface.so | grep -v webcface | grep -v wcf | grep utf8"
- name: install
run: meson install -C build

- name: Test CMake with installed package
if: matrix.dep != 'static'
working-directory: ${{github.workspace}}/.github/test
env:
CC: gcc-${{matrix.gcc_ver}}
Expand All @@ -88,7 +82,7 @@ jobs:
- name: Test building with pkg-config
working-directory: ${{github.workspace}}/.github/test
env:
PKG_CONFIG_PATH: ${{github.workspace}}/build/install/lib/pkgconfig
PKG_CONFIG_PATH: ${{github.workspace}}/build/install/lib/x86_64-linux-gnu/pkgconfig
run: |
pkg-config --cflags --libs webcface
g++-${{matrix.gcc_ver}} -std=c++17 test.cc $(pkg-config --cflags --libs webcface)
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/cmake-test-linux-many-clang.yaml

This file was deleted.

Loading

0 comments on commit 6369c9e

Please sign in to comment.