Commit Graph

18 Commits

Author SHA1 Message Date
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 f07a838883
Another hack to work-around broken vcpkg upgrades.
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>
2020-08-22 21:31:12 +00:00
Rafael Kitover dcaa18aae4
Fix optional deps in vcpkg script.
Before installing optional deps, check that the associated variable is
either unset or true.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-08-19 09:59:29 +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 b23d463652
Use vcpkg installed wxrc, support mingw triplet.
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>
2020-08-14 13:16:37 +00:00
Rafael Kitover 9495dc84f8
Prefer upgrading zlib before other vcpkg deps.
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>
2020-07-31 09:32:42 +00:00
Rafael Kitover 8024c87832
Fix vcpkg upgrades.
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>
2020-05-07 01:11:18 +00:00
Rafael Kitover 229bf815e0
Revert f1abbc5f, vcpkg upgrade is fixed.
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>
2020-02-25 20:40:22 +00:00
Rafael Kitover f1abbc5f83
cmake: Use vcpkg remove/install instead of upgrade.
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>
2020-02-05 17:56:05 +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 5cc1fd28b4
cmake: Wrap vcpkg code in a function.
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>
2020-01-17 21:55:26 +00:00
Rafael Kitover 47880ff9c6
cmake: Limit vcpkg upgrades to one port per run.
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>
2020-01-17 19:47:09 +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 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 2b34983b9f
cmake: Support VS Ninja/jom builds on Windows.
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>
2019-12-07 17:39:19 +00:00
Rafael Kitover 198e2467dd
cmake: Add vcpkg update and upgrade.
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>
2019-12-03 18:59:42 +00:00
Rafael Kitover c06e3bf3fc
cmake: update vcpkg mod for appveyor build cache
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>
2019-10-21 13:58:55 +00:00
Rafael Kitover e2f06210e0
update Visual Studio support
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>
2019-07-03 23:28:48 +00:00