Commit graph

738 commits

Author SHA1 Message Date
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
loonycyborg
a15732aac3 Fix debug build on mingw platform 2020-11-19 19:45:06 +03:00
Iris Morelle
227738cb6f campaignd: Command line processing w/ Boost.program_options
This also adds a few utility switches which people are probably already
familiarized with from the game proper. Most notably this means I don't
need to alter and recompile campaignd any time I want different logging
settings.

There's some functionality commented out in this commit while I figure
out how to wire it into the campaignd server class.
2020-11-09 21:22:00 -03:00
Pentarctagon
dbd230c1d6 Bump minimum gcc requirement to 5.4. 2020-10-23 09:23:12 -05:00
Pentarctagon
467e4312b9 Add support for executing async queries.
Making the logging correctly handle multiple threads writing to the same stream at the same time will be handled separately later.
2020-10-14 19:38:49 -05:00
Steve Cotton
c9511d7ba0
Drop support for the l10n-track file (#4722)
The file only had a run-time effect if it listed any files as "fuzzy", which it
hasn't since the last change in 2015. However, that isn't a reason for removing
it.

The reason for removing it is that it doesn't make sense to automatically mark
images as fuzzy when an image changes, because fuzzy is often much better than
untranslated. This is different to the logic for strings, where a single word
can negate the meaning of a sentence. The decision has to be a manual process,
and at that point it might as well be done with the source-control tool's
delete-file function.

Even considering the previous times that l10n-track was used, I can't see a
scenario where it would be useful.

* Scenario: a screenshot needs to be replaced. In this case the new images are
  going to be screenshots too. If the old images are out of date, better to
  just delete them instead of needing the fuzzy mechanism; either option would
  have the same effect of showing the up-to-date-but-untranslated image.

* Scenario: a map is completely redrawn. This seems unlikely, as a completely redrawn
  image could be added as a new map rather than replacing the old one. Even if
  it does happen, it's probably best to just delete the old --overlay.png
  files.

* Scenario: a new landmark is added to a map. Using the existing overlay file
  is still going to be good, as it means the rest of the map is shown
  translated. There's surely new dialogue in the WML files commenting on this
  new landmark, which would be a good place to say
    # po: Lorem's Ipsum was added to the map on 24 Jan 2020, please add a label to your language's --overlay file.

* Scenario: an old feature is removed from the map. Using the existing overlay
  will have an out-of-date label, and the significance of that would depend on
  how it affects the storyline. This could be significant enough to make
  showing the English labels be a better option than showing the translated
  ones. However, the translated maps could be updated without knowledge of the
  language, so if it's such a significant change then the developer writing the
  new WML should probably do that.

* Scenario: a feature moves slightly on the map. This is an example where the
  l10n-track file has been used, it happened with the Bitter Swamp on the
  bottom-right corner of the title screen. I think it would have been better to
  show the slightly-out-of-date overlay instead of showing the English.

Note about cherry-picking: in the 1.14 branch, the change needs to be applied
to src/picture.cpp instead of src/filesystem.cpp.
2020-08-08 05:07:59 +02:00
Martin Hrubý
9f854e7ce8
Fix SDL2 2.0.12 change in SDL_GetDisplayDPI (#5024)
* Fix SDL2 2.0.12 change in SDL_GetDisplayDPI

Fixes #5019

* Remove signing requirement for DEBUG Xcode builds
2020-08-05 23:44:39 -05:00
Steve Cotton
935fa41379
Final part of the Python 2 removal, including updating install-pytools (#5027)
Update the list of files installed by "scons install-pytools", dropping Python2
versions and adding their Python3 replacements. This doesn't update any
`import` statements, as the tools have already been ported to use the Python3
modules - the scons script was out of date and was still bundling the wrong
versions.

Note for anyone looking at the history - although most of the current
tools have a '3' in the name just to indicate that they're the Python 3 version,
there's a double-meaning to that number in wmlparser3.py's name. There was a
`wmlparser2.py`, where the `2` indicates a redesign of the original.

The data/tools/README.md file was renamed from plain README without being
converted to Markdown format. This commit touches about half of that file;
headings in that half are updated to be Markdown, but to reduce the diff the
other headings aren't updated.
2020-08-05 21:56:12 +02:00
Pentarctagon
f662cad825 Fix the source_lists not being found when using the -Y/--srcdir option. 2020-08-01 03:50:52 -05:00
pentarctagon
7f9eebdf49 Add mariadbpp as a submodule.
This has been added as a submodule for convenience of use, since mariadbpp isn't included in any repositories (linux distros, vcpkg, etc) aside from an Arch AUR.
2020-07-30 13:17:22 -05:00
Pentarctagon
e6e01341f4
Allow specifying c++20. 2020-03-24 14:44:13 -05:00
loonycyborg
a0229523b8 scons: correct open() call for lockfile creation with py3 2020-02-23 02:41:45 +03:00