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.
This commit is contained in:
John Emmas 2020-03-26 10:40:36 +00:00
parent d7500056fc
commit 4dd3d4effe
6 changed files with 27 additions and 7 deletions

View File

@ -32,7 +32,7 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
send_address.sin_family = AF_INET; send_address.sin_family = AF_INET;
send_address.sin_addr.s_addr = inet_addr("127.0.0.1"); send_address.sin_addr.s_addr = inet_addr("127.0.0.1");
send_address.sin_port = htons(0); send_address.sin_port = htons(0);
int status = bind(send_socket, (SOCKADDR*)&send_address, int status = ::bind(send_socket, (SOCKADDR*)&send_address,
sizeof(send_address)); sizeof(send_address));
if (status != 0) { if (status != 0) {
@ -54,7 +54,7 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
recv_address.sin_family = AF_INET; recv_address.sin_family = AF_INET;
recv_address.sin_addr.s_addr = inet_addr("127.0.0.1"); recv_address.sin_addr.s_addr = inet_addr("127.0.0.1");
recv_address.sin_port = htons(0); recv_address.sin_port = htons(0);
status = bind(receive_socket, (SOCKADDR*)&recv_address, status = ::bind(receive_socket, (SOCKADDR*)&recv_address,
sizeof(recv_address)); sizeof(recv_address));
if (status != 0) { if (status != 0) {

View File

@ -38,10 +38,12 @@ enum AVRT_PRIORITY {
AVRT_PRIORITY_CRITICAL AVRT_PRIORITY_CRITICAL
}; };
#ifndef ERROR_INVALID_TASK_NAME
enum error_codes { enum error_codes {
ERROR_INVALID_TASK_NAME = 1550, ERROR_INVALID_TASK_NAME = 1550,
ERROR_INVALID_TASK_INDEX = 1551 ERROR_INVALID_TASK_INDEX = 1551
}; };
#endif
bool LIBPBD_API initialize (); bool LIBPBD_API initialize ();

View File

@ -21,6 +21,7 @@
#include <sstream> #include <sstream>
#include <limits> #include <limits>
#include <algorithm>
namespace PBD { namespace PBD {

View File

@ -40,8 +40,9 @@
#include <math.h> #include <math.h>
/* Win32 doesn't seem to have these functions. #if defined(_MSC_VER) && (_MSC_VER < 1900)
** Therefore implement inline versions of these functions here. /* Win32 doesn't seem to have these functions.
* Therefore implement inline versions of these functions here.
*/ */
__inline long int __inline long int
@ -115,6 +116,8 @@
return intgr ; return intgr ;
} }
#endif #endif // _MSC_VER && _MSC_VER < 1900
#endif // _WIN32 || WIN32
#endif // __FLOAT_CAST_H__ #endif // __FLOAT_CAST_H__

View File

@ -19,9 +19,19 @@
#ifndef __ardour_msvc_extensions_h__ #ifndef __ardour_msvc_extensions_h__
#define __ardour_msvc_extensions_h__ #define __ardour_msvc_extensions_h__
#ifndef _WIN32_WINNT #ifdef WINVER
#define _WIN32_WINNT 0x0500 #undef WINVER
#endif #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 #ifndef _CPP_VECTOR
#define _CPP_VECTOR 1 #define _CPP_VECTOR 1
#endif #endif
@ -208,8 +218,10 @@ inline int64_t abs(int64_t val) throw()
#endif #endif
// fmin() and fmax() // fmin() and fmax()
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define fmin(a, b) min((double)a, (double)b) #define fmin(a, b) min((double)a, (double)b)
#define fmax(a, b) max((double)a, (double)b) #define fmax(a, b) max((double)a, (double)b)
#endif
// approximate POSIX pipe() // approximate POSIX pipe()
#define pipe(handles) _pipe(handles, 4096, _O_BINARY) #define pipe(handles) _pipe(handles, 4096, _O_BINARY)

View File

@ -308,11 +308,13 @@ enum {
#endif #endif
#ifndef HAVE_STRUCT_TIMESPEC #ifndef HAVE_STRUCT_TIMESPEC
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define HAVE_STRUCT_TIMESPEC 1 #define HAVE_STRUCT_TIMESPEC 1
struct timespec { struct timespec {
long tv_sec; long tv_sec;
long tv_nsec; long tv_nsec;
}; };
#endif /* _MSC_VER */
#endif /* HAVE_STRUCT_TIMESPEC */ #endif /* HAVE_STRUCT_TIMESPEC */
#ifndef SIG_BLOCK #ifndef SIG_BLOCK