mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-29 11:44:16 +01:00
Use libcxx from LLVM Project submodule
The version of libcxx shipped with Android NDK is fairly outdated and doesn't contain several features we desire such as C++ 20 ranges. This has been fixed by using libcxx directly from the LLVM Project which has been added as a submodule and can be updated independently of NDK.
This commit is contained in:
parent
82154f3ef6
commit
4b80e1f91c
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -38,3 +38,7 @@
|
||||
path = app/libraries/boost
|
||||
url = https://github.com/boostorg/boost.git
|
||||
ignore = all
|
||||
[submodule "app/libraries/llvm-project"]
|
||||
path = app/libraries/llvm
|
||||
url = https://github.com/llvm/llvm-project.git
|
||||
shallow = true
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Skyline LANGUAGES CXX ASM VERSION 0.3)
|
||||
project(Skyline LANGUAGES C CXX ASM VERSION 0.3)
|
||||
|
||||
set(BUILD_TESTS OFF CACHE BOOL "Build Tests" FORCE)
|
||||
set(BUILD_TESTING OFF CACHE BOOL "Build Testing" FORCE)
|
||||
@ -9,8 +9,31 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -fno-stack-protector -Wno-unused-command-line-argument -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -Wno-unused-command-line-argument")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -fno-stack-protector -DNDEBUG")
|
||||
|
||||
# libcxx
|
||||
set(ANDROID_STL "none")
|
||||
set(LIBCXX_INCLUDE_TESTS OFF)
|
||||
set(LIBCXX_INCLUDE_BENCHMARKS OFF)
|
||||
set(LIBCXX_INCLUDE_DOCS OFF)
|
||||
set(LIBCXX_ENABLE_SHARED FALSE)
|
||||
set(LIBCXX_ENABLE_ASSERTIONS FALSE)
|
||||
set(LIBCXX_STANDALONE_BUILD FALSE)
|
||||
add_subdirectory("libraries/llvm/libcxx")
|
||||
link_libraries(cxx_static)
|
||||
get_target_property(LIBCXX_INCLUDE_COMPILE_OPTION cxx-headers INTERFACE_COMPILE_OPTIONS)
|
||||
string(REGEX REPLACE "-I" "" LIBCXX_INCLUDE_DIRECTORY_LIST "${LIBCXX_INCLUDE_COMPILE_OPTION}")
|
||||
list(GET LIBCXX_INCLUDE_DIRECTORY_LIST 1 LIBCXX_TARGET_INCLUDE_DIRECTORY) # We just want the target include directory
|
||||
set_target_properties(cxx-headers PROPERTIES INTERFACE_COMPILE_OPTIONS -isystem${LIBCXX_TARGET_INCLUDE_DIRECTORY})
|
||||
|
||||
# libcxxabi
|
||||
set(LIBCXXABI_INCLUDE_TESTS OFF)
|
||||
set(LIBCXXABI_ENABLE_SHARED FALSE)
|
||||
set(LIBCXXABI_STANDALONE_BUILD FALSE)
|
||||
set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXX_TARGET_INCLUDE_DIRECTORY}" CACHE STRING "" FORCE)
|
||||
add_subdirectory("libraries/llvm/libcxxabi")
|
||||
link_libraries(cxxabi_static)
|
||||
|
||||
# {fmt}
|
||||
add_subdirectory("libraries/fmt")
|
||||
@ -57,8 +80,10 @@ include_directories(SYSTEM "libraries/mbedtls/include")
|
||||
target_compile_options(mbedcrypto PRIVATE -Wno-everything)
|
||||
|
||||
# Opus
|
||||
set(OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF CACHE BOOL "Install Opus CMake package config module" FORCE)
|
||||
include_directories(SYSTEM "libraries/opus/include")
|
||||
add_subdirectory("libraries/opus")
|
||||
target_compile_definitions(opus PRIVATE OPUS_WILL_BE_SLOW=1) # libopus will warn when built without optimizations
|
||||
|
||||
# Perfetto SDK
|
||||
include_directories(SYSTEM "libraries/perfetto/sdk")
|
||||
|
1
app/libraries/llvm
Submodule
1
app/libraries/llvm
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 08e3a5ccd952edee36b3c002e3a29c6b1b5153de
|
@ -98,7 +98,7 @@ namespace skyline {
|
||||
return this->data() < pointer;
|
||||
}
|
||||
|
||||
constexpr bool operator<(typename std::span<T, Extent>::const_iterator it) const {
|
||||
constexpr bool operator<(typename std::span<T, Extent>::iterator it) const {
|
||||
return this->begin() < it;
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
bigPageSize, asFd, flags, vaRangeStart, vaRangeEnd, vaRangeSplit);
|
||||
|
||||
if (bigPageSize) {
|
||||
if (!std::ispow2(bigPageSize)) {
|
||||
if (!std::has_single_bit(bigPageSize)) {
|
||||
state.logger->Error("Non power-of-2 big page size: 0x{:X}!", bigPageSize);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace skyline::service::nvdrv::device {
|
||||
if (!handle) [[unlikely]]
|
||||
return PosixResult::InvalidArgument;
|
||||
|
||||
if (!std::ispow2(align)) [[unlikely]]
|
||||
if (!std::has_single_bit(align)) [[unlikely]]
|
||||
return PosixResult::InvalidArgument;
|
||||
|
||||
// Force page size alignment at a minimum
|
||||
|
Loading…
Reference in New Issue
Block a user