Upgrade to C++17 [CI] (#4716)
* Update CI * Reduce one build to minimum cmake version * Update compile instructions with new minimum versions * Update more guides * Run debug build with VS 2017 Co-authored-by: Peter Bell <peterbell10@live.co.uk>
This commit is contained in:
parent
bd54cb71e5
commit
804c3ba6e9
76
.travis.yml
76
.travis.yml
@ -1,78 +1,60 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
sudo: false
|
cache: ccache
|
||||||
|
|
||||||
# Use Linux by default
|
# Use Linux by default
|
||||||
os: linux
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
|
# CMake version out of date: update
|
||||||
|
# TODO: add ARM64, PPC, SPARC builds when we find CMake for them
|
||||||
|
addons:
|
||||||
|
snaps:
|
||||||
|
- name: cmake
|
||||||
|
confinement: classic
|
||||||
|
channel: latest
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# gcc on arm64
|
# AppleClang Release
|
||||||
- compiler: gcc
|
|
||||||
arch: arm64
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- ccache
|
|
||||||
env: &Debug
|
|
||||||
- TRAVIS_CUBERITE_BUILD_TYPE=DEBUG
|
|
||||||
# AppleClang
|
|
||||||
# OSX workers are slower to start up. Having these first in the build matrix makes travis faster overall.
|
# OSX workers are slower to start up. Having these first in the build matrix makes travis faster overall.
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: clang
|
osx_image: xcode11.3
|
||||||
before_install:
|
before_install:
|
||||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
||||||
env: &Release
|
env: &Release
|
||||||
- TRAVIS_CUBERITE_BUILD_TYPE=RELEASE
|
- TRAVIS_CUBERITE_BUILD_TYPE=RELEASE
|
||||||
|
|
||||||
|
# AppleClang Debug
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: clang
|
osx_image: xcode11.3
|
||||||
env: *Debug
|
|
||||||
before_install:
|
before_install:
|
||||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
||||||
# Default clang
|
env: &Debug
|
||||||
|
- TRAVIS_CUBERITE_BUILD_TYPE=DEBUG
|
||||||
|
|
||||||
|
# Clang 7.0 - Release
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
|
before_install: &use-cmake
|
||||||
|
- export PATH=/snap/bin/:${PATH}
|
||||||
env: *Release
|
env: *Release
|
||||||
|
|
||||||
|
# Clang 7.0 - Debug
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
|
before_install: *use-cmake
|
||||||
env: *Debug
|
env: *Debug
|
||||||
# clang 3.5
|
|
||||||
- compiler: clang
|
# GCC 7.4 - Release, CMake 3.12
|
||||||
dist: trusty
|
|
||||||
addons: &clang35
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang++-3.5
|
|
||||||
- clang-3.5
|
|
||||||
before_install:
|
|
||||||
- CC=clang-3.5;CXX=clang++-3.5
|
|
||||||
env: *Release
|
|
||||||
- compiler: clang
|
|
||||||
dist: trusty
|
|
||||||
addons: *clang35
|
|
||||||
before_install:
|
|
||||||
- CC=clang-3.5;CXX=clang++-3.5
|
|
||||||
env: *Debug
|
|
||||||
# gcc 4.8
|
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
addons: &gcc48
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
- gcc-4.8
|
|
||||||
before_install:
|
|
||||||
- CC=gcc-4.8;CXX=g++-4.8
|
|
||||||
env: *Release
|
env: *Release
|
||||||
|
|
||||||
|
# GCC 7.4 - Debug
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
addons: *gcc48
|
before_install: *use-cmake
|
||||||
before_install:
|
|
||||||
- CC=gcc-4.8;CXX=g++-4.8
|
|
||||||
env: *Debug
|
env: *Debug
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/lib\/ccache//')
|
- export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/lib\/ccache//')
|
||||||
script: ./travisbuild.sh
|
script: ./travisbuild.sh
|
||||||
cache: ccache
|
|
||||||
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
17
COMPILING.md
17
COMPILING.md
@ -6,16 +6,16 @@ To compile Cuberite from source, you need the following set of software:
|
|||||||
- CMake
|
- CMake
|
||||||
- Platform-specific make tool (Windows would be MSVC, Linux/macOS GNU make, etc.)
|
- Platform-specific make tool (Windows would be MSVC, Linux/macOS GNU make, etc.)
|
||||||
- C compiler
|
- C compiler
|
||||||
- Modern C++ compiler and linker
|
- Modern C++17 capable compiler and linker
|
||||||
|
|
||||||
To contribute code, you also need a Git client.
|
To contribute code, you also need a Git client.
|
||||||
|
|
||||||
Windows
|
Windows
|
||||||
-------
|
-------
|
||||||
|
|
||||||
We use Microsoft Visual Studio for Windows compilation. It is possible to use other toolchains, but we don't test against them and they aren't supported. Visual Studio 2013 Express for Desktop is being actively used for development.
|
We use Microsoft Visual Studio for Windows compilation. It is possible to use other toolchains, but we don't test against them and they aren't supported. Visual Studio 2017 Community and above are being actively used for development.
|
||||||
|
|
||||||
You can find download links for VS2013 Express [here][1].
|
You can find download links for VS2019 Community [here][1].
|
||||||
|
|
||||||
Next, you need to download and install [CMake][2]. You should download a full installation package, so that the installer will set everything up for you (especially the paths).
|
Next, you need to download and install [CMake][2]. You should download a full installation package, so that the installer will set everything up for you (especially the paths).
|
||||||
|
|
||||||
@ -56,6 +56,8 @@ macOS
|
|||||||
|
|
||||||
- Install CMake from its [website][9] or homebrew: `brew install cmake`.
|
- Install CMake from its [website][9] or homebrew: `brew install cmake`.
|
||||||
|
|
||||||
|
Cuberite requires Xcode 11.3 or newer.
|
||||||
|
|
||||||
### Getting the Source
|
### Getting the Source
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -77,7 +79,13 @@ Install git, make, cmake and clang (or gcc), using your platform's package manag
|
|||||||
```
|
```
|
||||||
sudo apt-get install git make cmake clang
|
sudo apt-get install git make cmake clang
|
||||||
```
|
```
|
||||||
Ensure that you have modern C++ compiler and linker (Clang 3.5+, GCC 4.8+, or VS 2013+).
|
Ensure that you have modern C++ compiler and linker (Clang 7.0+, GCC 7.4+, or VS 2017+).
|
||||||
|
Cuberite also requires CMake 3.13 or newer. You might find that your distribution
|
||||||
|
defaults are too out of date, in which case you may need to add a new `apt` source,
|
||||||
|
or download directly from the projects' websites:
|
||||||
|
|
||||||
|
- [Clang][Clang-download]
|
||||||
|
- [CMake][2]
|
||||||
|
|
||||||
### Getting the Source
|
### Getting the Source
|
||||||
|
|
||||||
@ -260,3 +268,4 @@ Disables optimizations for the build host. This is important when building on a
|
|||||||
[10]: https://developer.android.com/ndk/downloads/index.html
|
[10]: https://developer.android.com/ndk/downloads/index.html
|
||||||
[11]: https://www.lua.org/download.html
|
[11]: https://www.lua.org/download.html
|
||||||
[12]: https://github.com/ninja-build/ninja/releases
|
[12]: https://github.com/ninja-build/ninja/releases
|
||||||
|
[clang-download]: https://releases.llvm.org/download.html
|
||||||
|
@ -14,7 +14,7 @@ When contributing, you must follow our code conventions. Otherwise, CI builds wi
|
|||||||
|
|
||||||
Here are the conventions:
|
Here are the conventions:
|
||||||
|
|
||||||
- We use the subset of C++11 supported by MSVC 2013 (ask if you think that something outside of this subset would be useful)
|
- We use C++17.
|
||||||
- All new public functions in all classes need documenting comments on what they do and what behavior they follow, use doxy-comments formatted as `/** Description */`. Do not use asterisks on additional lines in multi-line comments.
|
- All new public functions in all classes need documenting comments on what they do and what behavior they follow, use doxy-comments formatted as `/** Description */`. Do not use asterisks on additional lines in multi-line comments.
|
||||||
- Use spaces after the comment markers: `// Comment` instead of `//Comment`. A comment must be prefixed with two spaces if it's on the same line with code:
|
- Use spaces after the comment markers: `// Comment` instead of `//Comment`. A comment must be prefixed with two spaces if it's on the same line with code:
|
||||||
- `SomeFunction()<Space><Space>//<Space>Note the two spaces prefixed to me and the space after the slashes.`
|
- `SomeFunction()<Space><Space>//<Space>Note the two spaces prefixed to me and the space after the slashes.`
|
||||||
|
@ -27,7 +27,7 @@ Useful Resources
|
|||||||
- [Minecraft Wiki](https://minecraft.gamepedia.com/Minecraft_Wiki)
|
- [Minecraft Wiki](https://minecraft.gamepedia.com/Minecraft_Wiki)
|
||||||
- [Minecraft Protocol Wiki](http://wiki.vg/Main_Page)
|
- [Minecraft Protocol Wiki](http://wiki.vg/Main_Page)
|
||||||
- [Lua API Documentation](https://api.cuberite.org/)
|
- [Lua API Documentation](https://api.cuberite.org/)
|
||||||
- [VS2013 Community Edition Download](https://www.visualstudio.com/downloads/)
|
- [Visual Studio Community Edition Download](https://www.visualstudio.com/downloads/)
|
||||||
|
|
||||||
Setting up a Dev Environment
|
Setting up a Dev Environment
|
||||||
============================
|
============================
|
||||||
|
20
appveyor.yml
20
appveyor.yml
@ -1,7 +1,10 @@
|
|||||||
version: 1.0.{build}
|
version: 1.0.{build}
|
||||||
image: Visual Studio 2015
|
|
||||||
clone_depth: 50
|
clone_depth: 50
|
||||||
|
|
||||||
|
image:
|
||||||
|
- Visual Studio 2019
|
||||||
|
- Visual Studio 2017
|
||||||
|
|
||||||
# Set up environment variables for build info
|
# Set up environment variables for build info
|
||||||
environment:
|
environment:
|
||||||
CUBERITE_BUILD_SERIES_NAME: AppVeyor
|
CUBERITE_BUILD_SERIES_NAME: AppVeyor
|
||||||
@ -21,6 +24,14 @@ environment:
|
|||||||
configuration: Release
|
configuration: Release
|
||||||
BUILD_DIR: Release-x64
|
BUILD_DIR: Release-x64
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
exclude:
|
||||||
|
- image: Visual Studio 2017
|
||||||
|
configuration: Release
|
||||||
|
- image: Visual Studio 2019
|
||||||
|
configuration: Debug
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- git submodule update --init
|
- git submodule update --init
|
||||||
@ -38,7 +49,8 @@ for:
|
|||||||
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
||||||
- cd %BUILD_DIR%
|
- cd %BUILD_DIR%
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cmake -G "Visual Studio 14 2015 Win64" -DSELF_TEST=1 -DBUILD_TOOLS=1 ..
|
# TODO: re-add -DSELF_TEST=YES -DBUILD_TOOLS=YES once PCH for tools enabled (too slow otherwise)
|
||||||
|
- cmake -G "Visual Studio 15 2017" -A "x64" -DSELF_TEST=NO -DBUILD_TOOLS=NO ..
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
||||||
@ -63,7 +75,7 @@ for:
|
|||||||
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
||||||
- cd %BUILD_DIR%
|
- cd %BUILD_DIR%
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cmake -G "Visual Studio 14 2015" ..
|
- cmake -G "Visual Studio 16 2019" ..
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
||||||
@ -88,7 +100,7 @@ for:
|
|||||||
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
- if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
||||||
- cd %BUILD_DIR%
|
- cd %BUILD_DIR%
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cmake -G "Visual Studio 14 2015 Win64" ..
|
- cmake -G "Visual Studio 16 2019" -A "x64" ..
|
||||||
- echo %TIME%
|
- echo %TIME%
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user