Commit graph

36 commits

Author SHA1 Message Date
gfgtdf
5801b5bcdb
use to/from_chars in attribute_value and lexical_cast (#8790)
This makes attribute_value and lexical_cast use the "new" to/from_chars api.

Its main advantages are:
- It's guaranteed to be locale independent, hopefully fixing all cases of #3945 and similar
- It fixes some cases config serialization, in particular the test
```
	cfg["x"] = "9.87654321";
	BOOST_CHECK_EQUAL(cfg["x"], 9.87654321);
```
- Previously the lexical_cast implementation used exception
  handling for invalid formats (catching std::invalid_argument)
  which made noise during debugging (and is also slower if it
  is not optimized out).
- It's faster

So far afaik the only compiler which has a complete and proper to/from_chars implementation is msvc, gccs implementation of from_chars sometimes uses strtod under the hood and clang simply hasn't implemented from_chars for floating point numbers yet at all (actually the upcomig clang 20 will have it). Luckily for us, there is now also boost::charconv that can be used. So this raises to minimum build requirement to have at least one of:

- msvc 2019 update 5
- gcc 11
- clang 14 (i have added a fallback implementation of from_chars for this case, that doesn't support all of its features, and is probably certainly not as fast as the boost version, but supports the features that we use from it)
- boost 1.85
 
Since in particular the gcc implementation isn't that good (at least it on gcc11), boost charconv is the preferred implementation that is used if available.

This also removes a strange overload for
pointers to integers in lexical_cast while changing lexical_cast to use the new api.
2024-12-08 22:28:10 +01:00
Rafael Fillipe Silva
65090cc1bb add scons rules do detect boost-graph
Signed-off-by: Rafael Fillipe Silva <rfsc.mori@gmail.com>
2024-02-26 10:12:43 -06:00
Sergey Popov
3933ebab5c
Use coroutines via boost::asio::spawn to improve overall code structure in servers (#5341)
* Convert server_base class to use coroutine instead of handlers

* Rework wesnothd's client login to use coroutine

* Merge 3 player handling functions into a single coroutine

* update cmakelists too

* Implement send_doc_queued in terms of coroutine

* Use brace initialization for making asio buffers

* Implement campaignd's request handling in coroutine

* Brace-initialize entire vector

* Remove old handler based send/receive helpers

* Document coroutine send/receive helpers

* Made coro_send_doc() helper take wml doc by reference

In most cases there is no need to rely on shared pointers to ensure
object lifetime if using coroutines since even when coroutine is
suspended args are still kept alive by its context.

* Document coro_send_file()

* Silence deprecation warning to fix build on earlier versions of boost

* Explicitly check for boost.context to allow linking against static boost libs

* Add boost.coroutine to flatpak manifest

* Port winapi TransmitFile codepath to coroutines

* Exception safety fix

* Add boost.scope_exit to vcpkg

* Fix build with pre-1.66 boost

* Move coro_* helpers into server_base class

Those helpers were in .ipp solely because they were templated on handler
types, this is no longer true after coroutine based rework.

* Make server_base::coro_send_file non-inline

* CleanUp Xcode project

Co-authored-by: Martin Hrubý (hrubymar10) <hrubymar10@gmail.com>
2020-12-30 19:08:34 +03:00
Jyrki Vesterinen
f61856ff4f Fix #3926: SCons Boost test fails with -Werror=return-type
Based on the patch from @viy2 with a minor change.
2019-02-12 19:09:48 +02:00
loonycyborg
e54aa76700 scons: workaround for msys2's build's of sdl "#define main" breaking non-sdl checks
(cherry-picked from commit 2bc7cc3e61)
2018-10-07 03:22:09 +00:00
loonycyborg
a0c91ac41e Fix build against static libboost
(cherry-picked from commit c51065e39c)
2018-10-07 03:19:28 +00:00
loonycyborg
e637c55d50 scons: added a check for icu support in boost locale 2018-03-13 18:23:32 +03:00
Alexander van Gessel
72fdcd78d4 Further python3 compatibility updates.
This has been tested with scons2, but not with scons3.
2to3 runs perform no further useful transformations.
2017-09-20 16:51:33 +02:00
Alexander van Gessel
6c3f774390 Basic 2to3 fixes 2017-09-20 15:04:50 +02:00
loonycyborg
4b536bb0bc scons: compare paths in a different way to avoid error about /usr/include on macos 2016-08-05 21:27:58 +03:00
loonycyborg
35b9d7d5ed scons: fix logic error breaking compile on windows 2016-06-18 22:29:31 +03:00
loonycyborg
5a7b555d3a scons: don't add redundant include path for /usr/include 2016-06-10 21:54:08 +03:00
loonycyborg
b34b289928 scons: change -I to -isystem for fast=true option in boost.py 2016-01-04 20:26:36 +03:00
Chris Beck
a60c7efd9e fixup b88d2af26f 2014-10-27 17:05:41 -04:00
Chris Beck
b88d2af26f scons: add selected headers for boost libs locale, random 2014-10-27 16:54:25 -04:00
gfgtdf
e038938a73 Merge branch 'boost_filesystem' of https://github.com/AI0867/wesnoth into AI-boost_filesystem_3
Conflicts:
	.travis.yml
	SConstruct
	src/campaign_server/campaign_server.cpp
	src/create_engine.cpp
	src/editor/map/map_context.cpp
	src/game_config_manager.cpp
	src/gui/dialogs/screenshot_notification.cpp
	src/gui/dialogs/wml_error.cpp
	src/savegame.cpp
2014-10-17 16:40:45 +02:00
anatoly techtonik
0d750e528b scons: find bzip2 statically compiled into Boost (windows) 2014-08-10 19:43:16 +03:00
anatoly techtonik
5e3ee31a99 scons: find_include simplify API 2014-06-08 15:49:00 +03:00
anatoly techtonik
e40196f89e scons: Fix imports 2014-06-03 01:37:26 +03:00
Alexander van Gessel (AI0867)
6f2c048e2e Add filesystem_boost.cpp, a boost::filesystem implementation of filesystem.hpp 2013-11-27 13:19:53 +01:00
Alexander van Gessel
3ae335c5fe Merge branch 'bzip2' 2012-10-08 15:30:56 +01:00
Sergey Popov
6ab1b1c5ab scons: made boost autodetection look for lib files in prefix/lib64 too
This will make it unnecessary to pass boost_suffix=-mt on 64-bit Fedora
2012-02-24 09:41:00 +00:00
Sergey Popov
b10560cc58 Made config check for boost.thread add -pthread to compile and link flags.
This should fix asio check failing with undefined references to libpthread
on some systems.
2011-02-26 20:50:50 +00:00
Sergey Popov
640e5aff7c Fixed a mistake in autodetection of versioned installation boost. 2009-06-09 13:25:40 +00:00
Sergey Popov
1e0cdc6cd4 Committed Shadow_Master's fix for failure of boost::test check with boost 1.33 2008-11-01 21:52:17 +00:00
Sergey Popov
bda080bd63 Made boost autodetection look for boost in /sw, /sw/local and C:\Boost. 2008-10-15 10:00:27 +00:00
Alexander van Gessel
9f314cd978 Fix some executable properties. 2008-09-30 15:07:09 +01:00
Alexander van Gessel
0063d92356 Adjust a lot of svn properties. 2008-09-30 14:06:26 +01:00
Sergey Popov
dbb0f1de86 Added config check for gzip support in boost iostreams. 2008-09-26 12:42:09 +00:00
Pauli Nieminen
e50d11af06 Added boost asio and smart_ptr library checking to scons 2008-08-12 20:01:52 +00:00
Sergey Popov
c1416fcb0b Some cross-compile fixes. 2008-06-29 11:27:56 +00:00
Sergey Popov
a104a86be3 Made boost autodetection support boost compiled with --layout=versioned. 2008-06-25 13:22:08 +00:00
Sergey Popov
7e8c345745 Fixed scons crash when no boost_suffix is specified. 2008-06-25 07:43:35 +00:00
Sergey Popov
e22fedcb72 Improved boost autodetection. 2008-06-24 20:43:09 +00:00
Sergey Popov
f4f82aa9dd Added option "fast" to scons recipe. 2008-06-23 09:20:53 +00:00
Sergey Popov
5610e7f241 Moved all custom config checks to separate files. 2008-05-06 13:19:38 +00:00