Breaking: Use C++ 20 #1382

Closed
NickGerleman wants to merge 1 commits from export-D49261607 into main
8 changed files with 11 additions and 10 deletions

View File

@@ -28,5 +28,5 @@ let package = Package(
] ]
) )
], ],
cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++17") cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++20")
) )

View File

@@ -4,7 +4,7 @@ Yoga is an embeddable and performant flexbox layout engine with bindings for mul
## Building ## Building
Yoga's main implementation targets C++ 17 with accompanying build logic in CMake. A wrapper is provided to build the main library and run unit tests. Yoga's main implementation targets C++ 20 with accompanying build logic in CMake. A wrapper is provided to build the main library and run unit tests.
```sh ```sh
./unit_tests <Debug|Release> ./unit_tests <Debug|Release>

View File

@@ -33,7 +33,7 @@ Pod::Spec.new do |spec|
'-Werror', '-Werror',
'-Wextra', '-Wextra',
'-Wconversion', '-Wconversion',
'-std=c++17', '-std=c++20',
'-fPIC' '-fPIC'
] ]

View File

@@ -6,8 +6,8 @@
*/ */
plugins { plugins {
id("com.android.library") version "8.0.1" apply false id("com.android.library") version "8.1.1" apply false
id("com.android.application") version "8.0.1" apply false id("com.android.application") version "8.1.1" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
} }

View File

@@ -3,7 +3,7 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)

View File

@@ -21,9 +21,9 @@ val ndkVersionProperty: String by rootProject.extra
android { android {
namespace = "com.facebook.yoga" namespace = "com.facebook.yoga"
compileSdk = 33 compileSdk = 34
buildToolsVersion = "33.0.0" buildToolsVersion = "34.0.0"
ndkVersion = "23.1.7779620" ndkVersion = "25.1.8937393"
defaultConfig { defaultConfig {
minSdk = 21 minSdk = 21

View File

@@ -14,7 +14,7 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
include_directories(..) include_directories(..)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
add_compile_definitions( add_compile_definitions(
EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0) EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0)

View File

@@ -14,6 +14,7 @@ namespace facebook::yoga {
// Polyfill for std::bit_cast() from C++20, to allow safe type punning // Polyfill for std::bit_cast() from C++20, to allow safe type punning
// https://en.cppreference.com/w/cpp/numeric/bit_cast // https://en.cppreference.com/w/cpp/numeric/bit_cast
// TODO: Remove when we upgrade to NDK 26+
template <class To, class From> template <class To, class From>
std::enable_if_t< std::enable_if_t<
sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> && sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> &&