Skip to content

Commit

Permalink
Fixup boost filesystem options for cmake, scons
Browse files Browse the repository at this point in the history
The option should control the compilation, in wesnoth-core, of
filesystem_boost.cpp, and gettext_boost.cpp, vs. the old versions.

Using the new code is now the default option, you must explicitly
deactivate with both cmake and scons to get the old stuff back.
  • Loading branch information
cbeck88 committed Oct 25, 2014
1 parent e723de7 commit bdd109e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions SConstruct
Expand Up @@ -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")

Expand Down
16 changes: 14 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions src/SConscript
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/gettext_boost.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/language.cpp
Expand Up @@ -29,7 +29,7 @@

#ifdef _WIN32
#include <windows.h>
#ifndef _MSC_VER
#if !defined(_MSC_VER) && !defined(__MINGW32__)
extern "C" int _putenv(const char*);
#endif
#endif
Expand Down

0 comments on commit bdd109e

Please sign in to comment.