mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 01:38:45 +00:00
Visual Studio 2013 compilation support for NLMISC
This commit is contained in:
parent
03a3a6bd3a
commit
881bbc6083
8 changed files with 114 additions and 111 deletions
|
@ -112,16 +112,20 @@ IF(WITH_STATIC_LIBXML2)
|
|||
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
||||
ENDIF(WITH_STATIC_LIBXML2)
|
||||
|
||||
IF(WITH_LIBXML2_ICONV)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
|
||||
ENDIF(WITH_LIBXML2_ICONV)
|
||||
|
||||
IF(WITH_STATIC)
|
||||
# libxml2 could need winsock2 library
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
||||
|
||||
# on Mac OS X libxml2 requires iconv and liblzma
|
||||
IF(APPLE)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
FIND_PACKAGE(LibLZMA REQUIRED)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WITH_STATIC)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# - Try to find Iconv on Mac OS X
|
||||
# - Try to find Iconv
|
||||
# Once done this will define
|
||||
#
|
||||
# ICONV_FOUND - system has Iconv
|
||||
|
@ -6,78 +6,59 @@
|
|||
# ICONV_LIBRARIES - Link these to use Iconv
|
||||
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
|
||||
#
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
IF(APPLE)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(ICONV_FIND_QUIETLY TRUE)
|
||||
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
|
||||
IF(APPLE)
|
||||
FIND_PATH(ICONV_INCLUDE_DIR iconv.h
|
||||
PATHS
|
||||
/opt/local/include/
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c
|
||||
PATHS
|
||||
/opt/local/lib/
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
ENDIF(APPLE)
|
||||
|
||||
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
|
||||
|
||||
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
|
||||
|
||||
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
|
||||
|
||||
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
SET(ICONV_FOUND TRUE)
|
||||
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
|
||||
IF(ICONV_FOUND)
|
||||
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
|
||||
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
|
||||
if(ICONV_HAVE_WERROR)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
endif(ICONV_HAVE_WERROR)
|
||||
check_c_source_compiles("
|
||||
#include <iconv.h>
|
||||
int main(){
|
||||
iconv_t conv = 0;
|
||||
const char* in = 0;
|
||||
size_t ilen = 0;
|
||||
char* out = 0;
|
||||
size_t olen = 0;
|
||||
iconv(conv, &in, &ilen, &out, &olen);
|
||||
return 0;
|
||||
}
|
||||
" ICONV_SECOND_ARGUMENT_IS_CONST )
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
|
||||
ENDIF(ICONV_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
IF(ICONV_FOUND)
|
||||
IF(NOT ICONV_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
||||
ENDIF(NOT ICONV_FIND_QUIETLY)
|
||||
ELSE(ICONV_FOUND)
|
||||
IF(Iconv_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
||||
ENDIF(Iconv_FIND_REQUIRED)
|
||||
ENDIF(ICONV_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ICONV_INCLUDE_DIR
|
||||
ICONV_LIBRARIES
|
||||
ICONV_SECOND_ARGUMENT_IS_CONST
|
||||
)
|
||||
ENDIF(APPLE)
|
||||
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(ICONV_FIND_QUIETLY TRUE)
|
||||
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
|
||||
FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local)
|
||||
|
||||
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
|
||||
|
||||
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
SET(ICONV_FOUND TRUE)
|
||||
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
|
||||
IF(ICONV_FOUND)
|
||||
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
|
||||
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
|
||||
if(ICONV_HAVE_WERROR)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
endif(ICONV_HAVE_WERROR)
|
||||
check_c_source_compiles("
|
||||
#include <iconv.h>
|
||||
int main(){
|
||||
iconv_t conv = 0;
|
||||
const char* in = 0;
|
||||
size_t ilen = 0;
|
||||
char* out = 0;
|
||||
size_t olen = 0;
|
||||
iconv(conv, &in, &ilen, &out, &olen);
|
||||
return 0;
|
||||
}
|
||||
" ICONV_SECOND_ARGUMENT_IS_CONST )
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
|
||||
ENDIF(ICONV_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
IF(ICONV_FOUND)
|
||||
IF(NOT ICONV_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
||||
ENDIF(NOT ICONV_FIND_QUIETLY)
|
||||
ELSE(ICONV_FOUND)
|
||||
IF(Iconv_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
||||
ENDIF(Iconv_FIND_REQUIRED)
|
||||
ENDIF(ICONV_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ICONV_INCLUDE_DIR
|
||||
ICONV_LIBRARIES
|
||||
ICONV_SECOND_ARGUMENT_IS_CONST
|
||||
)
|
||||
|
|
|
@ -62,7 +62,7 @@ IF(MSVC12)
|
|||
IF(NOT MSVC12_REDIST_DIR)
|
||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC11_REDIST_DIR)
|
||||
ENDIF(NOT MSVC12_REDIST_DIR)
|
||||
ELSEIF(MSVC11)
|
||||
DETECT_VC_VERSION("11.0")
|
||||
SET(MSVC_TOOLSET "110")
|
||||
|
|
|
@ -255,6 +255,11 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
|||
ELSE(WITH_STATIC)
|
||||
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
|
||||
ENDIF(WITH_STATIC)
|
||||
IF(APPLE)
|
||||
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON )
|
||||
ELSE(APPLE)
|
||||
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" OFF)
|
||||
ENDIF(APPLE)
|
||||
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
|
||||
IF(WIN32)
|
||||
OPTION(WITH_EXTERNAL "With provided external." ON )
|
||||
|
@ -558,9 +563,15 @@ MACRO(NL_SETUP_BUILD)
|
|||
# Ignore default include paths
|
||||
ADD_PLATFORM_FLAGS("/X")
|
||||
|
||||
IF(MSVC11)
|
||||
IF(MSVC12)
|
||||
ADD_PLATFORM_FLAGS("/Gy- /MP")
|
||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||
# /Ox is working with VC++ 2013, but custom optimizations don't exist
|
||||
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
|
||||
ELSEIF(MSVC11)
|
||||
ADD_PLATFORM_FLAGS("/Gy- /MP")
|
||||
# /Ox is working with VC++ 2012, but custom optimizations don't exist
|
||||
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
|
||||
|
@ -582,9 +593,9 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
|
||||
ELSE(MSVC11)
|
||||
ELSE(MSVC12)
|
||||
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
|
||||
ENDIF(MSVC11)
|
||||
ENDIF(MSVC12)
|
||||
|
||||
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
|
||||
|
||||
|
|
|
@ -414,6 +414,12 @@ 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)
|
||||
# include <hash_map>
|
||||
# include <hash_set>
|
||||
# define CHashMap ::std::hash_map
|
||||
# define CHashSet ::std::hash_set
|
||||
# define CHashMultiMap ::std::hash_multimap
|
||||
#elif defined(NL_COMP_GCC) // GCC4
|
||||
# include <ext/hash_map>
|
||||
# include <ext/hash_set>
|
||||
|
|
|
@ -17,20 +17,6 @@
|
|||
#include "stdmisc.h"
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
#ifdef HAVE_NELCONFIG_H
|
||||
# include "nelconfig.h"
|
||||
#endif // HAVE_NELCONFIG_H
|
||||
|
||||
#include "nel/misc/log.h"
|
||||
#include "nel/misc/displayer.h"
|
||||
#include "nel/misc/mem_displayer.h"
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/report.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/variable.h"
|
||||
#include "nel/misc/system_info.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# define _WIN32_WINDOWS 0x0410
|
||||
|
@ -59,6 +45,21 @@
|
|||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
#ifdef HAVE_NELCONFIG_H
|
||||
# include "nelconfig.h"
|
||||
#endif // HAVE_NELCONFIG_H
|
||||
|
||||
#include "nel/misc/log.h"
|
||||
#include "nel/misc/displayer.h"
|
||||
#include "nel/misc/mem_displayer.h"
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/report.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/variable.h"
|
||||
#include "nel/misc/system_info.h"
|
||||
|
||||
#define NL_NO_DEBUG_FILES 1
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -18,6 +18,19 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
|
||||
// just comment this and the IsDebuggerPresent to compile on windows 95
|
||||
# define _WIN32_WINDOWS 0x0410
|
||||
# ifndef NL_COMP_MINGW
|
||||
# define WINVER 0x0400
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#else
|
||||
# define IsDebuggerPresent() false
|
||||
#endif
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
|
@ -35,19 +48,6 @@
|
|||
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
|
||||
// just comment this and the IsDebuggerPresent to compile on windows 95
|
||||
# define _WIN32_WINDOWS 0x0410
|
||||
# ifndef NL_COMP_MINGW
|
||||
# define WINVER 0x0400
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#else
|
||||
# define IsDebuggerPresent() false
|
||||
#endif
|
||||
|
||||
#include "nel/misc/displayer.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -251,7 +251,7 @@ void CWordsDictionary::exactLookupByKey( const CSString& key, CVectorSString& re
|
|||
*/
|
||||
inline CSString CWordsDictionary::makeResult( const CSString &key, const CSString &word )
|
||||
{
|
||||
return key + CSString(": ") + word;
|
||||
return key + ": " + word.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue