summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-07-16 18:00:49 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-07-16 18:00:49 +0100
commit7b480eaa27d73e2e5c21c6ac785a1aa2fb3aa51a (patch)
tree997d0988cda21ea79ee9675f31b6b79e99335d46
parente4ab2ffbfbe12cea63e1046b37184ddf32d9ba47 (diff)
Windows (compiler specific) includes for libpbd
-rw-r--r--libs/pbd/base_ui.cc4
-rw-r--r--libs/pbd/clear_dir.cc10
-rw-r--r--libs/pbd/epa.cc5
-rw-r--r--libs/pbd/fpu.cc6
-rw-r--r--libs/pbd/mountpoint.cc6
-rw-r--r--libs/pbd/pathexpand.cc2
-rw-r--r--libs/pbd/pathscanner.cc10
-rw-r--r--libs/pbd/pbd/abstract_ui.cc9
-rw-r--r--libs/pbd/pbd/localtime_r.h8
-rw-r--r--libs/pbd/pbd/pathscanner.h4
-rw-r--r--libs/pbd/pbd/pthread_utils.h4
-rw-r--r--libs/pbd/pbd/undo.h4
-rw-r--r--libs/pbd/pthread_utils.cc8
-rw-r--r--libs/pbd/stateful.cc4
14 files changed, 78 insertions, 6 deletions
diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc
index 5725d69182..4bd3d23514 100644
--- a/libs/pbd/base_ui.cc
+++ b/libs/pbd/base_ui.cc
@@ -19,7 +19,11 @@
#include <cstring>
#include <stdint.h>
+#ifdef COMPILER_MSVC
+#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
+#else
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <cerrno>
#include <cstring>
diff --git a/libs/pbd/clear_dir.cc b/libs/pbd/clear_dir.cc
index 29410d41e5..2ad3b73bb3 100644
--- a/libs/pbd/clear_dir.cc
+++ b/libs/pbd/clear_dir.cc
@@ -17,9 +17,17 @@
*/
-#include <string>
+#ifdef COMPILER_MSVC
+#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
+using PBD::readdir;
+using PBD::opendir;
+using PBD::closedir;
+#else
#include <dirent.h>
#include <unistd.h>
+#endif
+
+#include <string>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
diff --git a/libs/pbd/epa.cc b/libs/pbd/epa.cc
index d8a3cd5a65..1a27a436a6 100644
--- a/libs/pbd/epa.cc
+++ b/libs/pbd/epa.cc
@@ -24,7 +24,12 @@
#include "pbd/epa.h"
#include "pbd/strsplit.h"
+#ifdef COMPILER_MSVC
+#define environ _environ
+_CRTIMP extern char ** _environ;
+#else
extern char** environ;
+#endif
using namespace PBD;
using namespace std;
diff --git a/libs/pbd/fpu.cc b/libs/pbd/fpu.cc
index 40f8cca9d6..5d81cd2fd3 100644
--- a/libs/pbd/fpu.cc
+++ b/libs/pbd/fpu.cc
@@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+#ifndef COMPILER_MSVC
#include "libpbd-config.h"
#define _XOPEN_SOURCE 600
@@ -141,3 +141,7 @@ FPU::FPU ()
FPU::~FPU ()
{
}
+
+#else // COMPILER_MSVC
+ const char* pbd_fpu = "pbd/msvc/fpu.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc
index b2fb84760d..9c05f05ad6 100644
--- a/libs/pbd/mountpoint.cc
+++ b/libs/pbd/mountpoint.cc
@@ -17,7 +17,7 @@
$Id$
*/
-
+#ifndef COMPILER_MSVC
#include <cstdio>
#include <cstring>
#include <string>
@@ -172,3 +172,7 @@ main (int argc, char *argv[])
}
#endif // TEST_MOUNTPOINT
+
+#else // COMPILER_MSVC
+ const char* pbd_mountpoint = "pbd/msvc/mountpoint.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/pathexpand.cc b/libs/pbd/pathexpand.cc
index ad53bea37b..5c3a0f8bcf 100644
--- a/libs/pbd/pathexpand.cc
+++ b/libs/pbd/pathexpand.cc
@@ -36,7 +36,7 @@ using std::vector;
string
PBD::canonical_path (const std::string& path)
{
-#ifdef WIN32
+#ifdef COMPILER_MINGW
return path;
#endif
char buf[PATH_MAX+1];
diff --git a/libs/pbd/pathscanner.cc b/libs/pbd/pathscanner.cc
index fac2dcfd96..b9b501a120 100644
--- a/libs/pbd/pathscanner.cc
+++ b/libs/pbd/pathscanner.cc
@@ -18,11 +18,19 @@
$Id$
*/
+#ifdef COMPILER_MSVC
+#include <stdlib.h>
+#include <stdio.h>
+using PBD::readdir;
+using PBD::opendir;
+using PBD::closedir;
+#else
+#include <dirent.h>
#include <cstdlib>
#include <cstdio>
+#endif
#include <cstring>
#include <vector>
-#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
index 02b42fdead..9c405745ac 100644
--- a/libs/pbd/pbd/abstract_ui.cc
+++ b/libs/pbd/pbd/abstract_ui.cc
@@ -28,6 +28,15 @@
#include "i18n.h"
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h> // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
+ // searched and sorted. Thus, when instantiating the container, MSVC complains
+ // if the type of object being contained has no appropriate comparison operators
+ // defined (specifically, if operators '<' and '==' are undefined). This seems
+ // to be the case with ptw32 'pthread_t' which is a simple struct.
+DECLARE_DEFAULT_COMPARISONS(pthread_t)
+#endif
+
using namespace std;
template<typename RequestBuffer> void
diff --git a/libs/pbd/pbd/localtime_r.h b/libs/pbd/pbd/localtime_r.h
index 2e7c7aa149..ad5b89d134 100644
--- a/libs/pbd/pbd/localtime_r.h
+++ b/libs/pbd/pbd/localtime_r.h
@@ -2,6 +2,12 @@
#define PBD_LOCALTIME_R
#include <time.h>
-extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+#ifdef COMPILER_MSVC
+ #define localtime_r( _clock, _result ) \
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
+#else
+ extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+#endif
#endif
diff --git a/libs/pbd/pbd/pathscanner.h b/libs/pbd/pbd/pathscanner.h
index 1b7ef58655..796648de0f 100644
--- a/libs/pbd/pbd/pathscanner.h
+++ b/libs/pbd/pbd/pathscanner.h
@@ -22,7 +22,11 @@
#include <vector>
#include <string>
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h>
+#else
#include <regex.h>
+#endif
class PathScanner
diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h
index 793c3a1980..3d89d5581e 100644
--- a/libs/pbd/pbd/pthread_utils.h
+++ b/libs/pbd/pbd/pthread_utils.h
@@ -20,7 +20,11 @@
#ifndef __pbd_pthread_utils__
#define __pbd_pthread_utils__
+#ifdef COMPILER_MSVC
+#include <ardourext/pthread.h>
+#else
#include <pthread.h>
+#endif
#include <signal.h>
#include <string>
#include <stdint.h>
diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h
index 11ff2bf321..e9582a1b53 100644
--- a/libs/pbd/pbd/undo.h
+++ b/libs/pbd/pbd/undo.h
@@ -25,7 +25,11 @@
#include <map>
#include <sigc++/slot.h>
#include <sigc++/bind.h>
+#ifndef COMPILER_MSVC
#include <sys/time.h>
+#else
+#include <ardourext/misc.h>
+#endif
#include "pbd/command.h"
diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc
index 96cf99716f..91d93ec4f8 100644
--- a/libs/pbd/pthread_utils.cc
+++ b/libs/pbd/pthread_utils.cc
@@ -28,6 +28,14 @@
#include <fst.h>
#endif
+#ifdef COMPILER_MSVC
+DECLARE_DEFAULT_COMPARISONS(pthread_t) // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
+ // searched and sorted. Thus, when instantiating the container, MSVC complains
+ // if the type of object being contained has no appropriate comparison operators
+ // defined (specifically, if operators '<' and '==' are undefined). This seems
+ // to be the case with ptw32 'pthread_t' which is a simple struct.
+#endif
+
using namespace std;
typedef std::list<pthread_t> ThreadMap;
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index 105af75861..c4077f60af 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -18,7 +18,11 @@
$Id: stateful.cc 629 2006-06-21 23:01:03Z paul $
*/
+#ifdef COMPILER_MSVC
+#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
+#else
#include <unistd.h>
+#endif
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>