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>
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>
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>
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>
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>
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>
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>
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>
* Move CMake dependencies checkout to `cmake/Dependencies.cmake`.
* Disable most dependencies checkout from the `TRANSLATIONS_ONLY` build.
* Remove the debug/translations_only GitHub Action.
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>
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>
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>
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.
* 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.
* 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.
* 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.
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.
* Use add_compile_definitions everywhere.
* Remove unused intermediate target.
* Add ASAN support for MSVC.
* Remove duplicate option definitions.
* Configure MinGW separately from the toolchain
* 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.
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add some fixes for building on macOS Homebrew.
- Set ZLIB_ROOT because zlib is now keg-only. Unfortunately the cmake
warning about policy CMP0074 cannot be suppressed because of some kind
of cmake bug.
- Update FindFFmpeg.cmake from:
https://github.com/snikulov/cmake-modules/blob/master/FindFFmpeg.cmake
, this fixes a problem with FFmpeg not being found.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
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>