Commit Graph

280 Commits

Author SHA1 Message Date
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
Fabrice de Gans 95337da558 [build] Add basic clang-cl support
XAudio2 is disabled because the included header needs to be updated to
be parseable by clang.
2022-10-15 22:25:34 +00:00
Rafael Kitover 85a95dcde0
build: macOS C++ compatibility fixes
Remove constexpr in user-input.h as LLVM 13 complains that it is
illegal.

Use variant-lite as nonstd::variant and related types as some variant
functions are macOS 10.14 Mojave only.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-09-29 22:34:59 +00:00
Fabrice de Gans 69d24fb53e [build][msvc] Fix debug information and set hidpi support
* Add /ZI compiler flag in Debug mode to get proper debug symbols.
* Specify hidpi support in the app manifest.
2022-09-27 01:25:20 +00:00
Fabrice de Gans b2ec1544be [build] Regenerate lex and yacc files
The source grammar files were also updated. This fixes compiler
warnings for these files.

Bug: #1003
2022-09-26 02:13:12 +00:00
Rafael Kitover 913db72d12
build: check that -mtune=znver3 is supported
On gcc/clang check that the -mtune=znver3 compiler flag is supported, on
Debian 11 it is not and this breaks everything.

If it is not supported fallback to znver2, znver1, skylake-avx512 then
skylake in that order.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-08-26 17:12:09 +00:00
Rafael Kitover e29032d48a
Switch to nonstd::optional due to mac build issues
Switch usage of std::optional to nonstd::optional for now because of an
error from the Mac builder script, I cannot reproduce the problem yet
but will try to fix it later, it may not be fixable when targeting 10.7.

The header is from:

https://github.com/martinmoene/optional-lite
.

Usage is about the same, to include:

`#include "nonstd/optional.hpp"`

Then use nonstd::optional and nonstd::nullopt instead of the std::
counterparts.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-08-06 12:59:10 +00:00
Rafael Kitover 3e224bab40
build: enable ccache for MSVC
ccache supports MSVC now, so don't disable it for MSVC builds.

Remove the global RULE_LAUNCH_COMPILE property because it breaks
resource compilation on MSVC and just use CMAKE_CXX_COMPILER_LAUNCHER
etc..

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-06-15 01:00:13 +00:00
Rafael Kitover 1bd2f049cb
cmake: default VBAM_STATIC=ON for MinGW/MSYS2
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-04-19 04:07:30 +03:00
Rafael Kitover d91e5db524
cmake: fix static linking winpthread on MINGW
Include linker flags to link winpthread statically on MINGW when static
build is on.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-04-13 21:26:27 +00:00
Squall Leonhart 7726d26f9c Enable full optimizations and fix x86 builds
a bool isn't a BOOL and wglGetExtensionsStringEXT returns a const char*
2022-03-08 13:23:54 +11:00
Rafael Kitover 7853718627
Add winmm to SDL2 libs for WIN32.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-02-04 04:44:14 +00:00
Rafael Kitover 4af78f6482
Fix MSVC VCPKG build and Debug build type checks.
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>
2022-02-03 00:18:08 +00:00
Rafael Kitover 7d454e054a
Fix MSVC compiler/linker flags.
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>
2022-02-02 22:27:39 +00:00
Rafael Kitover 9ba5645964
Fix Win32 build regression in fa562426.
Move list of media libs ffmpeg depends on to the right cmake file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-02-02 00:44:41 +00:00
Rafael Kitover fa56242669
Add MSYS2 CLANG64/32 support.
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>
2022-01-31 03:26:52 +00:00
Rafael Kitover c4733bcf03
Fix x86 build, tweak MSVC opt flags.
Use:

/Ot /Oy /Ob3 /GF /Gy

, instead of /O2 for x86, this makes it not crash on ROM load for the
OpenGL renderer.

Supposedly /O2 is equivalent to:

/Og /Oi /Ot /Oy /Ob2 /GF /Gy

, but the documentation states that /Og is automatically enabled when
any other optimizations are enabled automatically. So this should make
absolutely no difference, yet it does.

For x64 use:

/O2 /Ob3

, this overrides /Ob2 from /O2 to use more aggressive inlining, VS 2019
is required for this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-01-18 03:01:13 +00:00
Rafael Kitover 73223445d6
MSVC opt /fp:fast /Oi, intrinsic sqrt() w/ XBRZ.
For MSVC, add the optimization flags:

/fp:fast /Oi

, to favor speed for floating point operations and use intrinsic
operations where possible.

For release builds also add:

/O2

. Use sqrt() instead of std::sqrt() in XBRZ for MSVC x64 just in case to
make sure it uses the intrinsic version.

Test build is reported to run much faster.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-01-16 15:55:02 +00:00
Rafael Kitover a5b2d070dc
Add cmake TRANSLATIONS_ONLY for translations.zip.
Builds translations.zip and nothing else.

This is for the nightly builder when only translations are changed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-12-19 13:57:05 +00:00
Rafael Kitover b3cc663344
Minor architecture/optimization improvements.
Use the X86_64 variable instead of AMD64 for this architecture in cmake.

For our upstream binary builds, use -march=core2 -mtune=rocketlake for
X86_64 on macOS, -march=core2 -mtune=znver3 for X86_64 on non-macOS (not
currently used) and -march=pentium-mmx -mtune=core2 for the future
Windows XP 32 bit MinGW build.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2021-10-31 18:23:34 -07:00
Clownacy 8455e7add0 Remove unintended semicolon from CPACK_PACKAGE_VERSION_PATCH
I noticed this while trying to install a CPack-generated Debian package, since `dpkg` complains about the semicolon being an invalid character.
2020-12-14 12:41:28 +00:00
Rafael Kitover a078dd2487
Add -D__STDC_LIMIT_MACROS for Visual Studio 2017.
Fixes a problem with `INT64_MAX` etc. being undeclared.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-10-12 21:23:47 +00:00
Rafael Kitover 890f560553
Switch to C++17 for GUI.
Adjust compiler flags to use `-std=gnu++17` for gcc/clang instead of
`-std=gnu++11` and `/std:c++17` for msvc.

Remove Ubuntu trusty job from travis (it's too old.)

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-09-28 12:09:54 +00:00
Rafael Kitover 5081ae44e5
Vcpkg fixes.
Fix vcpkg upgrades to work with the current vcpkg master.

When upgrading zlib, remove all optional deps first, because everything
depends on zlib and this can overrun the appveyor 1hr time limit.

Make SFML an optional dep too, like ffmpeg.

Reduce the vcpkg install time limit to 20 minutes, otherwise it may try
to build wxWidgets and ffmpeg and overrun the 1hr time limit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-26 10:07:04 +00:00
Rafael Kitover 4148080eb5
Always update Win32 dependencies git submodule.
Instead of just checking if the submodule has been cloned, always update
it when cmake runs if git is available.

This fixes the problem of users' dependencies submodule clone never
getting updated with new changes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-21 07:03:35 +00:00
Rafael Kitover 375daf99cb
Only build ffmpeg with vcpkg if installs < 30m.
Fix the problem with vcpkg installs including both wxWidgets and ffmpeg
overrunning the one hour time limit, by making ffmpeg optional and only
building it if the other builds are under 30 minutes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-17 18:38:58 +00:00
Rafael Kitover 299362b3cf
Refactor cmake ccache support and support MSVC.
Don't disable ccache for msys+ninja anymore, since the mingw ccache
works now and there is no reason to use the msys ccache anymore.

Use RULE_LAUNCH_COMPILE only on cmake versions < 3.4.0, because this
currently breaks resource compilation with visual studio and the windows
native ccache from chocolatey, this needs to be fixed in ccache.

On cmake 3.4.0 and greater, set the variables
CMAKE_<LANG>_COMPILER_LAUNCHER instead. This has the effect of using
ccache for C, C++ and nasm, but not for the resource file, avoiding the
problem with visual studio, which has a more recent cmake. This must be
done before the project() call.

TODO: Currently the Visual Studio build with ccache from chocolatey
works correctly, ccache is being invoked from ninja, but no cache files
are being created. This is being followed up with the chocolatey package
maintainer and upstream if necessary. The resource compiler issue also
needs to be fixed upstream.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-07-31 09:30:23 +00:00
Rafael Kitover 81c88227fa Add Catch2 unit testing framework + some tests.
Add the Catch2 headers to third_party/include/catch2.

Add Catch.cmake and CatchAddTests.cmake to cmake/.

Add unit tests src/wx/tests/strutils.cpp using Catch2 to test
src/wx/strutils.cpp.

Make some code changes to strutils.cpp to make the tests pass.

See src/wx/tests/CMakeLists.txt for how to set up unit test files; they
plug into the normal CTest mechanism in cmake.

The test binaries are written to the tests/ subdirectory of the build
directory.

Building the tests and enabling the CTest support can be turned off by
passing -DBUILD_TESTING=OFF to cmake, the default is ON, this is the
standard mechanism.

Start running ctest on travis and appveyor.

Move stb to third_party/include where Catch2 is now as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-07-10 13:43:48 +00:00
Edênis Freindorfer Azevedo 07064c8714
[Windows,MacOS] Auto-updater refactoring. (#639)
Create and enable auto-updater for MacOS using `Sparkle=1.23`. We need
to sign our app using an `Apple Developer Key` for it to work properly,
since we are not going to sign updates with the Sparkle key.

Add all auto-updater files to `gettext`'s pot.

Use `str_split` to always get related stable version. We do not want
to check for nightly builds.

For Windows, we create the flag `-DHTTPS` to select between using an
HTTPS or HTTP URL for the auto-updater checks. We use this to keep
support for Windows XP (HTTP only) while all others should be HTTPS.

Also, use `::FreeLibrary` to allow us to remove the temporary file
that stores the `WinSparkle.dll`. Previously, we could not get it to
work with `wine`.
2020-05-07 23:06:00 -03:00
Rafael Kitover abb8234174
Allow binding specific server IP. (#633)
For the netlink dialog, leave the server IP text field enabled when the
server radio button is selected and bind it to the new option
gopts.server_ip which defaults to "*" for binding on all addresses,
which was the previous behavior.

Copy this value to the new GBALink global IP_LINK_BIND_ADDRESS and use
it when creating a listening socket.

SFML supports creating sf:IpAddress values from hostnames, consequently
no additional code is needed to support hostnames in the netlink dialog.

Change GetLinkServerHost to return the primary local address when the
value is "*", which was the previous behavior, and the set value
otherwise.

Remove the min/max macros from GBALink as they are unnecessary and
conflict with std headers.

Require at least SFML 2.4 instead of 2.x for the IP binding
functionality in cmake.

- Fix #632

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-16 13:37:01 -03:00
Rafael Kitover 2f23467245
cmake: When replacing old tags, use origin.
Fetch new set of tags from the origin remote explicitly rather than
whatever remote is associated with the current branch.

In this way, old tags on other remotes get overwritten as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-07 11:36:40 +00:00
Rafael Kitover 20f57587e2
cmake: Replace old git tags if found.
Detect old badly formatted git tags we used in the user's git clone, and
if found delete all tags and fetch them from the origin.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-05 15:04:19 +00:00
Rafael Kitover 05bd2a95cd
Remove libpng direct dependency.
Followup on 513af13d which replaces the use of libpng with the stb_image
headers.

- Remove the use of libpng in cmake.

- Remove libpng from list of vcpkg dependencies.

- Add libpng to list of wxwidgets link libraries when using vcpkg, since
  it is no longer linked directly. This is necessary for static builds.

- Remove libpng from all package lists in installdeps.

- Remove libpng-dev from the debian control file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-03-01 13:56:29 +00:00
Edênis Freindorfer Azevedo 7f1a3a932c Add stb_image headers to cmake. 2020-03-01 09:54:43 +00:00
Rafael Kitover 951e8e0ebe
cmake: Check UPDATE_APPCAST before TAG_RELEASE.
Check for UPDATE_APPCAST being set before checking for TAG_RELEASE, as
the UPDATE_APPCAST script may be run in the same build directory where
TAG_RELEASE was just run.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-08 23:22:31 +00:00
Rafael Kitover 9475474ee6
cmake: Add UPDATE_APPCAST script for appcast.xml.
Add the -DUPDATE_APPCAST=TRUE option to invoke the UpdateAppcast.cmake
script, which clones the github pages repo and sets the version in the
appcast.xml to the last tag, presumably made with -DTAG_RELEASE.

The script prints out a final set of instructions to actually push the
change to git.

If the option -DUPDATE_APPCAST=UNDO is used, the clone is removed and no
changes are made.

Also use the correct method of splitting the tag list output into
multiple lines.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-08 22:53:53 +00:00
Rafael Kitover 83614290be
Turn on winsparkle update checking support.
Default to ON on Windows for x64 or x86.

Set new appcast URL, this will be in the github pages repo.

We will need to get everything ready for the next release.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-08 04:26:50 +00:00
Rafael Kitover 213f47ec96
builder: minor fixes for mingw.
Search the lib-prefixed names of intl/iconv/charset libraries first to
avoid dlls being linked.

Update toolchain files to include the common source by full path, fixes
using them as toolchains for other projects broken in 3edd9ba7.

Update URL for nasm, use newer jpeg-turbo, tiff and wx.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-02 03:35:26 +00:00
Rafael Kitover 3edd9ba756
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.

Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.

Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.

Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.

Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.

Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.

For static toolchains, also search for a static zlib and set ZLIB_ROOT.

Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.

Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
Rafael Kitover 93f906e2db
cmake: Automate release commit and tag.
Add a TAG_RELEASE cmake variable which engages a cmake script to
generate a signed release commit with changelog entries from git and
signed tag.

The value can be ON/TRUE/1 or a specific next version number, or UNDO to
rollback changes just made with this script.

The script tries to make sure all the preliminaries are in the right
state to do a release, the source is a git clone, on branch master, with
a clean working tree and gpg is available.

Also add a utility script FileIterator.cmake which is an OO-like line
iterator interface for text files, used by the release commit script.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-22 03:14:26 +00:00
Rafael Kitover 77c299c13f
cmake: Check for libcharset and use if found.
For Visual Studio, the static builds now require linking libcharset
explicitly, otherwise an `unresolved external symbol locale_charset`
error is thrown during linking.

This library is sometimes required on other platforms for iconv/gettext,
and checking for it and linking it should be harmless.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-01-17 16:03:07 +00:00
Rafael Kitover e98d89310e
cmake: Add some release automation steps.
Use ENV{MSYSTEM_PREFIX} instead of ENV{MSYSTEM} to check for msys2 as
that is more reliable.

Generate the translations.zip when building for Windows from the
generated .gmo files.

Add the UPSTREAM_RELEASE option to perform some additional release
automation steps:

- Codesign for Windows with either the Visual Studio signtool or
  osslsigncode when using MinGW.

- On Windows zip up the .exe into the appropriate zip file for release.

- Generate the gpg signature .asc files for the translations zip and the
  .exe zip on Windows.

- On Mac codesign the app, zip it and sign the zip.

- On all platforms try to strip the binary.

Remove the release automation steps from the builder script as they are
now in cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-24 06:32:01 +00:00
Rafael Kitover 99cdbb8860
cmake: Remove libcmt from SDL bin in debug mode.
For the SDL binary vbam when built with MSVC add /nodefaultlib:libcmt to
debug link flags, because in debug mode libcmtd is linked and libcmt
should not be.

This is the same as was done for the wx executable in cf9a88df.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-22 17:46:21 +00:00
Rafael Kitover f306cc63b0 App name cleanup.
Rename all icon basenames and references to them from "vbam" to
"visualboyadvance-m".

Change app name in desktop file from "VBA-M" to "visualboyadvance-m" as
well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-21 18:22:57 +00:00
Rafael Kitover 939a88ab4a
cmake: No default ffmpeg on 32 bit Windows.
Only check for ffmpeg if it's not explicitly turned off and the target
is not 32 bit Windows.

This is done because Windows XP does not have bcrypt.dll which ffmpeg
requires and the 32 bit builds are more likely to be used on older
systems which would also benefit from the smaller binary size.

Also add the X86 and X64 cmake architecture variable flags.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-18 14:17:20 +00:00
Rafael Kitover 49ca52ba03
cmake: Visual Studio misc followup on cf9a88df.
Fix the vcpkg root setting, which was trying to use CMAKE_PROJECT_DIR
before a project is defined by switching back to CMAKE_SOURCE_DIR. Also
check if the user has \vcpkg or c:\vcpkg and use those if found. Use
\vcpkg if ENV{CI} is set, e.g. on Appveyor.

Enable nasm for visual studio builds by using the nuget nasm2 package.

In Architecture.cmake check that the vcpkg arch matches the compiler
arch, and throw a fatal error otherwise.

When using GLOB to find the nuget package directory, use the package
name as the prefix, this is quite necessary when using multiple nuget
packages.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-15 19:34:18 +00:00
Rafael Kitover b3932e4e3d
cmake: Fix localization for Visual Studio.
Default to ENABLE_NLS=ON for vcpkg builds too.

Check for libintl under both the names "intl" and "libintl", likewise
for libiconv. The vcpkg versions have the "lib" prefix.

Use the Gettext.Tools package from NuGet for the tools to build the
translation files. vcpkg does not yet have gettext-tools.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-12 19:01:58 +00:00
Rafael Kitover 3aefcf64c9
cmake: Add ffmpeg to appveyor vcpkg cache.
Now that the initial vcpkg cache has been populated in appveyor, we can
build ffmpeg to add to it without going over the job limit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-12 14:10:36 +00:00
Rafael Kitover cf9a88dfc3
cmake: Visual Studio support improvements.
Add support for vcpkg ffmpeg, this requires using someone's
FindFFmpeg.cmake instead of relying on pkg-config, since vcpkg does not
have pkg-config.

Do not use the ffmpeg from vcpkg on appveyor however, because that
pushes the build cache generation over the time limit for jobs.

Add secur32 and bcrypt to the list of ffmpeg libs on windows, these are
standard windows libraries.

Change some code in ffmpeg.cpp to remove C-style casts of struct
initializers, which are illegal in MSVC.

Add the INT64_C and UINT64_C macros missing in MSVC's stdint.h (if not
defined) to ffmpeg.h before the ffmpeg headers are included, because
they rely on them.

Rewrite the wxWidgets finding code for the vcpkg wxWidgets to be nicer
and work correctly for debug and static builds.

Remove all /W* and /w* warnings options from cmake compiler flags, and
replace them with /W4 for debug builds, and /w (no warnings) for release
modes.

When building a static binary, remove all /MD* flags from cmake compiler
flags, and use /MT for static release builds and /MTd for static debug
builds.

Improve the vcpkg toolchain wrapper to only rebuild the vcpkg binary if
there were git updates.

Redo the handling of SDL2 and SDL_main. Only link SDL2Main to the SDL
binary and don't use the definitions.

Update CMakeSettings.json to use Ninja and include static
configurations.

Use CMAKE_PROJECT_DIR instead of CMAKE_SOURCE_DIR to determine the vcpkg
root, as CMAKE_SOURCE_DIR is sometimes set incorrectly in the 2017 GUI.

Add /nodefaultlib:libcmt to the debug build link flags, as in debug
builds libcmtd is used and libcmt should not be.

Add /subsystem:console to debug build link flags to produce a windows
console app for debug builds, like we do for mingw builds. To do this,
define a WIN32_CONSOLE_APP macro and if set, define a main() that calls
WinMain().

Call wxMesdsageOutput::Set() in OnInit with an instance of
wxMessageOutputStderr for windows debug builds to make sure the --help
text etc. goes to the console instead of a popup box.

Update the Visual Studio related text in README.md.

Fix dynamic debug builds by linking to the debug version of SDL2 and
copying the debug version of the dll to the build dir.

Fix issue in MainFrame::BindAppIcon with the function we are using not
being found in a Windows DLL in debug builds by using
wxDynamicLibrary::GetSymboolAorW() instead of GetSymbol().

Enable LTO for MSVC in Release modes, if the option is set.

Change appveyor config to use an 8 item build matrix of
x64/x86 / Release/Debug / Static/Dynamic. And test the binary in debug
modes by running --help.

When copying the wxrc.exe out of the build tree, copy both the release
and debug versions, this is so that appveyor caching of vcpkg works,
since the build trees are not cached.

Add some necessary win32 libraries to the SDL binary. And enable
building it on appveyor.

Fix #465.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-10 11:13:58 +00:00
Rafael Kitover d183245bdd
builder: Link setupapi always, update libpng.
On Windows always link setupapi with SDL2, the find_library() call with
SetupAPI was failing on mingw because of case.

Update libpng 1.6.32 -> 1.6.37.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-12-08 15:28:03 +00:00