Skip to content

Commit

Permalink
first go at c++20 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Sep 29, 2020
1 parent 2fe974d commit 1accf5a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 82 deletions.
105 changes: 30 additions & 75 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,26 @@ image: Visual Studio 2019
environment:
matrix:

- compiler: msvc-16-seh
generator: "Visual Studio 16 2019"
genarch: -A Win32
configuration: Debug

- compiler: msvc-16-seh
generator: "Visual Studio 16 2019"
genarch: -A x64
configuration: Debug

- compiler: msvc-16-seh
generator: "Visual Studio 16 2019"
genarch: -A Win32
configuration: Release

- compiler: msvc-16-seh
generator: "Visual Studio 16 2019"
genarch: -A x64
configuration: Release


- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
compiler: msvc-15-seh
generator: "Visual Studio 15 2017"
configuration: Debug

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
compiler: msvc-15-seh
generator: "Visual Studio 15 2017 Win64"
configuration: Debug

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
compiler: msvc-15-seh
generator: "Visual Studio 15 2017"
configuration: Release

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
compiler: msvc-15-seh
generator: "Visual Studio 15 2017 Win64"
configuration: Release


#- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# compiler: msvc-14-seh
# generator: "Visual Studio 14 2015"
# configuration: Debug

#- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# compiler: msvc-14-seh
# generator: "Visual Studio 14 2015 Win64"
# configuration: Debug

#- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# compiler: msvc-14-seh
# generator: "Visual Studio 14 2015"
# configuration: Release

#- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# compiler: msvc-14-seh
# generator: "Visual Studio 14 2015 Win64"
# configuration: Release

- {GEN: Visual Studio 16 2019, ARCH: -A x64, CFG: Debug, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A Win32, CFG: Debug, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A x64, CFG: Release, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A Win32, CFG: Release, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A x64, STD: -D C4_CXX_STANDARD=20, CFG: Debug, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A x64, STD: -D C4_CXX_STANDARD=17, CFG: Debug, compiler: msvc-16-seh}
- {GEN: Visual Studio 16 2019, ARCH: -A x64, STD: -D C4_CXX_STANDARD=14, CFG: Debug, compiler: msvc-16-seh}

- {GEN: Visual Studio 15 2017 Win64, CFG: Debug, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017, compiler: msvc-15-seh}
- {GEN: Visual Studio 15 2017, CFG: Debug, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017, compiler: msvc-15-seh}
- {GEN: Visual Studio 15 2017 Win64, CFG: Release, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017, compiler: msvc-15-seh}
- {GEN: Visual Studio 15 2017, CFG: Release, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017, compiler: msvc-15-seh}

#- compiler: gcc-5.3.0-posix
# generator: "MinGW Makefiles"
# GEN: "MinGW Makefiles"
# cxx_path: 'C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin'
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# configuration: Quicktest
# CFG: Quicktest
# externconfig: Debug
# cmkargs: "-DC4STL_PEDANTIC=ON -DC4STL_WERROR=ON"


matrix:
fast_finish: true
Expand All @@ -87,30 +37,31 @@ install:
- cmake --version

build_script:
- echo %generator%
- echo %genarch%
- echo %configuration%
- echo %GEN%
- echo %ARCH%
- echo %CFG%
- echo %STD%
- set NUM_JOBS=3
- set PROJ_DIR=%cd%
- set BUILD_DIR=%PROJ_DIR%\build
- set INSTALL_DIR=%PROJ_DIR%\install
- set C4_EXTERN_DIR=%BUILD_DIR%\extern
- md %BUILD_DIR%
- md %BUILD_DIR%\static %BUILD_DIR%\shared %BUILD_DIR%\extern
- cmake -S %PROJ_DIR% -B %BUILD_DIR%\static -DC4CORE_DEV=ON -G "%generator%" %genarch% "-DCMAKE_BUILD_TYPE=%configuration%" "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%\static" -DBUILD_SHARED_LIBS=OFF
- cmake -S %PROJ_DIR% -B %BUILD_DIR%\shared -DC4CORE_DEV=ON -G "%generator%" %genarch% "-DCMAKE_BUILD_TYPE=%configuration%" "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%\shared" -DBUILD_SHARED_LIBS=ON
- cmake -S %PROJ_DIR% -B %BUILD_DIR%\static %STD% -DC4CORE_DEV=ON -G "%generator%" %genarch% "-DCMAKE_BUILD_TYPE=%configuration%" "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%\static" -DBUILD_SHARED_LIBS=OFF
- cmake -S %PROJ_DIR% -B %BUILD_DIR%\shared %STD% -DC4CORE_DEV=ON -G "%generator%" %genarch% "-DCMAKE_BUILD_TYPE=%configuration%" "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%\shared" -DBUILD_SHARED_LIBS=ON
- cmake --build %BUILD_DIR%\static --config %configuration% --target test-build --parallel %NUM_JOBS%
- cmake --build %BUILD_DIR%\shared --config %configuration% --target test-build --parallel %NUM_JOBS%

test_script:
- cmake --build %BUILD_DIR%\static --config %configuration% --target test
- cmake --build %BUILD_DIR%\shared --config %configuration% --target test

artifacts:
- path: '_build/CMakeFiles/*.log'
name: logs
- path: '_build/Testing/**/*.xml'
name: test_results
#artifacts:
# - path: '_build/CMakeFiles/*.log'
# name: logs
# - path: '_build/Testing/**/*.xml'
# name: test_results

skip_commits:
files:
Expand All @@ -123,5 +74,9 @@ skip_commits:
- .ci/Vagrant*
- bm/html/*
- doc/*
- img/*
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE.txt
- README.*
- ROADMAP.*
2 changes: 1 addition & 1 deletion cmake
Submodule cmake updated 1 files
+1 −1 c4Project.cmake
25 changes: 20 additions & 5 deletions src/c4/language.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# if (!defined(_MSVC_LANG))
# error _MSVC not defined
# endif
# if _MSVC_LANG >= 201703L
# if _MSVC_LANG >= 201705L
# define C4_CPP 20
# define C4_CPP20
# elif _MSVC_LANG == 201703L
# define C4_CPP 17
# define C4_CPP17
# elif _MSVC_LANG >= 201402L
Expand All @@ -41,7 +44,10 @@
# endif
# endif
# elif defined(__INTEL_COMPILER) // https://software.intel.com/en-us/node/524490
# ifdef __INTEL_CXX17_MODE__ // not sure about this
# ifdef __INTEL_CXX20_MODE__ // not sure about this
# define C4_CPP 20
# define C4_CPP20
# elif defined __INTEL_CXX17_MODE__ // not sure about this
# define C4_CPP 17
# define C4_CPP17
# elif defined __INTEL_CXX14_MODE__ // not sure about this
Expand All @@ -59,6 +65,9 @@
# endif
# if __cplusplus == 1
# error cannot handle __cplusplus==1
# elif __cplusplus >= 202002L
# define C4_CPP 20
# define C4_CPP20
# elif __cplusplus >= 201703L
# define C4_CPP 17
# define C4_CPP17
Expand All @@ -73,7 +82,9 @@
# endif
# endif
#else
# ifdef C4_CPP == 17
# ifdef C4_CPP == 20
# define C4_CPP20
# elif C4_CPP == 17
# define C4_CPP17
# elif C4_CPP == 14
# define C4_CPP14
Expand All @@ -83,11 +94,15 @@
# define C4_CPP98
# error C++ lesser than C++11 not supported
# else
# error C4_CPP must be one of 17, 14, 11, 98
# error C4_CPP must be one of 20, 17, 14, 11, 98
# endif
#endif

#ifdef C4_CPP17
#ifdef C4_CPP20
# define C4_CPP17
# define C4_CPP14
# define C4_CPP11
#elif defined(C4_CPP17)
# define C4_CPP14
# define C4_CPP11
#elif defined(C4_CPP14)
Expand Down
9 changes: 8 additions & 1 deletion src/c4/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ struct cref_uses_val
enum { value = (
std::is_scalar<T>::value
||
(std::is_pod<T>::value && sizeof(T) <= sizeof(size_t))) };
(
#if C4_CPP >= 20
(std::is_trivially_copyable<T>::value && std::is_standard_layout<T>::value)
#else
std::is_pod<T>::value
#endif
&&
sizeof(T) <= sizeof(size_t))) };
};
/** utility macro to override the default behaviour for c4::fastcref<T>
@see fastcref */
Expand Down

0 comments on commit 1accf5a

Please sign in to comment.