Skip to content

Commit

Permalink
Merge pull request ornladios#3652 from guj/unistd-windows
Browse files Browse the repository at this point in the history
work around  with include <unistd.h> on  windows
  • Loading branch information
guj committed Jun 5, 2023
2 parents b18fec6 + a1a67ac commit c6b1cca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/h5vol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ if(CMAKE_C_COMPILER_ID MATCHES "^(GNU)$")
string(APPEND CMAKE_C_FLAGS " -Wno-format-zero-length")
endif()

include(CheckIncludeFiles)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(windows.h HAVE_WINDOWS_H)

if (HAVE_UNISTD_H)
add_definitions(-DHAVE_UNISTD_H)
endif()

if (HAVE_WINDOWS_H)
add_definitions(-DHAVE_WINDOWS_H)
endif()

add_library(adios2_h5vol
H5VolReadWrite.c
H5Vol.c
Expand Down
7 changes: 7 additions & 0 deletions source/h5vol/H5VolReadWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
#include "H5VolReadWrite.h"

#include "H5VolUtil.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h> // sleep
#elif defined HAVE_WINDOWS_H
#include <windows.h>
#define sleep(x) Sleep(1000 * (x))
#endif

// these are in h5private.h
#define SUCCEED 1
#define FAIL 0
Expand Down

0 comments on commit c6b1cca

Please sign in to comment.