diff options
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 13 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 7 | ||||
-rw-r--r-- | src/H5win32defs.h | 6 |
3 files changed, 16 insertions, 10 deletions
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 35ec3e9..a951429 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -66,15 +66,12 @@ set (WINDOWS) if (MINGW) set (${HDF_PREFIX}_HAVE_MINGW 1) set (WINDOWS 1) # MinGW tries to imitate Windows - set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") + set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) endif () if (WIN32) - set (${HDF_PREFIX}_HAVE_WIN32_API 1) - set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") - if (NOT UNIX AND NOT MINGW) + if (NOT UNIX) set (WINDOWS 1) - set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) endif () @@ -82,6 +79,9 @@ if (WIN32) endif () if (WINDOWS) + set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") + set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) set (${HDF_PREFIX}_HAVE_SYS_STAT_H 1) set (${HDF_PREFIX}_HAVE_SYS_TYPES_H 1) @@ -99,9 +99,6 @@ if (WINDOWS) set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) - if (MINGW) - set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) - endif () set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 0a4598d..d145607 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -179,7 +179,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) endif () else () - if (CYGWIN) + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + elseif (CYGWIN) set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 2ae2575..d439379 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -52,7 +52,11 @@ typedef __int64 h5_stat_size_t; /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. */ +#ifndef H5_HAVE_MINGW #define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__) +#else +#define HDopen(S,F,...) Wopen_utf8(S,F,##__VA_ARGS__) +#endif #define HDread(F,M,Z) _read(F,M,Z) #define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) @@ -128,7 +132,7 @@ extern "C" { H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL const wchar_t *H5_get_utf16_str(const char *s); - H5_DLL int Wopen_utf8(const char *path, int oflag, ...); + H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); /* Round functions only needed for VS2012 and earlier. |