Skip to content

Commit 69e75ea

Browse files
committed
Use C++17 as default (refs #359)
1 parent c8a66c9 commit 69e75ea

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ include(cmake/HealthCheck.cmake)
5656
# Project options
5757
option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON)
5858
option(OPTION_SELF_CONTAINED "Create a self-contained install with all dependencies." OFF)
59+
option(OPTION_CXX_11_COMPATABILITY "Ensure build on a C++11 compiler." OFF)
60+
option(OPTION_CXX_14_COMPATABILITY "Ensure build on a C++14 compiler." OFF)
5961
option(OPTION_BUILD_TESTS "Build tests." OFF)
6062
option(OPTION_BUILD_DOCS "Build documentation." OFF)
6163
option(OPTION_BUILD_TOOLS "Build tools." ON)
@@ -146,6 +148,18 @@ enable_coverage(${OPTION_ENABLE_COVERAGE})
146148
# Compiler settings and options
147149
#
148150

151+
# Determine CXX_STANDARD
152+
153+
set(CXX_STANDARD_TO_USE 17)
154+
if (OPTION_CXX_14_COMPATABILITY)
155+
set(CXX_STANDARD_TO_USE 14)
156+
endif ()
157+
if (OPTION_CXX_11_COMPATABILITY)
158+
set(CXX_STANDARD_TO_USE 11)
159+
endif ()
160+
161+
# Initialize default compiler options
162+
149163
include(cmake/CompileOptions.cmake)
150164

151165

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,22 @@ Building *glbinding* from source has several mandatory and optional dependencies
165165

166166
### Compile Instructions
167167

168-
For compilation, a C++11 compliant compiler, e.g., GCC 4.8, Clang 3.3, MSVC 2013 **Update 3**, is required.
168+
For compilation, at least C++11 compliant compiler, e.g., GCC 4.8, Clang 3.3, MSVC 2013 **Update 3**, is required.
169+
The current release of glbinding defaults to use of C++17, but can be configured to use C++14 and even C++11 as a fallback.
170+
These fallbacks are available with using the CMake options `OPTION_CXX_11_COMPATABILITY` and `OPTION_CXX_14_COMPATABILITY`.
171+
169172
First, download the source code [as archive](https://github.com/cginternals/glbinding/releases) or via git:
170173

171174
```bash
172175
> git clone https://github.com/cginternals/glbinding.git
173176
> cd glbinding
174177
```
175178

176-
Then, depending on the version of *glbinding* you want to build, choose the appropriate tag or branch, e.g., for the 2.1.4 release:
179+
Then, depending on the version of *glbinding* you want to build, choose the appropriate tag or branch, e.g., for the 3.5.0 release:
177180

178181
```bash
179182
> git fetch --tags
180-
> git checkout v2.1.4
183+
> git checkout v3.5.0
181184
```
182185

183186
The actual compilation can be done using CMake and your favorite compiler and IDE.

cmake/CompileOptions.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
1212
set(X64 ON)
1313
endif()
1414

15+
message(STATUS "Use C++ Standard ${CXX_STANDARD_TO_USE}")
1516

1617
#
1718
# Project options
1819
#
1920

2021
set(DEFAULT_PROJECT_OPTIONS
2122
DEBUG_POSTFIX "d"
22-
CXX_STANDARD 11
23+
CXX_STANDARD ${CXX_STANDARD_TO_USE}
2324
LINKER_LANGUAGE "CXX"
2425
POSITION_INDEPENDENT_CODE ON
2526
CXX_VISIBILITY_PRESET "hidden"

cmake/Cppcheck.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function(perform_cppcheck check_target target)
99
${cppcheck_EXECUTABLE}
1010
"$<$<BOOL:${includes}>:-I$<JOIN:${includes},\t-I>>"
1111
--enable=all
12-
--std=c++11
12+
--std=c++${CXX_STANDARD_TO_USE}
1313
--verbose
1414
--suppress=missingIncludeSystem
1515
${ARGN}

source/glbinding-aux/source/glrevision.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace glbinding
66
{
77

88

9-
const unsigned int GL_REVISION = 20250414; ///< The revision of the gl.xml at the time of code generation.
9+
const unsigned int GL_REVISION = 20250416; ///< The revision of the gl.xml at the time of code generation.
1010

1111

1212
} // namespace glbinding

0 commit comments

Comments
 (0)