Commit Graph

135 Commits

Author SHA1 Message Date
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 fc82e06270
build: do not build SDL bin on Windows or macOS
Stop enabling the SDL binary by default on Windows or macOS because it
usually only of interest to Linux users.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-08 12:53:52 +00:00
Rafael Kitover df89beb256
build: disable gpg signatures by default
Add the GPG_SIGNATURES cmake option to control creating gpg clearsign
signatures for the translations and exe zips for UPSTREAM_RELEASE,
defaulting to OFF.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-05-07 02:59:17 +00:00
Rafael Kitover 0c39a5ba7a
build: override FindGettext to not update po files
Copy the cmake 3.28.3 FindGettext.cmake to cmake/ and comment out the
line that updates the po file from the pot. Because we download po files
from transifex we don't want this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-16 22:12:46 +00:00
Rafael Kitover af6028a9dd
build: fix build for nix on macOS
Add the NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM env var to the macOS CI as
faudio has not been marked compatible with macOS yet.

Remove FindGettext.cmake as it is a core cmake module that is available
in the versions of cmake we support now.

Add support for nix to MacPackageManagers.cmake and add brew gettext to
CMAKE_IGNORE_PATH when not using brew. Also update the cmake style.

Add faudio, libintl and the System framework to buildInputs in
default.nix.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-16 15:30:30 +00: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
Rafael Kitover 50d17363ea
build: fail finding FAudio silently
Change the find_package() call for FAudio to QUIET to not show a giant
warning when it's not available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-14 10:09:37 +00:00
Rafael Kitover 8abe3e79da
build: remove -lgcc from static link flags
Remove -lgcc from static link flags for gcc/clang, clang does not
support this and -static-libgcc is enough.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-12 15:44:27 +00:00
Rafael Kitover 710ffeb1b2
build: update mac build
Update dists for gettext and gsed to get around new compile errors from
clang.

Update SDL and ffmpeg and add FAudio.

Make some other minor adjustments for recent changes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-10 22:52:35 +00:00
Rafael Kitover b00e23f5b5
build: enable FAudio on non-Windows
Enable FAudio on non-Windows too if the cmake support is found.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-08 04:02:48 +00:00
Rafael Kitover ff21f8da21
build: enable FAudio sound driver on Windows
Enable FAudio on Windows if cmake can find it.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-06 11:22:20 +00:00
Rafael Kitover 775a571f75
build: fix detecting Visual Studio default vcpkg
Make the regular expression against VCPKG_ROOT less specific for
detecting the default Visual Studio vcpkg, for some reason it stopped
working.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-06 11:09:34 +00:00
Rafael Kitover 045c98d8fa
build: only use -Werror=lto-type-mismatch on gcc
Only pass -Werror=lto-type-mismatch to gcc, clang does not have this
option and throws a warning.

Also quote some barewords in if() statements.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-03 10:30:04 +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 3518dc6a05 build: fix LTO on Linux
Add -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing to
compile and link options for gcc/clang always.

Rename struct yy_buffer_state in src/sdl/expr-lex.cpp to struct
yy_buffer_state_sdl because it breaks when linking the SDL binary with
-Werror=odr.

Fix #1260

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-04-01 21:40:35 -07: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 68adb14b07 [Build] Use Toolchain-gcc-clang for non-MSVC
Apple compiler ID is defined as `AppleClang`. Rather than explicitly
adding every single compiler ID, this changes the build to try to apply
settings for GCC for every non-MSVC-like compilers.
2024-03-18 17:12:51 -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 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 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 d8a1886ccb [Build] Use new way of setting /Z flag with MSVC
CMake 3.25 introduced the CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to set the
/Z flag for MSVC toolchains. Use it rather than modifying the compile
options if possible. We revert to setting the compile options manually
if the CMake version is too old.
2024-03-15 11:32:38 -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 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 215e3c5ae9
build: use find_program() to find powershell
Use cmake find_program() to find powershell.exe on Windows because
invoking `powershell` or `powershell.exe` without a path sometimes fails
for some reason. Use the standard location on Windows 11 as a hint.

Make the `pwsh` executable REQUIRED when installing vcpkg packages
on non-Windows.

Use find_program() to find the zip executable before downloading it on
Windows vcpkg builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-02-28 13:44:22 +00:00
Rafael Kitover e7d135dbf1
Update links to new domain visualboyadvance-m.org
Update all URLs in the code and documentation to the new domain
visualboyadvance-m.org and also fix the date for the last release in the
CHANGELOG.md.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-02-06 15:55:19 +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 d1aa4eb23d
build: detect vcpkg host triplet for build deps
On Windows, detect the host triplet for vcpkg and prepend it to the
triplet list to get the binary packages for vcpkg build dependencies
correctly.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-31 16:06:41 +00:00
Rafael Kitover 7dc95076e5
build: fix vcpkg binary package list parsing
Fix parsing of package list from the server html, which was ignoring
brotli because it was on the same line as another package. Use a
different method to extract the links that does not rely on them being
on separate lines.

Also fix the errors from `vcpkg list` on new vcpkg clones.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-31 15:41:05 +00:00
Rafael Kitover 8184522c6d
build: don't use vcpkg on non-WIN32 w/o triplet
Fix the logic in the vcpkg automatic support to return on non-WIN32 if
VCPKG_TARGET_TRIPLET is not defined.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-13 14:50:54 +00:00
Rafael Kitover 78b99d8b23
build: fix wrong syntax in vcpkg cmake
Fix if(EXISTS var) statements to be written as if(EXISTS ${var}) because
the EXISTS operator does not accept variable references.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-04 00:13:29 +00:00
Rafael Kitover 717ac7ed74
build: fix inst check for VS default vcpkg
Since the new default VS vcpkg does not implement list, use list from
the powershell module to check for packages that are already installed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-03 16:50:44 +00:00
Rafael Kitover 59d67fe703
build: fix check for vcpkg ports in vcpkg clones
Fix checking for already installed vcpkg ports in user vcpkg clones,
broken in 491f104b (build: better binpkg support for default VS vcpkg,
2023-11-30).

Checking for installed ports in the VS default vcpkg is still broken,
because it does not implement the list command.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-01 10:38:20 +00:00
Rafael Kitover de1f4dffba
build: prefer user vcpkg root over VS system-wide
If the vcpkg clone exists in our preferred location, and VCPKG_ROOT has
not been passed to the build system, use it over the Visual Studio
default one, which is much more problematic.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-12-01 09:54:51 +00:00
Rafael Kitover 491f104b89
build: better binpkg support for default VS vcpkg
Check for cl.exe in the PATH to also automatically enable vcpkg support.

Ignore git errors for default VS vcpkg, as it is not in git.

Get host triplet packages (build depends currently) for static triplets,
e.g. get x64-windows packages also when getting x64-windows-static
packages. This helps with the default VS vcpkg too, as it cannot run
regular install commands for build deps.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-30 17:53:24 +00:00
Rafael Kitover a262a2facf
build: make inferred vcpkg triplet default static
Make the vcpkg triplet inferring code only run on WIN32 explicitly, and
make all inferred triplets -static, not only when BUILD_SHARED_LIBS is
FALSE.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-14 08:40:10 +00:00
Rafael Kitover 215e9b1ac2
build: fix vcpkg support for Linux
Fix the Linux-specific date command in the cmake code, and skip the ABI
check for vcpkg, because it is failing for some reason on Linux+vcpkg.

The resulting executable works perfectly.

This should also help on mac, I will test this later.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-10 09:50:50 +00:00
Rafael Kitover 0e68a2340c
build: compare vcpkg bin pkg revisions explicitly
Compare port revisions explicitly instead of appending to version
string.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-10 06:48:33 +00:00
Rafael Kitover 0eb65a0eb3
build: fix finding vcpkg binary packages on server
Fix the regex against the file listing module on the server for the
vcpkg binary package list.

Also replace all the dashes in versions with periods for comparison
purposes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-07 18:32:02 +00:00
Rafael Kitover 1af7aa2333
build: install vcpkg binary packages in dep order
Use the new code in the powershell module for vcpkg binary packages to
install the downloaded binary packages in dependency order with build
dependencies so that the database is not corrupted at any point in the
installation process or after.

Also remove the build binary package directory after installation, so
that all the previous packages are not reinstalled if a package is
updated on a subsequent run.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-07 15:36:40 +00:00
Rafael Kitover e9162a0d28
build: handle revisions for vcpkg binary packages
Read the revision from the vcpkg binary package zip file names and from
`vcpkg list` and use them in version comparisons.

Also fix up the indentation a bit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-11-02 18:01:18 +00:00
Rafael Kitover 3a1b577d0a
build: prototype binary packages for vcpkg
Now that there is a task on the Windows build VM to upgrade all vcpkg
ports and generate packages, update the cmake vcpkg code to install
them.

This is a working prototype implementation, all of this will require a
significant amount of further work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-10-27 06:41:32 +00:00
Rafael Kitover 774fbab7cc
build: write version to macOS plist
Separate writing the version into the Info.plist on macOS into a
separate action from the online updates Sparkle framework into a
separate POST_BUILD action because we are not using Sparkle for macOS
builds right now due to codesigning issues.

Also sort tags by reverse tag name in the cmake git version extractor
because a tag was rewritten.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2023-07-12 06:24:20 +00:00