Commit graph

76 commits

Author SHA1 Message Date
kcgen
4b92afc4e0 Make GoogleMock available to the unit tests 2021-10-26 19:46:38 -07:00
kcgen
2e0ab8cbc7 Minimize warning-level for subprojects, as these are out-of-scope
Subprojects are only present to provide dependencies when the
local package manager is unable to provide the libraries.

Because fixing dependencies (and by extensions warnings) is out
of scope of staging (ie: such as SDL warnings), so too are
warnings from subprojects. Therefore, seeing excessive warnings
from a subproject only acts as confusing and excessive visual
clutter.

If someone does want to see greater subproject warning levels,
they can easily be "turned up" with:

  -Dmt32emu:warning_level=3
  -Dfluidsynth:warning_level=3
2021-10-21 18:31:09 -07:00
kcgen
ac5a9d2f2b Workaround GCC 7 and 8 that require experimental::filesystem
GCC 7 and 8 were released before the std::filesystem specification
was finalized in C++17, and use "experimental/filesystem" as
their include file and "std::experimental::filesystem" as the
namespace.

Newer GCC's and other compilers (Clang, MSVC) are currently
modern enough that no workarounds are needed for them.

Therefore, this commit uses a temporary "std_filesystem.h" that
normalizes these differences and provides a "std_fs" namespace.

The std_prefix was selected to explicitly indicate that the
file and namespace comes from std::, and not our own creation.

Unfortuantely we also cannot use the commonly suggested "fs::"
namespace shorthand due to the CPU core using an "fs" enum value.

When GCC 7 and 8 are eventually not supported, we can mass replace
"std_filesystem.h" and "std_fs::" with their C++17 equivalents,
<filesystem> and std::filesystem, respectively.
2021-10-05 14:16:35 -07:00
kcgen
3e703c2d97 Add whereami to the Meson and VS build systems 2021-10-05 14:16:35 -07:00
Patryk Obara
e777236c42 Reformat default meson options for readability 2021-10-04 06:41:41 -07:00
Patryk Obara
e65a2ae05e Avoid using libloguru as project include
Inject build instructions via dependency, just like other bundled libraries.

Also, move dependency declarations of bundled libraries to their
respective meson files.
2021-10-04 06:41:41 -07:00
Patryk Obara
4140145635 Use Meson summary function
Since we upgraded to meson > 0.53, we can use summary to highlight some
information important during build. This is way more readable than using
message function for the same purpose.
2021-10-04 06:41:41 -07:00
kcgen
38f648069f Move loguru from submodule to src/libs 2021-10-03 11:52:46 -07:00
kcgen
649b299b6d Set Meson to use level-3 warnings by default 2021-09-16 10:30:24 -07:00
kcgen
37ce68875e Use the C++17 standard in Meson's project settings 2021-09-16 10:30:24 -07:00
Kirk
34ac3379d7 Replace logging with loguru 2021-08-24 10:44:54 -07:00
Kirk
8fe2350cb6 Install latest Meson via pip3 2021-08-17 17:04:49 -07:00
Kirk
afbba7bb82 Define and prefer HAVE_BUILTIN_CLEAR_CACHE in meson.build 2021-08-17 17:04:49 -07:00
mrfixit2001
c74131c2aa Fix performance regression with meson build system
The meson build system adds -fPIC during compile, which has a negative performance impact. Adding this flags tells meson not to add this flag.

Resolves this issue:
https://github.com/dosbox-staging/dosbox-staging/issues/1174

Further info:
https://github.com/mesonbuild/meson/issues/9080
2021-08-09 12:45:03 -07:00
kcgen
6576f7e0cb Bump v0.77.0 version strings to v0.78.0 2021-07-02 11:59:12 -07:00
kcgen
6418e0ee65 Increase the required SDL version from 2.0.2 to 2.0.5
Why do we want this?

Currently sdlmain has three code branches that are only active
when the code is compiled with SDL versions prior to 2.0.5.

Testing these pre-2.0.5 branches is difficult because it
requires installing obscure OSes and/or installing end-of-like
operating OSes. We also have no maintainers running such
operating systems nor can we expect this of current and future
maintainers.

Repology shows that the currently maintained operating systems
are using SDL2 2.0.5 and greater:

macOS:
  - Brew 2.0.14
  - MacPorts: 2.0.14

Linux:
  - Arch (rolling distro): 2.0.14
  - CentOS 7 (aarch64, x86-64: 2.0.10 and 2.0.14
  - Cygwin: 2.0.7
  - Debian (old-stable): 2.0.5
  - Devuan 2.0 (oldest non-EOL release): 2.0.5
  - Fedora 33 (oldest non-EOL release): 2.0.14
  - FreeBSD ports: 2.0.14
  - Gentoo: 2.0.14
  - Manjero stable: 2.0.14
  - MSYS2: 2.0.14
  - OpenBSD: 2.0.14
  - OpenSUSE Leap 15.2 (oldest non-EOL release): 2.0.8
  - Raspbian (old-stable): 2.0.5
  - Rocky Linux 8 (CentOS fork): 2.0.10
  - Ubuntu 18.04 (oldest non-EOL release): 2.0.8

Windows:
  - vcpkg: 2.0.14

The only operating systems that _are_ maintained but don't support
support SDL2 2.0.5 are:
 - Salix 14.2 (released in 2014): 2.0.4
 - Trisquel 8.0 (EOL in "2021", month/day unspecified): 2.0.4

Ref: https://repology.org/project/sdl2/versions
2021-07-02 08:43:33 -07:00
kcgen
df687daa05 Allow static linking for mt32emu in Meson 2021-06-27 07:23:12 -07:00
kcgen
a4d148bd07 Add reSIDfp and Innovation SSI-2001 to the buildsystem 2021-06-03 19:50:37 -07:00
Kirk
649a428dc3 Dynamic core support for W^X systems 2021-06-01 09:11:00 -07:00
Patryk Obara
ddf73bea27 Add fluidsynth to try_static_libs list
Some checks failed
PVS-Studio analysis / PVS-Studio static analyzer (push) Has been cancelled
Windows builds / Clang 32-bit (push) Has been cancelled
Windows builds / GCC 32-bit (push) Has been cancelled
Windows builds / Clang 64-bit (push) Has been cancelled
Windows builds / GCC 64-bit (push) Has been cancelled
Linux builds / Clang, Ubuntu 20.04 (push) Has been cancelled
Linux builds / GCC 5, Ubuntu 18.04 (push) Has been cancelled
Linux builds / GCC, minimum build (push) Has been cancelled
Linux builds / GCC, -dyn-x86, +debugger (push) Has been cancelled
Linux builds / GCC, -dyn-x86 (push) Has been cancelled
Linux builds / GCC, +debugger (push) Has been cancelled
Linux builds / GCC, Ubuntu 18.04 (push) Has been cancelled
Linux builds / GCC, -network (push) Has been cancelled
Linux builds / GCC, warning_level=3 (push) Has been cancelled
Linux builds / GCC, +tests (push) Has been cancelled
Linux builds / GCC, Ubuntu 20.04 (push) Has been cancelled
Linux builds / Release build (push) Has been cancelled
Linux builds / Publish additional artifacts (push) Has been cancelled
macOS builds / GCC (push) Has been cancelled
macOS builds / Clang, +debugger (push) Has been cancelled
macOS builds / Clang, warning_level=3 (push) Has been cancelled
macOS builds / Clang, +tests (push) Has been cancelled
macOS builds / Clang (push) Has been cancelled
macOS builds / Release build (push) Has been cancelled
macOS builds / Publish additional artifacts (push) Has been cancelled
Windows builds / MSVC 64-bit (push) Has been cancelled
Windows builds / MSVC 32-bit (push) Has been cancelled
Windows builds / Release build (64-bit) (push) Has been cancelled
Windows builds / Release build (32-bit) (push) Has been cancelled
Windows builds / Publish additional artifacts (push) Has been cancelled
Fixes: #968
2021-04-04 19:38:24 +02:00
Patryk Obara
92266e3282 Update mt32emu wrap dependency to 2.5.0 2021-04-04 09:30:19 +02:00
Patryk Obara
1ab66b5e0b Revert "Use Meson summary to communicate configuration result"
This reverts commit 72c9b841fc.

LGTM servers are stuck on Meson 0.51.1
2021-03-15 01:34:52 +01:00
Patryk Obara
72c9b841fc Use Meson summary to communicate configuration result
FluidSynth dependency requires Meson 0.53.0 to be on par with upstream
CMake buildsystem, so let's start summarizing build setup as well.
2021-03-14 23:33:21 +01:00
Patryk Obara
9d25c50062 Add fluidsynth dependency meson wrap fallback 2021-03-14 23:33:21 +01:00
kcgen
c01634b395 Add informational-only support for naming std::threads 2021-03-13 12:59:53 +01:00
Patryk Obara
6107217f0a Rename CONF_BRAND to CONF_SUFFIX 2021-03-10 13:43:05 +01:00
Patryk Obara
810ce76d7e Remove "-git" suffix from .conf file in release
Default .conf file name after this change is:

- dosbox-staging.conf - for buildtypes release, plain, and other
  non-debug build types
- dosbox-staging-git.conf - for buildtype debug and debugoptimized

It does not work for Visual Studio buildsystem, but we're distributing
these builds ourselves, so simple adjustment on CI is enough (this tiny
hack will disappear once VS buildsystem will be replaced with Meson
anyway).

Pros of implementing this change:

- It's easier to test Linux and macOS builds before the release
- Removes another step from our release checklist (!)
- Makes life easier for packagers, who want to deliver pre-release
  builds (e.g. preparing new package or providing weekly test builds)

Cons of implementing this change:

- Users testing our official snapshot builds might end up with broken
  default .conf file for next stable release.
2021-03-10 13:43:05 +01:00
kcgen
b0e28def97 Use an atomic to manager the SoftLimiter's pre-scalar
The pre-scalar:
 1. Is read and applied to the samples before limiting in
    SoftLimiter

 2. Is written-to and updated when the user updates their
    channel's mixer level.

These two tasks can occur in separate threads, therefore
a potential data-race exists on the pre-scalar value as
reported by Clang's thread sanitizer:

1. When applying the scalar:

   ThreadSanitizer: data race
   ../src/misc/soft_limiter.cpp:194 in void
   SoftLimiter::ScaleOrCopy<(signed
   char)0>(std::vector<float, std::allocator<float> > const&,
   unsigned short, float, __gnu_cxx::__normal_iterator<float
   const*, std::vector<float, std::allocator<float> > >,
   __gnu_cxx::__normal_iterator<float const*,
   std::vector<float, std::allocator<float> > >, float,
   float, std::vector<short, std::allocator<short> >&)

2. When updating the scalar via mixer callback:

   ThreadSanitizer: data race ../src/midi/midi_mt32.cpp:362
   in MidiHandler_mt32::SetMixerLevel(AudioFrame const&)
2021-03-07 00:25:26 +01:00
kcgen
2c969cc12a Always support Opus CD-DA tracks
Vorbis has been deprecated for years by its maintainer Xiph who
recommends Opus as its successor because it provides:
 - superior audio qualilty at lower bitrates
 - PCM-accurate seeking
 - very low block-level latency

One of the reasons Staging supports Opus is to allow those
packaging games (like GoG) to finally get off Vorbis once and
for all.

However, if Staging makes Opus optional for package maintainers
then why would anyone packaging games rely on Opus.

This commit make Opus no longer optional. We know Opus is supported
under all known repositories that we ever expect Staging to run on,
and even beyond that we know Opus can be  compiled on all platforms
as well.
2021-03-06 01:50:20 +01:00
Patryk Obara
10067a7801 Add pcap dependency to make ne2000 buildable
Some checks failed
PVS-Studio analysis / PVS-Studio static analyzer (push) Has been cancelled
Windows builds / Clang 32-bit (push) Has been cancelled
Windows builds / GCC 32-bit (push) Has been cancelled
Windows builds / Clang 64-bit (push) Has been cancelled
Windows builds / GCC 64-bit (push) Has been cancelled
Linux builds / Clang, Ubuntu 20.04 (push) Has been cancelled
Linux builds / GCC 5, Ubuntu 18.04 (push) Has been cancelled
Linux builds / GCC, minimum build (push) Has been cancelled
Linux builds / GCC, -dyn-x86, +debugger (push) Has been cancelled
Linux builds / GCC, -dyn-x86 (push) Has been cancelled
Linux builds / GCC, +debugger (push) Has been cancelled
Linux builds / GCC, Ubuntu 18.04 (push) Has been cancelled
Linux builds / GCC, -network (push) Has been cancelled
Linux builds / GCC, warning_level=3 (push) Has been cancelled
Linux builds / GCC, +tests (push) Has been cancelled
Linux builds / GCC, Ubuntu 20.04 (push) Has been cancelled
Linux builds / Release build (push) Has been cancelled
Linux builds / Publish additional artifacts (push) Has been cancelled
macOS builds / GCC (push) Has been cancelled
macOS builds / Clang, +debugger (push) Has been cancelled
macOS builds / Clang, warning_level=3 (push) Has been cancelled
macOS builds / Clang, +tests (push) Has been cancelled
macOS builds / Clang (push) Has been cancelled
macOS builds / Release build (push) Has been cancelled
macOS builds / Publish additional artifacts (push) Has been cancelled
Windows builds / MSVC 64-bit (push) Has been cancelled
Windows builds / MSVC 32-bit (push) Has been cancelled
Windows builds / Release build (64-bit) (push) Has been cancelled
Windows builds / Release build (32-bit) (push) Has been cancelled
Windows builds / Publish additional artifacts (push) Has been cancelled
The feature and the dependency are disabled by default.
2021-02-24 15:05:24 +01:00
Patryk Obara
dcc08e81e4 Add slirp dependency and use_slirp setup option
Make use_slirp default to false as long as the code does not compile.
2021-02-24 02:39:51 +01:00
Patryk Obara
c245aa5d76 Add NE2000 to the buildsystem, but keep it disabled
Old implementation of NE2000 depends on pcap library, which we don't
want to use; disable the feature for now to make it possible to import
patches replacing libpcap with libslirp.
2021-02-24 01:02:02 +01:00
Patryk Obara
6ea6dffb7b Move zypper packages list to README.md 2021-02-21 18:13:12 +01:00
Patryk Obara
3cac04135b Make a note of feature in meson 0.53.0 2021-02-21 15:39:56 +01:00
Patryk Obara
612a02dc63 Link opusfile statically in macOS release 2021-02-21 15:39:56 +01:00
Patryk Obara
740a4ec270 Link libpng statically in Linux and macOS releases 2021-02-21 15:39:56 +01:00
Patryk Obara
a1b637abc6 Link SDL2_net statically in macOS release CI job
Convert option try_sdl2_static into a new one, where user can select
several libraries that will be marked for static linking.

Provide short explanation in meson_options.txt file.
2021-02-21 15:39:56 +01:00
Patryk Obara
0800f7d9de Raise the minimum meson version to 0.51.0
- We use "not found message" for dependencies, which was introduced in
  0.50.0. Our meson script was still operational on 0.49.0, but it
  was generating warnings. Usage of this feature combined with minimum
  meson version was generating warnings for everyone else as well.
  Rising minimum version avoids any confusion about what's the problem
  when.
- Meson version 0.51.0 has important bugfix; rising minimum version
  forces packagers into using client where this problem does not need
  to be re-discovered or worked around. Consequently, we can remove
  the assert now.

When comparing to default meson versions in various repos:

- Fedora, Arch have up-to-date Meson.
- Debian Stable is on 0.49.0, but Testing has newer version already and
  new Stable release in only a few months away.
- Ubuntu 18.04 LTS uses outdated Meson version, older than 0.49.0 already.
- Ubuntu 20.04 LTS uses Meson 0.53.0, so we're clear there.
- Other OSes generally have newer Meson versions.
2021-02-19 19:36:58 +01:00
Patryk Obara
036e8c58db Remove zlib dependency
It was relevant only for old versions of png library. Since we don't
support Ubuntu 16.04 any more, this dependency is not necessary.
2021-02-19 19:36:58 +01:00
Patryk Obara
515161087c Disable PPC and PPC64 dynrec backends for now
Upstream SVN r4424 started refactorization of cpu module, and it breaks
those backends; to be re-enabled once refactorization is done or when
we'll have time to fix it ourselves.
2021-02-16 12:09:11 +01:00
Patryk Obara
0881383470 Update version and license in meson project function
Simplify meson version check; we don't need an assert when minimum
version check is built straight into the project function (so the
version is verified in older meson clients as well).

Add license field.
2021-02-16 01:51:15 +01:00
Patryk Obara
3b5381b196 Link SDL2 statically for macOS release build
Fixes: #837
2021-02-15 02:03:58 +01:00
Patryk Obara
7cd6b2e994 Use Git tag description for emulator version
Some checks failed
Windows builds / GCC 32-bit (push) Has been cancelled
Windows builds / Clang 64-bit (push) Has been cancelled
Windows builds / GCC 64-bit (push) Has been cancelled
Linux builds / Clang, Ubuntu 20.04 (push) Has been cancelled
Linux builds / GCC, -dyn-x86, +debugger (push) Has been cancelled
Linux builds / GCC, -dyn-x86 (push) Has been cancelled
Linux builds / GCC, +debugger (push) Has been cancelled
Linux builds / GCC, Ubuntu 16.04 (push) Has been cancelled
Linux builds / GCC, Ubuntu 18.04 (push) Has been cancelled
Linux builds / GCC, -network (push) Has been cancelled
Linux builds / GCC, warning_level=3 (push) Has been cancelled
Linux builds / GCC, +tests (push) Has been cancelled
Linux builds / GCC, Ubuntu 20.04 (push) Has been cancelled
Linux builds / Release build (push) Has been cancelled
Linux builds / Publish additional artifacts (push) Has been cancelled
macOS builds / GCC (push) Has been cancelled
macOS builds / Clang, +debugger (push) Has been cancelled
macOS builds / Clang, warning_level=3 (push) Has been cancelled
macOS builds / Clang, +tests (push) Has been cancelled
macOS builds / Clang (push) Has been cancelled
macOS builds / Release build (push) Has been cancelled
macOS builds / Publish additional artifacts (push) Has been cancelled
Platform builds / Repository commit check (push) Has been cancelled
Platform builds / ppc64le (Ubuntu 20.04) (push) Has been cancelled
Platform builds / s390x (Ubuntu 20.04) (push) Has been cancelled
Windows builds / MSVC 64-bit (push) Has been cancelled
Windows builds / MSVC 32-bit (push) Has been cancelled
Windows builds / Release build (64-bit) (push) Has been cancelled
Windows builds / Release build (32-bit) (push) Has been cancelled
Windows builds / Publish additional artifacts (push) Has been cancelled
This change BREAKS Autoconf-based buildsystem. Only Meson and Visual
Studio buildsystems are operational from this point forward.

Thanks to this change, it will be easier for developers and testers to
communicate/detect the exact version of emulator.

Builds created from tarball releases OR builds from Git repo
checked out to point to an annotated tag will behave this way:

    $ dosbox --version
    dosbox (dosbox-staging), version 0.77.0
    ...

Development builds from Git repo will behave this way:

    $ dosbox --version
    dosbox (dosbox-staging), version 0.77.0-alpha-457-g6d8d10a9
    ...

Meson handles this "automagically", correctly for us via vcs_tag
function. We use it to generate version.cpp file - this way new commits
in repo will rebuild only a single file and trigger linker, but will
never result in full rebuild.

When Meson cannot obtain info version from Git, it automatically falls
back to version specified in our project function on top of meson.build
file.

Leave VERSION macro in place (it originated from Autoconf) in several
places - it's being extensively used when communicating e.g. "emulated
modem firmware version" and other fake-hardware identification.

Any builds created with Visual Studio (Release and Debug builds) will
use hardcoded version string for VERSION macro and hardcoded version
string DOSBOX_DETAILED_VERSION for all the places where we want more
info.  This macro defaults to string "git" and is being overriden with
output of "git describe" on CI.

Also, adjust --version copyright message for readability and to better
fit into 80 colums.

Fixes: #543
2021-02-15 02:03:58 +01:00
Patryk Obara
3fc7d92ed5 Provide an option for disabling ALSA dependency
We found that at least one Linux-like environment (Termux) provides
access to ALSA, but is missing ALSA development libraries in the repo.
2021-02-12 21:41:06 +01:00
Patryk Obara
74f0c1721e Prevent effc++ warnings from affecting subprojects 2021-02-12 21:41:06 +01:00
Patryk Obara
b37b098a61 Add mt32emu dependency with meson wrap fallback
Add new option (use_mt32emu), to allow users to opt-out of this
dependency if necessary. Aside of Meson WrapDB fallback, treat it as any
other dependency.
2021-02-12 21:41:06 +01:00
Patryk Obara
f3ff76788c Simplify mapping of OS names to defines 2021-02-08 00:37:00 +01:00
Patryk Obara
6737dbf349 Add unitial support for installation via meson
Install:

- compiled binary
- man page
- documentation (README, AUTHORS, etc)
- icons (both scalable and raster icons)
- desktop entry file
- metainfo.xml file
- license

Following usual Unix conventions.
2021-02-08 00:37:00 +01:00
Patryk Obara
0a71c02250 Upgrade minimum meson version to 0.49.0
As of early 2021, meson 0.49.x is packaged by Debian Stable and almost
all other up-to-date repositories.

Notably, it's missing from Ubuntu 18.04 (which uses meson 0.45.2).
2021-02-08 00:37:00 +01:00
Patryk Obara
7b39439f5e Document list of buildsystem improvements
We try to keep the compatibility with older meson versions to have wide
support amongst Linux distributions, but it means some improvements need
to wait until newer meson is widely available.
2021-02-08 00:37:00 +01:00