From 4cf3715a9a4d42d48553093ec7cbfe728334b798 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Sun, 22 Aug 2021 11:50:59 +0700 Subject: [PATCH] add option to enable/disable CPP API --- CMakeLists.txt | 5 +++++ src/gd_io_stream.cxx | 5 +++++ src/gdpp.cxx | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cab71c0..862d8e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ OPTION(ENABLE_HEIF "Enable HEIF support" 0) OPTION(ENABLE_AVIF "Enable AVIF support" 0) OPTION(ENABLE_RAQM "Enable RAQM support" 0) OPTION(ENABLE_ASAN "Enable (gcc) ASAN support" 0) +OPTION(ENABLE_CPP "Enable CPP GD API" 1) if (BUILD_TEST) ENABLE_TESTING() @@ -110,6 +111,10 @@ else (USE_EXT_GD) include(AC_HEADER_STDC) include(CheckPrototypeExists) + if (ENABLE_CPP) + SET(ENABLE_CPP_API 1) + endif (ENABLE_CPP) + if (ENABLE_GD_FORMATS) FIND_PACKAGE(ZLIB REQUIRED) endif (ENABLE_GD_FORMATS) diff --git a/src/gd_io_stream.cxx b/src/gd_io_stream.cxx index 603780e..d4f2749 100644 --- a/src/gd_io_stream.cxx +++ b/src/gd_io_stream.cxx @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#ifdef ENABLE_CPP_API /* ***************************************************************************** ** Initial file written and documented by: ** Kevin Shepherd December 2007 @@ -142,3 +146,4 @@ void ostreamIOCtx::FreeCtx(gdIOCtxPtr ctx) } #endif /* __cplusplus */ +#endif //ENABLE_CPP_API \ No newline at end of file diff --git a/src/gdpp.cxx b/src/gdpp.cxx index 5e579da..2a4bf58 100644 --- a/src/gdpp.cxx +++ b/src/gdpp.cxx @@ -1,3 +1,9 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef ENABLE_CPP_API + /* ***************************************************************************** ** Initial file written and documented by: ** Kevin Shepherd December 2007 @@ -259,3 +265,4 @@ std::istream & operator>> (std::istream & in, GD::Image & img) } #endif /* __cplusplus */ +#endif //ENABLE_CPP_API \ No newline at end of file