diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f81c8f1..554e1a029 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,17 +11,22 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") # Compiler-specific C++11 activation. -if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) - message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.7 or greater.") - endif () -elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) else () - message(FATAL_ERROR "Your C++ compiler does not support C++11.") -endif () + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) + message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.7 or greater.") + endif () + elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + else () + message(FATAL_ERROR "Your C++ compiler does not support C++11.") + endif () +endif() # Look for available Crypto++ version and if it is >= 5.6.2 find_path(ID cryptlib.h diff --git a/alephzero/alephzero.pro b/alephzero/alephzero.pro index afe6d573a..ce464554c 100644 --- a/alephzero/alephzero.pro +++ b/alephzero/alephzero.pro @@ -1,12 +1,5 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-01-22T11:47:38 -# -#------------------------------------------------- - QT += core gui widgets network - TARGET = alephzero TEMPLATE = app @@ -14,26 +7,11 @@ CONFIG(debug, debug|release): DEFINES += ETH_DEBUG QMAKE_CXXFLAGS += -std=c++11 -#CONFIG += local_cryptopp - -local_cryptopp { - QMAKE_LIBDIR += ../../cryptopp562 - INCLUDE_PATH += ../libethereum - LIBS += -lcryptoppeth -} - -INCLUDEPATH += ../../cpp-ethereum -QMAKE_LIBDIR += ../../cpp-ethereum-build/libethereum -CONFIG(debug, debug|release): LIBS += -Wl,-rpath,../../cpp-ethereum-build/libethereum -LIBS += -lethereum -lminiupnpc -lleveldb -lgmp -lboost_filesystem -lboost_system - -SOURCES += main.cpp \ - MainWin.cpp - -HEADERS += \ - MainWin.h +INCLUDEPATH += .. +QMAKE_LIBDIR += ../build/libethereum ../build/secp256k1 +CONFIG(debug, debug|release): LIBS += -Wl,-rpath,../build/libethereum +LIBS += -lethereum -lsecp256k1 -lminiupnpc -lleveldb -lgmp -lboost_filesystem -lboost_system -lcryptopp +SOURCES += main.cpp MainWin.cpp +HEADERS += MainWin.h FORMS += Main.ui - - - diff --git a/libethereum/PeerNetwork.cpp b/libethereum/PeerNetwork.cpp index 8e92f4383..f2c2ef351 100644 --- a/libethereum/PeerNetwork.cpp +++ b/libethereum/PeerNetwork.cpp @@ -550,7 +550,7 @@ struct UPnP printf("TB : init_upnp()\n"); memset(&urls, 0, sizeof(struct UPNPUrls)); memset(&data, 0, sizeof(struct IGDdatas)); - devlist = upnpDiscover(2000, NULL/*multicast interface*/, NULL/*minissdpd socket path*/, 0/*sameport*/, 0/*ipv6*/, &upnperror); + devlist = upnpDiscover(2000, NULL/*multicast interface*/, NULL/*minissdpd socket path*/, 0/*sameport*/, 0/*ipv6*/, 2/*ttl*/, &upnperror); if (devlist) { dev = devlist; @@ -566,7 +566,9 @@ struct UPnP printf("UPnP device :\n" " desc: %s\n st: %s\n", dev->descURL, dev->st); -#if MINIUPNPC_API_VERSION >= 9 +#if MINIUPNPC_API_VERSION >= 16 + descXML = (char*)miniwget(dev->descURL, &descXMLsize, 2, 0); +#elif MINIUPNPC_API_VERSION >= 9 descXML = (char*)miniwget(dev->descURL, &descXMLsize, 0); #else descXML = (char*)miniwget(dev->descURL, &descXMLsize); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0a7b494b2..ccf855aa2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_policy(SET CMP0015 NEW) aux_source_directory(. SRC_LIST) -include_directories(../libethereum) +include_directories(../libethereum ../secp256k1) link_directories(../libethereum) add_executable(testeth ${SRC_LIST}) diff --git a/test/trie.cpp b/test/trie.cpp index ba998046b..acc729446 100644 --- a/test/trie.cpp +++ b/test/trie.cpp @@ -42,13 +42,13 @@ int trieTest() cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}}) << endl; + cout << hash256(StringMap{{"test", "test"}}) << endl; t.insert(string("tesa"), string("testy")); cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}, {"te", "testy"}}) << endl; + cout << hash256(StringMap{{"test", "test"}, {"te", "testy"}}) << endl; cout << t.at(string("test")) << endl; cout << t.at(string("te")) << endl; cout << t.at(string("t")) << endl; @@ -56,7 +56,7 @@ int trieTest() t.remove(string("te")); cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}}) << endl; + cout << hash256(StringMap{{"test", "test"}}) << endl; t.remove(string("test")); cout << m; @@ -72,7 +72,7 @@ int trieTest() cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"b", "B"}, {"a", "A"}}) << endl; + cout << hash256(StringMap{{"b", "B"}, {"a", "A"}}) << endl; cout << RLP(rlp256({{"b", "B"}, {"a", "A"}})) << endl; } { @@ -89,7 +89,7 @@ int trieTest() cout << RLP(t.rlp()) << endl; } { - cout << hex << hash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl; + cout << hex << hash256(StringMap{{"dog", "puppy"}, {"doe", "reindeer"}}) << endl; MemTrie t; t.insert("dog", "puppy"); t.insert("doe", "reindeer");