Skip to content

Commit

Permalink
Allow to control C++ standard to use
Browse files Browse the repository at this point in the history
  • Loading branch information
h4tr3d committed Mar 11, 2024
1 parent 2592eb6 commit 3e2dfff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/cmake-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ jobs:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
skip_meson: [false]
cxx_latest: [On]
include:
- os: ubuntu-20.04
build_type: Release
skip_meson: true
cxx_latest: Off
- os: ubuntu-20.04
build_type: Debug
skip_meson: true
cxx_latest: Off


# The CMake configure and build commands are platform agnostic and should work equally
Expand All @@ -40,12 +43,13 @@ jobs:
OS_NAME: ${{ matrix.os }}
BUILD_TYPE: ${{ matrix.build_type }}
SKIP_MESON: ${{ matrix.skip_meson }}
CXX_LATEST: ${{ matrix.cxx_latest }}

steps:
- uses: actions/checkout@v3

- name: Dump environment variables
run: echo "OS_NAME=$OS_NAME, BUILD_TYPE=$BUILD_TYPE, SKIP_MESON=$SKIP_MESON"
run: echo "OS_NAME=$OS_NAME, BUILD_TYPE=$BUILD_TYPE, SKIP_MESON=$SKIP_MESON, CXX_LATEST=$CXX_LATEST"

- name: Install packages for Linux
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
Expand All @@ -58,7 +62,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DAV_CXX_LATEST=${{ matrix.cxx_latest }}

- name: Build
# Build your program with the given configuration
Expand Down
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ set(FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg compon
set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)")
set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)")
set(AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)")
set(AV_CXX_LATEST On CACHE BOOL "Use most modern C++ compiler features (On), otherwise use C++17")

# Compiler-specific C++11 activation.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED no)
# Compiler-specific Modern C++ activation.
if (AV_CXX_LATEST)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED no)
else()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED yes)
endif()

# Warnings
set (AVCPP_WARNING_OPTIONS
Expand Down

0 comments on commit 3e2dfff

Please sign in to comment.