-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for required C++ features during initial build (std::format, etc) #3479
base: main
Are you sure you want to change the base?
Changes from all commits
fc38066
16756b7
30fb1ee
93f0fa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ concurrency: | |
|
||
jobs: | ||
Run: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-24.04 | ||
|
||
timeout-minutes: 10 | ||
steps: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#table-of-feature-test-macros | ||
# https://en.cppreference.com/w/cpp/feature_test | ||
# https://en.cppreference.com/w/cpp/utility/feature_test | ||
|
||
include_guard(GLOBAL) | ||
|
||
#include (CheckSymbolExists) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here! |
||
include (CheckCXXSymbolExists) | ||
|
||
macro(CHECK_CXX_FEATURE SYMBOL VARIABLE) | ||
if (NOT DEFINED "${SYMBOL}") | ||
# Feature testing is only available since C++20 | ||
if (NOT CMAKE_CXX_COMPILE_FEATURES MATCHES "cxx_std_20") | ||
message(FATAL_ERROR "C++20 support is required!\n") | ||
endif() | ||
|
||
# Header containing the available C++ standard library features | ||
set(FILES "version") | ||
|
||
#__CHECK_SYMBOL_EXISTS_IMPL(RequireCXXFeature.cxx "${SYMBOL}" "${FILES}" "${VARIABLE}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also commented out remnant of testing? |
||
check_cxx_symbol_exists("${SYMBOL}" "${FILES}" "${VARIABLE}") | ||
endif() | ||
endmacro() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
# https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#table-of-feature-test-macros | ||
# https://en.cppreference.com/w/cpp/feature_test | ||
# https://en.cppreference.com/w/cpp/utility/feature_test | ||
|
||
include_guard(GLOBAL) | ||
|
||
#include (CheckSymbolExists) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably don't need to leave commented-out remnants of testing 😉 |
||
include (CheckCXXSymbolExists) | ||
|
||
macro(REQUIRE_CXX_FEATURE SYMBOL) | ||
if (NOT DEFINED "${SYMBOL}") | ||
# Feature testing is only available since C++20 | ||
if (NOT CMAKE_CXX_COMPILE_FEATURES MATCHES "cxx_std_20") | ||
message(FATAL_ERROR "C++20 support is required!\n") | ||
endif() | ||
|
||
# Header containing the available C++ standard library features | ||
set(FILES "version") | ||
|
||
#__CHECK_SYMBOL_EXISTS_IMPL(RequireCXXFeature.cxx "${SYMBOL}" "${FILES}" "${SYMBOL}") | ||
check_cxx_symbol_exists("${SYMBOL}" "${FILES}" "${SYMBOL}") | ||
|
||
# To us, failure is a fatal error | ||
if (NOT "${${SYMBOL}}") | ||
# Unset the variable cached by "symbol exists" check | ||
unset("${SYMBOL}" CACHE) | ||
message(FATAL_ERROR "Required C++ feature ${SYMBOL} not found!\nSee the feature test documentation, or https://en.cppreference.com/w/cpp/feature_test for details.\n") | ||
endif() | ||
endif() | ||
endmacro() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ version: 2 | |
|
||
# Set the version of Python and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
os: ubuntu-24.04 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise, is this required? |
||
tools: | ||
python: "3.11" | ||
# https://github.com/readthedocs/readthedocs.org/issues/9599 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems incidental. Is this a required part of the PR, or a remnant of a previous test?