mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
cmake: Add cross-compiling support
To configure CMake for cross-compiling, use `--toolchain depends/${HOST}/toolchain.cmake` command-line option.
This commit is contained in:
parent
0d01c228a7
commit
84ac35cfd4
3 changed files with 29 additions and 4 deletions
|
@ -479,6 +479,19 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITIONS})
|
||||
target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO})
|
||||
target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG})
|
||||
|
||||
# If the {CXX,LD}FLAGS environment variables are defined during building depends
|
||||
# and configuring this build system, their content might be duplicated.
|
||||
if(DEFINED ENV{CXXFLAGS})
|
||||
deduplicate_flags(CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
if(DEFINED ENV{LDFLAGS})
|
||||
deduplicate_flags(CMAKE_EXE_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
@ -538,6 +551,12 @@ message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}")
|
|||
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
|
||||
message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}")
|
||||
message("")
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(cross_status "TRUE, for ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
set(cross_status "FALSE")
|
||||
endif()
|
||||
message("Cross compiling ....................... ${cross_status}")
|
||||
message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}")
|
||||
include(FlagsSummary)
|
||||
flags_summary()
|
||||
|
|
|
@ -265,13 +265,14 @@ define $(package)_build_cmds
|
|||
$(MAKE)
|
||||
endef
|
||||
|
||||
# TODO: Investigate whether specific targets can be used here to minimize the amount of files/components installed.
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
|
||||
$(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \
|
||||
$(MAKE) -C qtbase INSTALL_ROOT=$($(package)_staging_dir) install && \
|
||||
$(MAKE) -C qttools INSTALL_ROOT=$($(package)_staging_dir) install && \
|
||||
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm -rf native/mkspecs/ native/lib/ lib/cmake/ && \
|
||||
rm -f lib/lib*.la lib/*.prl plugins/*/*.prl
|
||||
rm -rf doc/ native/lib/ && \
|
||||
rm -f lib/lib*.la
|
||||
endef
|
||||
|
|
|
@ -62,6 +62,11 @@ foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES)
|
|||
string(TOUPPER "${config}" config)
|
||||
set(CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
endforeach()
|
||||
# If the CFLAGS environment variable is defined during building depends
|
||||
# and configuring this build system, its content might be duplicated.
|
||||
if(DEFINED ENV{CFLAGS})
|
||||
deduplicate_flags(CMAKE_C_FLAGS)
|
||||
endif()
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS OFF)
|
||||
add_subdirectory(secp256k1)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
|
Loading…
Reference in a new issue