Commit Graph

329 Commits

Author SHA1 Message Date
Rafael Kitover cdfd37fc4e
build: rename dependencies submodule -> win32-deps
Rename the Git submodule `dependencies` used for some dependent files
for Win32 builds to `win32-deps` and make the necessary adjustments to
the CMake code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-10-04 20:05:52 +00:00
Rafael Kitover 821b9176bd
build: do not use debug libs for RelWithDebInfo
Stop trying to use debug libs for `CMAKE_BUILD_TYPE=RelWithDebInfo`,
this also fixes the current link error with SFML.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-17 18:35:39 +00:00
Rafael Kitover 3eea90afb6
build: set BUILD_TESTING=OFF when not git checkout
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-13 16:29:25 +00:00
Rafael Kitover d619ee2bb1
build: fix installing GoogleTest
Add the `EXCLUDE_FROM_ALL` keyword to the `FetchContent_Declare` call
for GoogleTest, so that gtest/gmock are not installed with the project.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-09 14:43:34 +00:00
Rafael Kitover 3bd7c918cc
build: fix cmake -DTAG_RELEASE functionality
Update the cmake -DTAG_RELEASE script to work with recent cmake changes.

Change it to not automatically make the release commit and tag, instead
specifying in the instructions that the person making the release must
edit the CHANGELOG.md and then run the commands, given in the
instructions, to make the release commit and tag.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-07 06:30:14 +00:00
Rafael Kitover 55c1477d69
build: disable FAudio for 32 bit Windows builds
Disable FAudio for 32 bit Windows builds because it uses libraries that
Windows XP does not have.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-09 02:34:25 +00:00
Fabrice de Gans 13756bcbf9 [Test] Replace doctest with googletest
* Convert the only existing test (strutils) to googletest.
* Create a test target for vbam-wx-config.
* Add necessary fakes for the test binary.
* Add tests to CI.
2024-05-08 13:00:56 -07:00
Rafael Kitover b52edf52ff
build: fix building on macOS with Homebrew
Move setting up the environment for macOS Homebrew earlier in
Options.cmake, as well as finding pkgconfig.

Update gcc/clang toolchain to not pass a gcc-specific option to clang.

Add faudio to list of brew packages to get in installdeps.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-15 23:30:34 +00:00
Fabrice de Gans 4ace296b3a [Build] Improve the TRANSLATIONS_ONLY build speed
* Move CMake dependencies checkout to `cmake/Dependencies.cmake`.
* Disable most dependencies checkout from the `TRANSLATIONS_ONLY` build.
* Remove the debug/translations_only GitHub Action.
2024-04-02 11:56:19 -07:00
Rafael Kitover c6da7e384e
build: add faudio to list of optional vcpkg deps
Add faudio to list of optional vcpkg deps linked to ENABLE_FAUDIO.

This codepath is not used right now as we are using binary packages.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-01 14:17:48 +00:00
Rafael Kitover 0556192238
build: fix MSYS2 check
Fix cmake logic for detecting MSYS2 "$ENV{MSYSTEM_PREFIX}".

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-03-31 01:16:36 +00:00
Rafael Kitover d9432ebb14
build: fix build on MINGW{64,32}/UCRT64 on MSYS2
Pass -Wno-deprecated-copy only for C++, gcc gives a warning for C.

Pass -Wno-unused-command-line-argument for clang only, gcc gives a
warning about it.

Add a failsafe for gcc/clang static link flags if libstdc++ or
libpthread is not available as a static library.

Move link command adjustment script invocations to src/wx, the target is
not yet defined in the toolchain.

Add -lws2_32 to the end of the link command for gcc on Windows because
of link order issues with those symbols.

Disable LTO for gcc on Windows, as it is broken.

Don't install extra-cmake-modules on MINGW32, that package is not
available there.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-03-30 20:14:32 +00:00
Rafael Kitover f57cad67c4
build: fix static linking on MSYS2 CLANG64
Bring back setting the MSYS variable under MSYS2, it's still being used
in a few places.

Link the SDL2::SDL2-static target for static builds.

Add -static-libgcc and -static-libstdc++ to the gcc/clang toolchain for
static builds.

Edit wxWidgets_LIBRARIES under MSYS2 to specify liblzma.a explicitly
because for some reason it's not being linked statically by default for
static builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-03-30 18:06:25 +00:00
Fabrice de Gans 98b51910eb [Build] Remove ENABLE_NLS, fix TRANSLATIONS_ONLY
* Remove the ENABLE_NLS option, it is now always enabled.
* Fix the TRANSLATIONS_ONLY build to properly build the zip file.
2024-03-26 17:38:12 -07:00
Fabrice de Gans 6ac95d373f [Build] Rework wx/CMakeLists.txt
* Bring the wx frontend more in-line with the rest of the codebase.
* Always default to Unicode APIs on Windows.
* Clean up all include guards and headers.
2024-03-18 23:56:22 +00:00
Fabrice de Gans d4430ca440 [Build] Move SDL build configuration to `sdl/`
* Clean up SDL includes and include guards.
* Add the sdl target to `sdl/CMakeLists.txt`.
2024-03-17 14:41:07 -07:00
Fabrice de Gans 000c7f854c [Build] Move non-core common code to `components/`
* Create multiple components library. These depend on the core code and
  are used by multiple frontends.
* Clean up the filters declaration by moving them to a common header in
  `components/filters/filters.h`.
* Clean up the include guards and include orders.
* Fix the modified paths in `src/debian/copyright` to match their new
  location.
2024-03-16 17:32:09 -07:00
Fabrice de Gans 047bd935ea [Build] Move the core emulator to src/core/
* Move src/apu/, src/gb/ and src/gba/ to src/core/.
* Clean up include guards and headers.
* Rename `BKPT_SUPPORT` to `VBAM_ENABLE_DEBUGGER` and remove the
  `NO_DEBUGGER` define.
2024-03-16 14:35:36 -07:00
Fabrice de Gans 33cb9a66d4 [Build] Move System.h and most of Util.h to core/
* Move System.h to core/base.
* Move most of the functionality out of Util.h to core/base.
* Fix corresponding headers.
2024-03-15 20:43:57 -07:00
Fabrice de Gans f8374b52a8 [Build] Move more of src/common to src/core/base
* Clean out all of the dependent headers.
* Modify generated version.h to improve the dependency chain and isolate
  the generated file to its own sub-directory within the build
  directory.
2024-03-15 19:51:52 -07:00
Fabrice de Gans 2f10e71f1d [Build] Cleanup files in src/common
* Remove unused files.
* Move files used only by the SDL frontend to the sdl folder.
* Remove contains.h in favor of manual iterator parsing.
2024-03-15 17:05:16 -07:00
Fabrice de Gans 8f92d99968 [Build] Move file-related utilities to core/base
* Remove duplicate function definitions between the libretro and other
  frontends by merging them into a common source file.
* Also move `systemMessage()` and message IDs definitions to core/base.
* Clean up and modernize many file utility methods.
2024-03-15 16:04:45 -07:00
Fabrice de Gans ce12db1e06 [Build] Move fex/ to src/core/fex/
* Clean up source set and public headers.
* Make the fex library an OBJECT library to speed up build.
* Clean up the only fex include to use the full path to the header.
2024-03-15 12:16:40 -07:00
Fabrice de Gans 1d051d0e6e
[Build] Make powershell optional on non-Windows (#1248)
Fixes: #1247
2024-03-15 11:32:24 -07:00
Fabrice de Gans f96e42fe04
build: cmake refactor and improvements
* Use add_compile_definitions everywhere.
* Remove unused intermediate target.
* Add ASAN support for MSVC.
* Remove duplicate option definitions.
* Configure MinGW separately from the toolchain
2024-03-15 16:19:01 +00:00
Fabrice de Gans aa59d94490
[Build] Add toolchain-specific files (#1244)
* Move toolchain-specific options to their own files.
* Clean up and modernize the use of toolchain options.
* Use modern cmake LTO support.
* Remove dead cmake code and cmake functions available in upstream cmake.
* Update README.md to remove references to removed build options.
2024-03-13 11:13:55 -07:00
Fabrice de Gans 1fff5cb1f7 Move build options to their own file
This moves all build options to their own file to clean up the main
CMakeLists.txt. In addition, this upgrades the minimum required CMake
version and changes the build to use CMAKE_MSVC_RUNTIME_LIBRARY rather
than hardcoding the MSVC ABI flag.
2024-03-11 01:38:25 +00:00
Fabrice de Gans 69769c1bef [CI] Use proper POWERSHELL variable casing
The POWERSHELL cmake variable was sometimes used lowercase.
2024-03-10 16:24:02 -07:00
Fabrice de Gans e998a4016a
[CI] Properly inclue SDL2 directories for vbamcore (#1240)
The variable name should have been changed to SDL2_INCLUDE_DIRS
2024-03-10 16:14:52 -07:00
Fabrice de Gans f17a9855f3
[CI] Look for pwsh in addition to powerhsell (#1239)
Newer github actions bot setup no longer include a powershell.exe
binary, only pwsh.exe
2024-03-10 15:58:25 -07:00
Rafael Kitover f46da1c525
build: remove our version of FindSDL2.cmake
SDL2 now comes with a cmake find_package() module, so we will use it
instead of this one that came from someone's github a decade ago.

Keep the fixup for libsamplerate with vcpkg and move it into the main
cmake code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-03-08 23:41:26 +00:00
Rafael Kitover ecb69a240a
build: add pthreads w/vcpkg, link FAudio target
In preparation for including the finished FAudio support, link the cmake
FAudio target FAudio::FAudio when the feature is enabled.

Add pthreads to vcpkg deps and use the installed PThreads4W on Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-03-06 21:58:43 +00:00
Rafael Kitover 390482a719
build: use libsamplerate with vcpkg sdl2 port
Enable the samplerate feature for the vcpkg sdl2 port to use
libsamplerate for resampling.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-01-02 02:57:09 +00:00
Rafael Kitover e19e13fa0a
build: use std:: proxy for nonstd:: on non-macOS
The nonstd:: implementation of nonstd::variant was causing a link error
in the Debug configuration on MSYS2 CLANG64.

Set the macros for choosing the implementation of both nonstd::optional
and nonstd::variant to the std:: forwarding behavior on all platforms
other than macOS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-10-24 17:22:47 +00:00
Rafael Kitover 6c38eaa2a5
build: rm gone ffmpeg deps in link flags for macOS
Followup on d8d3ee2b (build: remove unneeded ffmpeg/sfml deps for macOS,
2023-10-20). Also remove the link flags for these deps in the cmake
code, otherwise linking fails.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-10-20 23:25:14 +00:00
Rafael Kitover cd8d65bddd
build: set cmake C++ version to 17, fix Mac build
Fix Mac build regression caused by 2407923f (build: fix cmake version
warnings, 2023-08-26) due to vbamcore and vbam targets using C++11 but
no longer being compatible with it.

When cmake_minimum_required() was set to a much older version, the
CXX_STANDARD property for vbamcore and vbam were ignored.

With the change mentioned above setting a higher
cmake_minimum_required(), the -std=gnu++11 flag started being passed when
compiling these two targets, making them fail due to recent changes no
longer being C++11 compatible.

Set cmake_minimum_required() to 3.8.2, the first version of cmake
supporting C++17, remove the CXX_STANDARD and CXX_STANDARD_REQUIRED
properties from these two targets, and set CMAKE_CXX_STANDARD to 17 to
set this property to C++17 for all targets in the project.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-08-27 08:04:57 +00:00
Rafael Kitover 2407923fc0
build: fix cmake version warnings
To fix some cmake dev warnings in recent cmake versions, move
cmake_minimum_required() to before project() and set the minimum
required cmake version to 3.5.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-08-26 02:32:50 +00:00
Rafael Kitover 7b8c4242fb
builder: macOS build updates
Update glib/gvdb to fix a compile error with newer clang compilers.

Add link flags for ffmpeg to link the static libraries and frameworks it
needs.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-05-31 13:38:44 +00:00
Rafael Kitover 23aa083cd4
build: support RelWithDebInfo for vcpkg
Make some tweaks to the cmake files to support
CMAKE_BUILD_TYPE=RelWithDebInfo, release with debug information for MSVC
vcpkg builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-12 02:43:13 +00:00
Rafael Kitover 40711fa5c9
build: lowercase vcpkg package names
vcpkg now requires that package names be lowercase, change all package
names to lowercase.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-04-11 23:17:06 +00:00
Rafael Kitover 88b07df394
build: add pkgconf to vcpkg deps
Add pkgconf to list of vcpkg deps. We are not using it right now for
vcpkg builds, but it may be good to have available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-03-31 00:08:15 +00:00
Fabrice de Gans 0132c76100 Move GB/GBC header parsing to gbCartData
This adds a new class, gbCartData to do all of the GB/GBC header parsing
in a single location.

Breaking change: ROMs advertising a 2 KiB RAM size now properly only
have 2 KiB allocated for RAM, whereas it used to be 8 KiB. This was
tested with the one aftermarket ROM making use of this RAM size
(Quartet), with no issue. Save files and save state files should still
be compatible since the RAM was saved with the correct 2 KiB size.
2023-03-27 10:55:00 +00:00
Fabrice de Gans 892527e53b Move ConfigManager to SDL
This removes ConfigManager from common source and header files and moves
it to be only used by the SDL frontend.
2023-03-07 14:11:52 -08:00
Rafael Kitover 83d24828df
build: fix default debug build for vscode
Check if CMAKE_BUILD_TYPE is false and not just empty string, as it is
some kind of other empty value in the default vscode build and the check
fails.

If CMAKE_BUILD_TYPE is unset, default to Debug, which is what vscode and
most things expect as the default CMAKE_BUILD_TYPE.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-02-21 20:53:20 +00:00
Rafael Kitover 3989146fa5
build: enable severe warnings for MSVC release
Enable severe warnings for MSVC release builds with /W1.

Disable macro redefinition warnings explicitly with /wd4005.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-01-06 16:58:52 +00:00
Rafael Kitover 6307348cbc build: support MSVC arm64 cross build on x86
Adjust cmake code to support building a Windows arm64 binary on a
Windows x86/x64 host.

Add /EHsc to MSVC compiler flags for exception unwind support.

Check VCPKG_TARGET_TRIPLET in Architecture.cmake to set the appropriate
cmake variables for cross-compiling for arm64.

Add MSVC_x86_Host_Compile.cmake script, used from HostCompile.cmake, to
adjust the path of the cl.exe compiler and ENV{LIB} to build a C program
for x86 when cross-compiling, necessary for the bin2c utility.

Use wxrc from dependencies submodule when cross-compiling, because the
cross wxrc executable cannot be run on the host.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-12-29 20:29:53 -08:00
Rafael Kitover 2a65e92da2
build: remove StrawberryPerl from ENV{PATH}
On Windows, StrawberryPerl tools and libraries exposed in the PATH
environment variable can pollute and break the build, remove any such
entries for WIN32 as a startup cmake action.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-11-28 10:27:06 -08:00
Rafael Kitover 6d8ca723d0
build: restrict MSVC static libs to .lib only
The MSVC linker can now apparently link MinGW .a static libs too, and
StrawberryPerl pollutes the build with its own.

Set CMAKE_FIND_LIBRARY_SUFFIXES to .lib only when MSVC is true for
static builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-11-28 10:23:33 -08:00
Rafael Kitover 61b503ada4 builder: update core dists and macOS build
cmake:

Add cmake option `DISABLE_MACOS_PACKAGE_MANAGERS` to disable
automatically using macOS Homebrew, MacPorts or Fink.

Use `-Ofast` instead of `-O2` for default compiler optimization flags,
which enables `-ffast-math` among a few other tweaks. There is a lot of
controversy about this, but in our testing on MSVC with `/fp:fast` the
performance increase for this specific app is dramatic.

Update version regexps on the SFML headers in `FindSFML.cmake` to allow
for a variable number of spaces between the macro and its definition.

Update the version of the Sparkle update checker framework for macOS
from 1.23.0 to 2.3.0-beta.2, and add a command to the cmake commands for
copying the framework to the `.app` to delete it first if already
copied.

Builder dist changes:

Updates:

dist                    old v                   new v
==============================================================
xz                      5.2.4                   5.2.6
openssl                 1.1.1f                  1.1.1g
curl                    7.65.3                  7.85.0
ccache                  3.4.3                   4.6.3
cmake                   3.19.4                  3.24.1
autoconf                2.69                    2.71
autoconf-archive        2017.09.28              2022.09.03
libtool                 2.4.6                   2.4.7
help2man                1.47.5                  1.49.2
libiconv                1.16                    1.17
gsed                    4.4                     4.8
bison                   3.0.5                   3.8.2
texinfo                 6.5                     6.8
flex                    e7d45afc                ea6493d9
libicu                  65_1                    71_1
nasm                    2.14.02                 2.15.05
pcre                    8.41                    8.45
libffi                  3.2.1                   3.4.2
libxml2                 2.9.12                  2.10.2
libxslt                 1.1.33-rc2              1.1.37
XML-SAX                 0.99                    1.02
expat                   2.2.4                   2.4.8
libjpeg-turbo           2.0.4                   2.1.4
libtiff                 4.1.0                   4.4.0
freetype                2.10.0                  2.12.1
libgd                   2.2.5                   2.3.3
liberation              2.0.1                   2.1.5
urw                     91edd6ec                20200910
graphviz                4bf0ec9b                5.0.1
python2                 2.7.15                  2.7.18
python3                 3.9.1                   3.10.6
swig                    3.0.12                  4.0.2
doxygen                 1.8.14                  1.9.5
bakefile                33c270a5                7a218d89
XML-Parser              2.44                    2.46
ninja                   1.9.0                   1.11.1
meson                   0.51.2                  0.63.2
glib                    2.62.2                  51251940
libgpg-error            1.41                    1.45
libgcrypt               1.8.5                   1.10.1
libsecret               0.19.1                  0.20.5
sdl2                    2.0.10                  2.24.0
flac                    1.3.3                   1.3.4
libogg                  1.3.4                   1.3.5
libvorbis               1.3.6                   1.3.7
harfbuzz                1.7.5                   5.1.0
sfml                    03375688                2.5.1
shared-mime-info        1.9                     2.2
wxwidgets               9cc0c9a0                31720e1e
graphite2               ce0e793f                425da3d0
xvidcore                1.3.5                   1.3.7
fribidi                 1.0.1                   1.0.12
libgsm                  1.0.18                  1.0.22
libmodplug              5a39f591                d1b97ed0
libopencore-amrnb       0.1.5                   0.1.6
snappy                  1.1.7                   af720f9a
speex                   1.2.0                   1.2.1
vidstab                 1.1.0                   90c76aca
libvo-amrwbenc          0.1.3                   3b3fcd0d
libass                  0.14.0                  0.16.0
libbluray               1.1.2                   1.3.2
libvpx                  1.8.1                   1.12.0
libx264                 20190913-2245           f7074e12
libxavs                 distrotech-xavs-git     8300fbf4
libzmq                  4.2.2                   4.3.4
ffmpeg                  4.3.1                   5.1.1

Removed dists:

dist            ver
=========================
zlib            1.2.11
pkgconfig       0.29.2
docbook5.0      5.0
libwavpack      5.1.0

Added dists:

dist            ver
========================
zlib-ng         ce01b1e4
zstd            1.5.2
hiredis         1.0.2
pkgconf         1.9.3
pcre2           10.40
docbook5.0.1    5.0.1
docbook5.1      5.1

Changes:

Update all non-working dist URLs.

Replace zlib 1.2.11 with a recent zlib-ng built with `--zlib-compat`.

Add zstd and hiredis, new deps of ccache.

Replace pkgconfig with pkgconf.

Use both pcre1 and pcre2.

Remove the libxml2-python dist alias and rebuild libxml2 `--with-python`
and `--with-python3` after python 2 and 3 have built.

Remove libwavpack as ffmpeg 5 no longer uses it as a dependency.

Builder core:

Rename some of the directories and files to be a bit nicer.

Add `-Ofast -march=core2 -mtune=generic -pipe` to the global
`{C,CXX,OBJC,LD}FLAGS`. These are the optimization settings used by
default in the project as well, while `-pipe` significantly reduces
build time by making the compiler use pipes internally.

Add `-DFLOAT_APPROX` to the global `{CPP,C,CXX,OBJC}FLAGS` because we
are now using `-Ofast` and consequently, `-ffast-math`.

Set the `LIBRARY_PATH` variable in the global environment.

Make some adjustments for the new dist versions and make some other
improvements.

macOS builder fixes (tested on High Sierra 10.13 and Catalina 10.15):

Add support for predefined BUILD_ROOT and append BUILD_ROOT_SUFFIX.

Allow pre-defined CHECKOUT directory for building the project sources.

Sanitize `PATH` before build to remove `/usr/local` etc., use
/usr/local/bin/brew explicitly for deps instead.

If llvm and clang is installed from nix or brew, prepend the path of the
highest version found to `PATH`.

Remove `-lm` from build environment as macOS has never had an `m` math
library and this causes problems in some config checks.

Add LLVM `libunwind` from the LLVM archive.

Add a patch for `glib`'s `meson.build` to statically link
`gettext`/`libintl`, adds `-liconv -framework CoreFoundation`.

Add an extra location to check for `stdint.h` in XCode.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-11-12 13:23:54 +00:00
Rafael Kitover c249115b7a
build: set -mtune=generic
Nach explained that this is the safest and best option.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-10-16 18:37:03 +00:00