Changeset View
Changeset View
Standalone View
Standalone View
src/config/CMakeLists.txt
# Copyright (c) 2017-2019 The Bitcoin developers | # Copyright (c) 2017-2019 The Bitcoin developers | ||||
# This generates config.h which provides numerous defines | # This generates config.h which provides numerous defines | ||||
# about the state of the plateform we are building on. | # about the state of the plateform we are building on. | ||||
include(CheckIncludeFiles) | include(CheckIncludeFiles) | ||||
include(CheckSymbolExists) | include(CheckSymbolExists) | ||||
include(CheckCXXSourceCompiles) | include(CheckCXXSourceCompiles) | ||||
include(SanitizeHelper) | |||||
# Version | # Version | ||||
set(CLIENT_VERSION_MAJOR ${bitcoin-abc_VERSION_MAJOR}) | set(CLIENT_VERSION_MAJOR ${bitcoin-abc_VERSION_MAJOR}) | ||||
set(CLIENT_VERSION_MINOR ${bitcoin-abc_VERSION_MINOR}) | set(CLIENT_VERSION_MINOR ${bitcoin-abc_VERSION_MINOR}) | ||||
set(CLIENT_VERSION_REVISION ${bitcoin-abc_VERSION_PATCH}) | set(CLIENT_VERSION_REVISION ${bitcoin-abc_VERSION_PATCH}) | ||||
option(CLIENT_VERSION_IS_RELEASE "Build a release version" OFF) | option(CLIENT_VERSION_IS_RELEASE "Build a release version" OFF) | ||||
# Generate the version.h file | # Generate the version.h file | ||||
configure_file(version.h.cmake.in version.h ESCAPE_QUOTES) | configure_file(version.h.cmake.in version.h ESCAPE_QUOTES) | ||||
# Wrapper for the check_include_files() macro. | |||||
# The find_path() function honors the sysroot variables, and will help | |||||
# us adding the correct include path for check_include_files(). | |||||
# The most obvious use case is to help finding header files located in | |||||
# an Apple Framework. | |||||
function(check_include_files_with_sysroot INCLUDES) | |||||
foreach(INCLUDE ${INCLUDES}) | |||||
sanitize_variable("HEADER_" "${INCLUDE}_PATH" HEADER_PATH) | |||||
find_path(${HEADER_PATH} "${INCLUDE}") | |||||
if(${HEADER_PATH}) | |||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${${HEADER_PATH}}") | |||||
endif() | |||||
endforeach() | |||||
check_include_files("${INCLUDES}" ${ARGN}) | |||||
endfunction() | |||||
# Endianness | # Endianness | ||||
check_include_files("endian.h" HAVE_ENDIAN_H) | check_include_files_with_sysroot("endian.h" HAVE_ENDIAN_H) | ||||
check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H) | check_include_files_with_sysroot("sys/endian.h" HAVE_SYS_ENDIAN_H) | ||||
if(HAVE_ENDIAN_H) | if(HAVE_ENDIAN_H) | ||||
set(ENDIAN_FILE "endian.h") | set(ENDIAN_FILE "endian.h") | ||||
elseif(HAVE_SYS_ENDIAN_H) | elseif(HAVE_SYS_ENDIAN_H) | ||||
set(ENDIAN_FILE "sys/endian.h") | set(ENDIAN_FILE "sys/endian.h") | ||||
else() | else() | ||||
endif() | endif() | ||||
if(ENDIAN_FILE) | if(ENDIAN_FILE) | ||||
check_symbol_exists(htole16 ${ENDIAN_FILE} HAVE_DECL_HTOLE16) | check_symbol_exists(htole16 ${ENDIAN_FILE} HAVE_DECL_HTOLE16) | ||||
check_symbol_exists(htobe16 ${ENDIAN_FILE} HAVE_DECL_HTOBE16) | check_symbol_exists(htobe16 ${ENDIAN_FILE} HAVE_DECL_HTOBE16) | ||||
check_symbol_exists(be16toh ${ENDIAN_FILE} HAVE_DECL_BE16TOH) | check_symbol_exists(be16toh ${ENDIAN_FILE} HAVE_DECL_BE16TOH) | ||||
check_symbol_exists(le16toh ${ENDIAN_FILE} HAVE_DECL_LE16TOH) | check_symbol_exists(le16toh ${ENDIAN_FILE} HAVE_DECL_LE16TOH) | ||||
check_symbol_exists(htobe32 ${ENDIAN_FILE} HAVE_DECL_HTOBE32) | check_symbol_exists(htobe32 ${ENDIAN_FILE} HAVE_DECL_HTOBE32) | ||||
check_symbol_exists(htole32 ${ENDIAN_FILE} HAVE_DECL_HTOLE32) | check_symbol_exists(htole32 ${ENDIAN_FILE} HAVE_DECL_HTOLE32) | ||||
check_symbol_exists(be32toh ${ENDIAN_FILE} HAVE_DECL_BE32TOH) | check_symbol_exists(be32toh ${ENDIAN_FILE} HAVE_DECL_BE32TOH) | ||||
check_symbol_exists(le32toh ${ENDIAN_FILE} HAVE_DECL_LE32TOH) | check_symbol_exists(le32toh ${ENDIAN_FILE} HAVE_DECL_LE32TOH) | ||||
check_symbol_exists(htobe64 ${ENDIAN_FILE} HAVE_DECL_HTOBE64) | check_symbol_exists(htobe64 ${ENDIAN_FILE} HAVE_DECL_HTOBE64) | ||||
check_symbol_exists(htole64 ${ENDIAN_FILE} HAVE_DECL_HTOLE64) | check_symbol_exists(htole64 ${ENDIAN_FILE} HAVE_DECL_HTOLE64) | ||||
check_symbol_exists(be64toh ${ENDIAN_FILE} HAVE_DECL_BE64TOH) | check_symbol_exists(be64toh ${ENDIAN_FILE} HAVE_DECL_BE64TOH) | ||||
check_symbol_exists(le64toh ${ENDIAN_FILE} HAVE_DECL_LE64TOH) | check_symbol_exists(le64toh ${ENDIAN_FILE} HAVE_DECL_LE64TOH) | ||||
endif() | endif() | ||||
# Byte swap | # Byte swap | ||||
check_include_files("byteswap.h" HAVE_BYTESWAP_H) | check_include_files_with_sysroot("byteswap.h" HAVE_BYTESWAP_H) | ||||
check_symbol_exists(bswap_16 "byteswap.h" HAVE_DECL_BSWAP_16) | check_symbol_exists(bswap_16 "byteswap.h" HAVE_DECL_BSWAP_16) | ||||
check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32) | check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32) | ||||
check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64) | check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64) | ||||
# sys/select.h and sys/prctl.h headers | # sys/select.h and sys/prctl.h headers | ||||
check_include_files("sys/select.h" HAVE_SYS_SELECT_H) | check_include_files_with_sysroot("sys/select.h" HAVE_SYS_SELECT_H) | ||||
check_include_files("sys/prctl.h" HAVE_SYS_PRCTL_H) | check_include_files_with_sysroot("sys/prctl.h" HAVE_SYS_PRCTL_H) | ||||
# Bitmanip intrinsics | # Bitmanip intrinsics | ||||
function(check_builtin_exist SYMBOL VARIABLE) | function(check_builtin_exist SYMBOL VARIABLE) | ||||
set( | set( | ||||
SOURCE_FILE | SOURCE_FILE | ||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckBuiltinExists.c" | "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckBuiltinExists.c" | ||||
) | ) | ||||
set( | set( | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |