← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3104: prefer mingw-w64; various build fixes

 

------------------------------------------------------------
revno: 3104
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2012-11-02 23:23:18 +0100
message:
  prefer mingw-w64; various build fixes
added:
  test/testbase.cpp
  test/testbase.h
  utils/base.h
modified:
  Compile.txt
  SConstruct
  dcpp/compiler.h
  dwt/include/dwt/GCCHeaders.h
  intl/config-gcc.h
  plugins/Dev/SConscript
  plugins/Script/SConscript
  plugins/Test/SConscript
  test/testbloom.cpp
  test/testlockfree.cpp
  test/testtorrent.cpp
  test/testxml.cpp
  utils/portmap.cpp
  utils/xsum.cpp
  win32/WinUtil.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'Compile.txt'
--- Compile.txt	2012-09-17 18:25:16 +0000
+++ Compile.txt	2012-11-02 22:23:18 +0000
@@ -51,11 +51,19 @@
 2. Compiler
 
 	a. MinGW (GCC 4.7 or later):
+	<http://sourceforge.net/projects/mingw-w64/files/>
 	<http://sourceforge.net/projects/mingw/files/>
 
-		The easiest way to install is via mingw-get. Extract it to C:\MinGW and run:
+		We recommend using compilers from the MinGW-w64 project. All you have to do to use one is
+		download it and extract it.
+		Prefer DWARF versions of 32-bit compilers and SEH versions of 64-bit ones. (In short, avoid
+		SJLJ for performance reasons.)
+
+		To install compilers from regular MinGW (not MinGW-w64), the easiest way is to use
+		mingw-get. Extract it to C:\MinGW and run:
 			mingw-get install gcc g++
 		A graphical installer around mingw-get is also available to facilitate the above.
+		Note that building DC++ with MinGW (not MinGW-w64) is not often tested.
 
 		Make sure that MinGW\bin is in your PATH environment variable.
 
@@ -65,12 +73,12 @@
 		custom.py file containing:
 			prefix='i686-pc-mingw32-'
 		Make sure that Cygwin\bin is in your PATH environment variable.
+		Note that building with MinGW compilers provided by Cygwin is not often tested.
 
-		To build a version with HTML Help and Windows UPnP support, copy the following files from a
-		Windows SDK (Windows SDK path -> DC++ source code path):
+		To build a version with HTML Help support, copy the following files from a Windows SDK
+		(Windows SDK path -> DC++ source code path):
 		Include/shared/winapifamily.h -> mingw/include/winapifamily.h
 		Include/um/HtmlHelp.h -> mingw/include/htmlhelp.h
-		Include/um/natupnp.h -> mingw/include/natupnp.h
 		Lib/win8/um/x86/Htmlhelp.Lib -> mingw/lib/htmlhelp.lib
 		Lib/win8/um/x64/Htmlhelp.Lib -> mingw/lib/x64/htmlhelp.lib
 

=== modified file 'SConstruct'
--- SConstruct	2012-10-27 14:30:14 +0000
+++ SConstruct	2012-11-02 22:23:18 +0000
@@ -265,6 +265,10 @@
 conf = Configure(env, conf_dir = dev.get_build_path('.sconf_temp'), log_file = dev.get_build_path('config.log'), clean = False, help = False)
 if conf.CheckCXXHeader(['windows.h', 'htmlhelp.h'], '<>'):
 	conf.env.Append(CPPDEFINES='HAVE_HTMLHELP_H')
+# see whether we're compiling with MinGW or MinGW-w64 (2 different projects that can both build
+# a 32-bit program). the only differentiator is __MINGW64_VERSION_MAJOR.
+if conf.CheckDeclaration('__MINGW64_VERSION_MAJOR', '#include <windows.h>', 'C++'):
+	conf.env.Append(CPPDEFINES='HAVE_MINGW64')
 env = conf.Finish()
 
 dev.boost = dev.build('boost/')

=== modified file 'dcpp/compiler.h'
--- dcpp/compiler.h	2012-09-09 13:55:46 +0000
+++ dcpp/compiler.h	2012-11-02 22:23:18 +0000
@@ -42,7 +42,7 @@
 
 #endif
 
-#if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(_WIN64))
+#if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(HAVE_MINGW64))
 #define _LL(x) x##ll
 #define _ULL(x) x##ull
 #define I64_FMT "%I64d"

=== modified file 'dwt/include/dwt/GCCHeaders.h'
--- dwt/include/dwt/GCCHeaders.h	2012-09-09 13:55:46 +0000
+++ dwt/include/dwt/GCCHeaders.h	2012-11-02 22:23:18 +0000
@@ -389,7 +389,7 @@
 } DTTOPTS, *PDTTOPTS; 
 #endif
 
-#ifndef _WIN64 // mingw64 already has this
+#ifndef HAVE_MINGW64 // mingw64 already has this
 typedef struct tagNMTTCUSTOMDRAW
 {
     NMCUSTOMDRAW nmcd;

=== modified file 'intl/config-gcc.h'
--- intl/config-gcc.h	2012-09-09 13:55:46 +0000
+++ intl/config-gcc.h	2012-11-02 22:23:18 +0000
@@ -271,7 +271,7 @@
 
 /* Define to 1 if you have the `mempcpy' function. */
 /* #undef HAVE_MEMPCPY */
-#ifdef _WIN64
+#ifdef HAVE_MINGW64
 #define HAVE_MEMPCPY 1
 #endif
 

=== modified file 'plugins/Dev/SConscript'
--- plugins/Dev/SConscript	2012-08-26 17:26:56 +0000
+++ plugins/Dev/SConscript	2012-11-02 22:23:18 +0000
@@ -7,6 +7,10 @@
 
 env.Append(CPPPATH = ['#/dcpp'])
 
+# TODO remove this when GCC stops whining about stateless lambdas
+if dev.is_win32() and 'gcc' in env['TOOLS']:
+	env.Append(CPPFLAGS = ['-fpermissive'])
+
 res = env.RES(dev.get_sources(source_path, '*.rc'))
 env.Depends(res, 'resource.h')
 

=== modified file 'plugins/Script/SConscript'
--- plugins/Script/SConscript	2012-08-26 17:26:56 +0000
+++ plugins/Script/SConscript	2012-11-02 22:23:18 +0000
@@ -4,6 +4,10 @@
 
 env.Append(CPPPATH = ['#/dcpp', 'lua'])
 
+# TODO remove this when GCC stops whining about stateless lambdas
+if dev.is_win32() and 'gcc' in env['TOOLS']:
+	env.Append(CPPFLAGS = ['-fpermissive'])
+
 res = env.RES(dev.get_sources(source_path, '*.rc'))
 env.Depends(res, 'resource.h')
 

=== modified file 'plugins/Test/SConscript'
--- plugins/Test/SConscript	2012-09-08 13:53:58 +0000
+++ plugins/Test/SConscript	2012-11-02 22:23:18 +0000
@@ -7,6 +7,10 @@
 
 env.Append(CPPPATH = ['#/dcpp'])
 
+# TODO remove this when GCC stops whining about stateless lambdas
+if dev.is_win32() and 'gcc' in env['TOOLS']:
+	env.Append(CPPFLAGS = ['-fpermissive'])
+
 res = env.RES(dev.get_sources(source_path, '*.rc'))
 env.Depends(res, 'resource.h')
 

=== added file 'test/testbase.cpp'
--- test/testbase.cpp	1970-01-01 00:00:00 +0000
+++ test/testbase.cpp	2012-11-02 22:23:18 +0000
@@ -0,0 +1,12 @@
+#include "testbase.h"
+
+#include <dcpp/PluginApiImpl.h>
+
+namespace dcpp {
+
+// Functions for DCUI
+void PluginApiImpl::addCommand(const char* name, DCCommandFunc command) { }
+void PluginApiImpl::removeCommand(const char* name) { }
+void PluginApiImpl::playSound(const char* path) { }
+
+} // namespace dcpp

=== added file 'test/testbase.h'
--- test/testbase.h	1970-01-01 00:00:00 +0000
+++ test/testbase.h	2012-11-02 22:23:18 +0000
@@ -0,0 +1,7 @@
+// Base file for tests; hooks with the dcpp lib.
+
+#include <dcpp/stdinc.h>
+
+#include "gtest.h"
+
+#define _(x)

=== modified file 'test/testbloom.cpp'
--- test/testbloom.cpp	2012-10-15 19:17:43 +0000
+++ test/testbloom.cpp	2012-11-02 22:23:18 +0000
@@ -1,11 +1,9 @@
-#include <dcpp/stdinc.h>
+#include "testbase.h"
 
 #include <dcpp/HashBloom.h>
 #include <dcpp/HashValue.h>
 #include <dcpp/TigerHash.h>
 
-#include "gtest.h"
-
 using namespace dcpp;
 
 struct Hasher {

=== modified file 'test/testlockfree.cpp'
--- test/testlockfree.cpp	2012-10-15 19:17:43 +0000
+++ test/testlockfree.cpp	2012-11-02 22:23:18 +0000
@@ -1,4 +1,4 @@
-#include <dcpp/stdinc.h>
+#include "testbase.h"
 
 #include <dcpp/atomic.h>
 
@@ -6,8 +6,6 @@
 #include <boost/lockfree/spsc_queue.hpp>
 #include <boost/lockfree/stack.hpp>
 
-#include "gtest.h"
-
 using namespace dcpp;
 
 TEST(testlockfree, test_atomic)

=== modified file 'test/testtorrent.cpp'
--- test/testtorrent.cpp	2012-10-15 19:17:43 +0000
+++ test/testtorrent.cpp	2012-11-02 22:23:18 +0000
@@ -1,12 +1,8 @@
-#include <dcpp/stdinc.h>
+#include "testbase.h"
 
 #include <dcpp/Torrent.h>
 #include <unordered_map>
 
-#include "gtest.h"
-
-#define _(x)
-
 using namespace dcpp;
 
 const char* ubuntu = "d8:announce39:http://torrent.ubuntu.com:6969/announce13:announce-listll39:http://torrent.ubuntu.com:6969/announceel44:http://ipv6.torrent.ubuntu.com:6969/announceee7:comment29:Ubuntu CD releases.ubuntu.com13:creation datei1286702721e4:infod6:lengthi728754176e4:name30:ubuntu-10.10-desktop-amd64.iso12:piece lengthi524288eee";

=== modified file 'test/testxml.cpp'
--- test/testxml.cpp	2012-10-15 19:17:43 +0000
+++ test/testxml.cpp	2012-11-02 22:23:18 +0000
@@ -1,12 +1,8 @@
-#include <dcpp/stdinc.h>
+#include "testbase.h"
 
 #include <dcpp/SimpleXMLReader.h>
 #include <unordered_map>
 
-#include "gtest.h"
-
-#define _(x)
-
 using namespace dcpp;
 
 typedef std::unordered_map<std::string, int> Counter;

=== added file 'utils/base.h'
--- utils/base.h	1970-01-01 00:00:00 +0000
+++ utils/base.h	2012-11-02 22:23:18 +0000
@@ -0,0 +1,16 @@
+// Base file for utils; hooks with the dcpp lib.
+
+#include <dcpp/stdinc.h>
+
+#include <dcpp/PluginApiImpl.h>
+
+#define _(x)
+
+namespace dcpp {
+
+// Functions for DCUI
+void PluginApiImpl::addCommand(const char* name, DCCommandFunc command) { }
+void PluginApiImpl::removeCommand(const char* name) { }
+void PluginApiImpl::playSound(const char* path) { }
+
+} // namespace dcpp

=== modified file 'utils/portmap.cpp'
--- utils/portmap.cpp	2012-10-27 14:30:14 +0000
+++ utils/portmap.cpp	2012-11-02 22:23:18 +0000
@@ -1,6 +1,6 @@
 // Tool to add or remove port mapping rules using the interfaces provided by DC++.
 
-#include <dcpp/stdinc.h>
+#include "base.h"
 
 #include <iostream>
 #include <memory>

=== modified file 'utils/xsum.cpp'
--- utils/xsum.cpp	2012-01-01 14:22:32 +0000
+++ utils/xsum.cpp	2012-11-02 22:23:18 +0000
@@ -1,10 +1,11 @@
+#include "base.h"
+
 #include <iostream>
+#include <cstdlib>
 
-#include <dcpp/stdinc.h>
 #include <dcpp/FileReader.h>
 #include <dcpp/Util.h>
 #include <dcpp/MerkleTree.h>
-#include <stdlib.h>
 
 #include <boost/date_time/posix_time/ptime.hpp>
 using namespace boost::posix_time;

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2012-10-27 14:16:21 +0000
+++ win32/WinUtil.cpp	2012-11-02 22:23:18 +0000
@@ -71,7 +71,7 @@
 extern "C" {
 	void HH_GS_CALL __GSHandlerCheck() { }
 	void HH_GS_CALL __security_check_cookie(uintptr_t) { }
-#ifndef _WIN64
+#ifndef HAVE_MINGW64
 	uintptr_t __security_cookie;
 #endif
 }