Skip to content

Commit

Permalink
Merge etternagame#1071 Upgrade to C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Sep 12, 2022
2 parents 4a37ee9 + 03ee1c0 commit 8ba7066
Show file tree
Hide file tree
Showing 159 changed files with 12,935 additions and 2,152 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:
fail-fast: false
matrix:
cfg:
- { os: ubuntu-18.04, cpp-version: g++-8, dist: false}
- { os: ubuntu-18.04, cpp-version: g++-9, dist: false}
- { os: ubuntu-18.04, cpp-version: clang++-7, dist: false}
- { os: ubuntu-18.04, cpp-version: clang++-8, dist: false}
- { os: ubuntu-18.04, cpp-version: clang++-9, dist: true}
- { os: ubuntu-20.04, apt: g++-8, cxx: g++-8, cc: gcc-8, dist: false}
- { os: ubuntu-20.04, apt: g++-9, cxx: g++-9, cc: gcc-9, dist: false}
- { os: ubuntu-20.04, apt: g++-10, cxx: g++-10, cc: gcc-10, dist: false}
- { os: ubuntu-20.04, apt: clang-9, cxx: clang++-9, cc: clang-9, dist: false}
- { os: ubuntu-20.04, apt: clang-10, cxx: clang++-10, cc: clang-10, dist: false}
- { os: ubuntu-20.04, apt: clang-11, cxx: clang++-11, cc: clang-11, dist: false}
- { os: ubuntu-20.04, apt: clang-12, cxx: clang++-12, cc: clang-12, dist: true}

steps:
- name: Checkout Etterna
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ project(Etterna
LANGUAGES C CXX ASM)

## CMake and Compiler Setup
set(CMAKE_CXX_STANDARD 17) # Minimum C++ Version
set(CMAKE_CXX_STANDARD 20) # Minimum C++ Version
set(CMAKE_CXX_EXTENSIONS OFF) # True if compiler extensions are necessary. (Changes -std flag)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # True to require minimum C++ version to compile
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10) # Tell xcodebuild to target an older osx platform
Expand Down
2 changes: 1 addition & 1 deletion Docs/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ We actively support the following CMake generators

- macOS: `Ninja`, `Xcode`, `Unix Makefiles`
- Linux: `Ninja`, `Unix Makefiles`
- Windows: `Ninja`, `Visual Studio 15 2017`, `Visual Studio 16 2019` _(Technically, with how the CMake script is setup, any generator as far back as_ `Visual Studio 9 2008` _should work), but it has only tested it with the above three._
- Windows: `Ninja`, `Visual Studio 16 2019`, `Visual Studio 17 2022`

For the `OPENSSL_ROOT_DIR` parameter, set the directory for where ever the openssl root directory is located. Here are possible options

Expand Down
1 change: 1 addition & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ add_subdirectory(plog)


## Header Only
set(RAPIDJSON_BUILD_EXAMPLES OFF)
add_subdirectory(rapidjson)
add_subdirectory(stb)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class BasicStringPiece {
int compare(const BasicStringPiece<StringType>& that) const {
int result = traits_type::compare(pointer_,
that.pointer_,
std::min(length_, that.length_));
(std::min)(length_, that.length_));
if (result == 0) {
if (length_ < that.length_) {
result = -1;
Expand All @@ -100,15 +100,15 @@ class BasicStringPiece {

BasicStringPiece<StringType> substr(size_type position = 0,
size_type count = npos) const {
position = std::min(position, size());
count = std::min(count, size() - position);
position = (std::min)(position, size());
count = (std::min)(count, size() - position);
return BasicStringPiece<StringType>(data() + position, count);
}

size_type copy(value_type* dest,
size_type count,
size_type position = 0) const {
size_type ret = std::min(size() - position, count);
size_type ret = (std::min)(size() - position, count);
traits_type::copy(dest, data() + position, ret);
return ret;
}
Expand Down
4 changes: 4 additions & 0 deletions extern/rapidjson/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
!/bin/encodings
!/bin/jsonchecker
!/bin/types
!/bin/unittestschema
/build
/doc/html
/doc/doxygen_*.db
Expand All @@ -23,3 +24,6 @@ Doxyfile
Doxyfile.zh-cn
DartConfiguration.tcl
*.nupkg

# Files created by OS
*.DS_Store
3 changes: 0 additions & 3 deletions extern/rapidjson/.gitmodules

This file was deleted.

120 changes: 94 additions & 26 deletions extern/rapidjson/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
sudo: required
dist: precise
dist: xenial

language: cpp
cache:
- ccache

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- cmake
- valgrind
- clang-8
env:
global:
- USE_CCACHE=1
Expand All @@ -13,49 +21,96 @@ env:
- CCACHE_MAXSIZE=100M
- ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit
- ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit
- GITHUB_REPO='miloyip/rapidjson'
- ARCH_FLAGS_aarch64='-march=armv8-a'
- GITHUB_REPO='Tencent/rapidjson'
- secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="

before_install:
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -y cmake valgrind g++-multilib libc6-dbg:i386

matrix:
include:
# gcc
- env: CONF=release ARCH=x86 CXX11=ON
- env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
arch: amd64
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
arch: amd64
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON
compiler: gcc
arch: amd64
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
arch: amd64
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
- env: CONF=release ARCH=x86_64 CXX11=ON
arch: amd64
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG'
compiler: gcc
- env: CONF=debug ARCH=x86 CXX11=OFF
arch: amd64
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG'
compiler: gcc
- env: CONF=debug ARCH=x86_64 CXX11=OFF
arch: amd64
- env: CONF=release ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
arch: arm64
- env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
compiler: gcc
arch: arm64
- env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=ON
compiler: gcc
arch: arm64
# clang
- env: CONF=debug ARCH=x86 CXX11=ON CCACHE_CPP2=yes
- env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
arch: amd64
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
arch: amd64
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes
compiler: clang
arch: amd64
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
arch: amd64
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86 CXX11=OFF CCACHE_CPP2=yes
arch: amd64
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
compiler: clang
- env: CONF=debug ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
arch: amd64
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
compiler: clang
- env: CONF=release ARCH=x86 CXX11=ON CCACHE_CPP2=yes
arch: amd64
- env: CONF=debug ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
- env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
arch: arm64
- env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
compiler: clang
arch: arm64
- env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
compiler: clang
arch: arm64
# coverage report
- env: CONF=debug ARCH=x86 CXX11=ON GCOV_FLAGS='--coverage'
- env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=OFF
compiler: gcc
arch: amd64
cache:
- ccache
- pip
after_success:
- pip install --user cpp-coveralls
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
- env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=ON CXX17=OFF MEMBERSMAP=ON
compiler: gcc
arch: amd64
cache:
- ccache
- pip
after_success:
- pip install --user cpp-coveralls
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
- env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage'
- env: CONF=debug ARCH=aarch64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=ON
compiler: gcc
arch: arm64
cache:
- ccache
- pip
Expand All @@ -72,24 +127,37 @@ matrix:
packages:
- doxygen

before_install:
- if [ "x86_64" = "$(arch)" ]; then sudo apt-get install -y g++-multilib libc6-dbg:i386 --allow-unauthenticated; fi

before_script:
- ccache -s
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
# exposed by merging PR#163 (using -march=native)
# TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
- sed -i "s/-march=native//" CMakeLists.txt
- mkdir build
# travis provides clang-7 for amd64 and clang-3.8 for arm64
# here use clang-8 to all architectures as clang-7 is not available for arm64
- if [ -f /usr/bin/clang++-8 ]; then
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 1000;
sudo update-alternatives --config clang++;
export PATH=/usr/bin:$PATH;
fi
- if [ "$CXX" = "clang++" ]; then export CCACHE_CPP2=yes; fi
- ccache -s
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
# exposed by merging PR#163 (using -march=native)
# TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
- sed -i "s/-march=native//" CMakeLists.txt
- mkdir build

script:
- if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS}"; fi
- >
eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
(cd build && cmake
-DRAPIDJSON_HAS_STDSTRING=ON
-DRAPIDJSON_USE_MEMBERSMAP=$MEMBERSMAP
-DRAPIDJSON_BUILD_CXX11=$CXX11
-DRAPIDJSON_BUILD_CXX17=$CXX17
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=$CONF
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS"
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS $CXX_FLAGS"
-DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS
..)
- cd build
Expand Down
14 changes: 7 additions & 7 deletions extern/rapidjson/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.0] - 2015-04-22

### Added
* 100% [Coverall](https://coveralls.io/r/miloyip/rapidjson?branch=master) coverage.
* 100% [Coverall](https://coveralls.io/r/Tencent/rapidjson?branch=master) coverage.
* Version macros (#311)

### Fixed
Expand Down Expand Up @@ -140,7 +140,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Redo all documentation (English, Simplified Chinese)

### Changed
* Copyright ownership transfered to THL A29 Limited (a Tencent company).
* Copyright ownership transferred to THL A29 Limited (a Tencent company).
* Migrating from Premake to CMAKE (#192)
* Resolve all warning reports

Expand All @@ -151,8 +151,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## 0.1 - 2011-11-18

[Unreleased]: https://github.com/miloyip/rapidjson/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/miloyip/rapidjson/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/miloyip/rapidjson/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/miloyip/rapidjson/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/miloyip/rapidjson/compare/v1.0-beta...v1.0.0
[Unreleased]: https://github.com/Tencent/rapidjson/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/Tencent/rapidjson/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/Tencent/rapidjson/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/Tencent/rapidjson/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/Tencent/rapidjson/compare/v1.0-beta...v1.0.0
Loading

0 comments on commit 8ba7066

Please sign in to comment.