Commit 14e8f637 authored by Dan Lipsa's avatar Dan Lipsa

Build static hdf5 and build on VS 2003 7.1

Change-Id: I7fbcc5328443557729e2f5f6ea90df9438e8a3df
parent f62600ac
......@@ -3,6 +3,7 @@ if(POLICY CMP0025)
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
cmake_policy(SET CMP0054 NEW) # CMake 3.1
endif()
PROJECT (HDF5 C CXX)
......@@ -404,7 +405,12 @@ endif (CMAKE_BUILD_TYPE MATCHES Debug)
#-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
if (CMAKE_BUILD_TYPE MATCHES Debug)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -finline-functions -fno-common")
if (WIN32)
# timezone is not included in time.h on mingw if -std=c99
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -finline-functions -fno-common")
else ()
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -finline-functions -fno-common")
endif()
else (CMAKE_BUILD_TYPE MATCHES Debug)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -fomit-frame-pointer -finline-functions -fno-common")
endif (CMAKE_BUILD_TYPE MATCHES Debug)
......@@ -866,6 +872,15 @@ if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
endif (HDF5_BUILD_HL_LIB)
endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
IF (CMAKE_SYSTEM_NAME MATCHES Linux AND BUILD_STATIC_EXECS)
# fix a link error caused by
# warning: Using 'getpwuid' in statically linked applications
# requires at runtime the shared libraries from the glibc version
# used for linking
SET (H5_HAVE_GETPWUID "OFF")
ENDIF ()
#-----------------------------------------------------------------------------
# Generate the H5pubconf.h file containing user settings needed by compilation
#-----------------------------------------------------------------------------
......
......@@ -853,6 +853,10 @@ H5free_memory(void *mem)
*
*-------------------------------------------------------------------------
*/
/* Visual Studio 2003 7.1 does not define _In_ */
#if (_MSC_VER <= 1310)
#define _In_
#endif
BOOL WINAPI
DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
{
......
......@@ -128,10 +128,15 @@ typedef struct H5FD_stdio_t {
/* Use similar structure as in H5private.h by defining Windows stuff first. */
#ifdef H5_HAVE_WIN32_API
#ifndef H5_HAVE_MINGW
#define file_fseek _fseeki64
#define file_offset_t __int64
#define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */
#if (_MSC_VER > 1310)
#define file_fseek _fseeki64
#define file_ftell _ftelli64
#else
#define file_fseek fseek
#define file_ftell ftell
#endif
#endif /* H5_HAVE_MINGW */
#endif /* H5_HAVE_WIN32_API */
......
......@@ -515,7 +515,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
uint8_t *old_image; /* Old address of chunk's image in memory */
size_t old_size; /* Old size of chunk */
htri_t extended; /* If chunk can be extended */
size_t extend_msg; /* Index of null message to extend */
size_t extend_msg = 0; /* Index of null message to extend */
hbool_t extended_msg = FALSE; /* Whether an existing message was extended */
uint8_t new_size_flags = 0; /* New chunk #0 size flags */
hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */
......
......@@ -715,7 +715,15 @@ int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
int count = -1;
if (size != 0)
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
{
#if (_MSC_VER > 1310)
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
#else
/* Visual Studio 2003 7.1 does not define vsnprintf_s */
size_t c = size - 1;
count = _vsnprintf(str, c, format, ap);
#endif
}
if (count == -1)
count = _vscprintf(format, ap);
......
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