From: <arn...@us...> - 2007-11-19 14:20:25
|
Revision: 95 http://adchpp.svn.sourceforge.net/adchpp/?rev=95&view=rev Author: arnetheduck Date: 2007-11-19 06:20:21 -0800 (Mon, 19 Nov 2007) Log Message: ----------- win32 fixes Modified Paths: -------------- adchpp/trunk/SConstruct adchpp/trunk/adchpp/File.h adchpp/trunk/adchpp/SConscript adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/adchpp.h adchpp/trunk/build_util.py adchpp/trunk/lua/SConscript adchpp/trunk/swig/SConscript adchpp/trunk/windows/adchppdw.cpp Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/SConstruct 2007-11-19 14:20:21 UTC (rev 95) @@ -60,8 +60,13 @@ opts = Options('custom.py', ARGUMENTS) +if sys.platform == 'win32': + tooldef = 'mingw' +else: + tooldef = 'default' + opts.AddOptions( - EnumOption('tools', 'Toolset to compile with, default = platform default (msvc under windows)', 'mingw', ['mingw', 'default']), + EnumOption('tools', 'Toolset to compile with, default = platform default (msvc under windows)', tooldef, ['mingw', 'default']), EnumOption('mode', 'Compile mode', 'debug', ['debug', 'release']), ListOption('plugins', 'The plugins to compile', 'all', plugins), BoolOption('nativestl', 'Use native STL instead of STLPort', 'yes'), @@ -71,11 +76,6 @@ ) -if sys.platform == 'win32': - tooldef = 'mingw' -else: - tooldef = 'default' - tools = ARGUMENTS.get('tools', tooldef) toolset = [tools, 'swig'] @@ -98,7 +98,7 @@ env.Append(CPPPATH = ["#/boost/boost/tr1/tr1/", "#/boost/"]) -if env['PLATFORM'] != 'win32': +if not dev.is_win32(): env.Append(CPPDEFINES = ['_XOPEN_SOURCE=500'] ) env.Append(CCFLAGS=['-fvisibility=hidden']) @@ -166,7 +166,7 @@ dev.adchpp = dev.build('adchpp/') -if env['PLATFORM'] == 'win32' or env['PLATFORM'] == 'cygwin': +if dev.is_win32(): dev.build('windows/') else: dev.build('unix/') Modified: adchpp/trunk/adchpp/File.h =================================================================== --- adchpp/trunk/adchpp/File.h 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/adchpp/File.h 2007-11-19 14:20:21 UTC (rev 95) @@ -107,7 +107,7 @@ throw FileException(Util::translateError(GetLastError())); } if(x < len) { - throw FileException(STRING(DISK_FULL)); + throw FileException("Unable to write, disk full?"); } } @@ -118,8 +118,8 @@ } } - static void deleteFile(const string& aFileName) { ::DeleteFile(aFileName.c_str()); }; - static void renameFile(const string& source, const string& target) { ::MoveFile(source.c_str(), target.c_str()); }; + static void deleteFile(const std::string& aFileName) { ::DeleteFile(aFileName.c_str()); }; + static void renameFile(const std::string& source, const std::string& target) { ::MoveFile(source.c_str(), target.c_str()); }; #else // WIN32 Modified: adchpp/trunk/adchpp/SConscript =================================================================== --- adchpp/trunk/adchpp/SConscript 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/adchpp/SConscript 2007-11-19 14:20:21 UTC (rev 95) @@ -35,8 +35,8 @@ if 'HAVE_PTHREAD' in env['CPPDEFINES']: env.Append(LIBS = ['pthread']) -if env['PLATFORM'] == 'win32': - env.Append(LIBS = ['ws2_32', 'mswsock']) +if dev.is_win32(): + env.Append(LIBS = ['ws2_32', 'mswsock']) if 'gcc' in env['TOOLS']: env['GchSh'] = env.GchSh('adchpp.h')[0] @@ -54,5 +54,4 @@ if env['PLATFORM'] != 'win32': dev.env.Append(RPATH = env.Literal('\\$$ORIGIN')) - Return('ret') Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-11-19 14:20:21 UTC (rev 95) @@ -29,7 +29,7 @@ #include "Thread.h" #ifdef _WIN32 -#include <MSWSock.h> +#include <mswsock.h> #endif #ifdef HAVE_SYS_EPOLL_H @@ -39,6 +39,7 @@ namespace adchpp { using namespace std; +using namespace std::tr1; static uint32_t WRITE_TIMEOUT = 100; @@ -537,7 +538,7 @@ Pool<MSOverlapped, ClearOverlapped> pool; - typedef HASH_SET<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; + typedef unordered_set<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; /** Sockets that have a pending read */ SocketSet active; /** Sockets that have a pending accept */ Modified: adchpp/trunk/adchpp/adchpp.h =================================================================== --- adchpp/trunk/adchpp/adchpp.h 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/adchpp/adchpp.h 2007-11-19 14:20:21 UTC (rev 95) @@ -99,7 +99,7 @@ # define ADCHPP_DLL __declspec(dllimport) # endif // DLLEXPORT -#include <Winsock2.h> +#include <winsock2.h> #include <windows.h> #include <tchar.h> Modified: adchpp/trunk/build_util.py =================================================================== --- adchpp/trunk/build_util.py 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/build_util.py 2007-11-19 14:20:21 UTC (rev 95) @@ -40,6 +40,9 @@ self.env['PROGSUFFIX'] = '.exe' self.env['LIBPREFIX'] = 'lib' self.env['LIBSUFFIX'] = '.a' + + def is_win32(self): + return sys.platform == 'win32' or 'mingw' in self.env['TOOLS'] def get_build_root(self): return '#/build/' + self.mode + '-' + self.tools + '/' Modified: adchpp/trunk/lua/SConscript =================================================================== --- adchpp/trunk/lua/SConscript 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/lua/SConscript 2007-11-19 14:20:21 UTC (rev 95) @@ -2,7 +2,7 @@ env, target, sources = dev.prepare_build(source_path, 'alua', 'all.c') -if env['PLATFORM'] == 'win32': +if dev.is_win32(): env.Append(CPPDEFINES=['LUA_BUILD_AS_DLL=1']) else: env.Append(CPPDEFINES=['LUA_USE_LINUX=1']) Modified: adchpp/trunk/swig/SConscript =================================================================== --- adchpp/trunk/swig/SConscript 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/swig/SConscript 2007-11-19 14:20:21 UTC (rev 95) @@ -59,6 +59,11 @@ targets.append(rb) def buildPyModule(): + import sys + if dev.is_win32() and sys.platform != 'win32': + print "Cross-compiling python module not supported" + return + env, target, sources = dev.prepare_build(source_path, '_pyadchpp', 'python.i') env.Append(SWIGFLAGS=['-c++','-threads','-Wall','-python', '-O', '-classic']) Modified: adchpp/trunk/windows/adchppdw.cpp =================================================================== --- adchpp/trunk/windows/adchppdw.cpp 2007-11-18 20:58:59 UTC (rev 94) +++ adchpp/trunk/windows/adchppdw.cpp 2007-11-19 14:20:21 UTC (rev 95) @@ -23,8 +23,8 @@ #include <adchpp/File.h> #include <adchpp/version.h> - using namespace adchpp; +using namespace std; static const string modName = "adchpp"; @@ -169,7 +169,7 @@ SetUnhandledExceptionFilter(&DCUnhandledExceptionFilter); #endif - initConfig(configPath); + initialize(configPath); if(asService) LOGDT(modName, versionString + " started as a service"); @@ -189,6 +189,7 @@ EXTENDEDTRACEUNINITIALIZE(); #endif printf(".\n"); + cleanup(); } Semaphore exitSem; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |