393 Commits

Author SHA1 Message Date
Pentarctagon
b95d72f9c1 Use cmake to create VS project files.
Due to an upstream change in vcpkg that breaks the simple integration previously available with `vcpkg integrate install`, building using that setup method is no longer possible. In order to work correctly, cmake must instead be used to generate the VS project files, since that is able to integrate with vcpkg, since vcpkg also uses cmake to build all the library dependencies.

An additional benefit of this is that it will no longer be necessary to separately update the VS project files since it will read the same source_lists files as cmake (on linux) and scons do.

This also enables running the WML unit tests on Windows with this in order to confirm that a valid wesnoth.exe is in fact being generated as well as fixes building the boost unit tests.

The warning level for both release and debug builds are now at level three, the remaining warnings have been fixed, and therefore strict builds have been enabled - any warning will now cause the build to fail, just like for the linux jobs.

Known issues:
* The boost unit tests don't actually run successfully - they fail on CI at least with an exit code on 201 - however I don't know if this is a real problem or just a problem with running headless on CI.
* The debug build doesn't quite work since the executables are built against the non-debug dlls but cmake copies over the debug dlls into the output directory. For now this can be worked around by copying the release dlls into the debug directory.
* The instructions in INSTALL.md are not very good since I don't use Windows and thus can't write anything more detailed. Ideally someone who uses Windows can add more detailed step by step instructions at some point.

Fixes #5741
2021-05-07 00:02:02 -05:00
loonycyborg
1c4c5d4d1e
Drop compatibility for boost 1.65 2021-05-06 17:09:13 +03:00
loonycyborg
7f1f1cecdf
Fix cmake build 2021-05-06 17:09:13 +03:00
Grzegorz Halat
c0db7311bb Bump SDL2 version to 2.0.8 2021-04-27 04:53:27 -04:00
Pentarctagon
c1fad387c1
Add the high contrast icons to cmake for installation.
Fixes #5685
2021-04-07 17:10:45 -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
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
Pentarctagon
ba89526cec
Put these checks in the same place. 2020-12-04 17:21:59 -06:00
Charles Dang
6adc9ab76f Bump SDL_Image dependency to 2.0.2 and enable jpg screenshots unconditionally 2020-12-05 09:30:17 +11:00
Pentarctagon
058bbf594f
Increase Boost minimum version for BOOST_DATA_TEST_CASE usage. 2020-11-27 13:03:42 -06:00
Alexey Sokolov
60564a959a Don't override default AR and RANLIB without LTO
`ar` is not always available, and when it is, it's not always correct, e.g. during cross-compilation.

https://bugs.gentoo.org/732096
2020-10-24 17:31:49 -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
Pentarctagon
113a4e0913 Use mariadbpp rather than the mysql C connector.
Reasoning being:
* The result_set and other APIs are nicer to use.
* We use mariadb on our server rather than mysql, so this would minimize the chance of any incompatibilities.
* The mysql C++ connector 1.1 isn't compatible with with c++17 (https://stackoverflow.com/q/47284705).
2020-07-30 13:17:22 -05:00
laikh
c5a1ac03e8 Fix MINGW (with MSYS2) build in Windows 2020-01-31 09:44:09 -06:00
loonycyborg
1d80308325 Revert "Remove check for boost.thread from buildsystems since it's not used anymore"
This reverts commit 4c7497722700f40fb9aa807dcbc4b6dfe75457bf.
Explicit linking against boost_thread is required when using boost as
static libraries.
2019-10-25 19:05:28 +03:00
loonycyborg
4c74977227 Remove check for boost.thread from buildsystems since it's not used anymore 2019-09-28 14:21:04 +03:00
loonycyborg
c7271646b7 Remove config check for gobject
It's not supposed to be required and was mandatory only for particular
pango version(s) due to bug
2019-09-24 12:07:48 +03:00
josteph
d76a7ba5d0 Disable -Wunused-lambda-capture on clang.
In a nutshell, capturing a local "const constexpr int foo;" variable
with [foo](){} warns on clang that the program would be valid even if
the square brackets had been left empty, but making them so warns on
VC15.  See
https://stackoverflow.com/questions/52416362/unused-lambda-capture-warning-when-capture-is-actually-used

Disable the warning since explicitly capturing foo is good practice.
2019-06-05 10:31:09 +00:00
loonycyborg
798e809512 Rename appdata and desktop files to contain D-Bus well-known name
as per freedesktop spec
2019-03-27 22:18:01 +03:00
Jyrki Vesterinen
4147df7efc Explicitly link to GObject (should fix #3840) 2019-01-05 17:31:00 +02:00
pentarctagon
e273684f66 Disable requirements for OpenGL/GLEW. 2018-12-31 13:26:48 -06:00
Victor Sergienko
8716b8f9d0 #3634, #3557: Port from iOS: Compile with Apple crypto framework instead of OpenSSL. 2018-10-25 23:20:04 -07:00
pentarctagon
617c69529e Fix cmake linking against libboost_thread. 2018-10-14 21:40:53 -05:00
Pentarctagon
6714ef32e0 Fixes #3518
Certain distro/compiler combinations will apparently warn about not optimizing when _FORTIFY_SOURCE is set.

(cherry-picked from commit 09fcc6b0519d458cbc3e16788576000a8484020b)
2018-10-07 03:24:57 +00:00
Pentarctagon
e405dc2bff Disabling hardening on Windows due to tdm-gcc's poor support.
As per sigurd's trial and error: RELRO's options are unknown entirely and -fstack-protector-strong results in compile errors.  Building with just PIE and _FORTIFY_SOURCE enabled does then compile, but results in a broken executable.

(cherry-picked from commit c9541176776aeb676e99f1804d123552430582ee)
2018-10-07 03:22:51 +00:00
Pentarctagon
9e78232e0e Fixup hardening options for Windows.
(cherry-picked from commit 277158222200d4131bbbb385e45a8c6993020b44)
2018-10-07 03:22:43 +00:00
Pentarctagon
bc3ad71f03 Fixup for osx hardening options.
(cherry-picked from commit da6ebc7423ea7b2e8a242ceb44f7bc72f2d08426)
2018-10-07 03:22:37 +00:00
Pentarctagon
6be6646a4e Enabled hardened executables by default.
The result of running "hardening-check wesnoth" now shows:
* Position Independent Executable: yes
* Stack protected: yes
* Fortify Source functions: yes (some protected functions found)
* Read-only relocations: yes
* Immediate binding: yes

(cherry-picked from commit 3290961db2eb00221c94f88f02f77ab640f497a4)
2018-10-07 03:22:36 +00:00
Charles Dang
848062fde6 Remove the CMake/Scons compile-time check for IEEE 754 compliance
Now handled by a static assertion.

(cherry-picked from commit d9315199ee44dfa8a36e4e01a9332ef21505df3c)
2018-10-07 03:21:31 +00:00
Pentarctagon
461ce4975d Don't require SDL2 or OGL for building the servers.
Requiring SDL2 was masking needing to add -lpthread explicitly.

(cherry-picked from commit fd34fe849770de379096ac1ffe612fb22473a846)
2018-10-07 03:21:16 +00:00
Pentarctagon
bb87cef484 Mark OpenGL and GLEW as required in cmake.
(cherry-picked from commit 8582ce10445f1e9d6ecc22621a6265a10c52cdb1)
2018-10-07 03:20:50 +00:00
Pentarctagon
e2501940a0 Warn about use of trampolines for nested functions.
Use of this feature with GCC in particular causes the stack to become marked as executable.

(cherry-picked from commit 96b43a9af4ec76882afe6924e9c3dafb5b8beac5)
2018-10-07 03:20:41 +00:00
pentarctagon
36eae8c771 Add option to build wesnoth with hardening options.
(cherry-picked from commit 6c5fc82b1baa0fc7b40beaccd975d595c5db728f)
2018-10-07 03:20:23 +00:00
pentarctagon
a040d521a4 Updates cmake and scons to be able to compile with OGL.
Scons OpenGL/GLEW test taken mostly verbatim from 3e2eba22a96cb2c6c69ee5109059b806f22a372f

(cherry-picked from commit 5e36a90039ddde3625690ace5259198e1932a7f8)
2018-10-07 03:20:04 +00:00
Nils Kneuper
f8df22f7d9 fixed issues with building translation via cmake
commit 3effecd added an "if" block in CMakeLists with a variable that
does not exist ("NLS"). This breaks running translation updates for
every cmake user. Changed the variable to the existing "ENABLE_NLS".

@Pentarctagon I don't know if the travis script has to be adjusted as
well. Please test.

(cherry-picked from commit 64fe3988d87b61e40199297d710c035d85dedd49)
2018-10-07 03:20:01 +00:00
pentarctagon
ff0009aa52 Don't copy the po/ directory into the docker image for non-NLS jobs.
(cherry-picked from commit 3effecdb069dad3036011ddb47f07d56e8ded121)
2018-10-07 03:19:57 +00:00
Matthias Krüger
4c5e74b2da cmake/scons: if sanitizers are enabled, also add -fno-omit-frame-pointer and -fno-optimize-sibling-calls.
Otherwise, if we build with sanitizers and optimizations, the sanitizer stacktraces can become quite hard to read.

(cherry-picked from commit 29089a47369c32d4eabb93ac7f5b33222c047670)
2018-10-07 03:19:54 +00:00
pentarctagon
c75a083541 Allow specifying a sanitizer with cmake.
(cherry-picked from commit 5b94101975abd1ab81cc79bc18710478129446af)
2018-10-07 03:19:37 +00:00
pentarctagon
1ef1704fd9 Adds the opt/OPT option to scons/cmake.
Travis now also makes use of this to set the optimization level for the -O0 builds, rather than extra_flags_*.  This additionally fixes an issue where using -O0 in the release build with LTO resulted in the individual *.o files being compiled with -O0, but LTO then still linked with release's default -O3.

(cherry-picked from commit 63ff641662d4192401a49f9a002d7872000a3f02)
2018-10-07 03:19:35 +00:00
Charles Dang
31e6c40653 Removed OpenMP-related code
After some discussion, we concluded that this code was unmaintained, not even used in
some places (display.cpp, units/frame.cpp), leaving the only area that really used it
at all the image surface cache. Considering there was never really a conclusive benchmark
of its benefits and because said surface cache will be used a lot less going forward,
we're just removing it and simplifying everything for everyone.

Closes #1260 since it's now irrelevant.

(cherry-picked from commit 3792612fb759942e6eb5de51364c2cca4ed16b40)
2018-10-07 03:19:30 +00:00
Charles Dang
32da54b059 Removed Boost Thread as a built-time dependency
We use std::thread now.

(cherry-picked from commit 9de7aff9044b1aae7fc56c4b78a400d93c0f6750)
2018-10-07 03:19:10 +00:00
Iris Morelle
6f5f1482d2 cmake, scons: Drop option to enable or disable the removed SDL_SavePNG code
Commit dfc42e8a8dd550ca04ae16e2d2d7ebffbba0bc21 removed said code since
Wesnoth can use IMG_SavePNG() from SDL_image 2.0 instead. However, the
author left the build-time configuration options intact, and also part
of the necessary code for CMake to link Wesnoth against libpng.

Note that this change also eliminates an unnecessary direct link-time
dependency on libpng when using both CMake and SCons.

(cherry-picked from commit 4799ca05fe40838c41814433780d0464d9b8f071)
2018-10-07 03:18:33 +00:00
Iris Morelle
d0c9a02189 Revert "Revert "Bump min Boost version to 1.56.0""
This reverts commit cdf9b465c668648721c4638ce117da130ad36284.

May this noise be my vengeance.

(cherry-picked from commit f6a128579ad6d94cc7c8a57bebd1fc2bb0f735a0)
2018-10-07 03:18:08 +00:00
Iris Morelle
777eb9ef2d Revert "Bump min Boost version to 1.56.0"
This reverts commit c82c1ff9059aa19adda6a527f41595a18b8c0a1f.

(cherry-picked from commit cdf9b465c668648721c4638ce117da130ad36284)
2018-10-07 03:18:08 +00:00
pentarctagon
7f0827b848 Stop hard-coding cmake's -std version.
Adds the CXX_STD variable which can be set.  Currently defaults to 14.  This also now makes cmake honor the CXXSTD env variable set on travis.

(cherry-picked from commit 983045718aa13a2b7b1b45bb37baa76a88a1d47e)
2018-10-07 03:17:58 +00:00
Gregory A Lundberg
cc5fe2adc1 Change SCons and CMake to C++14
(cherry-picked from commit 2a17ecccfcbf30f0d966db74c176cae87648c6d6)
2018-10-07 03:17:57 +00:00