diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml
deleted file mode 100644
index 4ab77f9..0000000
--- a/.github/actions/build/action.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Build
-description: 'Build a CMake project with optional configuration and building parameters'
-
-inputs:
- shell:
- required: false
- default: bash
- cmake_build_type:
- default: 'Release'
- required: false
- cmake_configuration_parameters:
- required: false
- cmake_build_paramters:
- required: false
- target:
- default: 'all'
-
-runs:
- using: "composite"
- steps:
- - name: Configure
- shell: ${{inputs.shell}}
- run: cmake -B build -DCMAKE_BUILD_TYPE=${{inputs.cmake_build_type}} ${{inputs.cmake_configuration_parameters}}
-
- - name: Build
- shell: ${{inputs.shell}}
- run: cmake --build build --config ${{inputs.cmake_build_type}} --verbose ${{inputs.cmake_build_paramters}} --target ${{inputs.target}}
diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml
deleted file mode 100644
index d86345b..0000000
--- a/.github/actions/package/action.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-name: Package
-description: 'Package a CMake project with CPack support'
-
-inputs:
- generators:
- required: true
-
-runs:
- using: "composite"
- steps:
- - name: Package
- shell: bash
- run: cpack --config build/CPackConfig.cmake --verbose -G "${{inputs.generators}}"
-
- - name: Upload DEB artifact
- if: runner.os == 'Linux'
- uses: actions/upload-artifact@v4
- with:
- name: sigutils-linux-deb.zip
- path: build/dist/*.deb
-
- - name: Upload TGZ artifact
- if: runner.os == 'Linux'
- uses: actions/upload-artifact@v4
- with:
- name: sigutils-linux-tgz.zip
- path: build/dist/*.tar.gz
-
- - name: Upload TGZ artifact
- if: runner.os == 'MacOS'
- uses: actions/upload-artifact@v4
- with:
- name: sigutils-macos-tgz.zip
- path: build/dist/*.tar.gz
-
- - name: Upload ZIP artifact
- if: runner.os == 'Windows'
- uses: actions/upload-artifact@v4
- with:
- name: sigutils-windows-zip.zip
- path: build/dist/*.zip
diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml
deleted file mode 100644
index b04faaf..0000000
--- a/.github/actions/test/action.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Test
-description: 'Test a CMake project with CTest support'
-
-inputs:
- shell:
- required: false
- default: bash
-
-runs:
- using: "composite"
- steps:
- - name: Test
- shell: ${{inputs.shell}}
- run: ctest --test-dir build -VV --rerun-failed --output-on-failure
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index c2b68c3..371ecba 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -8,8 +8,3 @@ updates:
target-branch: "master"
schedule:
interval: "weekly"
- - package-ecosystem: "gitsubmodule"
- directory: "/"
- target-branch: "master"
- schedule:
- interval: "weekly"
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 9ead540..b60e4ed 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -7,24 +7,23 @@ build_system:
- all:
- changed-files:
- any-glob-to-any-file:
- - 'CMake*'
- - '**/CMakeLists.txt'
- - '**/*.cmake'
+ - meson_options.txt
+ - '**/meson.build'
sigutils:
- all:
- changed-files:
- any-glob-to-any-file: 'src/**'
- - all-globs-to-all-files: '!src/CMakeLists.txt'
+ - all-globs-to-all-files: '!**/meson.build'
documentation:
- all:
- changed-files:
- any-glob-to-any-file: 'doc/**'
- - all-globs-to-all-files: '!doc/CMakeLists.txt'
+ - all-globs-to-all-files: '!**/meson.build'
tests:
- all:
- changed-files:
- any-glob-to-any-file: 'tests/**'
- - all-globs-to-all-files: '!tests/CMakeLists.txt'
+ - all-globs-to-all-files: '!**/meson.build'
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 79603b4..0ceceaf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -3,138 +3,83 @@ name: Build
on: [push, pull_request, workflow_dispatch]
jobs:
- build-linux:
- runs-on: ubuntu-latest
- steps:
- - name: Install dependencies
- run: sudo apt-get update && sudo apt-get install libsndfile1-dev libvolk2-dev libfftw3-dev catch2
-
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: true
- fetch-depth: 0
+ build:
+ strategy:
+ matrix:
+ sys:
+ - { os: windows-latest, shell: 'msys2 {0}' }
+ - { os: ubuntu-latest, shell: bash }
+ - { os: macos-latest, shell: bash }
- - name: Build
- uses: "./.github/actions/build"
- with:
- target: sigutils
- cmake_configuration_parameters: -DCMAKE_INSTALL_PREFIX=/usr
-
- - name: Build tests
- uses: "./.github/actions/build"
- with:
- target: sigutils_test
-
- - name: Test
- uses: "./.github/actions/test"
+ runs-on: ${{ matrix.sys.os }}
- - name: Package
- uses: "./.github/actions/package"
- with:
- generators: TGZ;DEB
-
- build-macos:
- runs-on: macos-latest
- steps:
- - name: Install dependencies
- run: brew install libsndfile volk fftw catch2
-
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: true
- fetch-depth: 0
-
- - name: Build
- uses: "./.github/actions/build"
- with:
- target: sigutils
-
- - name: Build tests
- uses: "./.github/actions/build"
- with:
- target: sigutils_test
-
- - name: Test
- uses: "./.github/actions/test"
-
- - name: Package
- uses: "./.github/actions/package"
- with:
- generators: TGZ
-
- build-windows:
- runs-on: windows-latest
defaults:
run:
- shell: msys2 {0}
+ shell: ${{ matrix.sys.shell }}
+
steps:
- - name: Install dependencies
+ - name: Install dependencies (Ubuntu)
+ if: matrix.sys.os == 'ubuntu-latest'
+ run: |
+ sudo apt-get update
+ sudo apt-get install meson libsndfile1-dev libvolk2-dev libfftw3-dev catch2
+
+ - name: Install dependencies (Mac OS)
+ if: matrix.sys.os == 'macos-latest'
+ run: brew install -vd meson libsndfile volk fftw catch2
+
+ - name: Install dependencies (Windows)
+ if: matrix.sys.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
- install: git mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake mingw-w64-x86_64-libsndfile mingw-w64-x86_64-fftw mingw-w64-x86_64-volk mingw-w64-x86_64-catch
+ install: git mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc mingw-w64-x86_64-libsndfile mingw-w64-x86_64-fftw mingw-w64-x86_64-volk mingw-w64-x86_64-catch
- name: Checkout
uses: actions/checkout@v4
with:
- submodules: true
fetch-depth: 0
- - name: Build
- uses: "./.github/actions/build"
- with:
- shell: msys2 {0}
- target: sigutils
+ - name: Configure
+ run: meson setup builddir
- - name: Build tests
- uses: "./.github/actions/build"
- with:
- shell: msys2 {0}
- target: sigutils_test
+ - name: Build
+ run: meson compile -C builddir
- name: Test
- uses: "./.github/actions/test"
- with:
- shell: msys2 {0}
-
- - name: Package
- uses: "./.github/actions/package"
- with:
- generators: ZIP
-
- release:
- runs-on: "ubuntu-latest"
- needs:
- - build-linux
- - build-macos
- - build-windows
-
- steps:
- - name: Get current date
- id: date
- run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
-
- - name: Download binaries
- uses: actions/download-artifact@v4
-
- - name: Release nightly
- if: github.ref == 'refs/heads/master'
- uses: marvinpinto/action-automatic-releases@v1.2.1
- with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
- automatic_release_tag: "latest"
- prerelease: true
- title: "Sigutils nightly (${{steps.date.outputs.date}})"
- files: sigutils*/*
-
- - name: Release stable
- if: contains(github.ref, 'refs/tags/v')
- uses: marvinpinto/action-automatic-releases@v1.2.1
- with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
- prerelease: false
- title: "Sigutils ${{github.ref_name}}"
- files: sigutils*/*
+ run: meson test -C builddir
+
+ # TODO: Package
+ # TODO: Upload artifacts
+
+ # release:
+ # runs-on: "ubuntu-latest"
+ # needs: build
+
+ # steps:
+ # - name: Get current date
+ # id: date
+ # run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
+
+ # - name: Download binaries
+ # uses: actions/download-artifact@v4
+
+ # - name: Release nightly
+ # if: github.ref == 'refs/heads/master'
+ # uses: marvinpinto/action-automatic-releases@v1.2.1
+ # with:
+ # repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ # automatic_release_tag: "latest"
+ # prerelease: true
+ # title: "Sigutils nightly (${{steps.date.outputs.date}})"
+ # files: sigutils*/*
+
+ # - name: Release stable
+ # if: contains(github.ref, 'refs/tags/v')
+ # uses: marvinpinto/action-automatic-releases@v1.2.1
+ # with:
+ # repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ # prerelease: false
+ # title: "Sigutils ${{github.ref_name}}"
+ # files: sigutils*/*
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index bcfd681..52d8ac2 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -28,7 +28,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
- submodules: true
fetch-depth: 0
- name: Initialize CodeQL
@@ -37,8 +36,10 @@ jobs:
languages: ${{ matrix.language }}
- name: Install dependencies
- run: sudo apt-get update && sudo apt-get install libsndfile1-dev libvolk2-dev libfftw3-dev
-
+ run: |
+ sudo apt-get update
+ sudo apt-get install meson libsndfile1-dev libvolk2-dev libfftw3-dev
+
- name: Autobuild
uses: github/codeql-action/autobuild@v3
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
index 6e05f87..67f8dc8 100644
--- a/.github/workflows/doc.yml
+++ b/.github/workflows/doc.yml
@@ -14,7 +14,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
- sudo apt-get install libsndfile1-dev libvolk2-dev libfftw3-dev doxygen python3-pip
+ sudo apt-get install meson libsndfile1-dev libvolk2-dev libfftw3-dev doxygen graphviz python3-pip
sudo pip3 install coverxygen
- name: Determine checkout ref
@@ -30,18 +30,18 @@ jobs:
with:
ref: "${{ steps.fetch_ref.outputs.value }}"
fetch-depth: 0
- submodules: true
+
+ - name: Configure
+ run: meson setup builddir
- name: Build documentation
- uses: "./.github/actions/build"
- with:
- target: doxygen
+ run: meson compile -C builddir docs
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
- path: build/doc/html/
+ path: builddir/doc/html/
- name: Setup Pages
if: contains(github.ref, 'master') && (github.event_name != 'pull_request_target')
@@ -53,7 +53,7 @@ jobs:
if: contains(github.ref, 'master') && (github.event_name != 'pull_request_target')
uses: actions/upload-pages-artifact@v3
with:
- path: build/doc/html/
+ path: builddir/doc/html/
- name: Deploy to GitHub Pages
if: contains(github.ref, 'master') && (github.event_name != 'pull_request_target')
@@ -61,16 +61,14 @@ jobs:
- name: Documentation coverage
if: github.event_name == 'pull_request_target'
- uses: "./.github/actions/build"
- with:
- target: coverxygen_summary
+ run: meson compile -C builddir docs_coverage
- name: Documentation coverage report generation
if: github.event_name == 'pull_request_target'
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "report<<$EOF" >> "$GITHUB_ENV"
- cat build/doc/doc-coverage.markdown-summary.info >> "$GITHUB_ENV"
+ cat builddir/doc/coverxygen.md >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Documentation coverage report
diff --git a/.gitmodules b/.gitmodules
index 0baef4f..7681bac 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,9 +1,6 @@
[submodule "cmake/cmake-gitversiondetect"]
path = cmake/cmake-gitversiondetect
url = https://github.com/antoniovazquezblanco/cmake-gitversiondetect.git
-[submodule "cmake/cmake-pcfilegenerator"]
- path = cmake/cmake-pcfilegenerator
- url = https://github.com/antoniovazquezblanco/cmake-pcfilegenerator.git
[submodule "cmake/cmake-relativefilemacro"]
path = cmake/cmake-relativefilemacro
url = https://github.com/antoniovazquezblanco/cmake-relativefilemacro.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 6355b75..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# CMakeLists.txt: CMake configuration file for sigutils
-#
-# Copyright (C) 2019 Gonzalo José Carracedo Carballal
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation, version 3.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program. If not, see
-#
-#
-#
-
-cmake_minimum_required(VERSION 3.20.0)
-
-# CMake modules search path
-file(GLOB MODULE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*/" LIST_DIRECTORIES true)
-list(APPEND CMAKE_MODULE_PATH "${MODULE_DIRS}")
-
-# Check that all required submodules are there
-set(
- GIT_CMAKE_SUBMODULES
- cmake-gitversiondetect
- cmake-pcfilegenerator
- cmake-relativefilemacro)
-
-foreach (submodule IN ITEMS ${GIT_CMAKE_SUBMODULES})
- if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${submodule}/.git")
- message( FATAL_ERROR "Required CMake submodule `${submodule}' not found. This \
- is most likely caused by an incomplete clone from the main repository. Please run:
- $ git submodule update --init --recursive
-to clone all required submodules and run CMake again.")
- endif()
-endforeach()
-
-# Use git version detect to obtain a project version based on tags
-include(GitVersionDetect)
-set(SIGUTILS_VERSION_MAJOR ${GITVERSIONDETECT_VERSION_MAJOR})
-set(SIGUTILS_VERSION_MINOR ${GITVERSIONDETECT_VERSION_MINOR})
-set(SIGUTILS_VERSION_PATCH ${GITVERSIONDETECT_VERSION_PATCH})
-set(SIGUTILS_VERSION ${SIGUTILS_VERSION_MAJOR}.${SIGUTILS_VERSION_MINOR}.${SIGUTILS_VERSION_PATCH})
-
-# Define the project
-project(
- sigutils
- VERSION ${SIGUTILS_VERSION}
- DESCRIPTION "Small signal processing utility library"
- HOMEPAGE_URL "http://github.org/BatchDrake/sigutils"
- LANGUAGES C CXX)
-
-# Always use top level dir for generated targets to avoid linker problems
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-
-# The library code is in src
-add_subdirectory(src)
-
-# The documentation is in doc
-add_subdirectory(doc)
-
-# Tests are in the tests dir
-include(CTest)
-add_subdirectory(tests)
diff --git a/cmake/cmake-gitversiondetect b/cmake/cmake-gitversiondetect
deleted file mode 160000
index 0b35a72..0000000
--- a/cmake/cmake-gitversiondetect
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0b35a729aedc600669cfb73ff6bc5bd954164771
diff --git a/cmake/cmake-pcfilegenerator b/cmake/cmake-pcfilegenerator
deleted file mode 160000
index cda18b5..0000000
--- a/cmake/cmake-pcfilegenerator
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit cda18b55ffc52525a5fa070c8bbbbe3c3ceaddf8
diff --git a/cmake/cmake-relativefilemacro b/cmake/cmake-relativefilemacro
deleted file mode 160000
index 3d0e4c5..0000000
--- a/cmake/cmake-relativefilemacro
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 3d0e4c529dd5d83920e4299fecfb4355a4b9113c
diff --git a/cmake/modules/CodeAnalysis.cmake b/cmake/modules/CodeAnalysis.cmake
deleted file mode 100644
index 3e4d8e2..0000000
--- a/cmake/modules/CodeAnalysis.cmake
+++ /dev/null
@@ -1,32 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-CodeAnalysis
--------
-
-Add code format target.
-
-Custom Targets
-^^^^^^^^^^^^^^^^
-
-This module provides the following custom target, if found:
-
-``cppcheck-analysis``
- The code analysis custom target.
-
-#]=======================================================================]
-
-if(TARGET codeanalysis)
- return()
-endif()
-
-find_package(CppCheck)
-
-if(CppCheck_FOUND)
- message("Cppcheck analysis already added")
- set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
- file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/analysis/cppcheck)
- add_custom_target(codeanalysis
- COMMAND ${CPPCHECK_COMMAND})
-endif()
diff --git a/cmake/modules/FindCoverxygen.cmake b/cmake/modules/FindCoverxygen.cmake
deleted file mode 100644
index 5a801b9..0000000
--- a/cmake/modules/FindCoverxygen.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-# Copyright 2023 Antonio Vázquez Blanco
-
-# This package uses FindPython3, set min ver acordingly
-cmake_minimum_required(VERSION 3.12.0)
-
-# Check if python is available...
-find_package(Python3 COMPONENTS Interpreter)
-
-if(Python3_Interpreter_FOUND)
- # Python found. Try to find the module...
- execute_process(
- COMMAND ${Python3_EXECUTABLE} -c "import coverxygen"
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_QUIET
- )
- if (${EXIT_CODE} EQUAL 0)
- set(Coverxygen_FOUND ON)
- set(Coverxygen_COMMAND "${Python3_EXECUTABLE} -m coverxygen")
- endif()
-endif()
-
-if (NOT Coverxygen_FOUND)
- message("Coverxygen not found")
-endif()
-
-function(coverxygen_add_report targetName srcDir doxygenTarget reportFormat)
- get_filename_component(absSrcDir "${srcDir}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
- add_custom_target(${targetName} VERBATIM
- COMMAND "${Python3_EXECUTABLE}" -m coverxygen --xml-dir "${CMAKE_CURRENT_BINARY_DIR}/xml" --src-dir "${absSrcDir}" --output "${CMAKE_CURRENT_BINARY_DIR}/doc-coverage.${reportFormat}.info" --format ${reportFormat}
- DEPENDS ${doxygenTarget}
- COMMENT "Generate documentation coverage report in ${reportFormat} for ${targetName}"
- )
-endfunction()
diff --git a/cmake/modules/FindCppCheck.cmake b/cmake/modules/FindCppCheck.cmake
deleted file mode 100644
index f2a30da..0000000
--- a/cmake/modules/FindCppCheck.cmake
+++ /dev/null
@@ -1,140 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-FindCppCheck
--------
-
-Finds the CppCheck Tool.
-
-Custom Targets
-^^^^^^^^^^^^^^^^
-
-This module provides the following custom targets, if found:
-
-``cppcheck-analysis``
- The CppCheck custom target
-
-Result Variables
-^^^^^^^^^^^^^^^^
-
-This will define the following variables:
-
-``CppCheck_FOUND``
- True if the system has the cppcheck tool.
-``CppCheck_VERSION``
- Version of cppcheck tool.
-
-#]=======================================================================]
-
-if(CPPCHECK_ROOT_DIR)
- find_program(CPPCHECK_BIN
- NAMES
- cppcheck
- PATHS
- "${CPPCHECK_ROOT_DIR}"
- NO_DEFAULT_PATH)
-endif()
-
-if(NOT CPPCHECK_BIN)
- find_program(CPPCHECK_BIN NAMES cppcheck)
-endif()
-
-if(CPPCHECK_BIN)
- execute_process(
- COMMAND ${CPPCHECK_BIN} --version
- OUTPUT_VARIABLE CppCheck_VERSION
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- set(CPPCHECK_THREADS_ARG "-j4"
- CACHE STRING "The number of threads to use")
- set(CPPCHECK_PROJECT_ARG "--project=${PROJECT_BINARY_DIR}/compile_commands.json"
- CACHE STRING "The project directory to use")
- set(CPPCHECK_BUILD_DIR_ARG "--cppcheck-build-dir=${PROJECT_BINARY_DIR}/analysis/cppcheck"
- CACHE STRING "The build directory to use")
-
- # Don't show these errors
- if(EXISTS "${CMAKE_SOURCE_DIR}/.cppcheck-suppressions")
- set(CPPCHECK_SUPPRESSIONS "--suppressions-list=${CMAKE_SOURCE_DIR}/.cppcheck-suppressions"
- CACHE STRING "The suppressions file to use")
- else()
- set(CPPCHECK_SUPPRESSIONS ""
- CACHE STRING "The suppressions file to use")
- endif()
-
- # Show these errors but don't fail the build
- if(EXISTS "${CMAKE_SOURCE_DIR}/.cppcheck-exitcode-suppressions")
- set(CPPCHECK_EXITCODE_SUPPRESSIONS "--exitcode-suppressions=${CMAKE_SOURCE_DIR}/.cppcheck-exitcode-suppressions"
- CACHE STRING "The exitcode suppressions file to use")
- else()
- set(CPPCHECK_EXITCODE_SUPPRESSIONS ""
- CACHE STRING "The exitcode suppressions file to use")
- endif()
-
- set(CPPCHECK_ERROR_EXITCODE_ARG "--error-exitcode=1"
- CACHE STRING "The exitcode to use if an error is found")
- set(CPPCHECK_CHECKS_ARGS "--enable=warning"
- CACHE STRING "Arguments for the checks to run")
- set(CPPCHECK_OTHER_ARGS ""
- CACHE STRING "Other arguments")
-
- set(_CPPCHECK_EXCLUDES)
- foreach(ex ${CPPCHECK_EXCLUDES})
- list(APPEND _CPPCHECK_EXCLUDES "-i${ex}")
- endforeach(ex)
-
- set(CPPCHECK_ALL_ARGS
- ${CPPCHECK_THREADS_ARG}
- ${CPPCHECK_PROJECT_ARG}
- ${CPPCHECK_BUILD_DIR_ARG}
- ${CPPCHECK_ERROR_EXITCODE_ARG}
- ${CPPCHECK_SUPPRESSIONS}
- ${CPPCHECK_EXITCODE_SUPPRESSIONS}
- ${CPPCHECK_CHECKS_ARGS}
- ${CPPCHECK_OTHER_ARGS}
- ${_CPPCHECK_EXCLUDES}
- )
-
- if(NOT CPPCHECK_XML_OUTPUT)
- set(CPPCHECK_COMMAND
- ${CPPCHECK_BIN}
- ${CPPCHECK_ALL_ARGS}
- )
- else()
- set(CPPCHECK_COMMAND
- ${CPPCHECK_BIN}
- ${CPPCHECK_ALL_ARGS}
- --xml
- --xml-version=2
- 2> ${CPPCHECK_XML_OUTPUT})
- endif()
-endif()
-
-# handle the QUIETLY and REQUIRED arguments and set YAMLCPP_FOUND to TRUE if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(
- CppCheck
- DEFAULT_MSG
- CPPCHECK_BIN)
-
-mark_as_advanced(
- CPPCHECK_BIN
- CPPCHECK_THREADS_ARG
- CPPCHECK_PROJECT_ARG
- CPPCHECK_BUILD_DIR_ARG
- CPPCHECK_SUPPRESSIONS
- CPPCHECK_EXITCODE_SUPPRESSIONS
- CPPCHECK_ERROR_EXITCODE_ARG
- CPPCHECK_CHECKS_ARGS
- CPPCHECK_OTHER_ARGS)
-
-if(CppCheck_FOUND)
- file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/analysis/cppcheck)
- add_custom_target(cppcheck-analysis
- COMMAND ${CPPCHECK_COMMAND})
- message("CppCheck found. Use cppcheck-analysis targets to run it")
-else()
- message("CppCheck not found")
-endif()
diff --git a/doc/Building.md b/doc/Building.md
index 5cfefd9..b70eb70 100644
--- a/doc/Building.md
+++ b/doc/Building.md
@@ -5,10 +5,10 @@
## Getting the code
-Just clone it from the GitHub repository. Make sure you pass `--recurse-submodules` to `git clone` so all required submodules are also cloned.
+Just clone it from the GitHub repository.
```bash
-git clone --recurse-submodules https://github.com/BatchDrake/sigutils.git
+git clone https://github.com/BatchDrake/sigutils.git
```
@@ -16,7 +16,7 @@ git clone --recurse-submodules https://github.com/BatchDrake/sigutils.git
The following libraries (along with their respective development files) must also be present:
-* CMake 3.12.0 or higher is required for the build.
+* Meson is required for the build.
* sndfile (1.0.2 or later)
* fftw3 (3.0 or later)
* volk (1.0 or later) (Optional)
@@ -24,19 +24,19 @@ The following libraries (along with their respective development files) must als
### Requirements and dependencies in Ubuntu
```bash
-sudo apt-get install cmake libsndfile1-dev libvolk2-dev libfftw3-dev
+sudo apt-get install meson libsndfile1-dev libvolk2-dev libfftw3-dev
```
### Requirements and dependencies in Archlinux
```bash
-sudo pacman -S libsndfile libvolk fftw cmake
+sudo pacman -S meson libsndfile libvolk fftw
```
### Requirements and dependencies in Windows MSYS2 MinGW64
```bash
-pacman -S mingw-w64-x86_64-cc mingw-w64-x86_64-make mingw-w64-x86_64-cmake mingw-w64-x86_64-libsndfile mingw-w64-x86_64-fftw mingw-w64-x86_64-volk
+pacman -S mingw-w64-x86_64-cc mingw-w64-x86_64-ninja mingw-w64-x86_64-meson mingw-w64-x86_64-libsndfile mingw-w64-x86_64-fftw mingw-w64-x86_64-volk
```
@@ -44,30 +44,21 @@ pacman -S mingw-w64-x86_64-cc mingw-w64-x86_64-make mingw-w64-x86_64-cmake mingw
### Configuring the project
-You can configure the project into a `build/` folder by executing the following command. This will check for dependencies automatically.
+You can configure the project into a `builddir/` folder by executing the following command. This will check for dependencies automatically.
```bash
-cmake -B build .
+meson setup builddir
```
You may want to specify extra options.
-#### Configuring in Windows MSYS2 MinGW64
-
-In Windows you may want to instruct that you want MSYS makefiles and the mingw PREFIX.
-
-```bash
-/msys64/mingw64/bin/cmake -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/msys64/mingw64
-```
-
-
### Building
If the previous commands were successful, you can start the build by typing:
```bash
-cmake --build build
+meson compile -C builddir
```
@@ -76,5 +67,5 @@ cmake --build build
You may want to install the built library in your system:
```bash
-sudo cmake --build build --target install
+sudo meson install -C builddir
```
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
deleted file mode 100644
index 4e39652..0000000
--- a/doc/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Check for the required dependencies
-find_package(Doxygen)
-find_package(Coverxygen)
-
-if (NOT DOXYGEN_FOUND)
- message("Doxygen needs to be installed to generate the documentation")
-else()
- # Select doxygen output formats
- set(DOXYGEN_GENERATE_HTML YES)
- if(${Coverxygen_FOUND})
- set(DOXYGEN_GENERATE_XML YES)
- endif()
-
- # Other doxy options
- set(DOXYGEN_EXTRACT_ALL YES)
- set(DOXYGEN_EXTRACT_PRIVATE YES)
- set(DOXYGEN_EXTRACT_PACKAGE YES)
- set(DOXYGEN_EXTRACT_STATIC YES)
- set(DOXYGEN_EXTRACT_LOCAL_CLASSES YES)
- set(DOXYGEN_EXTRACT_LOCAL_METHODS YES)
- set(DOXYGEN_EXTRACT_ANON_NSPACES YES)
- set(DOXYGEN_MACRO_EXPANSION YES)
- get_target_property(DOXYGEN_INCLUDE_PATH sigutils INCLUDE_DIRECTORIES)
- set(DOXYGEN_SKIP_FUNCTION_MACROS NO)
-
- # Add a Doxygen target
- doxygen_add_docs(doxygen "../src" ".")
-endif()
-
-if (DOXYGEN_FOUND AND NOT Coverxygen_FOUND)
- message("Coverxygen needs to be installed to generate the documentation coverage reports")
-else()
- coverxygen_add_report(coverxygen_summary "../src" doxygen markdown-summary)
-endif()
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..bf5351e
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,56 @@
+dep_doxygen = find_program('doxygen', required : false)
+dep_python = import('python').find_installation(required : false)
+dep_coverxygen = run_command(dep_python, '-c', 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\'coverxygen\') is None else exit(0)', check : false).returncode() == 0
+
+if not dep_doxygen.found()
+ warning('Documentation disabled because doxygen was not found')
+endif
+
+if not dep_coverxygen
+ warning('Documentation coverage report disabled because coverxygen was not found')
+endif
+
+if dep_doxygen.found()
+ # Doxygen input folders...
+ doxygen_input = [
+ meson.current_source_dir(),
+ join_paths(meson.current_source_dir(), '../src'),
+ join_paths(meson.current_source_dir(), '../src/include'),
+ join_paths(meson.current_source_dir(), '../src/include/sigutils'),
+ join_paths(meson.current_source_dir(), '../src/include/sigutils/specific'),
+ join_paths(meson.current_source_dir(), '../src/include/sigutils/util'),
+ join_paths(meson.current_source_dir(), '../src/sigutils'),
+ join_paths(meson.current_source_dir(), '../src/sigutils/specific'),
+ join_paths(meson.current_source_dir(), '../src/util'),
+ ]
+
+ # Configure doxygen...
+ doxygen_conf_data = configuration_data()
+ doxygen_conf_data.set('VERSION', meson.project_version())
+ doxygen_conf_data.set('INPUT', ' '.join(doxygen_input))
+ doxygen_conf_data.set('OUTPUT_DIRECTORY', meson.current_build_dir())
+ sigutils_doxygen_conf = configure_file(
+ input: 'sigutils.doxygen.in',
+ output: 'sigutils.doxygen',
+ configuration: doxygen_conf_data,
+ )
+
+ # Actual docs target
+ run_target('docs',
+ command : [dep_doxygen, sigutils_doxygen_conf]
+ )
+endif
+
+if dep_doxygen.found() and dep_coverxygen
+ run_target('docs_coverage',
+ command : [
+ dep_python,
+ '-m', 'coverxygen',
+ '--xml-dir', join_paths(meson.current_build_dir(), 'xml'),
+ '--src-dir', meson.current_source_dir(),
+ '--output', join_paths(meson.current_build_dir(), 'coverxygen.md'),
+ '--format', 'markdown-summary'
+ ]
+ )
+
+endif
\ No newline at end of file
diff --git a/doc/sigutils.doxygen.in b/doc/sigutils.doxygen.in
new file mode 100644
index 0000000..8814265
--- /dev/null
+++ b/doc/sigutils.doxygen.in
@@ -0,0 +1,7 @@
+PROJECT_NAME = "Sigutils"
+PROJECT_NUMBER = @VERSION@
+GENERATE_HTML = YES
+GENERATE_XML = YES
+GENERATE_LATEX = NO
+INPUT = @INPUT@
+OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1b2cd1b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,5 @@
+project('sigutils', ['c', 'cpp'], version: '0.1', default_options: ['cpp_std=c++17'])
+
+subdir('src')
+subdir('doc')
+subdir('tests')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
deleted file mode 100644
index e7e70b0..0000000
--- a/src/CMakeLists.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# CMakeLists.txt: CMake configuration file for sigutils
-#
-# Copyright (C) 2019 Gonzalo José Carracedo Carballal
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation, version 3.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program. If not, see
-#
-#
-#
-
-# Set the ABI version manually
-set(SIGUTILS_ABI_VERSION 1)
-
-# Late module imports that depend on project definitions
-include(FindPkgConfig)
-include(CodeAnalysis)
-include(GNUInstallDirs)
-include(RelativeFileMacro)
-include(PcFileGenerator)
-
-# Find requirements
-find_package(Threads)
-
-pkg_check_modules(SNDFILE REQUIRED sndfile>=1.0.2)
-include_directories(${SNDFILE_INCLUDE_DIRS})
-link_directories(${SNDFILE_LIBRARY_DIRS})
-
-pkg_check_modules(FFTW3 REQUIRED fftw3f>=3.0)
-include_directories(${FFTW3_INCLUDE_DIRS})
-link_directories(${FFTW3_LIBRARY_DIRS})
-
-pkg_check_modules(VOLK volk>=1.0)
-if(VOLK_FOUND)
- include_directories(${VOLK_INCLUDE_DIRS})
- link_directories(${VOLK_LIBRARY_DIRS})
-endif()
-
-# Project build options
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug CACHE STRING
- "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
- FORCE)
-endif()
-if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math -s")
-endif()
-
-option(SIGUTILS_SINGLE_PRECISSION "Use single precission data types" ON)
-
-if (DEFINED PKGVERSION)
- # If you are building sigutils for your own software distribution, you may want
- # to set PKGVERSION to some descriptive string.
- add_compile_definitions(SIGUTILS_PKGVERSION="${PKGVERSION}")
-endif()
-
-# Source location
-file(GLOB_RECURSE SRCS LIST_DIRECTORIES false *.c)
-file(GLOB_RECURSE SRCS_WIN LIST_DIRECTORIES false win32-*.c)
-if(NOT WIN32)
- list(REMOVE_ITEM SRCS ${SRCS_WIN})
-endif()
-
-# Define the library target
-add_library(sigutils SHARED ${SRCS})
-
-# Define relative filename macros
-target_add_relative_file_macro(sigutils)
-
-# Add public include directories
-target_include_directories(sigutils PUBLIC include/)
-
-# Extra compilation definitions
-if(SIGUTILS_SINGLE_PRECISSION)
- target_compile_definitions(sigutils PUBLIC _SU_SINGLE_PRECISION)
-endif()
-
-if(VOLK_FOUND)
- target_compile_definitions(sigutils PUBLIC HAVE_VOLK)
-endif()
-
-# Target properties
-set_property(TARGET sigutils PROPERTY VERSION ${SIGUTILS_VERSION})
-set_property(TARGET sigutils PROPERTY SOVERSION ${SIGUTILS_ABI_VERSION})
-
-# Target dependencies
-target_link_libraries(sigutils ${SNDFILE_LIBRARIES})
-target_link_libraries(sigutils ${FFTW3_LIBRARIES})
-target_link_libraries(sigutils fftw3f_threads)
-target_link_libraries(sigutils ${CMAKE_THREAD_LIBS_INIT})
-target_link_libraries(sigutils m)
-
-if(WIN32)
- target_link_libraries(sigutils ws2_32)
-endif()
-
-if(VOLK_FOUND)
- target_link_libraries(sigutils ${VOLK_LIBRARIES})
-endif()
-
-# PC file generation
-target_pc_file_generate(sigutils "Digital signal processing utility library")
-
-# File install
-install(TARGETS sigutils LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT LIB)
-install(DIRECTORY include/sigutils DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT DEVEL)
-install(FILES ${PROJECT_BINARY_DIR}/src/sigutils.pc DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR} COMPONENT DEVEL)
-
-# General packaging settings
-set(CPACK_PACKAGE_NAME sigutils)
-set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/dist)
-
-# DEB packaging settings
-set(CPACK_DEB_COMPONENT_INSTALL ON)
-if(GITVERSIONDETECT_VERSION_COMMIT_NUM)
- set(CPACK_DEBIAN_PACKAGE_VERSION ${GITVERSIONDETECT_VERSION})
-endif()
-set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
-set(CPACK_DEBIAN_PACKAGE_MAINTAINER "arf20 ")
-set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libsndfile1 (>= 1.0.31-2build1), libvolk2.5 (>= 2.5.1-1), libfftw3-single3 (>= 3.3.8-2)")
-set(CPACK_DEBIAN_DEVEL_PACKAGE_DEPENDS "libsndfile1-dev (>= 1.0.31-2build1), libvolk2-dev (>= 2.5.1-1), libfftw3-dev (>= 3.3.8-2)")
-set(CPACK_DEBIAN_LIB_PACKAGE_NAME "libsigutils")
-set(CPACK_DEBIAN_DEVEL_PACKAGE_NAME "libsigutils-dev")
-set(CPACK_DEBIAN_LIB_PACKAGE_SECTION "libs")
-set(CPACK_DEBIAN_DEVEL_PACKAGE_SECTION "libdevel")
-
-# Include CPack
-include(CPack)
-
-# CPack component information
-cpack_add_component(LIB DISPLAY_NAME "Runtime library")
-cpack_add_component(DEVEL DISPLAY_NAME "Development files" DEPENDS LIB)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..82c8b9e
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,151 @@
+# Find dependencies
+dep_thread = dependency('threads')
+dep_sndfile = dependency('sndfile', version : '>=1.0.2')
+dep_fftw3 = dependency('fftw3', version : '>=3.0')
+dep_fftw3f = dependency('fftw3f', version : '>=3.0')
+# This is a temporary fix until https://github.com/FFTW/fftw3/issues/180 gets solved
+dep_fftw3f_threads = meson.get_compiler('c').find_library('fftw3_threads', dirs: dep_fftw3.get_variable(pkgconfig: 'libdir'))
+dep_volk = dependency('volk', version : '>=1.0', required : false)
+dep_math = meson.get_compiler('c').find_library('m', required : false)
+dep_ws2 = meson.get_compiler('c').find_library('ws2_32', required : target_machine.system() == 'windows')
+
+# Library
+srcs = files([
+ 'sigutils/specific/apt.c',
+ 'sigutils/agc.c',
+ 'sigutils/block.c',
+ 'sigutils/clock.c',
+ 'sigutils/coef.c',
+ 'sigutils/dc_corrector.c',
+ 'sigutils/detect.c',
+ 'sigutils/equalizer.c',
+ 'sigutils/iir.c',
+ 'sigutils/lfsr.c',
+ 'sigutils/lib.c',
+ 'sigutils/log.c',
+ 'sigutils/matfile.c',
+ 'sigutils/ncqo.c',
+ 'sigutils/pll.c',
+ 'sigutils/property.c',
+ 'sigutils/smoothpsd.c',
+ 'sigutils/softtune.c',
+ 'sigutils/specific/apt.c',
+ 'sigutils/specttuner.c',
+ 'sigutils/taps.c',
+ 'sigutils/tvproc.c',
+ 'sigutils/version.c',
+ 'util/util.c',
+])
+
+if target_machine.system() == 'windows'
+ srcs += files([
+ 'util/win32-fcntl.c',
+ 'util/win32-mman.c',
+ 'util/win32-poll.c',
+ 'util/win32-pwd.c',
+ 'util/win32-statvfs.c',
+ 'util/win32-stdlib.c',
+ 'util/win32-termios.c',
+ 'util/win32-time.c',
+ 'util/win32-unistd.c',
+ ])
+endif
+
+includes = include_directories([
+ 'include/',
+ # This is a fix. It is not clear why fftw3 include dirs are not picked up by pkg-config...
+ dep_fftw3.get_variable(pkgconfig: 'includedir'),
+])
+
+args = []
+if dep_volk.found()
+ args += '-DHAVE_VOLK'
+endif
+
+lib_sigutils = shared_library('sigutils', srcs,
+ include_directories : includes,
+ dependencies : [dep_thread, dep_sndfile, dep_fftw3, dep_fftw3f, dep_fftw3f_threads, dep_volk, dep_math, dep_ws2],
+ c_args : args,
+ version : meson.project_version(),
+ install : true)
+
+pkg = import('pkgconfig')
+pkg.generate(lib_sigutils)
+
+# Headers
+install_headers(
+ files([
+ 'include/sigutils/agc.h',
+ 'include/sigutils/block.h',
+ 'include/sigutils/clock.h',
+ 'include/sigutils/coef.h',
+ 'include/sigutils/dc_corrector.h',
+ 'include/sigutils/decider.h',
+ 'include/sigutils/defs.h',
+ 'include/sigutils/detect.h',
+ 'include/sigutils/equalizer.h',
+ 'include/sigutils/iir.h',
+ 'include/sigutils/lfsr.h',
+ 'include/sigutils/log.h',
+ 'include/sigutils/matfile.h',
+ 'include/sigutils/ncqo.h',
+ 'include/sigutils/pll.h',
+ 'include/sigutils/property.h',
+ 'include/sigutils/sampling.h',
+ 'include/sigutils/sigutils.h',
+ 'include/sigutils/smoothpsd.h',
+ 'include/sigutils/softtune.h',
+ 'include/sigutils/specttuner.h',
+ 'include/sigutils/taps.h',
+ 'include/sigutils/tvproc.h',
+ 'include/sigutils/types.h',
+ 'include/sigutils/version.h',
+ ]),
+ subdir : 'sigutils')
+
+install_headers(
+ files([
+ 'include/sigutils/specific/apt.h',
+ ]),
+ subdir : 'sigutils/specific')
+
+install_headers(
+ files([
+ 'include/sigutils/util/compat-fcntl.h',
+ 'include/sigutils/util/compat-in.h',
+ 'include/sigutils/util/compat-inet.h',
+ 'include/sigutils/util/compat-mman.h',
+ 'include/sigutils/util/compat-netdb.h',
+ 'include/sigutils/util/compat-poll.h',
+ 'include/sigutils/util/compat-pwd.h',
+ 'include/sigutils/util/compat-select.h',
+ 'include/sigutils/util/compat-socket.h',
+ 'include/sigutils/util/compat-stat.h',
+ 'include/sigutils/util/compat-statvfs.h',
+ 'include/sigutils/util/compat-stdlib.h',
+ 'include/sigutils/util/compat-termios.h',
+ 'include/sigutils/util/compat-time.h',
+ 'include/sigutils/util/compat-unistd.h',
+ 'include/sigutils/util/util.h',
+ 'include/sigutils/util/win32-fcntl.h',
+ 'include/sigutils/util/win32-in.h',
+ 'include/sigutils/util/win32-inet.h',
+ 'include/sigutils/util/win32-mman.h',
+ 'include/sigutils/util/win32-netdb.h',
+ 'include/sigutils/util/win32-poll.h',
+ 'include/sigutils/util/win32-pwd.h',
+ 'include/sigutils/util/win32-socket.h',
+ 'include/sigutils/util/win32-stat.h',
+ 'include/sigutils/util/win32-statvfs.h',
+ 'include/sigutils/util/win32-stdlib.h',
+ 'include/sigutils/util/win32-termios.h',
+ 'include/sigutils/util/win32-time.h',
+ 'include/sigutils/util/win32-unistd.h',
+ ]),
+ subdir : 'sigutils/util')
+
+# Create a dep for the test executables
+dep_sigutils = declare_dependency(
+ include_directories : includes,
+ link_with : lib_sigutils
+)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
deleted file mode 100644
index 9eec302..0000000
--- a/tests/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-find_package(Catch2)
-
-if(Catch2_FOUND)
- # General options
- file(GLOB_RECURSE TEST_SRCS LIST_DIRECTORIES false *.cpp)
- add_executable(sigutils_test EXCLUDE_FROM_ALL ${TEST_SRCS})
- target_include_directories(sigutils_test PUBLIC $)
- target_compile_definitions(sigutils_test PUBLIC $)
- target_link_libraries(sigutils_test $)
- include(Catch)
- catch_discover_tests(sigutils_test)
-
- if(Catch2_VERSION_MAJOR EQUAL 2)
- target_compile_definitions(sigutils_test PUBLIC CATCH2_V2)
- target_link_libraries(sigutils_test Catch2::Catch2)
- elseif(Catch2_VERSION_MAJOR EQUAL 3)
- target_compile_definitions(sigutils_test PUBLIC CATCH2_V3)
- target_link_libraries(sigutils_test Catch2::Catch2WithMain)
- else()
- message("Unsuported Catch2 version")
- endif()
-else()
- message("Catch2 needs to be installed to perform unit testing")
-endif()
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..ee0250e
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,34 @@
+dep_catch2 = dependency('catch2-with-main', required : false)
+if not dep_catch2.found()
+ dep_catch2 = dependency('catch2', required : false)
+endif
+
+if not dep_catch2.found()
+ warning('Testing is disabled because catch2 was not found')
+endif
+
+if dep_catch2.found()
+ # Test sources
+ test_srcs = files([
+ 'test_ncqo.cpp',
+ ])
+
+ # Catch hack to be compatible with v2 and v3...
+ test_cpp_args = []
+ if dep_catch2.version().version_compare('>3')
+ test_cpp_args += '-DCATCH2_V3'
+ else
+ test_cpp_args += '-DCATCH2_V2'
+ endif
+
+ # Test executable
+ test_exe = executable('sigutils_test',
+ test_srcs,
+ cpp_args : test_cpp_args,
+ dependencies : [dep_sigutils, dep_catch2],
+ build_by_default : false,
+ install : false)
+
+ # Let meson know what our executable is
+ test('Sigutils tests', test_exe)
+endif