clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 55224a66e6c674d3820c31f0ccd3d75a6cefad20
parent 7adbda2291210f1b461ff6a20b7d0bff5f6b0213
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sat,  5 Feb 2022 14:55:29 +0100

rework testing

Diffstat:
MCMakeLists.txt | 29+++++++++++++++++------------
Minclude/clap/version.h | 3++-
Msrc/main.c | 10+++++-----
Msrc/main.cc | 2+-
4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.17) +enable_testing() project(CLAP C CXX) # If you use clap as a submodule of your plugin you need some interface projects @@ -9,22 +10,26 @@ target_include_directories(clap-core INTERFACE include) install(DIRECTORY include DESTINATION "." OPTIONAL EXCLUDE_FROM_ALL) -add_executable(clap-compile-test-c EXCLUDE_FROM_ALL src/main.c) -target_link_libraries(clap-compile-test-c clap-core) -set_target_properties(clap-compile-test-c PROPERTIES C_STANDARD 11) +add_executable(clap-compile-c EXCLUDE_FROM_ALL src/main.c) +target_link_libraries(clap-compile-c clap-core) +set_target_properties(clap-compile-c PROPERTIES C_STANDARD 11) -add_executable(clap-compile-test-cpp EXCLUDE_FROM_ALL src/main.cc) -target_link_libraries(clap-compile-test-cpp clap-core) -set_target_properties(clap-compile-test-cpp PROPERTIES CXX_STANDARD 14) - -add_custom_target(clap-compile-tests DEPENDS clap-compile-test-c clap-compile-test-cpp) +add_executable(clap-compile-cpp EXCLUDE_FROM_ALL src/main.cc) +target_link_libraries(clap-compile-cpp clap-core) +set_target_properties(clap-compile-cpp PROPERTIES CXX_STANDARD 14) if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") - target_compile_options(clap-compile-test-c PRIVATE -Wall -Wextra -pedantic) - target_compile_options(clap-compile-test-cpp PRIVATE -Wall -Wextra -pedantic) + target_compile_options(clap-compile-c PRIVATE -Wall -Wextra -pedantic) + target_compile_options(clap-compile-cpp PRIVATE -Wall -Wextra -pedantic) endif() if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") - target_compile_options(clap-compile-test-c PRIVATE -Werror=pragma-pack) - target_compile_options(clap-compile-test-cpp PRIVATE -Werror=pragma-pack) + target_compile_options(clap-compile-c PRIVATE -Werror=pragma-pack) + target_compile_options(clap-compile-cpp PRIVATE -Werror=pragma-pack) endif() + +add_test(NAME test-clap-compile-c COMMAND clap-compile-c) +add_test(NAME test-clap-compile-cpp COMMAND clap-compile-cpp) + +add_custom_target(clap-tests) +add_dependencies(clap-tests clap-compile-c clap-compile-cpp) diff --git a/include/clap/version.h b/include/clap/version.h @@ -29,7 +29,8 @@ static CLAP_CONSTEXPR const uint32_t CLAP_VERSION_MINOR = 18; static CLAP_CONSTEXPR const uint32_t CLAP_VERSION_REVISION = 0; static CLAP_CONSTEXPR const clap_version_t CLAP_VERSION = { - CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION}; + CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION +}; // For version 0, we require the same minor version because // we may still break the ABI at this point diff --git a/src/main.c b/src/main.c @@ -1,7 +1,7 @@ #include <clap/clap.h> // The purpose of this file is to check that all headers compile - -clap_version_t m = CLAP_VERSION; - -int main(int argc, char **argv) { return !clap_version_is_compatible(m); } -\ No newline at end of file +int main(int argc, char **argv) { + clap_version_t m = CLAP_VERSION; + return !clap_version_is_compatible(m); +} +\ No newline at end of file diff --git a/src/main.cc b/src/main.cc @@ -2,6 +2,6 @@ // The purpose of this file is to check that all headers compile -clap_version m = CLAP_VERSION; +static const constexpr clap_version m = CLAP_VERSION; int main(int, char **) { return !clap_version_is_compatible(m); } \ No newline at end of file