Fix windows.h include logic

windows.h was only being included for MSVC, while in UnitTestTimer.cxx, the
Windows function Sleep was being called after check for _WIN32. This was
causing compilation failure in MINGW.

Fixes #122
This commit is contained in:
Sujin Philip 2017-03-09 09:31:19 -05:00
parent 149fd79386
commit 25f9f88f3e
4 changed files with 19 additions and 9 deletions

@ -38,10 +38,11 @@ VTKM_THIRDPARTY_PRE_INCLUDE
#pragma push_macro("__TBB_NO_IMPLICITLINKAGE")
#define __TBB_NO_IMPLICIT_LINKAGE 1
// TBB includes windows.h, so instead we want include windows.h with the
#endif // defined(VTKM_MSVC)
// TBB includes windows.h, so instead we want to include windows.h with the
// correct settings so that we don't clobber any existing function
#include <vtkm/internal/Windows.h>
#endif
#include <tbb/tbb_stddef.h>
#if (TBB_VERSION_MAJOR == 4) && (TBB_VERSION_MINOR == 2)

@ -29,10 +29,10 @@ void Time()
{
vtkm::cont::Timer<> timer;
#ifndef _WIN32
sleep(1);
#else
#ifdef VTKM_WINDOWS
Sleep(1000);
#else
sleep(1);
#endif
vtkm::Float64 elapsedTime = timer.GetElapsedTime();

@ -62,6 +62,10 @@
# endif
#endif
#if defined(_WIN32)
# define VTKM_WINDOWS
#endif
#if !defined(VTKM_USE_DOUBLE_PRECISION) && !defined(VTKM_NO_DOUBLE_PRECISION)
#cmakedefine VTKM_USE_DOUBLE_PRECISION
#endif

@ -22,7 +22,7 @@
#include <vtkm/internal/Configure.h>
#if defined(VTKM_MSVC)
#if defined(VTKM_WINDOWS)
// Use pragma push_macro to properly save the state of WIN32_LEAN_AND_MEAN
// and NOMINMAX that the caller of vtkm has setup
@ -30,8 +30,13 @@ VTKM_THIRDPARTY_PRE_INCLUDE
#pragma push_macro("WIN32_LEAN_AND_MEAN")
#pragma push_macro("NOMINMAX")
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
// windows.h, clobbers min and max functions so we
// define NOMINMAX to fix that problem. We also include WIN32_LEAN_AND_MEAN
@ -46,4 +51,4 @@ VTKM_THIRDPARTY_POST_INCLUDE
#endif
#endif //vtkm_internal_Windows_h
#endif //vtkm_internal_Windows_h