Skip to content

Commit

Permalink
chore: C++17 compatibility (#98)
Browse files Browse the repository at this point in the history
* feat: C++17 compatibility

* Apply suggestions from code review

Co-authored-by: kyle-cochran <[email protected]>

---------

Co-authored-by: kyle-cochran <[email protected]>
  • Loading branch information
vishwa2710 and kyle-cochran authored Aug 23, 2024
1 parent f48b7b9 commit abf24a4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
40 changes: 38 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OPTION (BUILD_PYTHON_BINDINGS "Build Python bindings." ON)
OPTION (BUILD_CODE_COVERAGE "Build code coverage" OFF)
OPTION (BUILD_DOCUMENTATION "Build documentation" OFF)
OPTION (BUILD_WITH_DEBUG_SYMBOLS "Build with debug symbols" ON)
OPTION (BUILD_WITH_CXX_17 "Build with C++ 17 support." OFF)

## Setup

Expand Down Expand Up @@ -126,9 +127,44 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

ENDIF ()

### C++ 20 support
### C++ 17/20 support

IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

IF (BUILD_WITH_CXX_17)

SET (CMAKE_CXX_STANDARD 17)

MESSAGE (STATUS "C++17 support enabled")

IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)

MESSAGE (FATAL_ERROR "GCC version must be at least 7.0 to build with C++17")

ENDIF ()

ELSE ()

MESSAGE (STATUS "C++20 support enabled")

SET (CMAKE_CXX_STANDARD 20)

IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)

MESSAGE (FATAL_ERROR "GCC version must be at least 13.0 to build with C++20")

ENDIF ()

ENDIF ()

SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wshadow -Wno-deprecated")

ELSE ()

SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wshadow")

ENDIF ()

SET (CMAKE_CXX_STANDARD 20)
SET (CMAKE_CXX_STANDARD_REQUIRED ON)
SET (CMAKE_CXX_EXTENSIONS OFF)

Expand Down
14 changes: 14 additions & 0 deletions docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ RUN apt-get update \
&& apt-get install -y jq \
&& rm -rf /var/lib/apt/lists/*

## fmt

ARG FMT_VERSION="5.2.0"

RUN cd /tmp \
&& git clone --branch ${FMT_VERSION} --depth 1 https://github.com/fmtlib/fmt.git \
&& cd fmt \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE .. \
&& make --silent -j $(nproc) \
&& make install \
&& rm -rf /tmp/fmt

## libcurl

RUN apt-get update -y \
Expand Down

0 comments on commit abf24a4

Please sign in to comment.