1
1

Correctly check the data type alignment for VS 2010 environment, and set the event include paths to global level, in order to make the clever VS load them.

This commit was SVN r23534.
Этот коммит содержится в:
Shiqing Fan 2010-07-30 14:25:15 +00:00
родитель d8ec83f939
Коммит ea7bf2bd9e
5 изменённых файлов: 110 добавлений и 31 удалений

Просмотреть файл

@ -20,10 +20,16 @@ MACRO(C_GET_ALIGNMENT TYPE LANG NAME)
MESSAGE( STATUS "Check alignment of ${TYPE} in ${LANG}...")
FILE (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/c_get_${NAME}_alignment.${LANG}"
"#include <stddef.h>
SET(INCLUDE_HEADERS "#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>")
IF(HAVE_STDINT_H)
SET(INCLUDE_HEADERS "${INCLUDE_HEADERS}\n#include <stdint.h>\n")
ENDIF(HAVE_STDINT_H)
FILE (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/c_get_${NAME}_alignment.${LANG}"
"${INCLUDE_HEADERS}
int main(){
char diff;
struct foo {char a; ${TYPE} b;};

Просмотреть файл

@ -188,6 +188,8 @@ OMPI_CHECK_INCLUDE_FILE (signal.h HAVE_SIGNAL_H)
OMPI_CHECK_INCLUDE_FILE (stdarg.h HAVE_STDARG_H)
OMPI_CHECK_INCLUDE_FILE (stdint.h HAVE_STDINT_H)
OMPI_CHECK_INCLUDE_FILE (stdlib.h HAVE_STDLIB_H)
OMPI_CHECK_INCLUDE_FILE (string.h HAVE_STRING_H)

Просмотреть файл

@ -779,38 +779,108 @@ ENDIF(HAVE_PTRDIFF_T)
#The same logic as in opal_stdint.h
#8-bit
IF(NOT HAVE_UINT8_T AND SIZEOF_CHAR EQUAL 1)
IF(SIZEOF_CHAR EQUAL 1)
IF(NOT HAVE_INT8_T)
OMPI_DEF(OPAL_ALIGNMENT_INT8 ${OPAL_ALIGNMENT_CHAR} "Alignment of `int8_t'." 0 1)
ELSE(NOT HAVE_UINT8_T AND SIZEOF_CHAR EQUAL 1)
ELSE(NOT HAVE_INT8_T)
OMPI_DEF(OPAL_ALIGNMENT_INT8 ${OPAL_ALIGNMENT_INT8_T} "Alignment of `int8_t'." 0 1)
ENDIF(NOT HAVE_INT8_T)
IF(NOT HAVE_UINT8_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT8 ${OPAL_ALIGNMENT_CHAR} "Alignment of `uint8_t'." 0 1)
ELSE(NOT HAVE_UINT8_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT8 ${OPAL_ALIGNMENT_UINT8_T} "Alignment of `uint8_t'." 0 1)
ENDIF(NOT HAVE_UINT8_T)
ELSE(SIZEOF_CHAR EQUAL 1)
MESSAGE(FATAL_ERROR "Failed to define 8-bit types.")
ENDIF(NOT HAVE_UINT8_T AND SIZEOF_CHAR EQUAL 1)
ENDIF(SIZEOF_CHAR EQUAL 1)
#16-bit
IF(NOT HAVE_INT16_T AND SIZEOF_SHORT EQUAL 2)
IF(SIZEOF_SHORT EQUAL 2)
IF(NOT HAVE_INT16_T)
OMPI_DEF(OPAL_ALIGNMENT_INT16 ${OPAL_ALIGNMENT_SHORT} "Alignment of `int16_t'." 0 1)
ELSE(NOT HAVE_INT16_T AND SIZEOF_SHORT EQUAL 2)
MESSAGE(FATAL_ERROR "Failed to define 8-bit types.")
ENDIF(NOT HAVE_INT16_T AND SIZEOF_SHORT EQUAL 2)
ELSE(NOT HAVE_INT16_T)
OMPI_DEF(OPAL_ALIGNMENT_INT16 ${OPAL_ALIGNMENT_INT16_T} "Alignment of `int16_t'." 0 1)
ENDIF(NOT HAVE_INT16_T)
IF(NOT HAVE_UINT16_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT16 ${OPAL_ALIGNMENT_SHORT} "Alignment of `uint16_t'." 0 1)
ELSE(NOT HAVE_UINT16_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT16 ${OPAL_ALIGNMENT_UINT16_T} "Alignment of `uint16_t'." 0 1)
ENDIF(NOT HAVE_UINT16_T)
ELSE(SIZEOF_SHORT EQUAL 2)
MESSAGE(FATAL_ERROR "Failed to define 16-bit types.")
ENDIF(SIZEOF_SHORT EQUAL 2)
#32-bit
IF(NOT HAVE_INT32_T AND SIZEOF_INT EQUAL 4)
IF(SIZEOF_INT EQUAL 4)
IF(NOT HAVE_INT32_T)
OMPI_DEF(OPAL_ALIGNMENT_INT32 ${OPAL_ALIGNMENT_INT} "Alignment of `int32_t'." 0 1)
ELSEIF(NOT HAVE_INT32_T AND SIZEOF_LONG EQUAL 4)
ELSE(NOT HAVE_INT32_T)
OMPI_DEF(OPAL_ALIGNMENT_INT32 ${OPAL_ALIGNMENT_INT32_T} "Alignment of `int32_t'." 0 1)
ENDIF(NOT HAVE_INT32_T)
IF(NOT HAVE_UINT32_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT32 ${OPAL_ALIGNMENT_INT} "Alignment of `uint32_t'." 0 1)
ELSE(NOT HAVE_UINT32_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT32 ${OPAL_ALIGNMENT_UINT32_T} "Alignment of `uint32_t'." 0 1)
ENDIF(NOT HAVE_UINT32_T)
ELSEIF(SIZEOF_LONG EQUAL 4)
IF(NOT HAVE_INT32_T)
OMPI_DEF(OPAL_ALIGNMENT_INT32 ${OPAL_ALIGNMENT_LONG} "Alignment of `int32_t'." 0 1)
ELSE(NOT HAVE_INT32_T AND SIZEOF_INT EQUAL 4)
ELSE(NOT HAVE_INT32_T)
OMPI_DEF(OPAL_ALIGNMENT_INT32 ${OPAL_ALIGNMENT_INT32_T} "Alignment of `int32_t'." 0 1)
ENDIF(NOT HAVE_INT32_T)
IF(NOT HAVE_UINT32_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT32 ${OPAL_ALIGNMENT_LONG} "Alignment of `uint32_t'." 0 1)
ELSE(NOT HAVE_UINT32_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT32 ${OPAL_ALIGNMENT_UINT32_T} "Alignment of `uint32_t'." 0 1)
ENDIF(NOT HAVE_UINT32_T)
ELSE(SIZEOF_INT EQUAL 4)
MESSAGE(FATAL_ERROR "Failed to define 8-bit types.")
ENDIF(NOT HAVE_INT32_T AND SIZEOF_INT EQUAL 4)
ENDIF(SIZEOF_INT EQUAL 4)
#64-bit
IF(NOT HAVE_INT64_T AND SIZEOF_INT EQUAL 8)
IF(SIZEOF_INT EQUAL 8)
IF(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_INT} "Alignment of `int64_t'." 0 1)
ELSEIF(NOT HAVE_INT64_T AND SIZEOF_LONG EQUAL 8)
ELSE(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_INT64_T} "Alignment of `int64_t'." 0 1)
ENDIF(NOT HAVE_INT64_T)
IF(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_INT} "Alignment of `uint64_t'." 0 1)
ELSE(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_UINT64_T} "Alignment of `uint64_t'." 0 1)
ENDIF(NOT HAVE_UINT64_T)
ELSEIF(SIZEOF_LONG EQUAL 8)
IF(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_LONG} "Alignment of `int64_t'." 0 1)
ELSEIF(NOT HAVE_INT64_T AND HAVE_LONG_LONG AND SIZEOF_LONG_LONG EQUAL 8)
ELSE(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_INT64_T} "Alignment of `int64_t'." 0 1)
ENDIF(NOT HAVE_INT64_T)
IF(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_LONG} "Alignment of `uint64_t'." 0 1)
ELSE(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_UINT64_T} "Alignment of `uint64_t'." 0 1)
ENDIF(NOT HAVE_UINT64_T)
ELSEIF(HAVE_LONG_LONG AND SIZEOF_LONG_LONG EQUAL 8)
IF(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_LONG_LONG} "Alignment of `int64_t'." 0 1)
ELSE(NOT HAVE_INT64_T AND SIZEOF_INT EQUAL 8)
ELSE(NOT HAVE_INT64_T)
OMPI_DEF(OPAL_ALIGNMENT_INT64 ${OPAL_ALIGNMENT_INT64_T} "Alignment of `int64_t'." 0 1)
ENDIF(NOT HAVE_INT64_T)
IF(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_LONG_LONG} "Alignment of `uint64_t'." 0 1)
ELSE(NOT HAVE_UINT64_T)
OMPI_DEF(OPAL_ALIGNMENT_UINT64 ${OPAL_ALIGNMENT_UINT64_T} "Alignment of `uint64_t'." 0 1)
ENDIF(NOT HAVE_UINT64_T)
ELSE(SIZEOF_INT EQUAL 8)
MESSAGE(FATAL_ERROR "Failed to define 8-bit types.")
ENDIF(NOT HAVE_INT64_T AND SIZEOF_INT EQUAL 8)
ENDIF(SIZEOF_INT EQUAL 8)
ENDMACRO(BEGIN_CONFIGURE)

Просмотреть файл

@ -18,10 +18,8 @@ FOREACH (FILE ${COMPAT_SYS_FILES})
ENDFOREACH (FILE)
IF(WIN32)
# include special path for these files
SET_SOURCE_FILES_PROPERTIES(event/event.c event/log.c event/signal.c event/select.c event/evutil.c event/WIN32-Code/win32.c
PROPERTIES COMPILE_FLAGS "${OMPI_C_INCLUDE_DIR}\"${PROJECT_SOURCE_DIR}/event/compat\"
${OMPI_C_INCLUDE_DIR}\"${PROJECT_SOURCE_DIR}/event/WIN32-Code\"")
INCLUDE_DIRECTORIES ("${PROJECT_SOURCE_DIR}/event/compat"
"${PROJECT_SOURCE_DIR}/event/WIN32-Code")
SET(EVENT_FILES
${EVENT_FILES}
event-internal.h

Просмотреть файл

@ -71,6 +71,9 @@
#include <signal.h>
#include <conio.h>
#include <fcntl.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
/**
* For all file io operations
@ -217,7 +220,7 @@ typedef unsigned int uint;
#define sigset_t int
#define in_addr_t uint32_t
#define _Bool BOOL
#define _Bool bool
/*
* No syslog.h on Windows, but these have to be defined somehow.