Skip to content

Commit

Permalink
Add support for compiling under c++20 on clang-based compilers. The w…
Browse files Browse the repository at this point in the history
…arnings that this change ignores are tricky to fix in the code in a way that is backwards compatible with c++17, but it is possible to do and it would allow these warnings to be reinstated. (#8199)
  • Loading branch information
emezeske authored Oct 15, 2024
1 parent a3290d7 commit 22db1be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions filament/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,13 @@ else()
-Wover-aligned
-Werror
)
if (CMAKE_CXX_STANDARD EQUAL 20)
# The lambdas for passes in PostProcessManager.cpp capture this
# implicitly in a way that's deprecated in c++20, but can't easily be
# fixed in a way that's backwards compatible with c++17:
# https://www.nextptr.com/tutorial/ta1430524603/capture-this-in-lambda-expression-timeline-of-change
list(APPEND FILAMENT_WARNINGS -Wno-deprecated-this-capture)
endif()
endif()

target_compile_options(${TARGET} PRIVATE
Expand Down
5 changes: 5 additions & 0 deletions libs/gltfio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ if (WEBGL_PTHREADS)
endif()

set(GLTFIO_WARNINGS -Wall -Werror)
if (CMAKE_CXX_STANDARD EQUAL 20)
# The following things used by AssetLoader.cpp are deprecated in c++20:
# wstring_convert and std::codecvt_utf8<char32_t>.
list(APPEND GLTFIO_WARNINGS -Wno-deprecated-declarations)
endif()
if (NOT MSVC)
target_compile_options(gltfio_core PRIVATE ${GLTFIO_WARNINGS})
endif()
Expand Down

0 comments on commit 22db1be

Please sign in to comment.