13
0

Some preliminary changes needed to support building with VS2019

(these get me about as far as 'libardour' )
This commit is contained in:
John Emmas 2021-01-30 13:55:25 +00:00
parent 24e0391679
commit b496a71d2e
6 changed files with 31 additions and 19 deletions

View File

@ -58,7 +58,7 @@
using Temporal::max_samplepos; using Temporal::max_samplepos;
using Temporal::max_samplecnt; using Temporal::max_samplecnt;
#if __GNUC__ < 3 #if defined (__GNUC__) && (__GNUC__ < 3)
typedef int intptr_t; typedef int intptr_t;
#endif #endif

View File

@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifdef FPU_AVX_FMA_SUPPORT
#include "ardour/mix.h" #include "ardour/mix.h"
#include <immintrin.h> #include <immintrin.h>
@ -135,3 +137,5 @@ x86_fma_mix_buffers_with_gain(
} }
} while (0); } while (0);
} }
#endif // FPU_AVX_FMA_SUPPORT

View File

@ -753,7 +753,7 @@ bool bValidPath = false;
#if (_WIN32_WINNT >= 0x0500) #if (_WIN32_WINNT >= 0x0500)
if (0 == strRootFileSystemType.compare("NTFS")) if (0 == strRootFileSystemType.compare("NTFS"))
{ {
if (TestForMinimumSpecOS()) // Hard links were only available from Win2K onwards if (TestForMinimumSpecOS(NULL)) // Hard links were only available from Win2K onwards
if (0 == CreateHardLinkA(link_filepath, existing_filepath, NULL)) if (0 == CreateHardLinkA(link_filepath, existing_filepath, NULL))
{ // Note that the above API call cannot create a link to a directory, so { // Note that the above API call cannot create a link to a directory, so
// should we also be checking that the supplied path was actually a file? // should we also be checking that the supplied path was actually a file?
@ -882,7 +882,7 @@ bool bValidPath = false;
std::transform(strRootFileSystemType.begin(), strRootFileSystemType.end(), strRootFileSystemType.begin(), ::toupper); std::transform(strRootFileSystemType.begin(), strRootFileSystemType.end(), strRootFileSystemType.begin(), ::toupper);
#if (_WIN32_WINNT >= 0x0500) #if (_WIN32_WINNT >= 0x0500)
if (0 == strRootFileSystemType.compare("NTFS")) if (0 == strRootFileSystemType.compare("NTFS"))
if (TestForMinimumSpecOS()) // Hard links were only available from Win2K onwards if (TestForMinimumSpecOS(NULL)) // Hard links were only available from Win2K onwards
if (0 == DeleteFileA(link_filepath)) if (0 == DeleteFileA(link_filepath))
ret = GetLastError(); ret = GetLastError();
else else

View File

@ -217,18 +217,22 @@ LIBPBD_API double PBD_APICALLTYPE trunc(double x);
namespace PBD { namespace PBD {
LIBPBD_API bool PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
LIBPBD_API char* PBD_APICALLTYPE realpath (const char *original_path, char resolved_path[_MAX_PATH+1]);
LIBPBD_API int PBD_APICALLTYPE mkstemp (char *template_name);
LIBPBD_API int PBD_APICALLTYPE ntfs_link (const char *existing_filepath, const char *link_filepath);
LIBPBD_API int PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
// These are used to replicate 'dirent.h' functionality // These are used to replicate 'dirent.h' functionality
LIBPBD_API DIR* PBD_APICALLTYPE opendir (const char *szPath); LIBPBD_API DIR* PBD_APICALLTYPE opendir (const char *szPath);
LIBPBD_API struct dirent* PBD_APICALLTYPE readdir (DIR *pDir); LIBPBD_API struct dirent* PBD_APICALLTYPE readdir (DIR *pDir);
LIBPBD_API int PBD_APICALLTYPE closedir (DIR *pDir); LIBPBD_API int PBD_APICALLTYPE closedir (DIR *pDir);
} // namespace PBD #if defined(_MSC_VER) && (_MSC_VER < 1900)
LIBPBD_API char* PBD_APICALLTYPE realpath (const char *original_path, char resolved_path[_MAX_PATH+1]);
LIBPBD_API int PBD_APICALLTYPE mkstemp (char *template_name);
// JE - 30-01-2021 (AFAICT these ones aren't needed any more)
LIBPBD_API bool PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
LIBPBD_API int PBD_APICALLTYPE ntfs_link (const char *existing_filepath, const char *link_filepath);
LIBPBD_API int PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
#endif
} // namespace PBD */
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -36,7 +36,7 @@
*/ */
#ifndef __FLOAT_CAST_H__ // Added by JE - 30-11-2009 #ifndef __FLOAT_CAST_H__ // Added by JE - 30-11-2009
#define __FLOAT_CAST_H__ #define __FLOAT_CAST_H__
#if (defined (WIN32) || defined (_WIN32)) #if defined (WIN32) || defined (_WIN32)
#include <math.h> #include <math.h>

View File

@ -47,12 +47,6 @@
#include <glib.h> #include <glib.h>
#include <ardourext/float_cast.h> #include <ardourext/float_cast.h>
// 'std::isnan()' is not available in MSVC. Assume '_isnan(double)'
#define isnan(val) _isnan((double)val)
// 'std::isinf()' is not available in MSVC. Assume '!_finite(double)'
#define isinf(val) !_finite((double)val)
// 'INFINITY' is not defined in MSVC. Assume 'HUGE_VAL' // 'INFINITY' is not defined in MSVC. Assume 'HUGE_VAL'
#ifndef INFINITY #ifndef INFINITY
#define INFINITY HUGE_VAL #define INFINITY HUGE_VAL
@ -69,6 +63,8 @@
#define X_OK 1 #define X_OK 1
// Miscellaneous #defines // Miscellaneous #defines
// JE - (these ones believed to be no longer needed from VS2015 onward)
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define __attribute__(x) #define __attribute__(x)
#define llabs _abs64 #define llabs _abs64
#define atoll _atoi64 #define atoll _atoi64
@ -76,9 +72,10 @@
#define getcwd _getcwd #define getcwd _getcwd
#define getpid _getpid #define getpid _getpid
#define snprintf _snprintf #define snprintf _snprintf
#define random rand
#define link ntfs_link #define link ntfs_link
#define unlink ntfs_unlink #define unlink ntfs_unlink
#endif
#define random rand
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#define strtok_r( _s, _sep, _lasts ) \ #define strtok_r( _s, _sep, _lasts ) \
@ -217,10 +214,17 @@ inline int64_t abs(int64_t val) throw()
#endif #endif
#endif #endif
// fmin() and fmax() // fmin() and fmax() etc.
#if defined(_MSC_VER) && (_MSC_VER < 1900) #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)
// 'std::isnan()' is not available in early versions of MSVC. Assume '_isnan(double)'
#define isnan(val) _isnan((double)val)
// 'std::isinf()' is not available in early versions of MSVC. Assume '!_finite(double)'
#define isinf(val) !_finite((double)val)
#endif #endif
// approximate POSIX pipe() // approximate POSIX pipe()