changeset 1216:c811991a5efa msvc2015_64

MSVC build fixes
author Chris Cannam
date Tue, 18 Oct 2016 14:03:55 +0100
parents fef49844b3f8
children 046f05fa31f3
files base/Profiler.cpp base/Profiler.h base/RealTime.cpp base/RealTime.h base/TempDirectory.cpp data/fileio/FileReadThread.cpp svcore.pro system/System.h
diffstat 8 files changed, 36 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/base/Profiler.cpp	Tue Sep 20 09:16:13 2016 +0100
+++ b/base/Profiler.cpp	Tue Oct 18 14:03:55 2016 +0100
@@ -47,15 +47,11 @@
     dump();
 }
 
+#ifndef NO_TIMING
 void Profiles::accumulate(
-#ifndef NO_TIMING
     const char* id, clock_t time, RealTime rt
-#else
-    const char*, clock_t, RealTime
-#endif
 )
 {
-#ifndef NO_TIMING    
     ProfilePair &pair(m_profiles[id]);
     ++pair.first;
     pair.second.first += time;
@@ -72,8 +68,8 @@
     if (rt > worstPair.second) {
         worstPair.second = rt;
     }
+}
 #endif
-}
 
 void Profiles::dump() const
 {
--- a/base/Profiler.h	Tue Sep 20 09:16:13 2016 +0100
+++ b/base/Profiler.h	Tue Oct 18 14:03:55 2016 +0100
@@ -25,8 +25,6 @@
 
 #include "system/System.h"
 
-#include <ctime>
-#include <sys/time.h>
 #include <map>
 
 #include "RealTime.h"
@@ -41,6 +39,11 @@
 #endif
 #endif
 
+#ifndef NO_TIMING
+#include <ctime>
+#include <sys/time.h>
+#endif
+
 /**
  * Profiling classes
  */
@@ -56,12 +59,15 @@
     static Profiles* getInstance();
     ~Profiles();
 
+#ifndef NO_TIMING
     void accumulate(const char* id, clock_t time, RealTime rt);
+#endif
     void dump() const;
 
 protected:
     Profiles();
 
+#ifndef NO_TIMING
     typedef std::pair<clock_t, RealTime> TimePair;
     typedef std::pair<int, TimePair> ProfilePair;
     typedef std::map<const char *, ProfilePair> ProfileMap;
@@ -70,6 +76,7 @@
     ProfileMap m_profiles;
     LastCallMap m_lastCalls;
     WorstCallMap m_worstCalls;
+#endif
 
     static Profiles* m_instance;
 };
--- a/base/RealTime.cpp	Tue Sep 20 09:16:13 2016 +0100
+++ b/base/RealTime.cpp	Tue Oct 18 14:03:55 2016 +0100
@@ -24,7 +24,6 @@
 #include <sstream>
 
 #include "RealTime.h"
-#include "sys/time.h"
 
 #include "Debug.h"
 
--- a/base/RealTime.h	Tue Sep 20 09:16:13 2016 +0100
+++ b/base/RealTime.h	Tue Oct 18 14:03:55 2016 +0100
@@ -28,7 +28,11 @@
 
 #include <vamp-hostsdk/RealTime.h>
 
-struct timeval;
+#ifdef _MSC_VER
+#include "winsock.h" // struct timeval is in here
+#else
+#include "sys/time.h"
+#endif
 
 /**
  * RealTime represents time values to nanosecond precision
--- a/base/TempDirectory.cpp	Tue Sep 20 09:16:13 2016 +0100
+++ b/base/TempDirectory.cpp	Tue Oct 18 14:03:55 2016 +0100
@@ -25,7 +25,7 @@
 
 #include <iostream>
 #include <cassert>
-#include <unistd.h>
+//#include <unistd.h>
 #include <time.h>
 
 TempDirectory *
--- a/data/fileio/FileReadThread.cpp	Tue Sep 20 09:16:13 2016 +0100
+++ b/data/fileio/FileReadThread.cpp	Tue Oct 18 14:03:55 2016 +0100
@@ -19,7 +19,14 @@
 #include "base/Thread.h"
 
 #include <iostream>
+
+#ifdef _MSC_VER
+#include <io.h>
+#define _lseek lseek
+#else
 #include <unistd.h>
+#endif
+
 #include <cstdio>
 
 //#define DEBUG_FILE_READ_THREAD 1
--- a/svcore.pro	Tue Sep 20 09:16:13 2016 +0100
+++ b/svcore.pro	Tue Oct 18 14:03:55 2016 +0100
@@ -17,8 +17,10 @@
         LIBS += -L../sv-dependency-builds/win32-mingw/lib
     }
     win32-msvc* {
-        INCLUDEPATH += ../sv-dependency-builds/win32-msvc/include
-        LIBS += -L../sv-dependency-builds/win32-msvc/lib
+        # We actually expect MSVC to be used only for 64-bit builds,
+        # though the qmake spec is still called win32-msvc*
+        INCLUDEPATH += ../sv-dependency-builds/win64-msvc/include
+        LIBS += -L../sv-dependency-builds/win64-msvc/lib
     }
     macx* {
         INCLUDEPATH += ../sv-dependency-builds/osx/include
@@ -30,6 +32,9 @@
     macx* {
         DEFINES += HAVE_COREAUDIO
     }
+    win32-msvc* {
+        DEFINES += NOMINMAX
+    }
 }
 
 CONFIG += staticlib qt thread warn_on stl rtti exceptions c++11
--- a/system/System.h	Tue Sep 20 09:16:13 2016 +0100
+++ b/system/System.h	Tue Oct 18 14:03:55 2016 +0100
@@ -59,6 +59,11 @@
 
 #define getpid _getpid
 
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
 extern "C" {
 /* usleep is now in mingw
 void usleep(unsigned long usec);