Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
60b1cf6
Doc++
mosra Jul 9, 2022
35ef62b
Rethink the CORRADE_TARGET_NEON* defines.
mosra Jul 9, 2022
6dc6d29
Test: Imply CORRADE_TARGET_WASM, not EMSCRIPTEN from SIMD128.
mosra Jul 9, 2022
ed1c127
Rethink how CORRADE_TARGET_AVX_F16C and FMA fit into the hierarchy.
mosra Jul 13, 2022
942898a
Add CORRADE_TARGET_POPCNT and CORRADE_TARGET_LZCNT.
mosra Jul 13, 2022
a339752
New Cpu namespace for compile-time and runtime CPU feature dispatch.
mosra Jul 9, 2022
3221990
Cpu: ability to construct a tag or a Feature from a tag type.
mosra Jul 9, 2022
0711cd3
Cpu: add x86 CORRADE_ENABLE_* function target attribute macros.
mosra Jul 9, 2022
e602f57
Cpu: sigh clang-cl what are you doing.
mosra Jul 10, 2022
23c4fb2
Cpu: ARM and WebAssembly CORRADE_ENABLE_* function attribute macros.
mosra Jul 9, 2022
c8a43c9
Cpu: implement runtime ARM feature detection on Linux and Android 18+.
mosra Jul 10, 2022
0d6a8d8
doc: setup Doxygen for dot graphs.
mosra Jul 13, 2022
099461f
Cpu: implement dispatching for extra tags not in the base hierarchy.
mosra Jul 13, 2022
449ae68
Utility: add a workaround for popcnt also for Clang < 7.
mosra Jul 13, 2022
c4027cf
Cpu: workaround MSVC 2015 and 2017 template parser warts.
mosra Jul 14, 2022
5b83438
Cpu: make the template expression build on MSVC without /permissive-.
mosra Jul 16, 2022
9a787db
Add a note about Apple AMX to CORRADE_TARGET_ARM.
mosra Jul 14, 2022
8cfaf2d
Cpu: detect ARM features on macOS and iOS.
mosra Jul 14, 2022
7264d19
Cpu: Doxygen! Bad Doxygen.
mosra Jul 15, 2022
ebb631a
Cpu: add bitwise operators also for Tags<> on both sides.
mosra Jul 16, 2022
c2bb167
Cpu: macros for efficient automatic runtime dispatch.
mosra Jul 16, 2022
bccd27b
Cpu: another day, another case of MSVC NOT WORKING AT ALL.
mosra Jul 17, 2022
ac9d940
doc: update outdated reference to CORRADE_TARGET_* variables.
mosra Jul 17, 2022
71398f3
Cpu: automatic cached dispatch via a pointer and via GNU IFUNC.
mosra Jul 17, 2022
a03fa51
Cpu: print also unknown bits in the Features debug printer.
mosra Jul 17, 2022
0662dbe
Cpu: make ifunc work on GCC 4.8.
mosra Jul 18, 2022
eccc8cb
Cpu: disable IFUNC on GCC 4.8 if --coverage is used.
mosra Jul 18, 2022
10ccf25
Cpu: disable IFUNC with sanitizers, and fail if it's enabled on them.
mosra Jul 18, 2022
b8a054f
Add a placeholder CORRADE_BUILD_CPU_RUNTIME_DISPATCH option.
mosra Jul 18, 2022
2847c9b
Forward-declare Cpu::Features in Corrade.h.
mosra Jul 19, 2022
d55c09a
Cpu: unify CORRADE_CPU_DISPATCHED_POINTER() and _IFUNC() signatures.
mosra Jul 19, 2022
ee6f239
Cpu: we don't need the type in CORRADE_CPU_DISPATCHED_IFUNC().
mosra Jul 19, 2022
1e8514e
Cpu: actually I don't need the type for CORRADE_CPU_DISPATCHER*() eit…
mosra Jul 19, 2022
afbb92e
doc: refresh minor bits in Developers Guide.
mosra Jul 19, 2022
b5f4445
Add CORRADE_TARGET_BMI1, _ENABLE_BMI1 and Cpu::Bmi1.
mosra Jul 19, 2022
62f9aaa
doc: document a checklist for adding a new CPU feature tag.
mosra Jul 19, 2022
1b035d0
Cpu: mention an important difference with CORRADE_ENABLE_* and lambdas.
mosra Jul 20, 2022
39e1255
CMake: unify the way sanitizers are checked for.
mosra Jul 20, 2022
c1c7a58
Cpu: one doesn't simply use multiple CORRADE_ENABLE_ macros on GCC.
mosra Jul 25, 2022
4c41cb4
Improve compile-time POPCNT, LZCNT and BMI1 detection on MSVC.
mosra Jul 21, 2022
fc82fb4
Cpu: don't use assertions in CPUID retrieval code.
mosra Jul 25, 2022
80a587a
Cpu: inline the CPUID query in the header and make it inline assembly.
mosra Jul 25, 2022
ac08aa2
Cpu: inline the internal ARM runtimeFeatures() query also.
mosra Jul 25, 2022
b38c532
Cpu: give up on extra instruction sets on GCC 4.8.
mosra Jul 25, 2022
cf31a98
Cpu: multiple CORRADE_ENABLE_ macros don't work on Clang < 8 either.
mosra Jul 26, 2022
22613a6
Cpu: older Clang also doesn't recognize lambda attributes.
mosra Jul 26, 2022
17713aa
Containers: partially inline StringView::find*() and related APIs.
mosra Jul 6, 2022
46e4ed0
Containers: split tests for string and character variant of find().
mosra Jul 20, 2022
272e8ef
Containers: initial benchmark for a subset of StringView APIs.
mosra Jul 20, 2022
ab543ab
Containers: benchmark also String::find[Last]() with small sizes.
mosra Jul 28, 2022
6f84587
Add a CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH option.
mosra Jul 22, 2022
6c8467e
Cpu: document more GCC lambda attribute bugs.
mosra Jul 26, 2022
6615e44
package/ci: install GCC 9.4 on the Android build.
mosra Jul 26, 2022
98c4744
CMake: avoid linking to both CorradeUtilityTestLib and CorradeUtility.
mosra Jul 26, 2022
75c786d
CMake: use dummy.cpp for TestSuite[TestLib] and document what is it for.
mosra Jul 26, 2022
d9cc4a2
CMake: consistently use PUBLIC in target_link_libraries().
mosra Jul 26, 2022
c3acf1c
CMake: use the new-style Threads::Threads target.
mosra Jul 26, 2022
66d7a38
Utility: add helpers for CPU tests.
mosra Jul 22, 2022
8dd4a33
Containers: SSE2+BMI1 implementation of StringView::find().
mosra Jul 28, 2022
4552812
Containers: AVX2+BMI1 variant of String::find().
mosra Jul 28, 2022
07b2027
Containers: benchmark both 15 and 31 bytes in AVX2 StringView::find().
mosra Jul 28, 2022
71fa0f1
Containers: WASM SIMD128 variant of String::find().
mosra Jul 30, 2022
96779d6
Containers: unroll < 16b fallback in StringView::find().
mosra Jul 28, 2022
a373cef
Containers: further optimize unrolled String::find().
mosra Jul 29, 2022
d5d1fcf
Containers: add a perf TODO for WASM SIMD128.
mosra Jul 29, 2022
7319e39
Cpu: test a WASM SIMD128 instruction that's only in the finalized set.
mosra Jul 29, 2022
39a98cf
Define CORRADE_TARGET_SIMD128 only on Clang 13+ and Emscripten 2.0.18+.
mosra Jul 29, 2022
b826e5e
doc: work around Emscripten 2.0.20 being extra picky.
mosra Jul 29, 2022
d15c2ea
modules: retrieve Node.js version in FindNodeJs.
mosra Jul 29, 2022
6936396
CMake: pass --experimental-wasm-simd to Node.js < 17 in corrade_add_t…
mosra Jul 29, 2022
f7f6fac
CMake: add our module path earlier.
mosra Jul 29, 2022
d218e78
CMake: introduce CORRADE_BUILD_TESTS_FORCE_WASM_SIMD128.
mosra Jul 29, 2022
6dcf752
package/ci: I tried EMSDK and SIMD. Wasted whole day. Failed.
mosra Jul 29, 2022
7a7a872
Cpu: mention an important caveat with CORRADE_ENABLE().
mosra Jul 30, 2022
ac375fe
Cpu: rethink how GCC 9.3 lambda attribute bug is handled.
mosra Jul 30, 2022
b6552f9
Containers: add a perf TODO.
mosra Jul 30, 2022
8efcc20
Cpu: add a benchmark for dispatch overhead.
mosra Jul 31, 2022
f0f2569
Containers: ARM NEON variant of String::find().
mosra Jul 30, 2022
86bb47f
Containers: more perf TODOs.
mosra Aug 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 108 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ project(Corrade CXX)
# Use folders for nice tree in Visual Studio and XCode
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})

include(CMakeDependentOption)

# Options that used to be unprefixed. New options shouldn't be added to this
Expand Down Expand Up @@ -187,6 +189,112 @@ if(CORRADE_TARGET_WINDOWS)
endif()
endif()

# Check if we can use IFUNC for CPU dispatch. Linux with glibc and Android with
# API 18+ has it, but e.g. Alpine Linux with musl doesn't, and on Android with
# API < 30 we don't get AT_HWCAP passed into the resolver and can't call
# getauxval() ourselves because it's too early at that point, which makes it
# pretty useless. Plus it also needs a certain binutils version and a capable
# compiler, so it's easiest to just verify the whole thing.
if(CORRADE_TARGET_UNIX)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("\
int fooImplementation() { return 42; }
#if defined(__ANDROID_API__) && __ANDROID_API__ < 30
#error need Android API 30+ to have AT_HWCAP passed into the resolver
#endif
extern \"C\" int(*fooDispatcher())() {
return fooImplementation;
}
int foo() __attribute__((ifunc(\"fooDispatcher\")));
int main() { return foo() - 42; }\
" _CORRADE_CPU_CAN_USE_IFUNC)
# In cases where ifunc is known to be broken, disable it by default --
# users can still force it to be enabled, but the initial state should not
# cause crashes or other strange behavior.
if(_CORRADE_CPU_CAN_USE_IFUNC)
set(_CORRADE_CPU_USE_IFUNC_DEFAULT ON)
# On GCC 4.8, if --coverage or -fprofile-arcs is enabled, the ifunc
# dispatchers cause a segfault. On Ubuntu 20.04 at least. Not the case
# with GCC 5 there, not the case with GCC 4.8 on Arch. Can't find any
# upstream bug report or commit that would be related to this.
if(CMAKE_CXX_COMPILER_ID AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9" AND CMAKE_CXX_FLAGS MATCHES "(--coverage|-fprofile-arcs)")
if(NOT DEFINED CORRADE_CPU_USE_IFUNC)
message(WARNING "Disabling CORRADE_CPU_USE_IFUNC by default as it may crash when used together with --coverage on GCC 4.8.")
endif()
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
endif()

# If sanitizers are enabled, call into the dispatch function crashes.
# Upstream bugreport https://github.com/google/sanitizers/issues/342
# suggests using __attribute__((no_sanitize_address)), but that doesn't
# work / can't be used because it would mean marking basically
# everything including the actual implementation that's being
# dispatched to.
#
# Sanitizers can be also enabled any other way such as with
# CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER or with per-target properties
# which isn't easy to detect, so as a secondary measure there's a kill
# switch in Corrade/configure.h that will fail with an error if a
# sanitizer is detected and CORRADE_CPU_USE_IFUNC is enabled.
#
# While Clang and GCC use -fsanitize=whatever, MSVC allows also
# /fsanitize=, so catch both.
if(CMAKE_CXX_FLAGS MATCHES "[-/]fsanitize=")
if(NOT DEFINED CORRADE_CPU_USE_IFUNC)
message(WARNING "Disabling CORRADE_CPU_USE_IFUNC by default as it crashes when used together with sanitizers. See https://github.com/google/sanitizers/issues/342 for more information.")
endif()
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
endif()
else()
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
endif()
else()
set(_CORRADE_CPU_CAN_USE_IFUNC OFF)
set(_CORRADE_CPU_USE_IFUNC_DEFAULT OFF)
endif()
cmake_dependent_option(CORRADE_CPU_USE_IFUNC "Allow using GNU IFUNC for runtime CPU dispatch" ${_CORRADE_CPU_USE_IFUNC_DEFAULT} "_CORRADE_CPU_CAN_USE_IFUNC" OFF)

# Runtime CPU dispatch. Because going through a function pointer may have
# negative perf consequences, enable it by default only on platforms that have
# IFUNC, and thus can avoid the function pointer indirection.
option(CORRADE_BUILD_CPU_RUNTIME_DISPATCH "Build with runtime dispatch for CPU-dependent functionality" ${_CORRADE_CPU_CAN_USE_IFUNC})
# Enabled by default and independent of CORRADE_BUILD_CPU_RUNTIME_DISPATCH as
# correctness is important. It can however negatively affect performance
# compared to IFUNC or compile-time dispatch, so make it possible to disable
# this for benchmarks.
cmake_dependent_option(CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH "Force pointer-based dispatch for unit tests to verify all variants of CPU-dependent functionality" ON "CORRADE_BUILD_TESTS" OFF)

# Pass -msimd128 to tests to make it possible to verify also the WASM SIMD
# functionality even if the actual library is built without. I thought it would
# be a no-brainer, however *actual* finalized SIMD128 requires final Clang 13
# (such version is reported since emsdk 2.0.13, but the actual final version
# containing all intrinsics is only in emsdk 2.0.18), and Node.js 15+, which
# contains V8 8.6:
# https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V15.md#2020-10-20-version-1500-current-bethgriggs
# Final bitmask instructions were added in 8.5, Node.js 14 has 8.4:
# https://github.com/v8/v8/commit/aa5bcc09bf7d5d77056e6033918d79c30aa3f49a
# However, even now, in the midst of 2022 wildfires, emsdk still bundles
# Node.js 14.18 and there's no hope of it being upgraded any time soon:
# https://github.com/emscripten-core/emsdk/pull/877
# https://github.com/emscripten-core/emsdk/issues/947
# https://github.com/emscripten-core/emsdk/issues/1064
# So instead of having -msimd128 always, I only enable it implicitly if Node.js
# 15 is found, and then CORRADE_ENABLE_SIMD128 / CORRADE_TARGET_SIMD128 gets
# enabled only if there's Clang 13 but also Emscripten 2.0.18+. What a mess.
if(CORRADE_TARGET_EMSCRIPTEN)
set(ENABLE_IF_NODEJS_15 OFF)
if(CORRADE_BUILD_TESTS)
find_package(NodeJs REQUIRED QUIET)
if(NOT NodeJs_VERSION VERSION_LESS 15.0)
set(ENABLE_IF_NODEJS_15 ON)
elseif(NOT DEFINED CORRADE_BUILD_TESTS_FORCE_WASM_SIMD128)
message(WARNING "Disabling CORRADE_BUILD_TESTS_FORCE_WASM_SIMD128 by default as finalized WebAssembly SIMD support is only since Node.js 15 but found version ${NodeJs_VERSION}")
endif()
endif()

cmake_dependent_option(CORRADE_BUILD_TESTS_FORCE_WASM_SIMD128 "Force -msimd128 for unit tests to verify also WASM SIMD variants of CPU-dependent functionality" ${ENABLE_IF_NODEJS_15} "CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH" OFF)
endif()

# Backwards compatibility for unprefixed CMake options. If the user isn't
# explicitly using prefixed options in the first run already, accept the
# unprefixed options, and remember this decision for subsequent runs
Expand Down Expand Up @@ -256,7 +364,6 @@ if(CORRADE_BUILD_TESTS)
enable_testing()
endif()

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})
if(CMAKE_CROSSCOMPILING)
find_program(CORRADE_RC_EXECUTABLE corrade-rc)
if(NOT CORRADE_RC_EXECUTABLE)
Expand Down
6 changes: 3 additions & 3 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2280,14 +2280,14 @@ DOT_NUM_THREADS = 0
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTNAME = Verdana
DOT_FONTNAME = Source Sans Pro

# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
# Minimum value: 4, maximum value: 24, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTSIZE = 8
DOT_FONTSIZE = 16

# By default doxygen will tell dot to use the default font as specified with
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
Expand Down Expand Up @@ -2445,7 +2445,7 @@ DOT_PATH =
# command).
# This tag requires that the tag HAVE_DOT is set to YES.

DOTFILE_DIRS =
DOTFILE_DIRS = .

# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
Expand Down
54 changes: 47 additions & 7 deletions doc/building-corrade.dox
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,28 @@ Options controlling the build:
Corrade features simultaneously in multiple threads. Enabled by default,
disable if you don't need this and don't want to pay potential performance
penalties coming from thread-local variables.
- `CORRADE_BUILD_CPU_RUNTIME_DISPATCH` --- Build with performance-critical
code paths optimized for multiple architectures (such as SSE or AVX on
x86), with the best matching variant selected at runtime based on detected
CPU features. If not enabled, the library is built with just a single
variant that's picked at compile time depending on target architecture
flags being passed to the compiler. Enabled by default on platforms that
support [GNU IFUNC](https://sourceware.org/glibc/wiki/GNU_IFUNC), which is
currently only Linux with glibc and Android with API 30+. See also the
`CORRADE_CPU_USE_IFUNC` option below and
@ref Cpu-usage-automatic-cached-dispatch for details and information about
performance tradeoffs.

Platform-specific options:

- `CORRADE_CPU_USE_IFUNC` --- Allow
[GNU IFUNC](https://sourceware.org/glibc/wiki/GNU_IFUNC) to be used for
runtime dispatch in the @ref Cpu library. Available only on platforms that
support it, which is currently only Linux with glibc and Android with API
30+, and there enabled by default unless a problematic case is detected
that may cause it to misbehave. See
@ref Cpu-usage-automatic-cached-dispatch for details and information about
performance tradeoffs.
- `CORRADE_UTILITY_USE_ANSI_COLORS` --- if building for Windows, this will
use ANSI escape codes in @ref Utility::Debug instead of WINAPI functions.
Note that you need at least Windows 10 or non-standard console emulator to
Expand Down Expand Up @@ -622,11 +641,31 @@ compatibility if `CORRADE_BUILD_DEPRECATED` isn't disabled.

@subsection building-corrade-tests Building and running tests

If you want to build also the tests (which are not built by default), enable
`CORRADE_BUILD_TESTS` in CMake. The tests use Corrade's own
@ref Corrade::TestSuite "TestSuite" framework and can be run either manually
(the binaries are located in `Test/` subdirectories in the build directory) or
using
Building of tests is controlled by the following options:

- `CORRADE_BUILD_TESTS` --- Builds unit tests. Disabled by default.
- `CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH` --- Force unit tests to be
built with function-pointer-based dispatch for CPU-dependent functionality,
independently of the `CORRADE_BUILD_CPU_RUNTIME_DISPATCH` and
`CORRADE_CPU_USE_IFUNC` options. This makes it possible for the tests to
verify all variants instead of just one, and is enabled by default. The
overhead from function pointers may however be significant on certain
platforms, skewing benchmark results. Disable it to make the tests use the
same dispatch method as the rest of the library.
- `CORRADE_BUILD_TESTS_FORCE_WASM_SIMD128` --- Force Emscripten unit tests to
be built with `-msimd128` independenently of `CMAKE_CXX_FLAGS`. Together
with `CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH` and presence of the
@ref CORRADE_ENABLE_SIMD128 preprocessor variable this makes it possible
for the tests to verify also WebAssembly SIMD variants of CPU-dependent
functionality instead of just the scalar version if the rest of the library
is built without `-msimd128`. Enabled by default if
`CORRADE_BUILD_TESTS_FORCE_CPU_POINTER_DISPATCH` is set and Node.js version
15+ is found, which has finalized WebAssembly SIMD support. Disable to make
the tests use the same compilation flags as the rest of the library.

The tests use Corrade's own @relativeref{Corrade,TestSuite} framework and can
be run either manually (the binaries are located in `Test/` subdirectories in
the build directory) or using

@code{.sh}
ctest --output-on-failure
Expand Down Expand Up @@ -947,8 +986,9 @@ for more information.
@subsection building-corrade-ci-circleci CircleCI

In `package/ci/` there is a `circle.yml` file with Linux GCC 4.8, Linux ARM64,
macOS, Emscripten, AddressSanitizer, ThreadSanitizer, Android x86 and iOS
x86_64 configuration. Online at https://circleci.com/gh/mosra/corrade.
macOS, Emscripten (except SIMD, see the file for details), AddressSanitizer,
ThreadSanitizer, Android x86 and iOS x86_64 configuration. Online at
https://circleci.com/gh/mosra/corrade.

@subsection building-corrade-ci-appveyor AppVeyor

Expand Down
24 changes: 17 additions & 7 deletions doc/corrade-changelog.dox
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ namespace Corrade {
@ref CORRADE_TARGET_POWERPC
- New @ref CORRADE_TARGET_SSE3, @ref CORRADE_TARGET_SSSE3,
@ref CORRADE_TARGET_SSE41, @ref CORRADE_TARGET_SSE42,
@ref CORRADE_TARGET_AVX, @ref CORRADE_TARGET_AVX_F16C,
@ref CORRADE_TARGET_AVX_FMA, @ref CORRADE_TARGET_AVX2,
@ref CORRADE_TARGET_AVX512F, @ref CORRADE_TARGET_NEON,
@ref CORRADE_TARGET_NEON_FP16, @ref CORRADE_TARGET_NEON_FMA and
@ref CORRADE_TARGET_SIMD128 preprocessor variables added to the already
existing @ref CORRADE_TARGET_SSE2 for detecting enabled instruction sets on
x86, ARM and WebAssembly
@ref CORRADE_TARGET_POPCNT, @ref CORRADE_TARGET_LZCNT,
@ref CORRADE_TARGET_BMI1, @ref CORRADE_TARGET_AVX,
@ref CORRADE_TARGET_AVX_F16C, @ref CORRADE_TARGET_AVX_FMA,
@ref CORRADE_TARGET_AVX2, @ref CORRADE_TARGET_AVX512F,
@ref CORRADE_TARGET_NEON, @ref CORRADE_TARGET_NEON_FMA,
@ref CORRADE_TARGET_NEON_FP16 and @ref CORRADE_TARGET_SIMD128 preprocessor
variables added to the already existing @ref CORRADE_TARGET_SSE2 for
detecting enabled instruction sets on x86, ARM and WebAssembly
- New @ref CORRADE_TARGET_32BIT preprocessor variable for cross-platform
detection of 32-bit builds
- New @ref Cpu namespace that provides building blocks for compile-time and
runtime CPU feature detection and dispatch on x86, ARM and WebAssembly

@subsubsection corrade-changelog-latest-new-containers Containers library

Expand Down Expand Up @@ -360,6 +363,13 @@ namespace Corrade {
Windows as well instead of declaring aligned memory allocation functions on
its own, as it's not worth the seriously-looking compiler warnings (see
[mosra/corrade#145](https://github.com/mosra/corrade/issues/145))
- Platforms that support @ref CORRADE_CPU_USE_IFUNC will now build certain
code paths optimized for multiple architectures, with the best variant
selected at runtime using the @ref Cpu library based on available CPU
features. This behavior can be disabled with the
@ref CORRADE_BUILD_CPU_RUNTIME_DISPATCH CMake option. Platforms without
IFUNC support implement runtime dispatch using function pointers instead of
indirect functions and have this currently disabled by default.

@subsection corrade-changelog-latest-bugfixes Bug fixes

Expand Down
13 changes: 11 additions & 2 deletions doc/corrade-cmake.dox
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ also available as preprocessor variables if you include
- `CORRADE_BUILD_MULTITHREADED` --- Defined if compiled in a way that makes
it possible to safely use certain Corrade features simultaneously in
multiple threads.
- `CORRADE_BUILD_CPU_RUNTIME_DISPATCH` --- Defined if built with code paths
optimized for multiple architectres with the best matching variant selected
at runtime based on detected CPU features
- `CORRADE_TARGET_UNIX` --- Defined if compiled for some Unix flavor (Linux,
BSD, macOS, iOS, Android, ...)
- `CORRADE_TARGET_APPLE` --- Defined if compiled for Apple platforms
Expand All @@ -230,6 +233,9 @@ also available as preprocessor variables if you include
- `CORRADE_TARGET_MSVC` --- Defined if compiling with MSVC or Clang with a
MSVC frontend
- `CORRADE_TARGET_MINGW` --- Defined if compiling under MinGW
- `CORRADE_CPU_USE_IFUNC` - Defined if
[GNU IFUNC](https://sourceware.org/glibc/wiki/GNU_IFUNC) is allowed to be
used for runtime dispatch in the @ref Cpu library
- `CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT` --- Defined if
@ref PluginManager doesn't support dynamic plugin loading due to platform
limitations
Expand All @@ -239,8 +245,11 @@ also available as preprocessor variables if you include
used for colored output with @ref Utility::Debug on Windows

Besides all the defines above, the @ref Corrade/Corrade.h additionally defines
@ref CORRADE_CXX_STANDARD, @ref CORRADE_TARGET_X86, @ref CORRADE_TARGET_ARM,
@ref CORRADE_TARGET_POWERPC, @ref CORRADE_TARGET_LIBCXX,
@ref CORRADE_CXX_STANDARD, @ref CORRADE_TARGET_X86 and related x86-specific
variables, @ref CORRADE_TARGET_ARM and related ARM-specific variables,
@ref CORRADE_TARGET_POWERPC, @ref CORRADE_TARGET_WASM and related
WebAssembly-specific variables, @ref CORRADE_TARGET_32BIT,
@ref CORRADE_TARGET_BIG_ENDIAN, @ref CORRADE_TARGET_LIBCXX,
@ref CORRADE_TARGET_LIBSTDCXX and @ref CORRADE_TARGET_DINKUMWARE based on
target architecture, standard and STL used. They are not exposed in CMake
because the meaning is unclear with projects that mix more different C++
Expand Down
Loading