[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/10: cmake: updates to msvc config.h
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/10: cmake: updates to msvc config.h |
Date: |
Mon, 13 Feb 2017 00:34:50 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit dd25086351b5e315b9e5265f0eabbac244ec918d
Author: Josh Blum <address@hidden>
Date: Fri Jan 20 09:53:02 2017 -0800
cmake: updates to msvc config.h
* Remove copies of math constants and add _USE_MATH_DEFINES
to windows definitions. This should work for all MSVC versions
* Version specific ifdef for the INFINITY macro (present in msvc 2013 and
up)
* Version specific ifdef for struct timespec (present in msvc 2015 and up)
---
CMakeLists.txt | 1 +
cmake/msvc/config.h | 21 +++------------------
cmake/msvc/sys/time.h | 2 ++
3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30ca737..280bc88 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,6 +135,7 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
if(MSVC)
include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers
+ add_definitions(-D_USE_MATH_DEFINES) #enables math constants on all
supported versions of MSVC
add_definitions(-D_WIN32_WINNT=0x0502) #Minimum version: "Windows Server
2003 with SP1, Windows XP with SP2"
add_definitions(-DNOMINMAX) #disables stupidity and enables std::min and
std::max
add_definitions( #stop all kinds of compatibility warnings
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h
index d3daed1..8b12c2a 100644
--- a/cmake/msvc/config.h
+++ b/cmake/msvc/config.h
@@ -21,8 +21,8 @@ typedef ptrdiff_t ssize_t;
////////////////////////////////////////////////////////////////////////
// rint functions
////////////////////////////////////////////////////////////////////////
-#include <math.h>
#if _MSC_VER < 1800
+#include <math.h>
static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x -
0.5f);}
static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5
: x - 0.5);}
@@ -34,26 +34,11 @@ static inline float rintf(float x){return (x > 0.0f)?
floorf(x + 0.5f) : ceilf(x
////////////////////////////////////////////////////////////////////////
// math constants
////////////////////////////////////////////////////////////////////////
-#ifndef INFINITY
+#if _MSC_VER < 1800
+#include <math.h>
#define INFINITY HUGE_VAL
#endif
-#ifndef _MATH_DEFINES_DEFINED
-# define M_E 2.7182818284590452354 /* e */
-# define M_LOG2E 1.4426950408889634074 /* log_2 e */
-# define M_LOG10E 0.43429448190325182765 /* log_10 e */
-# define M_LN2 0.69314718055994530942 /* log_e 2 */
-# define M_LN10 2.30258509299404568402 /* log_e 10 */
-# define M_PI 3.14159265358979323846 /* pi */
-# define M_PI_2 1.57079632679489661923 /* pi/2 */
-# define M_PI_4 0.78539816339744830962 /* pi/4 */
-# define M_1_PI 0.31830988618379067154 /* 1/pi */
-# define M_2_PI 0.63661977236758134308 /* 2/pi */
-# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
-# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-#endif
-
////////////////////////////////////////////////////////////////////////
// random and srandom
////////////////////////////////////////////////////////////////////////
diff --git a/cmake/msvc/sys/time.h b/cmake/msvc/sys/time.h
index 8800ed5..12acc8d 100644
--- a/cmake/msvc/sys/time.h
+++ b/cmake/msvc/sys/time.h
@@ -14,6 +14,7 @@
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
+#if _MSC_VER < 1900
struct timespec {
time_t tv_sec; /* Seconds since 00:00:00 GMT, */
@@ -25,6 +26,7 @@ long tv_nsec; /* Additional nanoseconds since */
/* tv_sec */
};
+#endif
struct timezone
{
- [Commit-gnuradio] [gnuradio] branch maint updated (884eddf -> b49da16), git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 07/10: analog: add missing probe_avg_mag_sqrd_cf block to GRC definition, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 08/10: analog: simplify probe_avg_mag_sqrd_x block GRC file, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 09/10: Merge remote-tracking branch 'nowls/add_probe_av_mag2_cf_grc_def' into maint, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 04/10: runtime: missing API export for block stream operator, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 06/10: grc: evaluate cheetah template to resolve 'optional' tag in port definition, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 05/10: cmake: removed stdint, inttypes, stdbool compat headers, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 03/10: cmake: updates to msvc config.h,
git <=
- [Commit-gnuradio] [gnuradio] 10/10: Merge remote-tracking branch 'josh/win_build' into maint, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 01/10: runtime: ifdef out unistd.h in public header, git, 2017/02/12
- [Commit-gnuradio] [gnuradio] 02/10: dtv: switch to hex format for number constants, git, 2017/02/12