Commit Graph

749 Commits

Author SHA1 Message Date
Charles Dang
9ef8c90767 Bump min Boost version to 1.70 2025-02-24 01:05:16 -05:00
pentarctagon
cac1f1e766 the gold linker is deprecated and not needed for LTO
the bfd linker supports plugins since 2.21, which was released a decade ago now
2025-02-13 00:23:53 -06:00
Gunter Labes
2c0a1cdaa7
Do not require the appdata path to exist 2025-02-01 17:06:42 +01:00
Gunter Labes
064caa681e
Use just the commit hash in the branch name and add proper version info 2025-02-01 15:10:13 +01:00
Charles Dang
2066456654 Target Windows 10 2024-12-12 20:35:51 -05:00
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
JJ Marr
e9e40b5a37 Enable compilation database for Scons
This is necessary for interfacing with external tools such as clang-tidy
2024-11-30 13:24:45 +01:00
pentarctagon
40ef4dbbf4 Revert "Bump min Boost version to 1.82 (#9317)"
This reverts commit 7c60174ad1.
2024-09-08 10:25:45 -05:00
Charles Dang
7c60174ad1
Bump min Boost version to 1.82 (#9317) 2024-09-08 00:58:32 -04:00
Gunter Labes
d8f2df16aa
Document translations target 2024-07-28 17:59:28 +02:00
Pentarctagon
9548f4c7b5
Hardware unit submerge effect using SDL_RenderGeometry. (#8687)
Original code from mesilliac in #6826. Made a separate PR for this since the relevant code moved to an entirely separate file and trying to "properly" fix the merge conflicts resulting from that isn't worth the time.
2024-04-11 12:58:56 -05:00
Rafael Fillipe Silva
dafb78cdf1 implement super cycle detection for the schema self validator
The super tag dependency forms a directed graph. Boost Graph's depth first search implementation was used with a back edge detector to find the cycles.

This is a preparation for enumerating all keys that a tag can use, including the keys from the super tags. If cycles aren't handled, it is impossible to validate mandatory keys without entering an infinite loop.
2024-02-26 10:12:43 -06:00
pentarctagon
8890cc75db check compiler version 2024-02-21 10:31:23 -06:00
P. J. McDermott
69fa5c199e Add CMake and SCons options to use system Lua 5.4 C++
scons/lua.py makes use of the vestigial luadir option from commit
e94dcecf17.

Like FindLua.cmake, scons/lua.py searches for the Lua headers and
library, instead of using pkg-config like the old scons/lua.py (removed
in commit 9929d3ca1c) did, because even though distributions typically
provide .pc files for Lua, upstream Lua doesn't.  It's likely that all
distributions that compile Lua as a C++ library will also provide .pc
files, but this check doesn't rely on that (just as the CMake module
doesn't).

Unfortunately, SCons.Conftest.CheckLib() prints up to eight messages
like "Checking for C++ library lua54-c++... no" until a working library
name is found.

Also conditionally include system Lua headers in src/lua/*.h and update
documentation in src/modules/lua_README.md, src/wesnoth_lua_config.h,
and src/wesnoth_lua_config.md.  The two lines about "The primary commit,
after replacing the sources," in src/wesnoth_lua_config.md don't make
sense since the instructions were updated for submodule Lua in commit
d32cfb88c4 and make even less sense now with preceding commits for
updating CMake modules.
2024-02-11 23:21:15 -06:00
Steve Cotton
cfb28fbfb5 Use -Wno-dangling-reference when building with GCC-13
Version 13 of GCC added the -Wdangling-reference option, however
due to false positives it had to be moved from -Wall to -Wextra.
Discussion about its status in GCC-14 is in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110075

The warning is for C++ only and the flag will generate a warning
when compiling C files if the flag is set in Scon's CCFLAGS.

The docs don't explain exactly what triggers the warning, but here's the
explanation from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106393#c1
> The warning works by checking if a reference is initialized with a function
> that returns a reference, and at least one parameter of the function is a
> reference that is bound to a temporary. It assumes that such a function
> actually returns one of its arguments! ... suppress the warning when we've
> seen the definition of the function and we can say that it can return a
> variable with static storage duration.

Consistent with that, we're getting warnings on functions of the form
find(container, const std::string&). All of the things triggering it
seem to be false positives:

* Calls to find_widget<...>.
* Calls to theme::get_theme_config.
* Calls to race::gender_value.
* In src/actions/attack.cpp, any `attacker->attacks()[i]`.
    Although there's an iterator in there, the eventual reference
    is to a member of the array, not the iterator.
* In src/gui/dialogs/unit_advance.cpp, `cfg.child_range("...").back()`
    That returns an object indirectly owned by cfg.

We'd like the other warnings of -Wextra, so turn off -Wdangling-reference.
2024-02-05 20:03:40 +01:00
Gwyn Ciesla
f67fd26ff5
Fix tmpfiles.conf and sysusers.conf paths in SConstruct. (#8280) 2024-01-23 04:07:45 +03:00
pentarctagon
453dbc685f Enable stricter checks for debug builds.
Use _GLIBCXX_DEBUG, _GLIBCXX_DEBUG_PEDANTIC, and _GLIBCXX_ASSERTIONS for the debug Ubuntu build.
2024-01-17 00:38:11 -06:00
P. J. McDermott
fc4d11b2cb systemd: Run as _wesnoth:_wesnoth
systemd 246+ logs a warning message, because running as "nobody" is
unsafe:
https://github.com/systemd/systemd/blob/v246/NEWS#L106-L113

Prefix names with underscore, as recommended by systemd documentation:
https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html
2024-01-15 21:33:26 +01:00
Severin Glöckner
900fdd34ea scons: edit comment
[ci skip]
2023-10-23 03:18:31 +02:00
Pentarctagon
8bc5d7b72f
address codeql issue (#7832) 2023-08-20 19:45:47 -05:00
Pentarctagon
9315079389 Add curl-based functionality to download files from a URL.
This is a complement to #7416 where it replaces opening the replay's download URL in a browser with directly downloading it into the player's save folder.
2023-03-15 14:49:16 -05:00
Steve Cotton
405e315f1e Add a CMake and SCons flag for GLIBCXX_ASSERTIONS without GLIBCXX_DEBUG
Turning GLIBCXX_ASSERTIONS adds some bounds checks, such as checking
in std::string::operator[]. It's a subset of the checks that GLIBCXX_DEBUG
adds, but has the advantage that it doesn't require a rebuild of the Boost
libraries.

None of the CI builds enable these assertions, as they slow down the code
which makes the unit tests time out.
2023-03-03 10:44:22 +01:00
loonycyborg
74ee51e2fa
scons: Disable -isystem conversion if sys.platform == "win32"
msys2 pkg-config adds root system include path among -I flags and
passing it with -isystem isn't supported by gcc, and
the workaround of passing --dont-define-prefix to pkg-config doesn't
work on msys2's "subsystem" install of scons because posix style
absolute paths aren't handled properly when expanding CPPPATH.
Most likely related to https://github.com/msys2/MINGW-packages/issues/10761
2022-10-23 00:06:07 +03:00
Pentarctagon
f3ca89d5f4 Set correct pango required version in cmake/scons. 2022-09-09 10:28:15 -05:00
Wedge009
9fccea96ea SDL: Increase requirement to 2.0.10.
SDL_RenderCopyF and SDL_RenderCopyExF are only available from SDL 2.0.10 onwards.
2022-06-20 11:51:41 -05:00
Tommy
57f32eaa9f Add options to scons and cmake to force coloured compiled output.
In CMake this is the FORCE_COLOR_OUTPUT option. In SCons this is the
force_color option. They both pass -fdiagnostics-color=always to gcc,
or -fcolor-diagnostics to clang.

This is useful when building with Ninja, or running piped CI tools.
2022-06-10 16:45:38 +12:00
Pentarctagon
9929d3ca1c Remove some unused scons code. 2022-05-03 20:36:00 -05:00
Pentarctagon
0aa8dc3c6c Have cmake also execute the conftests. 2022-05-03 18:10:46 -05:00
Pentarctagon
f44acd68c2 Add build support for webp images. 2022-03-12 13:47:46 -06:00
Pentarctagon
d32cfb88c4 Update instructions and add warning to scons/cmake. 2022-03-09 15:01:37 -06:00
Larkin Nickle
902f7d37c4 SConstruct: need to link against socket library on SunOS
Tested on OpenIndiana 2021.10
2021-12-12 20:20:29 -06:00
Pentarctagon
e53d9c321d
Update gcov options. 2021-06-09 02:51:17 -05:00
Pentarctagon
f4e6e1861f
Add -fno-omit-frame-pointer for perf. 2021-06-09 00:59:43 -05:00
Pentarctagon
4b35be4bb0 Combine profile build into release build. 2021-06-08 21:23:38 -05:00
loonycyborg
f59f5a4091
Load system certificate store manually on Windows because boost.asio doesn't 2021-05-22 01:06:10 +03:00
loonycyborg
1c4c5d4d1e
Drop compatibility for boost 1.65 2021-05-06 17:09:13 +03:00
loonycyborg
b72b7a05ed
Add TLS codepath to server_base 2021-05-06 17:09:10 +03:00
Grzegorz Halat
c0db7311bb Bump SDL2 version to 2.0.8 2021-04-27 04:53:27 -04:00
loonycyborg
5d8c476396
scons: remove file existence check from InstallData
It was breaking install of generated files. Also adjusted manpage
install which was relying on this behavior.
This helps with issue #5692
2021-04-25 03:11:56 +03:00
loonycyborg
546355f32e
scons: look for systemctl instead of systemd when determining default value of "systemd" option
This is a more reliable way to detect distro with systemd support.
"systemd" binary may not be in PATH while systemctl would have to be.
This helps with part of issue #5692
2021-04-25 02:07:28 +03:00
Pentarctagon
6db64459d2 Remove checks for stuff that aren't used anymore. 2021-03-14 22:42:59 -05:00
Iris Morelle
2dfdc0061d Remove SDL_ttf wrapper API
This removes the build-time dependencies on SDL_ttf and FriBidi,
alongside the SDL_ttf wrappers, the SDL_ttf text surface class, the
SDL_ttf render cache, and the SDL_ttf (de)initialization code.
2021-03-13 13:51:47 -03:00
Pentarctagon
b974423e2e Add optional fuh to campaignd. 2021-03-12 16:12:09 -06:00
Severin Glöckner
37dfcad927 Hide warnings from GCC if compiling with LTO
This adds the change from d643edc (in scons) and 941433e (in cmake) to the linking step as well, but only when using LTO

closes  #5350
2021-01-18 13:53:05 -06:00
Pentarctagon
90946ca262 Update to require C++17.
This then also bumps the minimum GCC version to 7.
2021-01-16 17:05:47 -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
Pentarctagon
0409c22ae2
Update cmake/scons for boost 1.65 minimum. 2020-12-19 01:54:46 -06:00
loonycyborg
85c9988f5e Remove "python_devel" from custom tools too 2020-12-14 15:59:14 +03:00
loonycyborg
4f5a713934 Drop load of unused scons tool "python_devel" 2020-12-14 15:47:41 +03:00
Pentarctagon
058bbf594f
Increase Boost minimum version for BOOST_DATA_TEST_CASE usage. 2020-11-27 13:03:42 -06:00