From 2f73681499c5b8216967feb8e74e7ddce7a8c7e2 Mon Sep 17 00:00:00 2001 From: Wedge009 Date: Wed, 1 Jun 2016 17:08:18 +1000 Subject: [PATCH 01/13] Fix broken Windows compilation. --- src/server/server.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/server.cpp b/src/server/server.cpp index 75be242faa16..fe99bbeb18c0 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -368,7 +368,9 @@ server::server(int port, bool keep_alive, const std::string& config_file, size_t ip_log_(), failed_logins_(), user_handler_(nullptr), +#ifndef _WIN32 input_(io_service_), +#endif input_path_(), config_file_(config_file), cfg_(read_config()), @@ -596,7 +598,9 @@ void server::load_config() { const std::string fifo_path = (cfg_["fifo_path"].empty() ? std::string(FIFODIR) + "/socket" : std::string(cfg_["fifo_path"])); // Reset (replace) the input stream only if the FIFO path changed. if(fifo_path != input_path_) { +#ifndef _WIN32 input_.close(); +#endif input_path_ = fifo_path; setup_fifo(); } From c8c1e750de7bb94ae533a23a34df31cb4a41abf4 Mon Sep 17 00:00:00 2001 From: Wedge009 Date: Wed, 1 Jun 2016 17:09:24 +1000 Subject: [PATCH 02/13] Update VC project files to correspond with PR #645 being merged. --- projectfiles/VC12/wesnoth.vcxproj | 3 ++ projectfiles/VC12/wesnoth.vcxproj.filters | 3 ++ projectfiles/VC12/wesnothd.vcxproj | 47 +++++++++++++++++----- projectfiles/VC12/wesnothd.vcxproj.filters | 11 ++--- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/projectfiles/VC12/wesnoth.vcxproj b/projectfiles/VC12/wesnoth.vcxproj index efff0b546264..34a844853f16 100644 --- a/projectfiles/VC12/wesnoth.vcxproj +++ b/projectfiles/VC12/wesnoth.vcxproj @@ -1113,6 +1113,9 @@ + + + diff --git a/projectfiles/VC12/wesnoth.vcxproj.filters b/projectfiles/VC12/wesnoth.vcxproj.filters index a6d742dcbf65..64946849bedc 100644 --- a/projectfiles/VC12/wesnoth.vcxproj.filters +++ b/projectfiles/VC12/wesnoth.vcxproj.filters @@ -1389,6 +1389,9 @@ + + + diff --git a/projectfiles/VC12/wesnothd.vcxproj b/projectfiles/VC12/wesnothd.vcxproj index 7f69bb19745a..498cf265d463 100644 --- a/projectfiles/VC12/wesnothd.vcxproj +++ b/projectfiles/VC12/wesnothd.vcxproj @@ -205,7 +205,12 @@ $(IntDir)Server\ $(IntDir)Server\ - + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ $(IntDir)Server\ @@ -230,16 +235,36 @@ $(IntDir)Server\ $(IntDir)Server\ - - + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + + $(IntDir)Server\ $(IntDir)Server\ $(IntDir)Server\ $(IntDir)Server\ - - - $(IntDir)Server\ $(IntDir)Server\ @@ -253,10 +278,14 @@ $(IntDir)Server\ $(IntDir)Server\ - + + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + $(IntDir)Server\ + - @@ -265,8 +294,8 @@ + - diff --git a/projectfiles/VC12/wesnothd.vcxproj.filters b/projectfiles/VC12/wesnothd.vcxproj.filters index 82b120c9c9e2..b061b0429cbb 100644 --- a/projectfiles/VC12/wesnothd.vcxproj.filters +++ b/projectfiles/VC12/wesnothd.vcxproj.filters @@ -42,10 +42,10 @@ Server - + Server - + Server @@ -79,9 +79,6 @@ Server - - Server - Server @@ -91,10 +88,10 @@ Server - + Server - + Server From dc9db2e830cf0853e37e33120663e2c13c491ba8 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 1 Jun 2016 19:06:58 +1100 Subject: [PATCH 03/13] Updated CB projfiles --- projectfiles/CodeBlocks/wesnoth.cbp | 1 + projectfiles/CodeBlocks/wesnothd.cbp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 5fb7a33e48a4..23bbc8ef92f3 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -320,6 +320,7 @@ + diff --git a/projectfiles/CodeBlocks/wesnothd.cbp b/projectfiles/CodeBlocks/wesnothd.cbp index 1f0e18a04975..c93a5a4c845d 100644 --- a/projectfiles/CodeBlocks/wesnothd.cbp +++ b/projectfiles/CodeBlocks/wesnothd.cbp @@ -49,6 +49,7 @@ + @@ -67,6 +68,7 @@ + @@ -74,12 +76,10 @@ - - @@ -113,13 +113,11 @@ + + - - - - From d350d91c40c390dad29a68846aec641f3afebd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=B6f?= Date: Wed, 1 Jun 2016 20:57:43 +1200 Subject: [PATCH 04/13] Make strict compilation under scons behave like cmake This adds -Wold-style-cast to the CCFLAGS when compiling everything but lua. Lua requires an exception from the flags and there's thus a workaround added. --- SConstruct | 2 +- src/lua/SConscript | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 8b822709ee81..6e6478be2091 100755 --- a/SConstruct +++ b/SConstruct @@ -511,7 +511,7 @@ for env in [test_env, campaignd_env, client_env, env]: env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"]) if env['strict']: - env.AppendUnique(CCFLAGS = Split("-Werror $(-Wno-unused-local-typedefs$)")) + env.AppendUnique(CCFLAGS = Split("-Werror -Wold-style-cast $(-Wno-unused-local-typedefs$)")) env["OPT_FLAGS"] = "-O2" env["DEBUG_FLAGS"] = Split("-O0 -DDEBUG -ggdb3") diff --git a/src/lua/SConscript b/src/lua/SConscript index b7e1978e7f22..98733a3cdf37 100644 --- a/src/lua/SConscript +++ b/src/lua/SConscript @@ -37,8 +37,12 @@ linit.cpp """) liblua = env.Library("lua", lua_sources, # Silence some Clang-specific warnings due to extra parentheses in if statements when comparing. - CCFLAGS = ["$CCFLAGS", "clang" in env["CXX"] and Split("-Wno-parentheses-equality -Wno-pointer-bool-conversion") or []], + CCFLAGS = ["$CCFLAGS", "clang" in env["CXX"] and Split("-Wno-parentheses-equality -Wno-pointer-bool-conversion") or [], "strict" in env and Split("-Wno-old-style-cast -Wno-useless-cast") or []], CCCOM = env["CXXCOM"], CPPPATH = ["$CPPPATH", Dir(".").srcnode()], CPPDEFINES = ["$CPPDEFINES", env["PLATFORM"] != "win32" and "LUA_USE_POSIX" or []]) + +#if env['strict']: +# env.AppendUnique(CCFLAGS = Split("-Wno-old-style-cast -Wno-useless-cast")) + Return("liblua") From 724408ceb828781cf73001020ecc83a1b730ac95 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 1 Jun 2016 13:24:50 +0300 Subject: [PATCH 05/13] Fixed -Wold-style-cast warnings --- src/SDL_SavePNG/savepng.cpp | 8 ++++---- src/network_worker.cpp | 4 ++-- src/server/server.cpp | 16 ++++++++-------- src/server/server.hpp | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/SDL_SavePNG/savepng.cpp b/src/SDL_SavePNG/savepng.cpp index fa6736a0313c..be026e0cb645 100644 --- a/src/SDL_SavePNG/savepng.cpp +++ b/src/SDL_SavePNG/savepng.cpp @@ -35,7 +35,7 @@ static void png_error_SDL(png_structp /*ctx*/, png_const_charp str) } static void png_write_SDL(png_structp png_ptr, png_bytep data, png_size_t length) { - SDL_RWops *rw = (SDL_RWops*)png_get_io_ptr(png_ptr); + SDL_RWops *rw = static_cast(png_get_io_ptr(png_ptr)); SDL_RWwrite(rw, data, sizeof(png_byte), length); } @@ -114,7 +114,7 @@ int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst) && (pal = surface->format->palette)) { colortype |= PNG_COLOR_MASK_PALETTE; - pal_ptr = (png_colorp)malloc(pal->ncolors * sizeof(png_color)); + pal_ptr = static_cast(malloc(pal->ncolors * sizeof(png_color))); for (i = 0; i < pal->ncolors; i++) { pal_ptr[i].red = pal->colors[i].r; pal_ptr[i].green = pal->colors[i].g; @@ -140,9 +140,9 @@ int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst) /* Write everything */ png_write_info(png_ptr, info_ptr); #ifdef USE_ROW_POINTERS - row_pointers = (png_bytep*) malloc(sizeof(png_bytep)*surface->h); + row_pointers = static_cast (malloc(sizeof(png_bytep)*surface->h)); for (i = 0; i < surface->h; i++) - row_pointers[i] = (png_bytep)(Uint8*)surface->pixels + i * surface->pitch; + row_pointers[i] = static_cast(static_cast(surface->pixels)) + i * surface->pitch; png_write_image(png_ptr, row_pointers); free(row_pointers); #else diff --git a/src/network_worker.cpp b/src/network_worker.cpp index 6a23cb4f2cbe..f41c7d4eacbe 100644 --- a/src/network_worker.cpp +++ b/src/network_worker.cpp @@ -398,7 +398,7 @@ static SOCKET_STATE send_buffer(TCPsocket sock, std::vector& buf, int in_s } #ifdef USE_POLL - struct pollfd fd = { ((_TCPsocket*)sock)->channel, POLLOUT, 0 }; + struct pollfd fd = { (reinterpret_cast<_TCPsocket*>(sock))->channel, POLLOUT, 0 }; int poll_res; do { poll_res = poll(&fd, 1, 60000); @@ -780,7 +780,7 @@ manager::manager(size_t p_min_threads,size_t p_max_threads) : active_(!managed) for(size_t shard = 0; shard != NUM_SHARDS; ++shard) { const threading::lock lock(*shard_mutexes[shard]); for(size_t n = 0; n != p_min_threads; ++n) { - threading::thread * tmp = new threading::thread(process_queue,(void*)(shard)); + threading::thread * tmp = new threading::thread(process_queue,reinterpret_cast(shard)); threads[shard][tmp->get_id()] = tmp; } } diff --git a/src/server/server.cpp b/src/server/server.cpp index fe99bbeb18c0..7d067a12020a 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -750,19 +750,19 @@ void server::accept_connection(const boost::system::error_code& error, socket_pt void server::serverside_handshake(socket_ptr socket) { - boost::shared_array handshake(new unsigned char[4]); + boost::shared_array handshake(new char[4]); async_read( *socket, boost::asio::buffer(handshake.get(), 4), boost::bind(&server::handle_handshake, this, _1, socket, handshake) ); } -void server::handle_handshake(const boost::system::error_code& error, socket_ptr socket, boost::shared_array handshake) +void server::handle_handshake(const boost::system::error_code& error, socket_ptr socket, boost::shared_array handshake) { if(check_error(error, socket)) return; - if(strcmp((const char*)handshake.get(), "\0\0\0\0") != 0) { + if(strcmp(handshake.get(), "\0\0\0\0") != 0) { ERR_SERVER << client_address(socket) << "\tincorrect handshake\n"; return; } @@ -934,16 +934,16 @@ void server::handle_login(socket_ptr socket, boost::shared_ptr(socket.get())].empty()) { send_password_request(socket, "Please try again.", username, MP_NO_SEED_ERROR); return; } // This name is registered and an incorrect password provided - else if(!(user_handler_->login(username, password, seeds_[(unsigned long)socket.get()]))) { + else if(!(user_handler_->login(username, password, seeds_[reinterpret_cast(socket.get())]))) { const time_t now = time(NULL); // Reset the random seed - seeds_.erase((unsigned long)socket.get()); + seeds_.erase(reinterpret_cast(socket.get())); login_log login_ip = login_log(client_address(socket), 0, now); std::deque::iterator i = std::find(failed_logins_.begin(), failed_logins_.end(), login_ip); @@ -982,7 +982,7 @@ void server::handle_login(socket_ptr socket, boost::shared_ptr(socket.get())); user_handler_->user_logged_in(username); } } @@ -1051,7 +1051,7 @@ void server::send_password_request(socket_ptr socket, const std::string& msg, return; } - seeds_[(long int)(socket.get())] = salt; + seeds_[reinterpret_cast(socket.get())] = salt; simple_wml::document doc; simple_wml::node& e = doc.root().add_child("error"); diff --git a/src/server/server.hpp b/src/server/server.hpp index c1d122e24ca7..da628ca45948 100644 --- a/src/server/server.hpp +++ b/src/server/server.hpp @@ -48,7 +48,7 @@ class server char buf[4]; } handshake_response_; void serverside_handshake(socket_ptr socket); - void handle_handshake(const boost::system::error_code& error, socket_ptr socket, boost::shared_array buf); + void handle_handshake(const boost::system::error_code& error, socket_ptr socket, boost::shared_array buf); void request_version(const boost::system::error_code& error, socket_ptr socket); void handle_version(socket_ptr socket); From 2755920ba268a9237c182c867b6acef7161fee67 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 1 Jun 2016 14:54:33 +0300 Subject: [PATCH 06/13] Fixed wesnothd not showing MOTD --- src/server/server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/server.cpp b/src/server/server.cpp index 7d067a12020a..5110cd26086f 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -1076,6 +1076,11 @@ void server::add_player(socket_ptr socket, const wesnothd::player& player) assert(inserted); send_to_player(socket, games_and_users_list_); + + if (motd_ != "") { + send_server_message(socket, motd_); + } + read_from_player(socket); // Send other players in the lobby the update that the player has joined From 0cd14d875d9ec04b9327aaff14567b1d522f7fa3 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Thu, 2 Jun 2016 01:03:16 +1100 Subject: [PATCH 07/13] Fixed accelerated speed settings not being respected in-game (bug #24653) Since the preference display manager was refactored out in d2bec9ec9d39b783f, the display class setters for preferences such as accelerated speed weren't getting called when opening the editor or starting a new game. This commit adds a function calling the relevant setters. This also cleans up a few redundant pref setter functions. --- src/editor/controller/editor_controller.cpp | 2 +- src/play_controller.cpp | 1 + src/preferences.cpp | 4 ++-- src/preferences.hpp | 4 ++-- src/preferences_display.cpp | 18 ++++++++---------- src/preferences_display.hpp | 3 +-- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/editor/controller/editor_controller.cpp b/src/editor/controller/editor_controller.cpp index 02210ba648e0..0d6bc9f8aa2f 100644 --- a/src/editor/controller/editor_controller.cpp +++ b/src/editor/controller/editor_controller.cpp @@ -95,7 +95,7 @@ editor_controller::editor_controller(const config &game_config, CVideo& video) void editor_controller::init_gui() { gui_->change_display_context(&context_manager_->get_map_context()); - gui_->set_grid(preferences::grid()); + preferences::set_preference_display_settings(); gui_->add_redraw_observer(std::bind(&editor_controller::display_redraw_callback, this, _1)); floating_label_manager_.reset(new font::floating_label_context()); gui().set_draw_coordinates(preferences::editor::draw_hex_coordinates()); diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 58e35c82b3a5..757f9b88545f 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -350,6 +350,7 @@ void play_controller::reset_gamestate(const config& level, int replay_pos) void play_controller::init_managers() { LOG_NG << "initializing managers... " << (SDL_GetTicks() - ticks()) << std::endl; + preferences::set_preference_display_settings(); tooltips_manager_.reset(new tooltips::manager(gui_->video())); soundsources_manager_.reset(new soundsource::manager(*gui_)); diff --git a/src/preferences.cpp b/src/preferences.cpp index a87222f0317f..a1bbb3847d40 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -341,7 +341,7 @@ bool scroll_to_action() return get("scroll_to_action", true); } -void _set_scroll_to_action(bool ison) +void set_scroll_to_action(bool ison) { prefs["scroll_to_action"] = ison; } @@ -470,7 +470,7 @@ bool ellipses() return get("show_side_colors", false); } -void _set_ellipses(bool ison) +void set_ellipses(bool ison) { preferences::set("show_side_colors", ison); } diff --git a/src/preferences.hpp b/src/preferences.hpp index 8eee89713a76..60b74d342d1a 100644 --- a/src/preferences.hpp +++ b/src/preferences.hpp @@ -62,7 +62,7 @@ namespace preferences { void set_core_id(const std::string& root); bool scroll_to_action(); - void _set_scroll_to_action(bool ison); + void set_scroll_to_action(bool ison); int min_allowed_width(); int min_allowed_height(); @@ -247,7 +247,7 @@ namespace preferences { void set_show_fps(bool value); bool ellipses(); - void _set_ellipses(bool ison); + void set_ellipses(bool ison); bool grid(); void _set_grid(bool ison); diff --git a/src/preferences_display.cpp b/src/preferences_display.cpp index c1c2fc0c0e97..a915fca59a8e 100644 --- a/src/preferences_display.cpp +++ b/src/preferences_display.cpp @@ -40,6 +40,14 @@ namespace preferences { +void set_preference_display_settings() +{ + set_grid(grid()); + set_turbo(turbo()); + set_turbo_speed(turbo_speed()); + set_color_cursors(preferences::get("color_cursors", true)); +} + void show_preferences_dialog(CVideo& video, const config& game_cfg, const DIALOG_OPEN_TO initial_view) { gui2::tpreferences dlg(video, game_cfg); @@ -57,11 +65,6 @@ void show_preferences_dialog(CVideo& video, const config& game_cfg, const DIALOG dlg.show(video); } -void set_scroll_to_action(bool ison) -{ - _set_scroll_to_action(ison); -} - void set_turbo(bool ison) { _set_turbo(ison); @@ -80,11 +83,6 @@ void set_turbo_speed(double speed) } } -void set_ellipses(bool ison) -{ - _set_ellipses(ison); -} - void set_grid(bool ison) { _set_grid(ison); diff --git a/src/preferences_display.hpp b/src/preferences_display.hpp index f15294f6c814..47851b170890 100644 --- a/src/preferences_display.hpp +++ b/src/preferences_display.hpp @@ -27,10 +27,9 @@ namespace preferences { VIEW_FRIENDS }; - void set_scroll_to_action(bool ison); + void set_preference_display_settings(); void set_turbo(bool ison); - void set_ellipses(bool ison); void set_grid(bool ison); void set_turbo_speed(double speed); void set_color_cursors(bool value); From 67479e4074142a87453beb92064b1413c90ad328 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 1 Jun 2016 17:29:37 +0300 Subject: [PATCH 08/13] scons: properly move asio check to serverside checks --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 6e6478be2091..fc137e077800 100755 --- a/SConstruct +++ b/SConstruct @@ -387,6 +387,7 @@ if env["prereqs"]: conf.CheckBoost("iostreams", require_version = "1.34.1") & \ conf.CheckBoostIostreamsGZip() & \ conf.CheckBoostIostreamsBZip2() & \ + CheckAsio(conf) & \ conf.CheckBoost("random",require_version = "1.40.0") & \ conf.CheckBoost("smart_ptr", header_only = True) & \ conf.CheckBoost("system") & \ @@ -409,7 +410,6 @@ if env["prereqs"]: conf.CheckOgg() & \ conf.CheckPNG() & \ conf.CheckJPG() & \ - CheckAsio(conf) & \ conf.CheckPango("cairo", require_version = "1.21.3") & \ conf.CheckPKG("fontconfig") & \ conf.CheckBoost("program_options", require_version="1.35.0") & \ From 904b4668cec65f849037e6e7d5507d9ac66e90b3 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 1 Jun 2016 21:32:47 +0300 Subject: [PATCH 09/13] Replace shared_ptr with unique_ptr as suggested in TODO item --- src/server/forum_user_handler.cpp | 8 +------- src/server/forum_user_handler.hpp | 7 ++----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/server/forum_user_handler.cpp b/src/server/forum_user_handler.cpp index 3e6ca8a33ecc..d155371cca23 100644 --- a/src/server/forum_user_handler.cpp +++ b/src/server/forum_user_handler.cpp @@ -249,12 +249,6 @@ void fuh::set_lastlogin(const std::string& user, const time_t& lastlogin) { } } -struct result_deleter { - void operator()(MYSQL_RES *result) { - mysql_free_result(result); - } -}; - fuh::mysql_result fuh::db_query(const std::string& sql) { if(mysql_query(conn, sql.c_str())) { WRN_UH << "not connected to database, reconnecting..." << std::endl; @@ -265,7 +259,7 @@ fuh::mysql_result fuh::db_query(const std::string& sql) { throw error("Error querying database."); } } - return mysql_result(mysql_store_result(conn), result_deleter()); + return mysql_result(mysql_store_result(conn), mysql_free_result); } std::string fuh::db_query_to_string(const std::string& sql) { diff --git a/src/server/forum_user_handler.hpp b/src/server/forum_user_handler.hpp index 5eea31e3228e..a75966a878a9 100644 --- a/src/server/forum_user_handler.hpp +++ b/src/server/forum_user_handler.hpp @@ -18,8 +18,8 @@ #include "user_handler.hpp" #include +#include -#include #include // The [user_handler] section in the server configuration @@ -94,10 +94,7 @@ class fuh : public user_handler { std::string db_name_, db_host_, db_user_, db_password_, db_users_table_, db_extra_table_; - // std::unique_ptr would be better, as the object isn't actually shared - // boost::scoped_ptr cannot be returned, so we can't use that - // TODO C++11: switch to std::unique_ptr - typedef boost::shared_ptr mysql_result; + typedef std::unique_ptr mysql_result; // Throws user_handler::error mysql_result db_query(const std::string& query); From 0f9e04501f2de74880234299875763f854f206ce Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Wed, 1 Jun 2016 22:14:09 +0300 Subject: [PATCH 10/13] Remove obsolete and unused HAVE_CXX0X macro from buildsystems --- CMakeLists.txt | 4 ---- SConstruct | 1 - 2 files changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df802e1f62b..3a6c9efe18d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,10 +252,6 @@ if(NOT MSVC) check_compiler_has_flag(CXX_FLAGS_PROJECT "-Wall" HAS_COMPILER_FLAG_WALL) endif(NOT MSVC) -### Set some extra var for C++11 -add_definitions(-DHAVE_CXX0X) - - ### Set strict compiler flags. set(CXX_FLAGS_STRICT_COMPILATION) diff --git a/SConstruct b/SConstruct index fc137e077800..02018a5cb191 100755 --- a/SConstruct +++ b/SConstruct @@ -505,7 +505,6 @@ for env in [test_env, campaignd_env, client_env, env]: env.AppendUnique(CCFLAGS = Split("-W -Wall"), CFLAGS = ["-std=c99"]) env.AppendUnique(CXXFLAGS = "-std=c++" + env["cxx_std"]) - env.Append(CPPDEFINES = "HAVE_CXX0X") if env['openmp']: env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"]) From cc8fcf81181b1d91c14d529465173468965a66a8 Mon Sep 17 00:00:00 2001 From: ln-zookeeper Date: Wed, 1 Jun 2016 22:36:17 +0300 Subject: [PATCH 11/13] Fixed compilation issue --- src/util.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util.hpp b/src/util.hpp index d8ca75e6b611..329a3096bdbf 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -23,6 +23,7 @@ #include "global.hpp" #include #include +#include #include #include // cmath may not provide round() #include From 7528852484ed01a04be233c15d06431ef5502852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=B6f?= Date: Thu, 2 Jun 2016 20:57:56 +1200 Subject: [PATCH 12/13] attempt to make travis also compile with cmake --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd9ad2791e2a..c74fadc86d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ env: - OPT=-O2 CXXSTD=11 NLS=false - OPT=-O2 CXXSTD=1y NLS=false - NLS=true - + - OPT=-O0 CXXSTD=11 NLS=false USE_CMAKE=true matrix: exclude: - compiler: gcc @@ -46,7 +46,7 @@ before_install: install: - if [ "$CXXSTD" == "1y" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi - travis_wait sudo apt-get update -qq - - travis_wait sudo apt-get install -qq libboost-filesystem-dev libboost-iostreams-dev libboost-random-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-locale-dev libboost-thread-dev libcairo2-dev libfribidi-dev libpango1.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb moreutils scons xvfb + - travis_wait sudo apt-get install -qq libboost-filesystem-dev libboost-iostreams-dev libboost-random-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-locale-dev libboost-thread-dev libcairo2-dev libfribidi-dev libpango1.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb moreutils scons xvfb cmake - if [ "$CXXSTD" == "1y" ]; then sudo apt-get install -qq g++-5; @@ -60,7 +60,8 @@ script: - ./utils/travis/check_utf8.sh - ./utils/travis/utf8_bom_dog.sh - $CXX --version - - scons cxxtool=$CXX --debug=time build=release extra_flags_config=-pipe extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2 + - if [ "$USE_CMAKE" = false ]; then scons cxxtool=$CXX --debug=time build=release extra_flags_config=-pipe extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2; fi + - if [ "$USE_CMAKE" = true ]; then cmake . -DENABLE_STRICT_COMPILATION=$STRICT_COMPILATION && make -j2; fi - "export DISPLAY=:99.0" - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24" - if [ "$CPP_TESTS" = true ]; then ./utils/travis/test_wrapper.sh; fi From ac8d026c6fd54f37b870e97f9cdba950544b573b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=B6f?= Date: Thu, 2 Jun 2016 21:18:29 +1200 Subject: [PATCH 13/13] make cmake buils honour the NLS flag --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c74fadc86d58..2206268f8d51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ script: - ./utils/travis/utf8_bom_dog.sh - $CXX --version - if [ "$USE_CMAKE" = false ]; then scons cxxtool=$CXX --debug=time build=release extra_flags_config=-pipe extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2; fi - - if [ "$USE_CMAKE" = true ]; then cmake . -DENABLE_STRICT_COMPILATION=$STRICT_COMPILATION && make -j2; fi + - if [ "$USE_CMAKE" = true ]; then cmake . -DENABLE_STRICT_COMPILATION=$STRICT_COMPILATION -DENABLE_NLS=$NLS && make -j2; fi - "export DISPLAY=:99.0" - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24" - if [ "$CPP_TESTS" = true ]; then ./utils/travis/test_wrapper.sh; fi