Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci skip] This supports 64 bit builds with vcpkg. Will need to decide what to do with porting these changes to the VC12/14 files...
- Loading branch information
Showing
16 changed files
with
9,165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Compiling Wesnoth on Windows using Visual Studio | ||
|
||
The current minimum Visual Studio version required for compiling Wesnoth is Visual Studio 2013 (VC12). | ||
Compilation is also supported with Visual Studio 2015 (VC14) and later versions. However, since we keep | ||
the project files in the Git repository targeted at the minimum version, it is recommended you duplicate | ||
the `wesnoth/projectfiles/VC12` directory and rename it after the Visual Studio version with which you | ||
wish to build. | ||
|
||
## Prerequisites | ||
|
||
We maintain a handy [GitHub repository](https://github.com/aquileia/external) with all the external | ||
libraries (see [INSTALL.md](https://github.com/wesnoth/wesnoth/blob/master/INSTALL.md)) Wesnoth requires. | ||
It has various branches corresponding to the Visual Studio version you are building with. Be sure to use | ||
the libraries from the appropriate branch! | ||
|
||
## What to do | ||
|
||
1. Clone or download a snapshot of the aforementioned dependency repository. If you do the latter, be sure | ||
you've downloaded the snapshot for the correct branch, **not** `master`! Either way, it should be | ||
cloned/unpacked into the same directory as Wesnoth. If you have Wesnoth cloned in `Documents/wesnoth`, for | ||
example, the dependency pack should be at `Documents/external`. Note that `external` is the name of the | ||
resulting directory by default. **DO NOT RENAME IT!** | ||
|
||
2. If you cloned the repository, switch to the the version-appropriate branch now. | ||
|
||
3. Return to `wesnoth/projectfiles` and duplicate the VC12 folder if applicable, as mentioned above. | ||
|
||
4. Open `projectfiles/VCXX/wesnoth.sln` in Visual Studio. At this point, it may prompt you to re-target the | ||
projectfiles for your current VS and Windows versions. Do so; the build will likely fail if you do not. | ||
|
||
5. **Optional:** by default, Wesnoth's WML unit tests are run after each build. This can be quite annoying | ||
and/or time-consuming if you build regularly. They can be disabled by heading to the `wesnoth` projectfile's | ||
properties, under `Build Events → Post-Build Event`. Delete the value in the "Command Line" field. | ||
|
||
6. That's it! You can now go ahead and start the build (`Build → Build Solution`). | ||
|
||
7. **Important!** After building, copy all the files from `external/dll` into the same directory (`wesnoth/` | ||
by default) as the newly built executable . The game will not start if you fail to do this. | ||
|
||
## Manually updating the external dependencies | ||
|
||
We do our best to keep the build dependency repository up-to-date with the latest versions of the libraries | ||
within, as well as synced with any build requirement changes. If you want to build with a different version | ||
of a certain library, however, you can fetch the relevant files at the links below: | ||
|
||
* **Boost:** http://www.boost.org/users/download. Do note that you will need to build the necessary Boost | ||
libraries yourself. See the [instructions](https://github.com/aquileia/external/blob/master/README.md#updating-boost-libraries) | ||
in the dependency repository for details. | ||
|
||
* **SDL 2:** https://www.libsdl.org/download-2.0.php. You'll want the "Visual C++ 32/64-bit" Development | ||
Libraries. | ||
|
||
* **SDL_Image:** https://www.libsdl.org/projects/SDL_image. Again, you'll want the "Visual C++ 32/64-bit" | ||
Development Libraries. | ||
|
||
* **SDL_Mixer:** https://www.libsdl.org/projects/SDL_mixer. Again, you'll want the "Visual C++ 32/64-bit" | ||
Development Libraries. | ||
|
||
The other libraries require complicated compilation procedures too in-depth to document here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
:: WML_tests.cmd : Run the WML unit tests specified in wml_test_schedule | ||
|
||
:: preamble: don't spam stdout with commands, don't expand ERRORLEVEL to 0 | ||
@echo off | ||
setlocal enabledelayedexpansion | ||
|
||
:: if OMP_WAIT_POLICY isn't set, the process restarts itself and !ERRORLEVEL!=0 | ||
set OMP_WAIT_POLICY=PASSIVE | ||
|
||
:: save file paths and command line arguments | ||
cd ..\..\ | ||
set LoadFile=wml_test_schedule | ||
set binary=%~f1%wesnoth.exe | ||
set opt=--log-strict=warning --noaddons | ||
|
||
echo running WML tests: | ||
set tSTART=%time% | ||
|
||
:: ignore lines beginning with # | ||
:: %%G contains whether the test should pass (0), timeout (2) or fail (1,4) | ||
:: %%H is the name of the WML unit test to be executed | ||
for /f "eol=# tokens=1,2 delims= " %%G in (%LoadFile%) do ( | ||
WindowsTimeout.exe "%binary% %opt% -u%%H" 20000 | ||
if !ERRORLEVEL! neq %%G ( | ||
if !ERRORLEVEL! equ 2 ( | ||
echo( | ||
echo WML_tests.cmd: Warning WML2: Test '%%H' timed out, expected return value %%G | ||
) else ( | ||
echo( | ||
echo WML_tests.cmd: Error WML1: Test '%%H' returned !ERRORLEVEL!, expected %%G | ||
) | ||
set /a "fail_num+=1" | ||
) | ||
:: minimalistic progress bar | ||
<nul (set/p progress=.) | ||
set /a "test_num+=1" | ||
) | ||
echo( | ||
if not DEFINED fail_num ( set "fail_num=none" ) | ||
set /a "minutes = 1%time:~3,2% - 1%tSTART:~3,2%" | ||
set /a "seconds = 1%time:~6,2% - 1%tSTART:~6,2%" | ||
if %seconds% LSS 0 ( | ||
set /a "seconds+=60" | ||
set /a "minutes-=1" | ||
) | ||
echo %test_num% WML tests completed in %minutes%m %seconds%s, %fail_num% of them failed | ||
|
||
:: restore the state before execution | ||
cd %~p0 | ||
echo on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright (C) 2014 by Sebastian Koelle <sk.aquileia@gmail.com> | ||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY. | ||
See the COPYING file for more details. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Execute another executable: | ||
* - wait for the process to quit, then pass through the error code | ||
* - terminate it after a timeout of "t" microseconds, then return 2 | ||
*/ | ||
|
||
#if _WIN32_WINNT < 0x0602 //Windows version before Win8 | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
#else | ||
#include <Processthreadsapi.h> | ||
#endif | ||
#include <stdlib.h> | ||
#include <iostream> | ||
|
||
int main(int argc, char* argv[]) { | ||
|
||
if (argc != 3) { | ||
std::cout << "WindowsTimeout: Error USAGE1: " << argv[0] << " \"command [--options]\" t"; | ||
return -1; | ||
} | ||
|
||
PROCESS_INFORMATION pi; | ||
STARTUPINFO info = { sizeof(info) }; | ||
HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE); | ||
info.hStdError = hStdErr; | ||
|
||
if (!CreateProcess(NULL, argv[1], NULL, NULL, TRUE, 0, NULL, NULL, &info, &pi)) | ||
return -1; | ||
|
||
DWORD dwExitCode; | ||
if (::WaitForSingleObject(pi.hProcess, atoi(argv[2])) == WAIT_OBJECT_0) { | ||
GetExitCodeProcess(pi.hProcess, &dwExitCode); | ||
} | ||
else { | ||
TerminateProcess(pi.hProcess, 2); | ||
dwExitCode = 2; | ||
} | ||
CloseHandle(pi.hProcess); | ||
CloseHandle(pi.hThread); | ||
CloseHandle(hStdErr); | ||
return dwExitCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}</ProjectGuid> | ||
<RootNamespace>wesnoth</RootNamespace> | ||
<Keyword>Win32Proj</Keyword> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<Optimization>Disabled</Optimization> | ||
<MinimalRebuild>false</MinimalRebuild> | ||
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> | ||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||
<WarningLevel>Level4</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions> | ||
<OutputFile>$(OutDir)WindowsTimeout.exe</OutputFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> | ||
<SubSystem>Console</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<Optimization>Disabled</Optimization> | ||
<MinimalRebuild>false</MinimalRebuild> | ||
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> | ||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||
<WarningLevel>Level4</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions> | ||
<OutputFile>$(OutDir)WindowsTimeout.exe</OutputFile> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> | ||
<SubSystem>Console</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<Optimization>MaxSpeed</Optimization> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
<SubSystem>Console</SubSystem> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> | ||
<OutputFile>$(OutDir)WindowsTimeout.exe</OutputFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<Optimization>MaxSpeed</Optimization> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
<SubSystem>Console</SubSystem> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> | ||
<OutputFile>$(OutDir)WindowsTimeout.exe</OutputFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="WindowsTimeout.cpp" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
Oops, something went wrong.