From 020927283131363a10621b33e5ad45d48f523ba3 Mon Sep 17 00:00:00 2001 From: Alexei Kasatkin Date: Fri, 23 May 2014 21:34:15 +0600 Subject: [PATCH] fix includes and definitions (avoid unistd.h, isatty, fix min,max, round and M_PI) --- CMakeLists.txt | 4 ++++ Util/SimpleLogger.h | 7 +++++++ typedefs.h | 1 - 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15b85457f..a1c9f4c1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,10 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # using Visual Studio C++ set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time chrono zlib) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DNOMINMAX) # avoid min and max macros that can break compilation + add_definitions(-D_USE_MATH_DEFINES) # define M_PI + add_definitions(-D_WIN32_WINNT=0x0501) endif() # disable partitioning of LTO process when possible (fixes Debian issues) diff --git a/Util/SimpleLogger.h b/Util/SimpleLogger.h index fac4a59db..f154b0e82 100644 --- a/Util/SimpleLogger.h +++ b/Util/SimpleLogger.h @@ -31,7 +31,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include + +#ifdef _MSC_VER +#include +#define isatty _isatty +#define fileno _fileno +#else #include +#endif #include #include diff --git a/typedefs.h b/typedefs.h index 3a042804f..c39cd1e63 100644 --- a/typedefs.h +++ b/typedefs.h @@ -36,7 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define M_PI 3.14159265358979323846 #endif -template digitT round(digitT x) { return std::floor(x + 0.5); } #endif typedef unsigned int NodeID;