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>
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>
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>
Sometimes vcpkg calls the SDL2 library SDL2-static for static toolchains
and sometimes it doesn't, change FindSDL2.cmake to search some possible
library names in order of priority.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
The static lib is now called `SDL2-static.lib` and the debug version is
called `SDL2-staticd.lib`.
Adjust our `cmake/FindSDL2.cmake` for the new vcpkg naming convention.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Probably fixes this in other environments as well, or breaks it.
Move the wxWidgets_LIBRARIES paths conversion to the already existing
normalize_wx_paths() function that was using a different method that no
longer works. This converts the variable to the right format before the
tests run, fixing the Wx OpenGL test.
For the ABI checks, wrap the function pointers for the minhook
trampoline API in reinterpret_cast<LPVOID>(&fp), why this is necessary I
don't know, and it may break on other compilers. The trampoline is used
to catch message boxes opened by Wx for fatal errors.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Search for wx-config-static for static builds first, and wx-config
otherwise, before trying any config and version suffixes.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use jpeg.lib instead of jpegd.lib for jpeg debug lib, it no longer has
the "d" suffix.
Fix all CMAKE_BUILD_TYPE checks for debug builds to either also check
for RelWithDebInfo or match "Debug" exactly.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Turn off ccache for vcpkg builds (this is only relevant to MSVC, where
ccache does not work yet.)
Throw an error if CMAKE_BUILD_TYPE is not valid or does not match case
exactly (to make comparisons simple.)
Add SetCompilerLinkerFlags.cmake lib with the functions:
add_compiler_flags()
For each flag passed in, add it to CMAKE_CXX_FLAGS and CMAKE_C_FLAGS if
not already present. Also clears all build-specific flag variables on
every call, if using this functions you must set build-specific flags
yourself.
add_linker_flags()
For each flag passed in, add it to
CMAKE_(EXE|SHARED|MODULE|STATIC)_LINKER_FLAGS if not already present.
Add remove_dupes() function to VbamFunctions.cmake from:
https://stackoverflow.com/a/41416298/262458
This is used to remove duplicate flags in SetCompilerLinkerFlags.cmake
described above.
Use the new functions to set compiler and linker flags for MSVC.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Update installdeps to support CLANG64/CLANG32 MSYS2 targets.
cmake:
Set POLICY CMP0060 to NEW to not convert full lib paths, this is the
default.
Stop disabling ffmpeg on WIN32+i686.
On MSYS2+clang add windows import libs to CMAKE_PREFIX_PATH.
For static builds on MSYS2 append full paths for static libs for tiff,
jbig and lzma to FFMPEG_LIBRARIES.
Add -Wno-unused-command-line-argument to all CFLAGS/CXXFLAGS so that
clang does not warn about gcc-specific options.
Enable -march/-mtune optimizations by default instead of only for
UPSTREAM_RELEASE.
Update find_wx_util() to search suffixes for WIN32 and add the "static"
suffix for static builds.
Remove all linker flags from wxWidgets_LIBRARIES and translate all wx*
libs as well as jpeg, tiff, jbig lzma and expat to full .a paths for
static builds.
Disable strutil tests on MSYS2+clang, currently does not build.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Instead of suffixing release zip files with 32bit or 64bit, add an
architecture suffix, which would be one of:
x86_32
x86_64
arm32
arm64
Allow codesign to fail on mac without aborting.
Disable the interactive pause for gpg signing because there is no
passphrase anymore.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Followup on 98b2fb6e.
To make a one element of empty string list in cmake, you have to set the
variable to `";"`.
If it is set to `""`, a subsequent `list(APPEND ...)` will consider the
variable unset.
With this fix, `/usr/bin/wx-config` is tried first on Gentoo, as was
intended in 98b2fb6e.
The rationale for this is that on Gentoo, app-eselect/eselect-wxwidgets
links `/usr/bin/wx-config` to the user's preferred version of wxWidgets,
while on other distributions such as Arch, we want to check for the 3.x
gtk3 variant explicitly first.
Also add a modeline to `VbamFunctions.cmake`.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>