clap

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

commit 57d6946b72b5821cdb5118cb3416a25988b5397b
parent 9ec05e3cd62eb82e5dc05f07314eb22ad722490c
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sun, 19 Dec 2021 12:20:25 +0100

Fixes #19

Diffstat:
MCMakeLists.txt | 10+++++++++-
Minclude/clap/entry.h | 2+-
Minclude/clap/host.h | 2+-
Minclude/clap/plugin.h | 2+-
Minclude/clap/version.h | 16+++++++++++-----
Msrc/main.c | 6+++---
6 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 3.17) -cmake_policy(SET CMP0100 NEW) # handle .hh files project(CLAP C CXX) # If you use clap as a submodule of your plugin you need some interface projects @@ -12,6 +11,15 @@ install(DIRECTORY include DESTINATION "${CMAKE_INSTALL_PREFIX}") 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-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) + +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) +endif() diff --git a/include/clap/entry.h b/include/clap/entry.h @@ -11,7 +11,7 @@ extern "C" { // // Every methods must be thread-safe. typedef struct clap_plugin_entry { - clap_version clap_version; // initialized to CLAP_VERSION + clap_version_t clap_version; // initialized to CLAP_VERSION // Must be called fist bool (*init)(const char *plugin_path); diff --git a/include/clap/host.h b/include/clap/host.h @@ -7,7 +7,7 @@ extern "C" { #endif typedef struct clap_host { - clap_version clap_version; // initialized to CLAP_VERSION + clap_version_t clap_version; // initialized to CLAP_VERSION void *host_data; // reserved pointer for the host diff --git a/include/clap/plugin.h b/include/clap/plugin.h @@ -30,7 +30,7 @@ enum { typedef int32_t clap_plugin_type; typedef struct clap_plugin_descriptor { - clap_version clap_version; // initialized to CLAP_VERSION + clap_version_t clap_version; // initialized to CLAP_VERSION const char *id; // eg: "com.u-he.diva" const char *name; // eg: "Diva" diff --git a/include/clap/version.h b/include/clap/version.h @@ -16,17 +16,23 @@ typedef struct clap_version { uint32_t major; uint32_t minor; uint32_t revision; -} clap_version; +} clap_version_t; #ifdef __cplusplus } #endif -#define CLAP_VERSION_MAJOR 0 -#define CLAP_VERSION_MINOR 16 -#define CLAP_VERSION_REVISION 0 +#define CLAP_VERSION_MAJOR ((uint32_t)0) +#define CLAP_VERSION_MINOR ((uint32_t)16) +#define CLAP_VERSION_REVISION ((uint32_t)0) -#define CLAP_VERSION ((clap_version){CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION}) +#ifdef __cplusplus +# define CLAP_VERSION \ + (clap_version_t{CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION}) +#else +# define CLAP_VERSION \ + ((clap_version_t){CLAP_VERSION_MAJOR, CLAP_VERSION_MINOR, CLAP_VERSION_REVISION}) +#endif // 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 @@ -2,6 +2,6 @@ // The purpose of this file is to check that all headers compile -clap_version m = CLAP_VERSION; +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) { return !clap_version_is_compatible(m); } +\ No newline at end of file