From 032f5c83375eac10ee8138b2f035f4133917b1df Mon Sep 17 00:00:00 2001 From: Abs62 Date: Fri, 8 Apr 2016 00:45:27 +0300 Subject: [PATCH] Win-specific: Tune code for compilation with MS Visual Studio --- README.md | 11 +++++++++++ article_netmgr.cc | 2 +- bgl_babylon.hh | 2 +- btreeidx.hh | 2 +- chunkedstorage.cc | 7 ------- chunkedstorage.hh | 2 +- config.cc | 2 +- epwing_book.hh | 4 ++++ goldendict.pro | 17 +++++++++++------ hunspell.hh | 4 ++++ language.cc | 3 ++- ripemd.hh | 6 +++++- 12 files changed, 42 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 58635fcb..4ad5cf3a 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,17 @@ Then, invoke `make clean` before `make` because the setting change: make clean && make +### Building under Windows with MS Visual Studio + +To build GoldenDict with Visual Studio take one of next library packs and unpack it to `"winlibs/lib/msvc"` folder in GoldenDict sources folder. +[GoldenDict_libs_VS2013_x86.7z](http://www.mediafire.com/download/d3jrbsnco6ox4d8/GoldenDict_libs_VS2013_x86.7z) - for MS Visual Studio 2013, 32 bit +[GoldenDict_libs_VS2013_x64.7z](http://www.mediafire.com/download/21lun6uj51hnk3s/GoldenDict_libs_VS2013_x64.7z) - for MS Visual Studio 2013, 64 bit + +To create project files for Visual Studio you can pass `"-tp vc"` option to `qmake`. + +Note: In Qt 5.6.0 and later the `Webkit` module was removed from official release builds. You should to build it from sources to compile GoldenDict. + + ## Installation Installation is an optional step since the built binary can be used as-is without installation. But you can properly install via: diff --git a/article_netmgr.cc b/article_netmgr.cc index e1cc3541..07b555fa 100644 --- a/article_netmgr.cc +++ b/article_netmgr.cc @@ -1,7 +1,7 @@ /* This file is (c) 2008-2012 Konstantin Isakov * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ -#ifdef _MSC_VER +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/bgl_babylon.hh b/bgl_babylon.hh index ead7e419..d8d7a458 100644 --- a/bgl_babylon.hh +++ b/bgl_babylon.hh @@ -27,7 +27,7 @@ #include #include #include -#ifdef _MSC_VER +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/btreeidx.hh b/btreeidx.hh index f80dbc15..30817a96 100644 --- a/btreeidx.hh +++ b/btreeidx.hh @@ -14,7 +14,7 @@ #include #include -#ifdef _MSC_VER +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/chunkedstorage.cc b/chunkedstorage.cc index 761eb1b8..aaf11e88 100644 --- a/chunkedstorage.cc +++ b/chunkedstorage.cc @@ -5,13 +5,6 @@ #include #include -#ifdef _MSC_VER -#include -#else -#include -#endif - - namespace ChunkedStorage { enum diff --git a/chunkedstorage.hh b/chunkedstorage.hh index 11dd6e91..0ef2a017 100644 --- a/chunkedstorage.hh +++ b/chunkedstorage.hh @@ -8,7 +8,7 @@ #include "file.hh" #include -#ifdef _MSC_VER +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/config.cc b/config.cc index 9f53fcea..a41ebe60 100644 --- a/config.cc +++ b/config.cc @@ -7,7 +7,7 @@ #include #include "gddebug.hh" -#ifdef _MSC_VER +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/epwing_book.hh b/epwing_book.hh index 77111111..d7be2d3c 100644 --- a/epwing_book.hh +++ b/epwing_book.hh @@ -18,6 +18,10 @@ #include #include +#ifdef _MSC_VER +#include +#endif + #include namespace Epwing { diff --git a/goldendict.pro b/goldendict.pro index ee600f01..ea68dfc8 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -44,14 +44,14 @@ win32 { DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS contains(QMAKE_TARGET.arch, x86_64) { DEFINES += NOMINMAX __WIN64 - LIBS += -L$${PWD}/winlibs/lib/msvc/x64 - } else { - LIBS += -L$${PWD}/winlibs/lib/msvc } + LIBS += -L$${PWD}/winlibs/lib/msvc QMAKE_CXXFLAGS += /wd4290 # silence the warning C4290: C++ exception specification ignored - QMAKE_LFLAGS_RELEASE += /LTCG /OPT:REF /OPT:ICF + QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF # QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly - LIBS += -lshell32 -luser32 -lsapi -lole32 -lhunspell + LIBS += -lshell32 -luser32 -lsapi -lole32 + Debug: LIBS+= -lhunspelld + Release: LIBS+= -lhunspell HUNSPELL_LIB = hunspell } else { LIBS += -lhunspell-1.3.2 @@ -483,7 +483,12 @@ CONFIG( chinese_conversion_support ) { chineseconversion.hh SOURCES += chinese.cc \ chineseconversion.cc - LIBS += -lopencc + win32-msvc* { + Debug: LIBS += -lopenccd + Release: LIBS += -lopencc + } else { + LIBS += -lopencc + } } RESOURCES += resources.qrc \ diff --git a/hunspell.hh b/hunspell.hh index 3c8e58a3..3c9e1581 100644 --- a/hunspell.hh +++ b/hunspell.hh @@ -4,6 +4,10 @@ #ifndef __HUNSPELL_HH_INCLUDED__ #define __HUNSPELL_HH_INCLUDED__ +#ifdef _MSC_VER +#define HUNSPELL_STATIC +#endif + #include "dictionary.hh" #include "config.hh" diff --git a/language.cc b/language.cc index f50053c8..357470e8 100644 --- a/language.cc +++ b/language.cc @@ -2,7 +2,8 @@ #include "langcoder.hh" #include #include -#ifdef _MSC_VER + +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older #include #else #include diff --git a/ripemd.hh b/ripemd.hh index dc461f51..9b17f636 100644 --- a/ripemd.hh +++ b/ripemd.hh @@ -19,9 +19,13 @@ #ifndef __RIPEMD_HH_INCLUDED__ #define __RIPEMD_HH_INCLUDED__ -#include #include +#if defined( _MSC_VER ) && _MSC_VER < 1800 // VS2012 and older +#include +#else +#include +#endif class RIPEMD128 {