Enhance the support of endianess with cmake and inside the code (credit to Winfried)
This commit is contained in:
parent
7062c01b68
commit
ba0c271774
3
CHANGES
3
CHANGES
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
|||
! : changed
|
||||
+ : added
|
||||
|
||||
September 21, 2011
|
||||
+ [mickael] Enhance the support of endianess with cmake and inside the code (credit to Winfried)
|
||||
|
||||
September 20, 2011
|
||||
* [mickael] WIP: fixed build issues with MJ2 option ON
|
||||
* [mickael] WIP: fixed build issues with JPWL option ON
|
||||
|
|
|
@ -39,12 +39,13 @@ SET(OPENJPEG_LIBRARY_PROPERTIES
|
|||
SOVERSION "${OPENJPEG_VERSION_MAJOR}"
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
SET(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/CMake
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||
# warnings
|
||||
IF(WIN32)
|
||||
|
@ -108,6 +109,7 @@ ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
|||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test for some required system information.
|
||||
# For example this macro test the endianness (CMAKE_WORDS_BIGENDIAN)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -94,7 +94,7 @@ struct tga_header
|
|||
|
||||
static unsigned short get_ushort(unsigned short val) {
|
||||
|
||||
#ifdef ORDER_BIGENDIAN
|
||||
#ifdef OPJ_BIG_ENDIAN
|
||||
return( ((val & 0xff) << 8) + (val >> 8) );
|
||||
#else
|
||||
return( val );
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -49,7 +50,6 @@
|
|||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -44,7 +45,6 @@
|
|||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "j2k.h"
|
||||
#include "jp2.h"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -89,27 +89,19 @@ void cio_skip(opj_cio_t *cio, int n);
|
|||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#if defined(OPJ_BIG_ENDIAN)
|
||||
#if !defined(OPJ_LITTLE_ENDIAN)
|
||||
#define opj_write_bytes opj_write_bytes_BE
|
||||
#define opj_read_bytes opj_read_bytes_BE
|
||||
#define opj_write_double opj_write_double_BE
|
||||
#define opj_read_double opj_read_double_BE
|
||||
#define opj_write_float opj_write_float_BE
|
||||
#define opj_read_float opj_read_float_BE
|
||||
#else
|
||||
#error "Either BIG_ENDIAN or LITTLE_ENDIAN must be #defined, but not both."
|
||||
#endif
|
||||
#else
|
||||
#if defined(OPJ_LITTLE_ENDIAN)
|
||||
#define opj_write_bytes opj_write_bytes_LE
|
||||
#define opj_read_bytes opj_read_bytes_LE
|
||||
#define opj_write_double opj_write_double_LE
|
||||
#define opj_read_double opj_read_double_LE
|
||||
#define opj_write_float opj_write_float_LE
|
||||
#define opj_read_float opj_read_float_LE
|
||||
#else
|
||||
#error "Either BIG_ENDIAN or LITTLE_ENDIAN must be #defined, but not none."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -20,9 +20,4 @@
|
|||
#cmakedefine HAVE_LCMS1_H @HAVE_LCMS1_H@
|
||||
#cmakedefine HAVE_LCMS2_H @HAVE_LCMS2_H@
|
||||
|
||||
#cmakedefine CMAKE_WORDS_BIGENDIAN
|
||||
#ifdef CMAKE_WORDS_BIGENDIAN
|
||||
#define OPJ_BIG_ENDIAN
|
||||
#else
|
||||
#define OPJ_LITTLE_ENDIAN
|
||||
#endif
|
||||
#cmakedefine OPJ_BIG_ENDIAN @CMAKE_WORDS_BIGENDIAN@
|
Loading…
Reference in New Issue