diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2013-09-18 14:24:10 -0700 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2013-09-18 15:48:09 -0700 |
commit | d4728dd569da4c7fa262dc1cd4bec21277450dd6 (patch) | |
tree | 5be1b9221b27ca96ac921d4c374cb84b809f53cf | |
parent | be064db44281a9bfa0e63595018df84d0c31e5f1 (diff) |
waffle: Add feature test macro WAFFLE_API_VERSION
This macro controls the API exposed by Waffle's headers. Use it to guard
the new API added in waffle 1.3.
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r-- | cmake/Modules/WaffleDefineVersion.cmake | 11 | ||||
-rw-r--r-- | examples/gl_basic.c | 1 | ||||
-rw-r--r-- | include/waffle/waffle.h | 16 | ||||
-rw-r--r-- | src/waffle/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 |
5 files changed, 26 insertions, 6 deletions
diff --git a/cmake/Modules/WaffleDefineVersion.cmake b/cmake/Modules/WaffleDefineVersion.cmake index a47c81d..43d2fc4 100644 --- a/cmake/Modules/WaffleDefineVersion.cmake +++ b/cmake/Modules/WaffleDefineVersion.cmake @@ -53,3 +53,14 @@ set(waffle_version "${waffle_major_version}.${waffle_minor_version}.${waffle_pat # set(waffle_libname "waffle-${waffle_major_version}") set(waffle_soversion "0") + + +# +# API version. +# +# This gets bumped to x.(y+1) immediately after each waffle-x.y.0 release. +# +math(EXPR waffle_api_version "(${waffle_major_version} << 8) | ${waffle_minor_version}") +if (waffle_patch_version GREATER 89) + math(EXPR waffle_api_version "${waffle_api_version} + 1") +endif() diff --git a/examples/gl_basic.c b/examples/gl_basic.c index efdec8f..5812f1c 100644 --- a/examples/gl_basic.c +++ b/examples/gl_basic.c @@ -34,6 +34,7 @@ /// each buffer swap. #define _POSIX_C_SOURCE 199309L // glibc feature macro for nanosleep. +#define WAFFLE_API_VERSION 0x0103 #include <getopt.h> #include <stdarg.h> diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index d3b1fc9..70815dc 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -139,8 +139,10 @@ enum waffle_enum { WAFFLE_CONTEXT_CORE_PROFILE = 0x0211, WAFFLE_CONTEXT_COMPATIBILITY_PROFILE = 0x0212, +#if WAFFLE_API_VERSION >= 0x0103 WAFFLE_CONTEXT_FORWARD_COMPATIBLE = 0x0215, WAFFLE_CONTEXT_DEBUG = 0x0216, +#endif WAFFLE_RED_SIZE = 0x0201, WAFFLE_GREEN_SIZE = 0x0202, @@ -249,17 +251,19 @@ WAFFLE_API bool waffle_window_show(struct waffle_window *self); WAFFLE_API bool -waffle_window_resize( - struct waffle_window *self, - int32_t width, - int32_t height); - -WAFFLE_API bool waffle_window_swap_buffers(struct waffle_window *self); WAFFLE_API union waffle_native_window* waffle_window_get_native(struct waffle_window *self); +#if WAFFLE_API_VERSION >= 0x0103 +WAFFLE_API bool +waffle_window_resize( + struct waffle_window *self, + int32_t width, + int32_t height); +#endif + // --------------------------------------------------------------------------- // waffle_dl // --------------------------------------------------------------------------- diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt index a743096..b5641d3 100644 --- a/src/waffle/CMakeLists.txt +++ b/src/waffle/CMakeLists.txt @@ -2,6 +2,8 @@ # Applies to all targets in this CMakeLists. # ---------------------------------------------------------------------------- +add_definitions(-DWAFFLE_API_VERSION=${waffle_api_version}) + include_directories( android api diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7a9dd7e..42061a3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,5 @@ +add_definitions(-DWAFFLE_API_VERSION=${waffle_api_version}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(waffle_test) |