diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 120 |
1 files changed, 104 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e280826c0..0b0ce5a4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ cmake_minimum_required(VERSION 2.8.7) -project(bitmonero) +project(monero) function (die msg) if (NOT WIN32) @@ -76,6 +76,11 @@ if (ARM_TEST STREQUAL "arm") endif() endif() +if (ARCH_ID STREQUAL "aarch64") + set(ARM 1) + set(ARM8 1) +endif() + if(WIN32 OR ARM) set(OPT_FLAGS_RELEASE "-O2") else() @@ -353,8 +358,15 @@ else() set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert") endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG}") + option(COVERAGE "Enable profiling for test coverage report" 0) + + if(COVERAGE) + message(STATUS "Building with profiling for test coverage report") + set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage --coverage") + endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS}") # With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that # is fixed in the code (Issue #847), force compiler to be conservative. @@ -367,31 +379,99 @@ else() message(STATUS "AES support enabled") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") - elseif(ARM) + elseif(ARM) #NB ARMv8 DOES support AES, but not yet coded message(STATUS "AES support disabled (not available on ARM)") else() message(STATUS "AES support disabled") endif() - if(ARM6) - message(STATUS "Setting ARM6 C and C++ flags") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp -mfloat-abi=hard") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp -mfloat-abi=hard") - endif() + if(ARM) + message(STATUS "Setting FPU Flags for ARM Processors") + include(TestCXXAcceptsFlag) + + #NB NEON hardware does not fully implement the IEEE 754 standard for floating-point arithmetic + #Need custom assembly code to take full advantage of NEON SIMD + + #Cortex-A5/9 -mfpu=neon-fp16 + #Cortex-A7/15 -mfpu=neon-vfpv4 + #Cortex-A8 -mfpu=neon + #ARMv8 -FP and SIMD on by default for all ARM8v-a series, NO -mfpu setting needed + + #For custom -mtune, processor IDs for ARMv8-A series: + #0xd04 - Cortex-A35 + #0xd07 - Cortex-A57 + #0xd08 - Cortex-A72 + #0xd03 - Cortex-A73 + + if(NOT ARM8) + CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp3-d16 CXX_ACCEPTS_VFP3_D16) + CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp4 CXX_ACCEPTS_VFP4) + CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=hard CXX_ACCEPTS_MFLOAT_HARD) + CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=softfp CXX_ACCEPTS_MFLOAT_SOFTFP) + endif() - if(ARM7) - message(STATUS "Setting ARM7 C and C++ flags") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") - endif() + if(ARM8) + CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769) + CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-843419 CXX_ACCEPTS_MFIX_CORTEX_A53_843419) + endif() + + if(ARM6) + message(STATUS "Selecting VFP for ARMv6") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp") + endif(ARM6) + + if(ARM7) + if(CXX_ACCEPTS_VFP3_D16 AND NOT CXX_ACCEPTS_VFP4) + message(STATUS "Selecting VFP3 for ARMv7") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp3-d16") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp3-d16") + endif() + + if(CXX_ACCEPTS_VFP4) + message(STATUS "Selecting VFP4 for ARMv7") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp4") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp4") + endif() + + if(CXX_ACCEPTS_MFLOAT_HARD) + message(STATUS "Setting Hardware ABI for Floating Point") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") + endif() + + if(CXX_ACCEPTS_MFLOAT_SOFTFP AND NOT CXX_ACCEPTS_MFLOAT_HARD) + message(STATUS "Setting Software ABI for Floating Point") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp") + endif() + endif(ARM7) + + if(ARM8) + if(CXX_ACCEPTS_MFIX_CORTEX_A53_835769) + message(STATUS "Enabling Cortex-A53 workaround 835769") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769") + endif() + + if(CXX_ACCEPTS_MFIX_CORTEX_A53_843419) + message(STATUS "Enabling Cortex-A53 workaround 843419") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-843419") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-843419") + endif() + endif(ARM8) + + endif(ARM) if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0") endif() + + set(DEBUG_FLAGS "-g3") if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)) - set(DEBUG_FLAGS "-g3 -Og -fprofile-arcs -ftest-coverage --coverage") + set(DEBUG_FLAGS "${DEBUG_FLAGS} -Og ") else() - set(DEBUG_FLAGS "-g3 -O0 -fprofile-arcs -ftest-coverage --coverage") + set(DEBUG_FLAGS "${DEBUG_FLAGS} -O0 ") endif() if(NOT DEFINED USE_LTO_DEFAULT) @@ -533,3 +613,11 @@ if(BUILD_DOCUMENTATION) endif() endif() +# when ON - will install libwallet_merged into "lib" +option(BUILD_GUI_DEPS "Build GUI dependencies." OFF) + +# This is not nice, distribution packagers should not enable this, but depend +# on libunbound shipped with their distribution instead +option(INSTALL_VENDORED_LIBUNBOUND "Install libunbound binary built from source vendored with this repo." OFF) + + |