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>
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>
Add a function to check if libogg is installed but libvorbis isn't, this
means it failed to upgrade libvorbis because libogg wasn't upgraded to
the newest port revision supporting pkg-config, see:
https://github.com/microsoft/vcpkg/issues/13037
In this case, remove libogg recursively and allow the install action to
reinstall SFML and all deps.
This will also fix building link support on appveyor for the time being.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
Use the vcpkg installed wxrc, from a tools subdirectory, instead of
copying it out of the build tree.
Except when running on appveyor, for some reason the vcpkg wxrc does not
work there, so use our own from the dependencies submodule.
Support vcpkg mingw triplets, they don't work yet however.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Just a hack to fix a problem with vcpkg upgrades, in this case the
version of the zlib port being too old breaks another upgrade, so we
will check if zlib is in the list of packages to upgrade and upgrade it
before anything else.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We upgrade only the first listed package to upgrade for vcpkg to not
overrun the CI time limit.
Sometimes these packages are up-to-date but are listed for rebuild due
to depending on other packages that would be upgraded.
Find the first package in the upgrade list that is not up-to-date and
use that as the package to upgrade.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
vcpkg upgrade is fixed via:
f6d52648ec
Use upgrade --no-dry-run again to install the first package to upgrade.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
vcpkg upgrade is currently broken, see:
https://github.com/microsoft/vcpkg/issues/9916
Use remove followed by install, which does practically the same thing,
as a workaround.
Hopefully fix current appveyor build failures.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
Wrap the main body of code in Set-Toolchain-vcpkg.cmake in the
vcpkg_set_toolchain() function to not pollute the global variable
namespace with helper variables.
VCPKG_ROOT and toolchain variables are set in the cache.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In order to not overrun the appveyor time limit of one hour, limit vcpkg
port upgrades to only the first port. This way the cache will be rebuilt
gradually instead of all at once, and the job won't fail due to
overrunning the time limit.
Also do a bit of refactoring and code improvements for
Set-Toolchain-vcpkg.cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
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>
Only set CMAKE_GENERATOR_PLATFORM to "x64" for 64 bit toolchains for any
of the "Visual Studio" generators, which use msbuild.
For other generators such as Ninja or NMake (jom) set
CMAKE_C[XX]_COMPILER to "cl" to let cmake find the compiler in the
user's PATH and set up the toolchain appropriately. On the user's part,
all that is required is running the 64 bit dev tools command prompt, or
setting up the equivalent environment in powershell.
We are no longer restricted to msbuild, and other generators such as
Ninja will work correctly.
Switch the appveyor job to Ninja, this requires some wrangling because
the appveyor environment does not include ninja. I used this:
https://github.com/boostorg/hana/blob/master/.appveyor.yml
Also update the README.md instructions to use Ninja.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In the vcpkg module, call vcpkg update to update the portfiles and vcpkg
upgrade to upgrade any installed ports to make sure we are using the
latest versions.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
On appveyor we only cache the `vcpkg/installed` directory, so vcpkg
itself still needs to be pulled from git.
Also update vcpkg from git if it has already been cloned, and always
rebuild vcpkg itself.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Replace the vcpkg code with a newer and better version. In this version
the `vcpkg` directory is on the same level as the source directory, so
that IntelliSense does not get confused scanning for files.
The cmake variable `VCPKG_TARGET_TRIPLET` is required to activate vcpkg
support, it must be set to e.g. `x64-windows` or `x86-windows`.
Update `CMakeSettings.json` for the new code for the GUI.
Fix a problem copying the `SDL2.dll` file to the binary directory.
Update `README.md` with commandline instructions.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>