From b8b5362ba550456ec26c617e8b5d77b9f0f41525 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 24 Sep 2015 23:20:52 +0200 Subject: [PATCH 1/6] Removed dependency on boost when Qt is used. --- JGE/include/Threading.h | 21 ++++++++++----------- projects/mtg/include/ObjectAnalytics.h | 2 -- projects/mtg/include/PrecompiledHeader.h | 3 ++- projects/mtg/include/WResource_Fwd.h | 9 +++++++++ projects/mtg/src/ExtraCost.cpp | 16 +++++++++++++++- projects/mtg/src/WResourceManager.cpp | 2 ++ projects/mtg/wagic.pri | 1 - 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/JGE/include/Threading.h b/JGE/include/Threading.h index 73036a27d..a57899318 100644 --- a/JGE/include/Threading.h +++ b/JGE/include/Threading.h @@ -312,9 +312,6 @@ namespace boost #include #include -#include -#include - #include "../include/JLogger.h" namespace boost @@ -420,23 +417,25 @@ namespace boost virtual void run() = 0; }; - typedef boost::shared_ptr thread_data_ptr; - template + typedef QSharedPointer thread_data_ptr; + + template class thread_data : public detail::thread_data_base { public: - thread_data(F f_) : f(f_) + thread_data(F f_, A1 a1_) : f(f_), a1(a1_) { } void run() { - f(); + f(a1); } private: F f; + A1 a1; void operator=(thread_data&); thread_data(thread_data&); @@ -493,7 +492,7 @@ namespace boost } template - thread(F f, A1 a1) : mThreadInfo(make_thread_info(boost::bind(boost::type(), f, a1))) + thread(F f, A1 a1) : mThreadInfo(make_thread_info(f, a1)) { mpThread = new threadImpl(mThreadInfo); LOG("Calling start func"); @@ -510,10 +509,10 @@ namespace boost } private: - template - static inline detail::thread_data_ptr make_thread_info(F f) + template + static inline detail::thread_data_ptr make_thread_info(F f, A1 a1) { - return detail::thread_data_ptr(new detail::thread_data(f)); + return detail::thread_data_ptr(new detail::thread_data(f, a1)); } detail::thread_data_ptr mThreadInfo; diff --git a/projects/mtg/include/ObjectAnalytics.h b/projects/mtg/include/ObjectAnalytics.h index 43306f801..db610a54c 100644 --- a/projects/mtg/include/ObjectAnalytics.h +++ b/projects/mtg/include/ObjectAnalytics.h @@ -1,8 +1,6 @@ #ifndef OBJECTANALYTICS_H #define OBJECTANALYTICS_H -#include - #ifdef _DEBUG #define TRACK_OBJECT_USAGE #endif diff --git a/projects/mtg/include/PrecompiledHeader.h b/projects/mtg/include/PrecompiledHeader.h index 3b7cc0ffa..97df7a34b 100644 --- a/projects/mtg/include/PrecompiledHeader.h +++ b/projects/mtg/include/PrecompiledHeader.h @@ -21,8 +21,9 @@ #include "GameOptions.h" -#ifndef WP8 +#if !defined(WP8) && !defined(QT_CONFIG) #include +#include #endif #if defined (WP8) || defined (IOS) || defined (ANDROID) || defined (QT_CONFIG) || defined (SDL_CONFIG) diff --git a/projects/mtg/include/WResource_Fwd.h b/projects/mtg/include/WResource_Fwd.h index c03b0b752..096f4df97 100644 --- a/projects/mtg/include/WResource_Fwd.h +++ b/projects/mtg/include/WResource_Fwd.h @@ -4,6 +4,15 @@ #if (__cplusplus > 199711L) #include typedef std::shared_ptr JQuadPtr; +#elif defined(QT_CONFIG) +#include +class JQuadPtr : public QSharedPointer +{ +public: + JQuadPtr() : QSharedPointer(){}; + JQuadPtr(JQuad*ptr) : QSharedPointer(ptr){}; + JQuad* get() const {return data();}; +}; #else #include typedef boost::shared_ptr JQuadPtr; diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index efa341ba6..ead4c22c4 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -7,7 +7,21 @@ #include "Player.h" #include "Counters.h" #include "AllAbilities.h" + +#if !defined(QT_CONFIG) #include +typedef ManaCostPtr boost::scoped_ptr +#else +#include +class ManaCostPtr : public QScopedPointer +{ +public: + ManaCostPtr(ManaCost*m) : QScopedPointer(m){ + }; + ManaCost* get() const {return data();}; + +}; +#endif SUPPORT_OBJECT_ANALYTICS(ExtraCost) @@ -209,7 +223,7 @@ LifeorManaCost::LifeorManaCost(TargetChooser *_tc, string manaType) string buildType ="{"; buildType.append(manaType); buildType.append("}"); - boost::scoped_ptr cost(ManaCost::parseManaCost(buildType)); + ManaCostPtr cost(ManaCost::parseManaCost(buildType)); manaCost.copy(cost.get()); } diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index 80e3c72ae..bfd4570df 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -11,6 +11,8 @@ #endif #include "WFont.h" +#include + #ifdef FORCE_LOW_CACHE_MEMORY //#define FORCE_LOW_CACHE_MEMORY const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024; diff --git a/projects/mtg/wagic.pri b/projects/mtg/wagic.pri index 7360f681e..62ab32ed9 100644 --- a/projects/mtg/wagic.pri +++ b/projects/mtg/wagic.pri @@ -39,7 +39,6 @@ windows{ macx:INCLUDEPATH += /opt/include INCLUDEPATH += ../../JGE/include INCLUDEPATH += ../../JGE/src/zipFS -INCLUDEPATH += ../../Boost INCLUDEPATH += include unix:!symbian:LIBS += -lz From 0f168922d8a927989a42f11ca03d28f926b25ef4 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 24 Sep 2015 23:47:16 +0200 Subject: [PATCH 2/6] Fixed compilation issue of config without Qt --- projects/mtg/src/ExtraCost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index ead4c22c4..4437bd0f8 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -10,7 +10,7 @@ #if !defined(QT_CONFIG) #include -typedef ManaCostPtr boost::scoped_ptr +typedef boost::scoped_ptr ManaCostPtr; #else #include class ManaCostPtr : public QScopedPointer From 5ae9d4248091fdc627b0095ba3f848a92344f163 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Fri, 25 Sep 2015 20:21:10 +0200 Subject: [PATCH 3/6] Fixed compilation issue with clang --- JGE/include/Threading.h | 1 + 1 file changed, 1 insertion(+) diff --git a/JGE/include/Threading.h b/JGE/include/Threading.h index a57899318..adfe4084e 100644 --- a/JGE/include/Threading.h +++ b/JGE/include/Threading.h @@ -311,6 +311,7 @@ namespace boost #include #include +#include #include "../include/JLogger.h" From a19ccb6b498210de7f15724cbfc6db0fd14e5d24 Mon Sep 17 00:00:00 2001 From: Xawotihs Date: Fri, 25 Sep 2015 21:01:09 +0200 Subject: [PATCH 4/6] Should fix g++ compilation issue --- projects/mtg/include/ObjectAnalytics.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/mtg/include/ObjectAnalytics.h b/projects/mtg/include/ObjectAnalytics.h index db610a54c..892c865d5 100644 --- a/projects/mtg/include/ObjectAnalytics.h +++ b/projects/mtg/include/ObjectAnalytics.h @@ -1,6 +1,8 @@ #ifndef OBJECTANALYTICS_H #define OBJECTANALYTICS_H +#include + #ifdef _DEBUG #define TRACK_OBJECT_USAGE #endif From 4185923d0415c4ba948dadefa705d34dde2344b5 Mon Sep 17 00:00:00 2001 From: Xawotihs Date: Fri, 25 Sep 2015 21:46:37 +0200 Subject: [PATCH 5/6] Replaced C++ types by C ones --- projects/mtg/include/ObjectAnalytics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/mtg/include/ObjectAnalytics.h b/projects/mtg/include/ObjectAnalytics.h index 892c865d5..92cd8cbd9 100644 --- a/projects/mtg/include/ObjectAnalytics.h +++ b/projects/mtg/include/ObjectAnalytics.h @@ -1,7 +1,7 @@ #ifndef OBJECTANALYTICS_H #define OBJECTANALYTICS_H -#include +#include #ifdef _DEBUG #define TRACK_OBJECT_USAGE From 9e778995355b05ebebf99dfc5955c8b77ed2228f Mon Sep 17 00:00:00 2001 From: xawotihs Date: Sat, 26 Sep 2015 09:44:11 +0200 Subject: [PATCH 6/6] Adds missing breaking macosx compilation without boost --- JGE/src/pc/JSocket.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/JGE/src/pc/JSocket.cpp b/JGE/src/pc/JSocket.cpp index 49eb7165a..f04d36913 100644 --- a/JGE/src/pc/JSocket.cpp +++ b/JGE/src/pc/JSocket.cpp @@ -7,6 +7,7 @@ #include #include #elif LINUX +#include #include #include #include