You've already forked Zygisk-Assistant
mirror of
https://github.com/snake-4/Zygisk-Assistant.git
synced 2025-09-06 06:37:02 +00:00
Initial commit
This commit is contained in:
50
module/jni/libcxx/cmake/Modules/CodeCoverage.cmake
Normal file
50
module/jni/libcxx/cmake/Modules/CodeCoverage.cmake
Normal file
@@ -0,0 +1,50 @@
|
||||
find_program(CODE_COVERAGE_LCOV lcov)
|
||||
if (NOT CODE_COVERAGE_LCOV)
|
||||
message(FATAL_ERROR "Cannot find lcov...")
|
||||
endif()
|
||||
|
||||
find_program(CODE_COVERAGE_LLVM_COV llvm-cov)
|
||||
if (NOT CODE_COVERAGE_LLVM_COV)
|
||||
message(FATAL_ERROR "Cannot find llvm-cov...")
|
||||
endif()
|
||||
|
||||
find_program(CODE_COVERAGE_GENHTML genhtml)
|
||||
if (NOT CODE_COVERAGE_GENHTML)
|
||||
message(FATAL_ERROR "Cannot find genhtml...")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
|
||||
|
||||
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
|
||||
if (NOT DEFINED LIBCXX_BINARY_DIR)
|
||||
message(FATAL_ERROR "Variable must be set")
|
||||
endif()
|
||||
|
||||
set(GCOV_TOOL "${LIBCXX_BINARY_DIR}/llvm-cov-wrapper")
|
||||
file(GENERATE OUTPUT ${GCOV_TOOL}
|
||||
CONTENT "#!/usr/bin/env bash\n${CODE_COVERAGE_LLVM_COV} gcov \"$@\"\n")
|
||||
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
|
||||
set(CAPTURE_DIRS "")
|
||||
foreach(cdir ${capture_dirs})
|
||||
list(APPEND CAPTURE_DIRS "-d;${cdir}")
|
||||
endforeach()
|
||||
|
||||
set(EXTRACT_DIRS "")
|
||||
foreach(sdir ${source_dirs})
|
||||
list(APPEND EXTRACT_DIRS "'${sdir}/*'")
|
||||
endforeach()
|
||||
|
||||
message(STATUS "Capture Directories: ${CAPTURE_DIRS}")
|
||||
message(STATUS "Extract Directories: ${EXTRACT_DIRS}")
|
||||
|
||||
add_custom_target(generate-lib${target_name}-coverage
|
||||
COMMAND chmod +x ${GCOV_TOOL}
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --capture ${CAPTURE_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
|
||||
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
|
||||
WORKING_DIRECTORY ${output_dir}
|
||||
COMMENT "Generating coverage results")
|
||||
endfunction()
|
||||
180
module/jni/libcxx/cmake/Modules/HandleLibCXXABI.cmake
Normal file
180
module/jni/libcxx/cmake/Modules/HandleLibCXXABI.cmake
Normal file
@@ -0,0 +1,180 @@
|
||||
#===============================================================================
|
||||
# Define targets for linking against the selected ABI library
|
||||
#
|
||||
# After including this file, the following targets are defined:
|
||||
# - libcxx-abi-headers: An interface target that allows getting access to the
|
||||
# headers of the selected ABI library.
|
||||
# - libcxx-abi-shared: A target representing the selected shared ABI library.
|
||||
# - libcxx-abi-static: A target representing the selected static ABI library.
|
||||
#
|
||||
# Furthermore, some ABI libraries also define the following target:
|
||||
# - libcxx-abi-shared-objects: An object library representing a set of object files
|
||||
# constituting the ABI library, suitable for bundling
|
||||
# into a shared library.
|
||||
# - libcxx-abi-static-objects: An object library representing a set of object files
|
||||
# constituting the ABI library, suitable for bundling
|
||||
# into a static library.
|
||||
#===============================================================================
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# This function copies the provided headers to a private directory and adds that
|
||||
# path to the given INTERFACE target. That target can then be linked against to
|
||||
# get access to those headers (and only those).
|
||||
#
|
||||
# The problem this solves is that when building against a system-provided ABI library,
|
||||
# the ABI headers might live side-by-side with an actual C++ Standard Library
|
||||
# installation. For that reason, we can't just add `-I <path-to-ABI-headers>`,
|
||||
# since we would end up also adding the system-provided C++ Standard Library to
|
||||
# the search path. Instead, what we do is copy just the ABI library headers to
|
||||
# a private directory and add just that path when we build libc++.
|
||||
function(import_private_headers target include_dirs headers)
|
||||
foreach(header ${headers})
|
||||
set(found FALSE)
|
||||
foreach(incpath ${include_dirs})
|
||||
if (EXISTS "${incpath}/${header}")
|
||||
set(found TRUE)
|
||||
message(STATUS "Looking for ${header} in ${incpath} - found")
|
||||
get_filename_component(dstdir ${header} PATH)
|
||||
get_filename_component(header_file ${header} NAME)
|
||||
set(src ${incpath}/${header})
|
||||
set(dst "${LIBCXX_BINARY_DIR}/private-abi-headers/${dstdir}/${header_file}")
|
||||
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXX_BINARY_DIR}/private-abi-headers/${dstdir}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying C++ ABI header ${header}")
|
||||
list(APPEND abilib_headers "${dst}")
|
||||
else()
|
||||
message(STATUS "Looking for ${header} in ${incpath} - not found")
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT found)
|
||||
message(WARNING "Failed to find ${header} in ${include_dirs}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Work around https://gitlab.kitware.com/cmake/cmake/-/issues/18399
|
||||
add_library(${target}-generate-private-headers OBJECT ${abilib_headers})
|
||||
set_target_properties(${target}-generate-private-headers PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
target_link_libraries(${target} INTERFACE ${target}-generate-private-headers)
|
||||
target_include_directories(${target} INTERFACE "${LIBCXX_BINARY_DIR}/private-abi-headers")
|
||||
endfunction()
|
||||
|
||||
# This function creates an imported library named <target> of the given <kind> (SHARED|STATIC).
|
||||
# It imports a library named <name> searched at the given <path>.
|
||||
function(imported_library target kind path name)
|
||||
add_library(${target} ${kind} IMPORTED GLOBAL)
|
||||
set(libnames "${CMAKE_${kind}_LIBRARY_PREFIX}${name}${CMAKE_${kind}_LIBRARY_SUFFIX}")
|
||||
# Make sure we find .tbd files on macOS
|
||||
if (kind STREQUAL "SHARED")
|
||||
list(APPEND libnames "${CMAKE_${kind}_LIBRARY_PREFIX}${name}.tbd")
|
||||
endif()
|
||||
find_library(file
|
||||
NAMES ${libnames}
|
||||
PATHS "${path}"
|
||||
NO_CACHE)
|
||||
set_target_properties(${target} PROPERTIES IMPORTED_LOCATION "${file}")
|
||||
endfunction()
|
||||
|
||||
# Link against a system-provided libstdc++
|
||||
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||
"cxxabi.h;bits/c++config.h;bits/os_defines.h;bits/cpu_defines.h;bits/cxxabi_tweaks.h;bits/cxxabi_forced.h")
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-DLIBSTDCXX" "-D__GLIBCXX__")
|
||||
|
||||
imported_library(libcxx-abi-shared SHARED "${LIBCXX_CXX_ABI_LIBRARY_PATH}" stdc++)
|
||||
target_link_libraries(libcxx-abi-shared INTERFACE libcxx-abi-headers)
|
||||
|
||||
imported_library(libcxx-abi-static STATIC "${LIBCXX_CXX_ABI_LIBRARY_PATH}" stdc++)
|
||||
target_link_libraries(libcxx-abi-static INTERFACE libcxx-abi-headers)
|
||||
|
||||
# Link against a system-provided libsupc++
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||
"cxxabi.h;bits/c++config.h;bits/os_defines.h;bits/cpu_defines.h;bits/cxxabi_tweaks.h;bits/cxxabi_forced.h")
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-D__GLIBCXX__")
|
||||
|
||||
imported_library(libcxx-abi-shared SHARED "${LIBCXX_CXX_ABI_LIBRARY_PATH}" supc++)
|
||||
target_link_libraries(libcxx-abi-shared INTERFACE libcxx-abi-headers)
|
||||
|
||||
imported_library(libcxx-abi-static STATIC "${LIBCXX_CXX_ABI_LIBRARY_PATH}" supc++)
|
||||
target_link_libraries(libcxx-abi-static INTERFACE libcxx-abi-headers)
|
||||
|
||||
# Link against the in-tree libc++abi
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
target_link_libraries(libcxx-abi-headers INTERFACE cxxabi-headers)
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-DLIBCXX_BUILDING_LIBCXXABI")
|
||||
|
||||
if (TARGET cxxabi_shared)
|
||||
add_library(libcxx-abi-shared ALIAS cxxabi_shared)
|
||||
endif()
|
||||
|
||||
if (TARGET cxxabi_static)
|
||||
add_library(libcxx-abi-static ALIAS cxxabi_static)
|
||||
endif()
|
||||
|
||||
if (TARGET cxxabi_shared_objects)
|
||||
add_library(libcxx-abi-shared-objects ALIAS cxxabi_shared_objects)
|
||||
endif()
|
||||
|
||||
if (TARGET cxxabi_static_objects)
|
||||
add_library(libcxx-abi-static-objects ALIAS cxxabi_static_objects)
|
||||
endif()
|
||||
|
||||
# Link against a system-provided libc++abi
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "system-libcxxabi")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS}" "cxxabi.h;__cxxabi_config.h")
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-DLIBCXX_BUILDING_LIBCXXABI")
|
||||
|
||||
imported_library(libcxx-abi-shared SHARED "${LIBCXX_CXX_ABI_LIBRARY_PATH}" c++abi)
|
||||
target_link_libraries(libcxx-abi-shared INTERFACE libcxx-abi-headers)
|
||||
|
||||
imported_library(libcxx-abi-static STATIC "${LIBCXX_CXX_ABI_LIBRARY_PATH}" c++abi)
|
||||
target_link_libraries(libcxx-abi-static INTERFACE libcxx-abi-headers)
|
||||
|
||||
# Link against a system-provided libcxxrt
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
|
||||
# libcxxrt does not provide aligned new and delete operators
|
||||
# TODO: We're keeping this for backwards compatibility, but this doesn't belong here.
|
||||
set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON)
|
||||
|
||||
if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
|
||||
message(STATUS "LIBCXX_CXX_ABI_INCLUDE_PATHS not set, using /usr/include/c++/v1")
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
|
||||
endif()
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
import_private_headers(libcxx-abi-headers "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||
"cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h")
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-DLIBCXXRT")
|
||||
|
||||
imported_library(libcxx-abi-shared SHARED "${LIBCXX_CXX_ABI_LIBRARY_PATH}" cxxrt)
|
||||
target_link_libraries(libcxx-abi-shared INTERFACE libcxx-abi-headers)
|
||||
|
||||
imported_library(libcxx-abi-static STATIC "${LIBCXX_CXX_ABI_LIBRARY_PATH}" cxxrt)
|
||||
target_link_libraries(libcxx-abi-static INTERFACE libcxx-abi-headers)
|
||||
|
||||
# Link against a system-provided vcruntime
|
||||
# FIXME: Figure out how to configure the ABI library on Windows.
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "vcruntime")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
add_library(libcxx-abi-shared INTERFACE)
|
||||
add_library(libcxx-abi-static INTERFACE)
|
||||
|
||||
# Don't link against any ABI library
|
||||
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "none")
|
||||
add_library(libcxx-abi-headers INTERFACE)
|
||||
target_compile_definitions(libcxx-abi-headers INTERFACE "-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY")
|
||||
|
||||
add_library(libcxx-abi-shared INTERFACE)
|
||||
target_link_libraries(libcxx-abi-shared INTERFACE libcxx-abi-headers)
|
||||
|
||||
add_library(libcxx-abi-static INTERFACE)
|
||||
target_link_libraries(libcxx-abi-static INTERFACE libcxx-abi-headers)
|
||||
endif()
|
||||
254
module/jni/libcxx/cmake/Modules/HandleLibcxxFlags.cmake
Normal file
254
module/jni/libcxx/cmake/Modules/HandleLibcxxFlags.cmake
Normal file
@@ -0,0 +1,254 @@
|
||||
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
|
||||
# and link libc++. These macros add flags to the following CMake variables.
|
||||
# - LIBCXX_COMPILE_FLAGS: flags used to compile libc++
|
||||
# - LIBCXX_LINK_FLAGS: flags used to link libc++
|
||||
# - LIBCXX_LIBRARIES: libraries to link libc++ to.
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
unset(add_flag_if_supported)
|
||||
|
||||
# Mangle the name of a compiler flag into a valid CMake identifier.
|
||||
# Ex: --std=c++11 -> STD_EQ_CXX11
|
||||
macro(mangle_name str output)
|
||||
string(STRIP "${str}" strippedStr)
|
||||
string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
|
||||
string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
|
||||
string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
|
||||
string(REPLACE "-" "_" strippedStr "${strippedStr}")
|
||||
string(REPLACE ":" "_COLON_" strippedStr "${strippedStr}")
|
||||
string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
|
||||
string(REPLACE "+" "X" strippedStr "${strippedStr}")
|
||||
string(TOUPPER "${strippedStr}" ${output})
|
||||
endmacro()
|
||||
|
||||
# Remove a list of flags from all CMake variables that affect compile flags.
|
||||
# This can be used to remove unwanted flags specified on the command line
|
||||
# or added in other parts of LLVM's cmake configuration.
|
||||
macro(remove_flags)
|
||||
foreach(var ${ARGN})
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
|
||||
remove_definitions(${var})
|
||||
endforeach()
|
||||
endmacro(remove_flags)
|
||||
|
||||
macro(check_flag_supported flag)
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
endmacro()
|
||||
|
||||
macro(append_flags DEST)
|
||||
foreach(value ${ARGN})
|
||||
list(APPEND ${DEST} ${value})
|
||||
list(APPEND ${DEST} ${value})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If the specified 'condition' is true then append the specified list of flags to DEST
|
||||
macro(append_flags_if condition DEST)
|
||||
if (${condition})
|
||||
list(APPEND ${DEST} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add each flag in the list specified by DEST if that flag is supported by the current compiler.
|
||||
macro(append_flags_if_supported DEST)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
append_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${DEST} ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a macro definition if condition is true.
|
||||
macro(define_if condition def)
|
||||
if (${condition})
|
||||
add_definitions(${def})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add a macro definition if condition is not true.
|
||||
macro(define_if_not condition def)
|
||||
if (NOT ${condition})
|
||||
add_definitions(${def})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add a macro definition to the __config_site file if the specified condition
|
||||
# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
|
||||
# the build include the '__config_site' header.
|
||||
macro(config_define_if condition def)
|
||||
if (${condition})
|
||||
set(${def} ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(config_define_if_not condition def)
|
||||
if (NOT ${condition})
|
||||
set(${def} ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(config_define value def)
|
||||
set(${def} ${value})
|
||||
endmacro()
|
||||
|
||||
# Add a list of flags to all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS',
|
||||
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_target_flags)
|
||||
foreach(value ${ARGN})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${value}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${value}")
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
|
||||
list(APPEND LIBCXX_LINK_FLAGS ${value})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If the specified 'condition' is true then add a list of flags to
|
||||
# all of 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
|
||||
# and 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_target_flags_if condition)
|
||||
if (${condition})
|
||||
add_target_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add all the flags supported by the compiler to all of
|
||||
# 'CMAKE_CXX_FLAGS', 'CMAKE_C_FLAGS', 'LIBCXX_COMPILE_FLAGS'
|
||||
# and 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_target_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_target_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
|
||||
# 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_flags)
|
||||
foreach(value ${ARGN})
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
|
||||
list(APPEND LIBCXX_LINK_FLAGS ${value})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If the specified 'condition' is true then add a list of flags to both
|
||||
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_flags_if condition)
|
||||
if (${condition})
|
||||
add_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add each flag in the list to LIBCXX_COMPILE_FLAGS and LIBCXX_LINK_FLAGS
|
||||
# if that flag is supported by the current compiler.
|
||||
macro(add_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of flags to 'LIBCXX_COMPILE_FLAGS'.
|
||||
macro(add_compile_flags)
|
||||
foreach(f ${ARGN})
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${f})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If 'condition' is true then add the specified list of flags to
|
||||
# 'LIBCXX_COMPILE_FLAGS'
|
||||
macro(add_compile_flags_if condition)
|
||||
if (${condition})
|
||||
add_compile_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# For each specified flag, add that flag to 'LIBCXX_COMPILE_FLAGS' if the
|
||||
# flag is supported by the C++ compiler.
|
||||
macro(add_compile_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_compile_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of flags to 'LIBCXX_LINK_FLAGS'.
|
||||
macro(add_link_flags)
|
||||
foreach(f ${ARGN})
|
||||
list(APPEND LIBCXX_LINK_FLAGS ${f})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# If 'condition' is true then add the specified list of flags to
|
||||
# 'LIBCXX_LINK_FLAGS'
|
||||
macro(add_link_flags_if condition)
|
||||
if (${condition})
|
||||
add_link_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# For each specified flag, add that flag to 'LIBCXX_LINK_FLAGS' if the
|
||||
# flag is supported by the C++ compiler.
|
||||
macro(add_link_flags_if_supported)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
add_link_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Add a list of libraries or link flags to 'LIBCXX_LIBRARIES'.
|
||||
macro(add_library_flags)
|
||||
foreach(lib ${ARGN})
|
||||
list(APPEND LIBCXX_LIBRARIES ${lib})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# if 'condition' is true then add the specified list of libraries and flags
|
||||
# to 'LIBCXX_LIBRARIES'.
|
||||
macro(add_library_flags_if condition)
|
||||
if(${condition})
|
||||
add_library_flags(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Turn a comma separated CMake list into a space separated string.
|
||||
macro(split_list listname)
|
||||
string(REPLACE ";" " " ${listname} "${${listname}}")
|
||||
endmacro()
|
||||
|
||||
# For each specified flag, add that link flag to the provided target.
|
||||
# The flags are added with the given visibility, i.e. PUBLIC|PRIVATE|INTERFACE.
|
||||
function(target_add_link_flags_if_supported target visibility)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
if (CXX_SUPPORTS_${flagname}_FLAG)
|
||||
target_link_libraries(${target} ${visibility} ${flag})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# For each specified flag, add that compile flag to the provided target.
|
||||
# The flags are added with the given visibility, i.e. PUBLIC|PRIVATE|INTERFACE.
|
||||
function(target_add_compile_flags_if_supported target visibility)
|
||||
foreach(flag ${ARGN})
|
||||
mangle_name("${flag}" flagname)
|
||||
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
|
||||
if (CXX_SUPPORTS_${flagname}_FLAG)
|
||||
target_compile_options(${target} ${visibility} ${flag})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
||||
2
module/jni/libcxx/cmake/caches/AArch64.cmake
Normal file
2
module/jni/libcxx/cmake/caches/AArch64.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu" CACHE STRING "")
|
||||
19
module/jni/libcxx/cmake/caches/AIX.cmake
Normal file
19
module/jni/libcxx/cmake/caches/AIX.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
|
||||
set(CMAKE_C_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-G -Wl,-bcdtors:all:-2147483548:s" CACHE STRING "")
|
||||
set(CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "")
|
||||
|
||||
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXX_ABI_VERSION "1" CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
|
||||
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")
|
||||
21
module/jni/libcxx/cmake/caches/Apple.cmake
Normal file
21
module/jni/libcxx/cmake/caches/Apple.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE OFF CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXX_ABI_VERSION "1" CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
|
||||
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_TEST_CONFIG "apple-libc++-shared.cfg.in" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_CONFIG "apple-libc++abi-shared.cfg.in" CACHE STRING "")
|
||||
set(LIBCXX_TEST_PARAMS "stdlib=apple-libc++" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
4
module/jni/libcxx/cmake/caches/Armv7Arm.cmake
Normal file
4
module/jni/libcxx/cmake/caches/Armv7Arm.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(CMAKE_CXX_COMPILER_TARGET "armv7l-linux-gnueabihf" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "-marm" CACHE STRING "")
|
||||
@@ -0,0 +1,6 @@
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(CMAKE_CXX_COMPILER_TARGET "armv7l-linux-gnueabihf" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "-mthumb" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "-mthumb" CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
4
module/jni/libcxx/cmake/caches/Armv8Arm.cmake
Normal file
4
module/jni/libcxx/cmake/caches/Armv8Arm.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(CMAKE_CXX_COMPILER_TARGET "armv8l-linux-gnueabihf" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "-marm" CACHE STRING "")
|
||||
@@ -0,0 +1,6 @@
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(CMAKE_CXX_COMPILER_TARGET "armv8l-linux-gnueabihf" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "-mthumb" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "-mthumb" CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
9
module/jni/libcxx/cmake/caches/FreeBSD.cmake
Normal file
9
module/jni/libcxx/cmake/caches/FreeBSD.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXX_ABI_VERSION "1" CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBCXX_CXX_ABI libcxxrt CACHE STRING "")
|
||||
set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
|
||||
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ABI_UNSTABLE ON CACHE BOOL "")
|
||||
3
module/jni/libcxx/cmake/caches/Generic-asan.cmake
Normal file
3
module/jni/libcxx/cmake/caches/Generic-asan.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(LLVM_USE_SANITIZER "Address" CACHE STRING "")
|
||||
# This is a temporary (hopefully) workaround for an ASan issue (see https://llvm.org/D119410).
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -asan-use-private-alias=1" CACHE INTERNAL "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-assertions.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-assertions.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_ENABLE_ASSERTIONS ON CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_ASSERTIONS ON CACHE BOOL "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx03.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx03.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++03" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx11.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx11.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++11" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx14.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx14.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++14" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx17.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx17.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++17" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx20.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx20.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++20" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-cxx2b.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-cxx2b.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "std=c++2b" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
1
module/jni/libcxx/cmake/caches/Generic-debug-mode.cmake
Normal file
1
module/jni/libcxx/cmake/caches/Generic-debug-mode.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_DEBUG_MODE ON CACHE BOOL "")
|
||||
12
module/jni/libcxx/cmake/caches/Generic-merged.cmake
Normal file
12
module/jni/libcxx/cmake/caches/Generic-merged.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
# Build a libc++ shared library, but merge libc++abi and libunwind into it.
|
||||
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
|
||||
set(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
|
||||
set(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY ON CACHE BOOL "")
|
||||
|
||||
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-modules.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-modules.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "enable_modules=True" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
1
module/jni/libcxx/cmake/caches/Generic-msan.cmake
Normal file
1
module/jni/libcxx/cmake/caches/Generic-msan.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(LLVM_USE_SANITIZER "MemoryWithOrigins" CACHE STRING "")
|
||||
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "enable_experimental=False" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
|
||||
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
|
||||
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
|
||||
3
module/jni/libcxx/cmake/caches/Generic-no-threads.cmake
Normal file
3
module/jni/libcxx/cmake/caches/Generic-no-threads.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
|
||||
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_TEST_PARAMS "enable_transitive_includes=False" CACHE STRING "")
|
||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||
1
module/jni/libcxx/cmake/caches/Generic-no-unicode.cmake
Normal file
1
module/jni/libcxx/cmake/caches/Generic-no-unicode.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
|
||||
@@ -0,0 +1 @@
|
||||
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
|
||||
@@ -0,0 +1,2 @@
|
||||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
3
module/jni/libcxx/cmake/caches/Generic-static.cmake
Normal file
3
module/jni/libcxx/cmake/caches/Generic-static.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
1
module/jni/libcxx/cmake/caches/Generic-tsan.cmake
Normal file
1
module/jni/libcxx/cmake/caches/Generic-tsan.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(LLVM_USE_SANITIZER "Thread" CACHE STRING "")
|
||||
2
module/jni/libcxx/cmake/caches/Generic-ubsan.cmake
Normal file
2
module/jni/libcxx/cmake/caches/Generic-ubsan.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(LLVM_USE_SANITIZER "Undefined" CACHE STRING "")
|
||||
set(LIBCXX_ABI_UNSTABLE ON CACHE BOOL "")
|
||||
15
module/jni/libcxx/cmake/caches/MinGW.cmake
Normal file
15
module/jni/libcxx/cmake/caches/MinGW.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_TARGET_INFO "libcxx.test.target_info.MingwLocalTI" CACHE STRING "")
|
||||
|
||||
# Without this flag, 'long double' (which is 80 bit on x86 mingw, but
|
||||
# 64 bit in MSVC) isn't handled correctly in printf.
|
||||
set(LIBCXX_EXTRA_SITE_DEFINES "__USE_MINGW_ANSI_STDIO=1" CACHE STRING "")
|
||||
13
module/jni/libcxx/cmake/caches/README.md
Normal file
13
module/jni/libcxx/cmake/caches/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# libc++ / libc++abi configuration caches
|
||||
|
||||
This directory contains CMake caches for the supported configurations of libc++.
|
||||
Some of the configurations are specific to a vendor, others are generic and not
|
||||
tied to any vendor.
|
||||
|
||||
While we won't explicitly work to break configurations not listed here, any
|
||||
configuration not listed here is not explicitly supported. If you use or ship
|
||||
libc++ under a configuration not listed here, you should work with the libc++
|
||||
maintainers to make it into a supported configuration and add it here.
|
||||
|
||||
Similarly, adding any new configuration that's not already covered must be
|
||||
discussed with the libc++ maintainers as it entails a maintenance burden.
|
||||
129
module/jni/libcxx/cmake/config-ix.cmake
Normal file
129
module/jni/libcxx/cmake/config-ix.cmake
Normal file
@@ -0,0 +1,129 @@
|
||||
include(CMakePushCheckState)
|
||||
include(CheckLibraryExists)
|
||||
include(LLVMCheckCompilerLinkerFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
# The compiler driver may be implicitly trying to link against libunwind.
|
||||
# This is normally ok (libcxx relies on an unwinder), but if libunwind is
|
||||
# built in the same cmake invocation as libcxx and we've got
|
||||
# LIBCXXABI_USE_LLVM_UNWINDER set, we'd be linking against the just-built
|
||||
# libunwind (and the compiler implicit -lunwind wouldn't succeed as the newly
|
||||
# built libunwind isn't installed yet). For those cases, it'd be good to
|
||||
# link with --uwnindlib=none. Check if that option works.
|
||||
llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
# NOTE(compnerd) this is technically a lie, there is msvcrt, but for now, lets
|
||||
# let the default linking take care of that.
|
||||
set(LIBCXX_HAS_C_LIB NO)
|
||||
else()
|
||||
check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
|
||||
endif()
|
||||
|
||||
if (NOT LIBCXX_USE_COMPILER_RT)
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(LIBCXX_HAS_GCC_S_LIB NO)
|
||||
else()
|
||||
if(ANDROID)
|
||||
check_library_exists(gcc __gcc_personality_v0 "" LIBCXX_HAS_GCC_LIB)
|
||||
else()
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# libc++ is using -nostdlib++ at the link step when available,
|
||||
# otherwise -nodefaultlibs is used. We want all our checks to also
|
||||
# use one of these options, otherwise we may end up with an inconsistency between
|
||||
# the flags we think we require during configuration (if the checks are
|
||||
# performed without one of those options) and the flags that are actually
|
||||
# required during compilation (which has the -nostdlib++ or -nodefaultlibs). libc is
|
||||
# required for the link to go through. We remove sanitizers from the
|
||||
# configuration checks to avoid spurious link errors.
|
||||
|
||||
check_cxx_compiler_flag(-nostdlib++ CXX_SUPPORTS_NOSTDLIBXX_FLAG)
|
||||
if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
|
||||
else()
|
||||
check_c_compiler_flag(-nodefaultlibs C_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CXX_SUPPORTS_NOSTDLIBXX_FLAG OR C_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
if (LIBCXX_HAS_C_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES c)
|
||||
endif ()
|
||||
if (LIBCXX_USE_COMPILER_RT)
|
||||
include(HandleCompilerRT)
|
||||
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY
|
||||
FLAGS ${LIBCXX_COMPILE_FLAGS})
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}")
|
||||
elseif (LIBCXX_HAS_GCC_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
|
||||
elseif (LIBCXX_HAS_GCC_S_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
# Mingw64 requires quite a few "C" runtime libraries in order for basic
|
||||
# programs to link successfully with -nodefaultlibs.
|
||||
if (LIBCXX_USE_COMPILER_RT)
|
||||
set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
|
||||
else ()
|
||||
set(MINGW_RUNTIME gcc_s gcc)
|
||||
endif()
|
||||
set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
|
||||
shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
|
||||
moldname mingwex msvcrt)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
|
||||
endif()
|
||||
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
|
||||
endif ()
|
||||
if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES -fsanitize-coverage)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fsanitize-coverage=0")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Check compiler pragmas
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
|
||||
check_c_source_compiles("
|
||||
#pragma comment(lib, \"c\")
|
||||
int main() { return 0; }
|
||||
" C_SUPPORTS_COMMENT_LIB_PRAGMA)
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
# Check libraries
|
||||
if(WIN32 AND NOT MINGW)
|
||||
# TODO(compnerd) do we want to support an emulation layer that allows for the
|
||||
# use of pthread-win32 or similar libraries to emulate pthreads on Windows?
|
||||
set(LIBCXX_HAS_PTHREAD_LIB NO)
|
||||
set(LIBCXX_HAS_M_LIB NO)
|
||||
set(LIBCXX_HAS_RT_LIB NO)
|
||||
set(LIBCXX_HAS_SYSTEM_LIB NO)
|
||||
set(LIBCXX_HAS_ATOMIC_LIB NO)
|
||||
elseif(APPLE)
|
||||
check_library_exists(System write "" LIBCXX_HAS_SYSTEM_LIB)
|
||||
set(LIBCXX_HAS_PTHREAD_LIB NO)
|
||||
set(LIBCXX_HAS_M_LIB NO)
|
||||
set(LIBCXX_HAS_RT_LIB NO)
|
||||
set(LIBCXX_HAS_ATOMIC_LIB NO)
|
||||
elseif(FUCHSIA)
|
||||
set(LIBCXX_HAS_M_LIB NO)
|
||||
set(LIBCXX_HAS_PTHREAD_LIB NO)
|
||||
set(LIBCXX_HAS_RT_LIB NO)
|
||||
set(LIBCXX_HAS_SYSTEM_LIB NO)
|
||||
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
|
||||
else()
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
set(LIBCXX_HAS_SYSTEM_LIB NO)
|
||||
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
|
||||
endif()
|
||||
Reference in New Issue
Block a user