From a8db3b2dda53e3ce8245d6c67566a005fb497c6b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 20 Feb 2015 18:10:06 +0100 Subject: [PATCH] Visual Studio 2013 compilation support for Ryzom Client --HG-- branch : develop --- code/CMakeLists.txt | 6 ++++-- code/CMakeModules/nel.cmake | 5 +++++ code/nel/include/nel/gui/group_html.h | 1 - code/nel/include/nel/misc/sstring.h | 8 ++++---- code/nel/include/nel/misc/types_nl.h | 5 ++++- code/ryzom/client/src/http_client_curl.cpp | 1 - 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 0ffef9c1e..279aa3d49 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -156,9 +156,11 @@ IF(WITH_NEL) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) - IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) SET(CURL_STATIC ON) - ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + SET(CURL_STATIC OFF) + ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 081da67ca..70113e11b 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -255,6 +255,11 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) ELSE(WITH_STATIC) OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF) ENDIF(WITH_STATIC) + IF (WITH_STATIC) + OPTION(WITH_STATIC_CURL "With static curl" ON ) + ELSE(WITH_STATIC) + OPTION(WITH_STATIC_CURL "With static curl" OFF) + ENDIF(WITH_STATIC) IF(APPLE) OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON ) ELSE(APPLE) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 333800760..4f9bee46c 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -17,7 +17,6 @@ #ifndef CL_GROUP_HTML_H #define CL_GROUP_HTML_H -#define CURL_STATICLIB 1 #include #include "nel/misc/types_nl.h" diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index fdeebcfc8..c9ebff721 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -937,21 +937,21 @@ inline CSString operator+(const CSString& s0,const CSString& s1) */ inline CSString operator+(char s0,const CSString& s1) { - return CSString(s0)+s1; + return CSString(s0) + s1.c_str(); } inline CSString operator+(const char* s0,const CSString& s1) { - return CSString(s0)+s1; + return CSString(s0) + s1.c_str(); } -#ifndef NL_COMP_VC10 +#if !defined(NL_COMP_VC) || (NL_COMP_VC_VERSION <= 100) // TODO: check if it can be disabled for other compilers too inline CSString operator+(const std::string& s0,const CSString& s1) { return s0+static_cast(s1); } -#endif // NL_COMP_VC10 +#endif } // NLMISC diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 7a6ee2662..7091f4905 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -54,6 +54,9 @@ # ifdef _MSC_VER # define NL_COMP_VC # if _MSC_VER >= 1700 +# define NL_COMP_VC12 +# define NL_COMP_VC_VERSION 120 +# elif _MSC_VER >= 1700 # define NL_COMP_VC11 # define NL_COMP_VC_VERSION 110 # elif _MSC_VER >= 1600 @@ -414,7 +417,7 @@ extern void operator delete[](void *p) throw(); # define CHashMap stdext::hash_map # define CHashSet stdext::hash_set # define CHashMultiMap stdext::hash_multimap -#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION == 110) +#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 120) # include # include # define CHashMap ::std::hash_map diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index db830a9df..008bef19a 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . #include "stdpch.h" -#define CURL_STATICLIB 1 #include #include "http_client_curl.h"