summaryrefslogtreecommitdiff
path: root/msvc_extra_headers
diff options
context:
space:
mode:
authorJohn Emmas <john@creativepost.co.uk>2020-03-26 10:40:36 +0000
committerJohn Emmas <john@creativepost.co.uk>2020-03-26 10:40:36 +0000
commit4dd3d4effe6c76e97d2e0a915257570999b14574 (patch)
treedaefcb1a868235abb29e7c172773ac2cddbe9bea /msvc_extra_headers
parentd7500056fc60d65753b473528f6f6a32d51ba19f (diff)
Some initial changes (currently for libpbd only) to help a new contributer who's trying to build with MSVC2017
These changes compile okay for me (using VS2019) although they wouldn't link to my older-built libraries. Hopefully he'll be okay if he builds everything with the same compiler.
Diffstat (limited to 'msvc_extra_headers')
-rw-r--r--msvc_extra_headers/ardourext/float_cast.h.input9
-rw-r--r--msvc_extra_headers/ardourext/misc.h.input16
-rw-r--r--msvc_extra_headers/ardourext/ptw32/pthread.h.input2
3 files changed, 22 insertions, 5 deletions
diff --git a/msvc_extra_headers/ardourext/float_cast.h.input b/msvc_extra_headers/ardourext/float_cast.h.input
index 94433da965..73eb2c38f6 100644
--- a/msvc_extra_headers/ardourext/float_cast.h.input
+++ b/msvc_extra_headers/ardourext/float_cast.h.input
@@ -40,8 +40,9 @@
#include <math.h>
- /* Win32 doesn't seem to have these functions.
- ** Therefore implement inline versions of these functions here.
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+/* Win32 doesn't seem to have these functions.
+ * Therefore implement inline versions of these functions here.
*/
__inline long int
@@ -115,6 +116,8 @@
return intgr ;
}
-#endif
+#endif // _MSC_VER && _MSC_VER < 1900
+
+#endif // _WIN32 || WIN32
#endif // __FLOAT_CAST_H__
diff --git a/msvc_extra_headers/ardourext/misc.h.input b/msvc_extra_headers/ardourext/misc.h.input
index 4c8d193eac..6018886b58 100644
--- a/msvc_extra_headers/ardourext/misc.h.input
+++ b/msvc_extra_headers/ardourext/misc.h.input
@@ -19,9 +19,19 @@
#ifndef __ardour_msvc_extensions_h__
#define __ardour_msvc_extensions_h__
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#ifdef WINVER
+#undef WINVER
#endif
+#if (defined(_MSC_VER) && (_MSC_VER < 1900)) /* 1900 is an arbitrary value, corresponding to VS2019 (it might need to be lowered) */
+#define WINVER 0x0500
+#else
+#define WINVER 0x0601
+#endif
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT WINVER
+
#ifndef _CPP_VECTOR
#define _CPP_VECTOR 1
#endif
@@ -208,8 +218,10 @@ inline int64_t abs(int64_t val) throw()
#endif
// fmin() and fmax()
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define fmin(a, b) min((double)a, (double)b)
#define fmax(a, b) max((double)a, (double)b)
+#endif
// approximate POSIX pipe()
#define pipe(handles) _pipe(handles, 4096, _O_BINARY)
diff --git a/msvc_extra_headers/ardourext/ptw32/pthread.h.input b/msvc_extra_headers/ardourext/ptw32/pthread.h.input
index 0aa4522556..b8646c321b 100644
--- a/msvc_extra_headers/ardourext/ptw32/pthread.h.input
+++ b/msvc_extra_headers/ardourext/ptw32/pthread.h.input
@@ -308,11 +308,13 @@ enum {
#endif
#ifndef HAVE_STRUCT_TIMESPEC
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define HAVE_STRUCT_TIMESPEC 1
struct timespec {
long tv_sec;
long tv_nsec;
};
+#endif /* _MSC_VER */
#endif /* HAVE_STRUCT_TIMESPEC */
#ifndef SIG_BLOCK