Skip to content

Commit

Permalink
added BEAM_CPP_20_STANDARD option
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolse committed May 23, 2024
1 parent bdbedba commit 038d1c4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion keykeeper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions wallet/core/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions wallet/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ namespace beam::wallet
public:
TxParameters(const boost::optional<TxID>& 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<TxID>& GetTxID() const;

Expand Down
6 changes: 5 additions & 1 deletion wasmclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 038d1c4

Please sign in to comment.