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 #include +#ifdef COMPILER_MSVC +#include // Microsoft's nearest equivalent to +#else #include +#endif #include #include #include 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 +#ifdef COMPILER_MSVC +#include // Microsoft's nearest equivalent to +using PBD::readdir; +using PBD::opendir; +using PBD::closedir; +#else #include #include +#endif + +#include #include #include #include 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 #include #include @@ -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 +#include +using PBD::readdir; +using PBD::opendir; +using PBD::closedir; +#else +#include #include #include +#endif #include #include -#include #include #include 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 // 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 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 -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 #include +#ifdef COMPILER_MSVC +#include +#else #include +#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 +#else #include +#endif #include #include #include 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 #include #include +#ifndef COMPILER_MSVC #include +#else +#include +#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 #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 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 // Microsoft's nearest equivalent to +#else #include +#endif #include #include