Skip to content

Commit

Permalink
Update codeblock and Vc project for 1.14 (#3604)
Browse files Browse the repository at this point in the history
merge of pr #3604 by @newfrenchy83


This in particular fixes the appveyour build which was broken in f726a86
  • Loading branch information
newfrenchy83 authored and gfgtdf committed Oct 9, 2018
1 parent 8715df6 commit 5703ee7
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 65 deletions.
30 changes: 30 additions & 0 deletions packaging/windows/campaignd.rc
@@ -0,0 +1,30 @@
#include "windows.h"
#include "../../src/wesconfig.h"

WESNOTH_ICON ICON "wesnoth-icon.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_VERSION_MAJOR, RC_VERSION_MINOR, RC_VERSION_REVISION, 0
PRODUCTVERSION RC_VERSION_MAJOR, RC_VERSION_MINOR, RC_VERSION_REVISION, 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Wesnoth Campaign Server\0"
VALUE "InternalName", "campaignd\0"
VALUE "OriginalFilename", "campaignd.exe\0"
VALUE "FileVersion", VERSION "\0"
VALUE "ProductVersion", VERSION "\0"
VALUE "ProductName", "The Battle for Wesnoth\0"
VALUE "CompanyName", "The Battle for Wesnoth Project\0"
VALUE "LegalCopyright", "(C) 2003-2018 The Battle for Wesnoth Project\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
38 changes: 32 additions & 6 deletions projectfiles/CodeBlocks/README.md
@@ -1,6 +1,6 @@
## Compiling Wesnoth on Windows using CodeBlocks

(Last tested using Wesnoth 1.13.5+ on Code::Blocks 16.01)
(Last tested using Wesnoth 1.14.5+ on Code::Blocks 16.01)

1. Get a Wesnoth source tarball or Git repository clone. The folder which
contains the data/, projectfiles/, and src/ subfolders is referred to as
Expand All @@ -9,8 +9,8 @@
2. Install CodeBlocks from <http://www.codeblocks.org/>.
MinGW is not needed.

3. Download and unpack MinGW-w64 from https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/threads-posix/dwarf/i686-7.2.0-release-posix-dwarf-rt_v5-rev0.7z or
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/threads-posix/sjlj/i686-7.2.0-release-posix-sjlj-rt_v5-rev0.7z.
3. Download and unpack MinGW-w64 from <https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/threads-posix/dwarf/i686-7.2.0-release-posix-dwarf-rt_v5-rev0.7z> or
<https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/threads-posix/sjlj/i686-7.2.0-release-posix-sjlj-rt_v5-rev0.7z>.
Note that the project files in `wesnoth_root/projectfiles/CodeBlocks/` may
contain a setting to compile with OpenMP support, so you should make sure
that this option is enabled while installing the compiler (mark the
Expand All @@ -19,6 +19,26 @@
NOTE: You must make sure to download the 32-bit version.
Building a 64-bit Wesnoth executable on Windows is currently not supported and will
fail with the SDK package provided in the next step.

To resolve out of memory errors when creating debug builds, follow these steps:

1. If you use 32-bit Windows, run Admin command prompt
```
bcdedit/set IncreaseUserVa 3072
```

2. Install MASM32;

3. Open `cmd`( as Admin too);

4. Run these commands in an admin command prompt
```
cd C:\..\mingw32\libexec\gcc\i686-w64-mingw32\7.2.0
```
and
```
C:\masm32\bineditbin.exe /LARGEADDRESSAWARE cc1plus.exe
```

4. Download the latest `CodeBlocksWinSDK*.zip` package from <http://sourceforge.net/projects/wesnoth/files/SDK/>.
The package contains the right version/build combination of source headers,
Expand All @@ -27,11 +47,15 @@
after new dependencies are added to Wesnoth or its version requirements
change.

for versions > 1.12, follow these steps in `libraries.md` for updating libraries yourself.


Unpack the file to any path of your choice, which will be referred to as
`sdk_root` for the remainder of this file.

The exact names of the folders containing the required files may vary; take
note of them for the next steps.


5. In CodeBlocks, open `wesnoth_root/projectfiles/CodeBlocks/wesnoth.workspace`.

Expand All @@ -46,15 +70,15 @@
dialog. Enter the following settings into the text boxes:

* Compiler's installation directory: the path to which you installed
tdm-gcc-5.1.0 (click on ... to browse for it).
mingw-w64 (click on ... to browse for it).
* C compiler, C++ compiler, Linker for dynamic libs: g++.exe
* Linker for static libs: ar.exe

7. Change to the Search directories -> Compiler tab and choose Add; enter the
path to `sdk_root/include_tdm_gcc/`.
path to `sdk_root/include_w64-mingw32/`.

8. Change to the Search directories -> Linker tab and choose Add; enter the
path to `sdk_root/lib_tdm_gcc/`.
path to `sdk_root/lib_w64-mingw32/`.

9. OPTIONAL: By default, CodeBlocks will only run one compiler instance at a
time, making the overall build process very slow even with fast hardware.
Expand All @@ -70,3 +94,5 @@

12. To be able to run your build, copy all `*.dll` files from the `sdk_root/dll/`
folder to `wesnoth_root` where the `*.exe` files are.


153 changes: 153 additions & 0 deletions projectfiles/CodeBlocks/campaignd.cbp
@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="campaignd" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="../../campaignd" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../" />
<Option object_output=".objs-release" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O3" />
</Compiler>
</Target>
<Target title="Debug">
<Option output="../../campaignd-debug" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../" />
<Option object_output=".objs-debug" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-std=c++17" />
<Add option="-mthreads" />
<Add option="-fexceptions" />
<Add option="-fdiagnostics-show-option" />
<Add option="-fopenmp" />
<Add option="-Wunused" />
<Add option="-Wunused-parameter" />
<Add option="-DHAVE_PYTHON" />
<Add option="-DUSE_GZIP" />
<Add option="-D_WIN32_WINNT=0x0501" />
<Add option="-D_WIN32_IE=0x0501" />
<Add directory="../../src" />
</Compiler>
<Linker>
<Add option="-mthreads" />
<Add option="-fopenmp" />
<Add library="mingw32" />
<Add library="mingwthrd" />
<Add library="SDL2main" />
<Add library="SDL2" />
<Add library="ws2_32" />
<Add library="wsock32" />
<Add library="shlwapi" />
<Add library="libboost_iostreams" />
<Add library="libboost_bzip2" />
<Add library="libboost_filesystem" />
<Add library="libboost_locale" />
<Add library="libboost_program_options" />
<Add library="libboost_random" />
<Add library="libboost_regex" />
<Add library="libboost_system" />
<Add library="libboost_thread" />
<Add library="libboost_timer" />
<Add library="libboost_zlib" />
<Add library="libcrypto-1_1"/>
<Add library="winmm" />
<Add directory="./" />
</Linker>
<Unit filename="../../packaging/windows/campaignd.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Unit filename="../../src/crypt_blowfish/crypt_blowfish.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../src/crypt_blowfish/crypt_blowfish.h" />
<Unit filename="../../src/about.hpp" />
<Unit filename="../../src/addon/validation.cpp" />
<Unit filename="../../src/addon/validation.hpp" />
<Unit filename="../../src/campaign_server/addon_utils.cpp" />
<Unit filename="../../src/campaign_server/addon_utils.hpp" />
<Unit filename="../../src/campaign_server/blacklist.cpp" />
<Unit filename="../../src/campaign_server/blacklist.hpp" />
<Unit filename="../../src/campaign_server/campaign_server.cpp" />
<Unit filename="../../src/campaign_server/campaign_server.hpp" />
<Unit filename="../../src/campaign_server/control.hpp" />
<Unit filename="../../src/campaign_server/fs_commit.cpp" />
<Unit filename="../../src/campaign_server/fs_commit.hpp" />
<Unit filename="../../src/color.cpp" />
<Unit filename="../../src/color.hpp" />
<Unit filename="../../src/color_range.cpp" />
<Unit filename="../../src/config.cpp" />
<Unit filename="../../src/config.hpp" />
<Unit filename="../../src/config_attribute_value.cpp" />
<Unit filename="../../src/config_attribute_value.hpp" />
<Unit filename="../../src/filesystem.hpp" />
<Unit filename="../../src/filesystem_boost.cpp" />
<Unit filename="../../src/filesystem_common.cpp" />
<Unit filename="../../src/filesystem_sdl.cpp" />
<Unit filename="../../src/filesystem_win32.ii" />
<Unit filename="../../src/font/constants.cpp" />
<Unit filename="../../src/font/constants.hpp" />
<Unit filename="../../src/game_config.cpp" />
<Unit filename="../../src/game_config.hpp" />
<Unit filename="../../src/game_version.cpp" />
<Unit filename="../../src/game_version.hpp" />
<Unit filename="../../src/gettext.hpp" />
<Unit filename="../../src/gettext_boost.cpp" />
<Unit filename="../../src/global.hpp" />
<Unit filename="../../src/hash.cpp" />
<Unit filename="../../src/hash.hpp" />
<Unit filename="../../src/libc_error.hpp" />
<Unit filename="../../src/log.cpp" />
<Unit filename="../../src/log.hpp" />
<Unit filename="../../src/log_windows.cpp" />
<Unit filename="../../src/log_windows.hpp" />
<Unit filename="../../src/mt_rng.cpp" />
<Unit filename="../../src/mt_rng.hpp" />
<Unit filename="../../src/random.cpp" />
<Unit filename="../../src/random.hpp" />
<Unit filename="../../src/seed_rng.cpp" />
<Unit filename="../../src/seed_rng.hpp" />
<Unit filename="../../src/serialization/base64.cpp" />
<Unit filename="../../src/serialization/base64.hpp" />
<Unit filename="../../src/serialization/binary_or_text.cpp" />
<Unit filename="../../src/serialization/binary_or_text.hpp" />
<Unit filename="../../src/serialization/compression.hpp" />
<Unit filename="../../src/serialization/parser.cpp" />
<Unit filename="../../src/serialization/parser.hpp" />
<Unit filename="../../src/serialization/preprocessor.cpp" />
<Unit filename="../../src/serialization/preprocessor.hpp" />
<Unit filename="../../src/serialization/string_utils.cpp" />
<Unit filename="../../src/serialization/string_utils.hpp" />
<Unit filename="../../src/serialization/tokenizer.cpp" />
<Unit filename="../../src/serialization/unicode.cpp" />
<Unit filename="../../src/serialization/unicode.hpp" />
<Unit filename="../../src/server/server_base.cpp" />
<Unit filename="../../src/server/server_base.hpp" />
<Unit filename="../../src/server/simple_wml.cpp" />
<Unit filename="../../src/server/simple_wml.hpp" />
<Unit filename="../../src/server/user_handler.cpp" />
<Unit filename="../../src/server/user_handler.hpp" />
<Unit filename="../../src/tstring.cpp" />
<Unit filename="../../src/tstring.hpp" />
<Unit filename="../../src/util.hpp" />
<Unit filename="../../src/wesconfig.h" />
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
2 changes: 1 addition & 1 deletion projectfiles/CodeBlocks/liblua.cbp
Expand Up @@ -31,7 +31,7 @@
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-std=c++14" />
<Add option="-std=c++17" />
<Add option="-U__STRICT_ANSI__" />
<Add option="-include ../../src/wesnoth_lua_config.h" />
<Add directory="../../src" />
Expand Down
49 changes: 49 additions & 0 deletions projectfiles/CodeBlocks/libraries.md
@@ -0,0 +1,49 @@
## 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]#updating-boost-libraries)
in the dependency repository for details.

* [**SDL 2:**](https://www.libsdl.org/download-2.0.php) You'll want the "GCC 32/64-bit" Development
Libraries.

* [**SDL_Image:**](https://www.libsdl.org/projects/SDL_image) Again, you'll want the "GCC 32/64-bit"
Development Libraries.

* [**SDL_Mixer:**](https://www.libsdl.org/projects/SDL_mixer) Again, you'll want the "GCC 32/64-bit"
Development Libraries.

The other libraries require complicated compilation procedures too in-depth to document here.

## Updating Boost libraries

Download and unpack the source of the libraries zlib, libbzip2, boost (version 1.64 or 1.68 preferred)
* http://www.bzip.org/downloads.html
* http://www.boost.org/users/download/
* http://www.zlib.net/

Open `cmd`, go to the boost directory and type (with the correct paths of the other two libraries):
```
bootstrap gcc
```
If you're already did this, run this immediately this command:
```
.\b2 -sZLIB_SOURCE=..\zlib-1.2.11 -sBZIP2_SOURCE=..\bzip2-1.0.6 -j2 --with-date_time --with-filesystem --with-iostreams --with-locale --with-program_options --with-random --with-regex --with-system --with-thread --with-test --with-timer --toolset=gcc --layout=system variant=release address-model=32
```
Depending on your boost version, you may need to replace `..\` with the absolute paths to zlib and bzip.
If you have multiple versions of gcc, add `--toolset=gcc-X.Y.Z` with **X.Y.Z** being the target version number.

Separate the required subset of the Boost source:
Run this command for generate `bcp.exe`
```
.\b2 tools\bcp
```
Create `include` in same path what `boost_...` and run this command:
```
dist\bin\bcp.exe algorithm asio assign bimap container date_time dynamic_bitset exception filesystem iostreams iterator locale math mpl multi_array multi_index program_options ptr_container random range regex serialization system test boost\nondet_random.hpp ..\include
```

Replace the outdated files in 'cb/lib' with those from 'boost_.../stage/lib' and those in 'cb/include/boost' with the ones in 'boost_.../boost'.

0 comments on commit 5703ee7

Please sign in to comment.