13
0

Windows (compiler specific) includes for libpbd

This commit is contained in:
John Emmas 2013-07-16 18:00:49 +01:00
parent e4ab2ffbfb
commit 7b480eaa27
14 changed files with 78 additions and 6 deletions

View File

@ -19,7 +19,11 @@
#include <cstring> #include <cstring>
#include <stdint.h> #include <stdint.h>
#ifdef COMPILER_MSVC
#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
#else
#include <unistd.h> #include <unistd.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>

View File

@ -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 <dirent.h>
#include <unistd.h> #include <unistd.h>
#endif
#include <string>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>

View File

@ -24,7 +24,12 @@
#include "pbd/epa.h" #include "pbd/epa.h"
#include "pbd/strsplit.h" #include "pbd/strsplit.h"
#ifdef COMPILER_MSVC
#define environ _environ
_CRTIMP extern char ** _environ;
#else
extern char** environ; extern char** environ;
#endif
using namespace PBD; using namespace PBD;
using namespace std; using namespace std;

View File

@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef COMPILER_MSVC
#include "libpbd-config.h" #include "libpbd-config.h"
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
@ -141,3 +141,7 @@ FPU::FPU ()
FPU::~FPU () FPU::~FPU ()
{ {
} }
#else // COMPILER_MSVC
const char* pbd_fpu = "pbd/msvc/fpu.cc takes precedence over this file";
#endif // COMPILER_MSVC

View File

@ -17,7 +17,7 @@
$Id$ $Id$
*/ */
#ifndef COMPILER_MSVC
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string> #include <string>
@ -172,3 +172,7 @@ main (int argc, char *argv[])
} }
#endif // TEST_MOUNTPOINT #endif // TEST_MOUNTPOINT
#else // COMPILER_MSVC
const char* pbd_mountpoint = "pbd/msvc/mountpoint.cc takes precedence over this file";
#endif // COMPILER_MSVC

View File

@ -36,7 +36,7 @@ using std::vector;
string string
PBD::canonical_path (const std::string& path) PBD::canonical_path (const std::string& path)
{ {
#ifdef WIN32 #ifdef COMPILER_MINGW
return path; return path;
#endif #endif
char buf[PATH_MAX+1]; char buf[PATH_MAX+1];

View File

@ -18,11 +18,19 @@
$Id$ $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 <cstdlib>
#include <cstdio> #include <cstdio>
#endif
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include <dirent.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -28,6 +28,15 @@
#include "i18n.h" #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; using namespace std;
template<typename RequestBuffer> void template<typename RequestBuffer> void

View File

@ -2,6 +2,12 @@
#define PBD_LOCALTIME_R #define PBD_LOCALTIME_R
#include <time.h> #include <time.h>
#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); extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
#endif
#endif #endif

View File

@ -22,7 +22,11 @@
#include <vector> #include <vector>
#include <string> #include <string>
#ifdef COMPILER_MSVC
#include <ardourext/misc.h>
#else
#include <regex.h> #include <regex.h>
#endif
class PathScanner class PathScanner

View File

@ -20,7 +20,11 @@
#ifndef __pbd_pthread_utils__ #ifndef __pbd_pthread_utils__
#define __pbd_pthread_utils__ #define __pbd_pthread_utils__
#ifdef COMPILER_MSVC
#include <ardourext/pthread.h>
#else
#include <pthread.h> #include <pthread.h>
#endif
#include <signal.h> #include <signal.h>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>

View File

@ -25,7 +25,11 @@
#include <map> #include <map>
#include <sigc++/slot.h> #include <sigc++/slot.h>
#include <sigc++/bind.h> #include <sigc++/bind.h>
#ifndef COMPILER_MSVC
#include <sys/time.h> #include <sys/time.h>
#else
#include <ardourext/misc.h>
#endif
#include "pbd/command.h" #include "pbd/command.h"

View File

@ -28,6 +28,14 @@
#include <fst.h> #include <fst.h>
#endif #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; using namespace std;
typedef std::list<pthread_t> ThreadMap; typedef std::list<pthread_t> ThreadMap;

View File

@ -18,7 +18,11 @@
$Id: stateful.cc 629 2006-06-21 23:01:03Z paul $ $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> #include <unistd.h>
#endif
#include <glibmm/fileutils.h> #include <glibmm/fileutils.h>
#include <glibmm/miscutils.h> #include <glibmm/miscutils.h>