diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e3956b588db..8c7dfb54fc0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ option(ENABLE_LOW_MEM "Reduce memory usage by removing extra functionality" OFF) option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF) option(ENABLE_PANDORA "Add support for the OpenPandora by deactivating libvorbis support" OFF) option(ENABLE_SDL_GPU "Enable building with SDL_gpu (experimental" OFF) +option(ENABLE_BOOST_FILESYSTEM "Enable building with the boost filesystem and boost locale code" ON) if(NOT DEFINED ENABLE_DISPLAY_REVISION) # Test whether the code is used in a repository if not autorevision will @@ -586,6 +587,11 @@ if(ENABLE_GAME) endif(LIBDBUS_FOUND) endif(ENABLE_NOTIFICATIONS) + if(ENABLE_BOOST_FILESYSTEM) + find_package( Boost 1.44 REQUIRED COMPONENTS filesystem ) + find_package( Boost 1.48 REQUIRED COMPONENTS locale ) + endif(ENABLE_BOOST_FILESYSTEM) + endif(ENABLE_GAME) if(ENABLE_POT_UPDATE_TARGET) diff --git a/SConstruct b/SConstruct index e8420044b610..78e24b33f595 100755 --- a/SConstruct +++ b/SConstruct @@ -369,8 +369,9 @@ if env["prereqs"]: conf.CheckBoostIostreamsBZip2() & \ conf.CheckBoost("smart_ptr", header_only = True) & \ conf.CheckBoost("system") & \ - ((not env["boostfilesystem"]) or (conf.CheckBoost("filesystem", require_version = "1.44.0"))) & \ - ((not env["PLATFORM"] == "win32") or (not env["boostfilesystem"]) or (conf.CheckBoost("locale"))) \ + ((not env["boostfilesystem"]) or + (conf.CheckBoost("filesystem", require_version = "1.44.0") & \ + conf.CheckBoost("locale"))) \ and Info("GOOD: Base prerequisites are met")) \ or Warning("WARN: Base prerequisites are not met") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8babbd2bcfc0..ea185013998c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -209,10 +209,8 @@ endif(ENABLE_SHARED_LIBRARIES) set(libwesnoth-core_STAT_SRC color_range.cpp config.cpp - filesystem.cpp filesystem_common.cpp game_config.cpp - gettext.cpp hash.cpp log.cpp md5.cpp @@ -229,6 +227,20 @@ set(libwesnoth-core_STAT_SRC serialization/validator.cpp ) +if(ENABLE_BOOST_FILESYSTEM) + set(libwesnoth-core_STAT_SRC + ${libwesnoth-core_STAT_SRC} + filesystem_boost.cpp + gettext_boost.cpp + ) +else(ENABLE_BOOST_FILESYSTEM) + set(libwesnoth-core_STAT_SRC + ${libwesnoth-game_STAT_SRC} + filesystem.cpp + gettext.cpp + ) +endif(ENABLE_BOOST_FILESYSTEM) + # a 'lib' is automatically set in front when creating the library (as in the filename) # internal reference is the name given here add_library(wesnoth-core ${LIBRARY_TYPE} EXCLUDE_FROM_ALL ${libwesnoth-core_STAT_SRC}) diff --git a/src/SConscript b/src/SConscript index d3d2d671aac1..c85adaaf37cb 100644 --- a/src/SConscript +++ b/src/SConscript @@ -16,7 +16,6 @@ for env in [test_env, client_env, env]: libwesnoth_core_sources = Split(""" color_range.cpp config.cpp - gettext.cpp hash.cpp log.cpp map.cpp @@ -64,7 +63,8 @@ if env['default_prefs_file']: libwesnoth_core_sources.extend([ game_config_env.Object("game_config.cpp"), filesystem_env.Object("filesystem_common.cpp"), - filesystem_env.Object("filesystem_boost.cpp") if env["boostfilesystem"] else filesystem_env.Object("filesystem.cpp") + filesystem_env.Object("filesystem_boost.cpp") if env["boostfilesystem"] else filesystem_env.Object("filesystem.cpp"), + filesystem_env.Object("gettext_boost.cpp") if env["boostfilesystem"] else filesystem_env.Object("gettext.cpp") ]) libwesnoth_core = [env.Library("wesnoth_core", libwesnoth_core_sources)] diff --git a/src/gettext_boost.cpp b/src/gettext_boost.cpp index 3ff064c8efca..b92060cdc5b9 100644 --- a/src/gettext_boost.cpp +++ b/src/gettext_boost.cpp @@ -88,7 +88,7 @@ std::string dsngettext (const char * domainname, const char *singular, const cha return msgval; } -void bind_textdomain(const char* domain, const char* direcory, const char* encoding) +void bind_textdomain(const char* domain, const char* direcory, const char* /*encoding*/) { std::cerr << "adding textdomain '" << domain << "' in directory '" << direcory << "'\n"; get_manager().generator_.add_messages_domain(domain); diff --git a/src/language.cpp b/src/language.cpp index 653fef289154..fac1210c9426 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -29,7 +29,7 @@ #ifdef _WIN32 #include -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__MINGW32__) extern "C" int _putenv(const char*); #endif #endif