Use cmake style define. Fix big endian issue on dual OS (eg. Tiger)
This commit is contained in:
parent
3a8438e1f8
commit
ab9a63bbea
|
@ -109,9 +109,12 @@ ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Test for some required system information.
|
# Test for some required system information.
|
||||||
# For example this macro test the endianness (CMAKE_WORDS_BIGENDIAN)
|
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||||
|
|
||||||
|
# Big endian test:
|
||||||
|
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||||
|
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Setup file for setting custom ctest vars
|
# Setup file for setting custom ctest vars
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
|
@ -134,7 +137,7 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||||
@ONLY IMMEDIATE)
|
@ONLY)
|
||||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
@ -155,51 +158,15 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# opj_config.h generation (1/2)
|
# opj_config.h generation (1/2)
|
||||||
FIND_FILE(HAVE_STRINGS_H_FOUND strings.h)
|
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||||
IF(NOT HAVE_STRINGS_H_FOUND STREQUAL "HAVE_STRINGS_H_FOUND-NOTFOUND")
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||||
FIND_FILE(HAVE_STRINGS_H strings.h)
|
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||||
SET(HAS_STRINGS_H 1)
|
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||||
ENDIF()
|
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||||
FIND_FILE(HAVE_INTTYPES_H_FOUND inttypes.h)
|
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
||||||
IF(NOT HAVE_INTTYPES_H_FOUND STREQUAL "HAVE_INTTYPES_H_FOUND-NOTFOUND")
|
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||||
FIND_FILE(HAVE_INTTYPES_H inttypes.h)
|
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||||
SET(HAS_INTTYPES_H 1)
|
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_MEMORY_H_FOUND memory.h)
|
|
||||||
IF(NOT HAVE_MEMORY_H_FOUND STREQUAL "HAVE_MEMORY_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_MEMORY_H memory.h)
|
|
||||||
SET(HAS_MEMORY_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_STDINT_H_FOUND stdint.h)
|
|
||||||
IF(NOT HAVE_STDINT_H_FOUND STREQUAL "HAVE_STDINT_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_STDINT_H stdint.h)
|
|
||||||
SET(HAS_STDINT_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_STDLIB_H_FOUND stdlib.h)
|
|
||||||
IF(NOT HAVE_STDLIB_H_FOUND STREQUAL "HAVE_STDLIB_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_STDLIB_H stdlib.h)
|
|
||||||
SET(HAS_STDLIB_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_STRING_H_FOUND string.h)
|
|
||||||
IF(NOT HAVE_STRING_H_FOUND STREQUAL "HAVE_STRING_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_STRING_H string.h)
|
|
||||||
SET(HAS_STRING_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_SYS_STAT_H_FOUND sys/stat.h)
|
|
||||||
IF(NOT HAVE_SYS_STAT_H_FOUND STREQUAL "HAVE_SYS_STAT_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_SYS_STAT_H sys/stat.h)
|
|
||||||
SET(HAS_SYS_STAT_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_SYS_TYPES_H_FOUND sys/types.h)
|
|
||||||
IF(NOT HAVE_SYS_TYPES_H_FOUND STREQUAL "HAVE_SYS_TYPES_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_SYS_TYPES_H sys/types.h)
|
|
||||||
SET(HAS_SYS_TYPES_H 1)
|
|
||||||
ENDIF()
|
|
||||||
FIND_FILE(HAVE_UNISTD_H_FOUND unistd.h)
|
|
||||||
IF(NOT HAVE_UNISTD_H_FOUND STREQUAL "HAVE_UNISTD_H_FOUND-NOTFOUND")
|
|
||||||
FIND_FILE(HAVE_UNISTD_H unistd.h)
|
|
||||||
SET(HAS_UNISTD_H 1)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build Library
|
# Build Library
|
||||||
|
@ -247,8 +214,11 @@ IF(BUILD_TESTING)
|
||||||
# Search openjpeg data needed for the tests
|
# Search openjpeg data needed for the tests
|
||||||
# They could be found via svn on the OpenJPEG google code project
|
# They could be found via svn on the OpenJPEG google code project
|
||||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data)
|
PATHS
|
||||||
|
$ENV{OPJ_DATA_ROOT}
|
||||||
|
${CMAKE_SOURCE_DIR}/../data
|
||||||
|
)
|
||||||
|
|
||||||
# For encoding tests we need the path to the ref decoder exe/lib (kakadu)
|
# For encoding tests we need the path to the ref decoder exe/lib (kakadu)
|
||||||
SET (REF_DECODER_BIN_PATH "NOTFOUND" CACHE PATH "Single directory where find the reference decoder binaries to enable encoding test suite.")
|
SET (REF_DECODER_BIN_PATH "NOTFOUND" CACHE PATH "Single directory where find the reference decoder binaries to enable encoding test suite.")
|
||||||
|
|
|
@ -1,23 +1,37 @@
|
||||||
/* create config.h for CMake */
|
/* create config.h for CMake */
|
||||||
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
|
|
||||||
#cmakedefine HAVE_INTTYPES_H @HAS_INTTYPES_H@
|
#cmakedefine HAVE_INTTYPES_H
|
||||||
#cmakedefine HAVE_MEMORY_H @HAS_MEMORY_H@
|
#cmakedefine HAVE_MEMORY_H
|
||||||
#cmakedefine HAVE_STDINT_H @HAS_STDINT_H@
|
#cmakedefine HAVE_STDINT_H
|
||||||
#cmakedefine HAVE_STDLIB_H @HAS_STDLIB_H@
|
#cmakedefine HAVE_STDLIB_H
|
||||||
#cmakedefine HAVE_STRINGS_H @HAS_STRINGS_H@
|
#cmakedefine HAVE_STRINGS_H
|
||||||
#cmakedefine HAVE_STRING_H @HAS_STRING_H@
|
#cmakedefine HAVE_STRING_H
|
||||||
#cmakedefine HAVE_SYS_STAT_H @HAS_SYS_STAT_H@
|
#cmakedefine HAVE_SYS_STAT_H
|
||||||
#cmakedefine HAVE_SYS_TYPES_H @HAS_SYS_TYPES_H@
|
#cmakedefine HAVE_SYS_TYPES_H
|
||||||
#cmakedefine HAVE_UNISTD_H @HAS_UNISTD_H@
|
#cmakedefine HAVE_UNISTD_H
|
||||||
#cmakedefine HAVE_LIBPNG @HAVE_LIBPNG@
|
#cmakedefine HAVE_LIBPNG
|
||||||
#cmakedefine HAVE_PNG_H @HAVE_PNG_H@
|
#cmakedefine HAVE_PNG_H
|
||||||
#cmakedefine HAVE_LIBTIFF @HAVE_LIBTIFF@
|
#cmakedefine HAVE_LIBTIFF
|
||||||
#cmakedefine HAVE_TIFF_H @HAVE_TIFF_H@
|
#cmakedefine HAVE_TIFF_H
|
||||||
|
|
||||||
#cmakedefine HAVE_LIBLCMS1 @HAVE_LIBLCMS1@
|
#cmakedefine HAVE_LIBLCMS1
|
||||||
#cmakedefine HAVE_LIBLCMS2 @HAVE_LIBLCMS2@
|
#cmakedefine HAVE_LIBLCMS2
|
||||||
#cmakedefine HAVE_LCMS1_H @HAVE_LCMS1_H@
|
#cmakedefine HAVE_LCMS1_H
|
||||||
#cmakedefine HAVE_LCMS2_H @HAVE_LCMS2_H@
|
#cmakedefine HAVE_LCMS2_H
|
||||||
|
|
||||||
|
#cmakedefine OPJ_BIG_ENDIAN @CMAKE_WORDS_BIGENDIAN@
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
#cmakedefine OPJ_BIG_ENDIAN @CMAKE_WORDS_BIGENDIAN@
|
|
Loading…
Reference in New Issue