From 68415d040f73ec4e6a0c091bc0652b7825a6e82b Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Mon, 25 Mar 2013 12:43:27 +0000 Subject: [PATCH] [trunk] separate the opj_config file between public and private part to avoid expose unused variables into the public API. --- CMakeLists.txt | 8 +++-- src/lib/openjp2/CMakeLists.txt | 2 +- src/lib/openjp2/openjpeg.c | 1 - src/lib/openjp2/opj_config.h.cmake.in | 34 +------------------ src/lib/openjp2/opj_config_private.h.cmake.in | 31 +++++++++++++++++ src/lib/openjp2/opj_includes.h | 2 +- 6 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 src/lib/openjp2/opj_config_private.h.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb62e61..c55f46f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,8 +211,6 @@ CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) include(TestLargeFiles) OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES) - - #----------------------------------------------------------------------------- # Build Library add_subdirectory(src) @@ -249,6 +247,12 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h @ONLY ) + + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h + @ONLY + ) #----------------------------------------------------------------------------- # Build DOCUMENTATION (not in ALL target and only if Doxygen is found) diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index a6359890..5c87f297 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -5,7 +5,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers) include_directories( - ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h + ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h ) # Defines the source code for the library set(OPENJPEG_SRCS diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c index ec9746f7..e7ca5f80 100644 --- a/src/lib/openjp2/openjpeg.c +++ b/src/lib/openjp2/openjpeg.c @@ -30,7 +30,6 @@ #include #endif /* _WIN32 */ -#include "opj_config.h" #include "opj_includes.h" /** diff --git a/src/lib/openjp2/opj_config.h.cmake.in b/src/lib/openjp2/opj_config.h.cmake.in index d922d116..2f5311b8 100644 --- a/src/lib/openjp2/opj_config.h.cmake.in +++ b/src/lib/openjp2/opj_config.h.cmake.in @@ -1,34 +1,2 @@ -/* create config.h for CMake */ +/* create opj_config.h for CMake */ #cmakedefine OPJ_HAVE_STDINT_H @OPJ_HAVE_STDINT_H@ -#cmakedefine OPJ_HAVE_INTTYPES_H @OPJ_HAVE_INTTYPES_H@ - -#define OPJ_PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Not used by openjp2*/ -/*#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@*/ -/*#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@*/ -/*#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@*/ -/*#cmakedefine HAVE_STRING_H @HAVE_STRING_H@*/ -/*#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@*/ -/*#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ */ -/*#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@*/ - -#cmakedefine _LARGEFILE_SOURCE -#cmakedefine _LARGE_FILES -#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ -#cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@ - - -/* Byte order. */ -/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or -__LITTLE_ENDIAN__ to match the endianness of the architecture being -compiled for. This is not necessarily the same as the architecture of the -machine doing the building. In order to support Universal Binaries on -Mac OS X, we prefer those defines to decide the endianness. -On other platforms we use the result of the TRY_RUN. */ -#if !defined(__APPLE__) -#cmakedefine OPJ_BIG_ENDIAN -#elif defined(__BIG_ENDIAN__) -# define OPJ_BIG_ENDIAN -#endif - diff --git a/src/lib/openjp2/opj_config_private.h.cmake.in b/src/lib/openjp2/opj_config_private.h.cmake.in new file mode 100644 index 00000000..8a02c79d --- /dev/null +++ b/src/lib/openjp2/opj_config_private.h.cmake.in @@ -0,0 +1,31 @@ +/* create opj_config_private.h for CMake */ +#cmakedefine OPJ_HAVE_INTTYPES_H @OPJ_HAVE_INTTYPES_H@ + +#define OPJ_PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Not used by openjp2*/ +/*#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@*/ +/*#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@*/ +/*#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@*/ +/*#cmakedefine HAVE_STRING_H @HAVE_STRING_H@*/ +/*#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@*/ +/*#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ */ +/*#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@*/ + +#cmakedefine _LARGEFILE_SOURCE +#cmakedefine _LARGE_FILES +#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ +#cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@ + +/* Byte order. */ +/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or +__LITTLE_ENDIAN__ to match the endianness of the architecture being +compiled for. This is not necessarily the same as the architecture of the +machine doing the building. In order to support Universal Binaries on +Mac OS X, we prefer those defines to decide the endianness. +On other platforms we use the result of the TRY_RUN. */ +#if !defined(__APPLE__) +#cmakedefine OPJ_BIG_ENDIAN +#elif defined(__BIG_ENDIAN__) +# define OPJ_BIG_ENDIAN +#endif \ No newline at end of file diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h index 82cc9c19..9d74e470 100644 --- a/src/lib/openjp2/opj_includes.h +++ b/src/lib/openjp2/opj_includes.h @@ -32,7 +32,7 @@ * This must be included before any system headers, * since they can react to macro defined there */ -#include "opj_config.h" +#include "opj_config_private.h" /* ==========================================================