diff --git a/CMakeLists.txt b/CMakeLists.txt index 2437f7427..9897d35a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,8 +109,6 @@ target_include_directories(beam INTERFACE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/3rdparty) -target_compile_features(beam INTERFACE cxx_std_20) - file(WRITE ${PROJECT_SOURCE_DIR}/beam_version.gen "${PROJECT_VERSION}") add_definitions(-DBEAM_LIB_VERSION="${BEAM_VERSION}") @@ -121,7 +119,17 @@ endif() include(AddTest) -set(CMAKE_CXX_STANDARD 20) +option(BEAM_CPP_20_STANDARD "Build wallet with C++20 standard" OFF) +message("BEAM_CPP_20_STANDARD is ${BEAM_CPP_20_STANDARD}") + +if (BEAM_CPP_20_STANDARD) + set(CMAKE_CXX_STANDARD 20) + target_compile_features(beam INTERFACE cxx_std_20) +else() + set(CMAKE_CXX_STANDARD 17) + target_compile_features(beam INTERFACE cxx_std_17) +endif() + set(CMAKE_CXX_STANDARD_REQUIRED ON) set(BEAM_USE_AVX FALSE) diff --git a/keykeeper/CMakeLists.txt b/keykeeper/CMakeLists.txt index 4bdacd8af..e7c4f06b2 100644 --- a/keykeeper/CMakeLists.txt +++ b/keykeeper/CMakeLists.txt @@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 3.13) set(TARGET_NAME wasm-key-keeper) if(EMSCRIPTEN) - set(CMAKE_CXX_STANDARD 20) + if (BEAM_CPP_20_STANDARD) + set(CMAKE_CXX_STANDARD 20) + else() + set(CMAKE_CXX_STANDARD 17) + endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() diff --git a/wallet/core/common.cpp b/wallet/core/common.cpp index 65ba5d27f..6ee2bdc12 100644 --- a/wallet/core/common.cpp +++ b/wallet/core/common.cpp @@ -444,13 +444,13 @@ namespace beam::wallet } - bool TxParameters::operator==(const TxParameters& other) + bool TxParameters::operator==(const TxParameters& other) const { return m_ID == other.m_ID && m_Parameters == other.m_Parameters; } - bool TxParameters::operator!=(const TxParameters& other) + bool TxParameters::operator!=(const TxParameters& other) const { return !(*this == other); } diff --git a/wallet/core/common.h b/wallet/core/common.h index 25dd12826..92504dce1 100644 --- a/wallet/core/common.h +++ b/wallet/core/common.h @@ -441,8 +441,8 @@ namespace beam::wallet public: TxParameters(const boost::optional& txID = {}); - bool operator==(const TxParameters& other); - bool operator!=(const TxParameters& other); + bool operator==(const TxParameters& other) const; + bool operator!=(const TxParameters& other) const; const boost::optional& GetTxID() const; diff --git a/wasmclient/CMakeLists.txt b/wasmclient/CMakeLists.txt index f02519308..e647ee749 100644 --- a/wasmclient/CMakeLists.txt +++ b/wasmclient/CMakeLists.txt @@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 3.13) set(TARGET_NAME wasm-client) if(EMSCRIPTEN) - set(CMAKE_CXX_STANDARD 20) + if (BEAM_CPP_20_STANDARD) + set(CMAKE_CXX_STANDARD 20) + else() + set(CMAKE_CXX_STANDARD 17) + endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-value \ -pthread \