Commit bd340909 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

More checks with cmake

parent d81e226f
#
# Check if the system supports 64 bit streams
#
# CHECK_FOR_64BIT_STREAMS - macro which checks the existence of 64 bit streams
# VARIABLE - variable to return result
#
MACRO(CHECK_FOR_64BIT_STREAMS VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS ${CMAKE_REQUIRED_FLAGS})
IF(CMAKE_NO_ANSI_STREAM_HEADERS)
SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS
"${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DNO_ANSI")
ENDIF(CMAKE_NO_ANSI_STREAM_HEADERS)
IF(SIZEOF_LONG_LONG)
SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS
"${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DSIZEOF_LONG_LONG")
ENDIF(SIZEOF_LONG_LONG)
IF(SIZEOF___INT64)
SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS
"${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DSIZEOF___INT64")
ENDIF(SIZEOF___INT64)
MESSAGE(STATUS "Check if system supports 64 bit streams")
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${Xdmf_SOURCE_DIR}/CMake/CheckFor64BitStreams.cxx
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
MESSAGE(STATUS "Check if system supports 64 bit streams - yes")
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
ELSE(${VARIABLE})
MESSAGE(STATUS "Check if system supports 64 bit streams - no")
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the system supports 64 bit streams "
"failed with the following output:\n"
"${OUTPUT}\n" APPEND)
ENDIF(${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_FOR_64BIT_STREAMS)
#ifdef NO_ANSI
# include <iostream.h>
#else
# include <iostream>
#endif
#if defined(SIZEOF_LONG_LONG)
typedef long long t64;
#elif defined(SIZEOF___INT64)
typedef __int64 t64;
#else
#error No 64 bit types
#endif
int main()
{
t64 foo;
cin >> foo;
return 0;
}
......@@ -4,7 +4,7 @@ PROJECT(ICE)
SET(ICE_YEAR 03)
SET(ICE_MONTH 08)
SET(ICE_VERSION
"${ICE_YEAR}.${ICE_MONTH)")
"${ICE_YEAR}.${ICE_MONTH)")
# Platform configuration tests.
INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
......@@ -27,7 +27,7 @@ SET(ICE_SIZEOF_SHORT ${CMAKE_SIZEOF_SHORT})
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
MESSAGE(STATUS "Finding a 64 Bit Integer")
IF(WIN32)
CHECK_TYPE_SIZE(__int64 SIZEOF___INT64)
CHECK_TYPE_SIZE(__int64 SIZEOF___INT64)
ENDIF(WIN32)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
......@@ -42,36 +42,39 @@ SET(ICE_8_INT_VALID 1)
SET(ICE_8_INT "unsigned char")
# These should be Valid
IF(${ICE_SIZEOF_FLOAT} MATCHES 4)
SET(ICE_32_FLOAT_VALID 1)
SET(ICE_FLOAT "float")
SET(ICE_32_FLOAT "float")
SET(ICE_32_FLOAT_VALID 1)
SET(ICE_FLOAT "float")
SET(ICE_32_FLOAT "float")
ELSE (${ICE_SIZEOF_FLOAT} MATCHES 4)
MESSAGE(SEND_ERROR "Can't Find a 32 Bit Float")
MESSAGE(SEND_ERROR "Can't Find a 32 Bit Float")
ENDIF (${ICE_SIZEOF_FLOAT} MATCHES 4)
IF(${ICE_SIZEOF_DOUBLE} MATCHES 8)
SET(ICE_64_FLOAT_VALID 1)
SET(ICE_DOUBLE "double")
SET(ICE_64_FLOAT "double")
SET(ICE_64_FLOAT_VALID 1)
SET(ICE_DOUBLE "double")
SET(ICE_64_FLOAT "double")
ELSE (${ICE_SIZEOF_DOUBLE} MATCHES 8)
MESSAGE(SEND_ERROR "Can't Find a 64 Bit Float")
MESSAGE(SEND_ERROR "Can't Find a 64 Bit Float")
ENDIF (${ICE_SIZEOF_DOUBLE} MATCHES 8)
# These are sometimes different
IF(${ICE_SIZEOF_INT} MATCHES 4)
SET(ICE_32_INT_VALID 1)
SET(ICE_32_INT "int")
SET(ICE_32_U_INT "unsigned int")
SET(ICE_32_S_INT "int")
SET(ICE_32_INT_VALID 1)
SET(ICE_32_INT "int")
SET(ICE_32_U_INT "unsigned int")
SET(ICE_32_S_INT "int")
ELSE (${ICE_SIZEOF_INT} MATCHES 4)
IF(${ICE_SIZEOF_LONG} MATCHES 4)
SET(ICE_32_INT_VALID 1)
SET(ICE_32_INT "long")
SET(ICE_32_U_INT "unsigned long")
SET(ICE_32_S_INT "long")
ELSE(${ICE_SIZEOF_LONG} MATCHES 4)
MESSAGE(SEND_ERROR "Can't Find a 32 Bit Integer")
ENDIF(${ICE_SIZEOF_LONG} MATCHES 4)
IF(${ICE_SIZEOF_LONG} MATCHES 4)
SET(ICE_32_INT_VALID 1)
SET(ICE_32_INT "long")
SET(ICE_32_U_INT "unsigned long")
SET(ICE_32_S_INT "long")
ELSE(${ICE_SIZEOF_LONG} MATCHES 4)
MESSAGE(SEND_ERROR "Can't Find a 32 Bit Integer")
ENDIF(${ICE_SIZEOF_LONG} MATCHES 4)
ENDIF(${ICE_SIZEOF_INT} MATCHES 4)
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
INCLUDE(${Xdmf_SOURCE_DIR}/CMake/CheckFor64BitStreams.cmake)
CHECK_FOR_64BIT_STREAMS(ICE_HAVE_64BIT_STREAMS)
# Find include files
FIND_PATH(ICE_HAVE_FCNTL fcntl.h /usr/include /usr/include/sys)
......@@ -81,7 +84,7 @@ MARK_AS_ADVANCED(ICE_HAVE_FCNTL ICE_HAVE_NETINET ICE_HAVE_MMAN)
#Create IceConfig.h
CONFIGURE_FILE(
${ICE_SOURCE_DIR}/IceConfig.h.in
${ICE_BINARY_DIR}/IceConfig.h
)
${ICE_SOURCE_DIR}/IceConfig.h.in
${ICE_BINARY_DIR}/IceConfig.h
)
/* IceConfig.h. Generated automatically by configure. */
/********************************************************/
/* */
/* ICE Host Dependent Configuration File */
/* */
/********************************************************/
#ifdef _WIN32
# include "windows.h"
#endif
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef ICE_WORDS_BIGENDIAN */
/* The number of bytes in a double. */
#define ICE_SIZEOF_DOUBLE 8
/* The number of bytes in a float. */
#define ICE_SIZEOF_FLOAT 4
/* The number of bytes in a int. */
#define ICE_SIZEOF_INT 4
/* The number of bytes in a unsigned long long. */
#define ICE_SIZEOF_UNSIGNED_LONG_LONG 8
/* Define if you have the GL library (-lGL). */
#define ICE_HAVE_LIBGL 1
/* Define if you have the X11 library (-lX11). */
/* #undef ICE_HAVE_LIBX11 */
/* Define if you have the Xmu library (-lXmu). */
/* #undef ICE_HAVE_LIBXMU */
/* Define if you have the curses library (-lcurses). */
#define ICE_HAVE_LIBCURSES 1
/* Define if you have the dl library (-ldl). */
#define ICE_HAVE_LIBDL 1
/* Define if you have the m library (-lm). */
#define ICE_HAVE_LIBM 1
/* Define if you have the mpi library (-lmpi). */
#define ICE_HAVE_LIBMPI 1
/* Define if you have the sun library (-lsun). */
/* #undef ICE_HAVE_LIBSUN */
#define ICE_SYSTEM "Linux-2.4.9-34smp"
#define ICE_HOST Linux
#define ICE_BYTE_ORDER_LITTLE
#define ICE_HAVE_FCNTL
#ifndef _WIN32
# define ICE_HAVE_NETINET
# define ICE_HAVE_MMAN
# define ICE_have_64_bit_int
#endif
/* Size of Atomic Datum */
typedef void ICE_VOID;
typedef void * ICE_PTR;
typedef char ICE_CHAR;
typedef unsigned char ICE_8_INT;
typedef int ICE_32_INT;
#ifdef _WIN32
typedef unsigned long ICE_64_INT;
#else
typedef unsigned long long ICE_64_INT;
#endif
typedef float ICE_FLOAT;
typedef double ICE_DOUBLE;
/********************************************************/
......@@ -93,6 +93,7 @@
# error "64 bit long not defined"
#endif
#cmakedefine ICE_HAVE_64BIT_STREAMS
#cmakedefine ICE_HAVE_FCNTL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment