Skip to content

Commit afbf31f

Browse files
authored
Fixed C++20 and macos build (#1976)
* added BEAM_CPP_20_STANDARD option * WIP * wip
1 parent bdbedba commit afbf31f

File tree

15 files changed

+39
-20
lines changed

15 files changed

+39
-20
lines changed

3rdparty/libbitcoin/src/chain/transaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ bool transaction::all_inputs_final() const
738738

739739
bool transaction::is_final(size_t block_height, uint32_t block_time) const
740740
{
741-
const auto max_locktime = [=, this]()
741+
const auto max_locktime = [=]()
742742
{
743743
return locktime_ < locktime_threshold ?
744744
safe_unsigned<uint32_t>(block_height) : block_time;

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ target_include_directories(beam INTERFACE
109109
${PROJECT_SOURCE_DIR}
110110
${PROJECT_SOURCE_DIR}/3rdparty)
111111

112-
target_compile_features(beam INTERFACE cxx_std_20)
113-
114112

115113
file(WRITE ${PROJECT_SOURCE_DIR}/beam_version.gen "${PROJECT_VERSION}")
116114
add_definitions(-DBEAM_LIB_VERSION="${BEAM_VERSION}")
@@ -121,7 +119,20 @@ endif()
121119

122120
include(AddTest)
123121

124-
set(CMAKE_CXX_STANDARD 20)
122+
option(BEAM_CPP_20_STANDARD "Build wallet with C++20 standard" OFF)
123+
message("BEAM_CPP_20_STANDARD is ${BEAM_CPP_20_STANDARD}")
124+
125+
126+
if (BEAM_CPP_20_STANDARD)
127+
set(CMAKE_CXX_STANDARD 20)
128+
set(BEAM_INTERFACE_STANDARD, cxx_std_20)
129+
else()
130+
set(CMAKE_CXX_STANDARD 17)
131+
set(BEAM_INTERFACE_STANDARD, cxx_std_17)
132+
endif()
133+
134+
target_compile_features(beam INTERFACE ${BEAM_INTERFACE_STANDARD})
135+
125136
set(CMAKE_CXX_STANDARD_REQUIRED ON)
126137

127138
set(BEAM_USE_AVX FALSE)

keykeeper/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 3.13)
44
set(TARGET_NAME wasm-key-keeper)
55

66
if(EMSCRIPTEN)
7-
set(CMAKE_CXX_STANDARD 20)
7+
if (BEAM_CPP_20_STANDARD)
8+
set(CMAKE_CXX_STANDARD 20)
9+
else()
10+
set(CMAKE_CXX_STANDARD 17)
11+
endif()
812
set(CMAKE_CXX_STANDARD_REQUIRED ON)
913
endif()
1014

utility/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if (MSVC)
5454
endif()
5555

5656
add_library(utility STATIC ${UTILITY_SRC} ${IO_SRC})
57-
target_compile_features(utility PUBLIC cxx_std_20)
57+
target_compile_features(utility PUBLIC ${BEAM_INTERFACE_STANDARD})
5858

5959
if (NOT EMSCRIPTEN)
6060
add_library(cli STATIC ${CLI_SRC})

wallet/client/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ target_link_libraries(wallet_client_no_ipfs
3333
PRIVATE http
3434
)
3535

36-
target_compile_features(wallet_client PUBLIC cxx_std_20)
37-
target_compile_features(wallet_client_no_ipfs PUBLIC cxx_std_20)
36+
target_compile_features(wallet_client PUBLIC ${BEAM_INTERFACE_STANDARD})
37+
target_compile_features(wallet_client_no_ipfs PUBLIC ${BEAM_INTERFACE_STANDARD})
3838

3939
add_subdirectory(extensions)
4040

wallet/client/extensions/broadcast_gateway/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ target_link_libraries(broadcast_gateway
1818
wallet_core
1919
)
2020

21-
target_compile_features(broadcast_gateway PUBLIC cxx_std_20)
21+
target_compile_features(broadcast_gateway PUBLIC ${BEAM_INTERFACE_STANDARD})
2222

wallet/client/extensions/dex_board/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ target_link_libraries(dex_board
1616
wallet
1717
)
1818

19-
target_compile_features(dex_board PUBLIC cxx_std_20)
19+
target_compile_features(dex_board PUBLIC ${BEAM_INTERFACE_STANDARD})
2020

wallet/client/extensions/export/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ if(BEAM_ATOMIC_SWAP_SUPPORT)
2121
target_compile_definitions(export PUBLIC BEAM_ATOMIC_SWAP_SUPPORT)
2222
endif()
2323

24-
target_compile_features(export PUBLIC cxx_std_20)
24+
target_compile_features(export PUBLIC ${BEAM_INTERFACE_STANDARD})
2525

wallet/client/extensions/news_channels/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ target_link_libraries(news_channels
2424
wallet_core
2525
)
2626

27-
target_compile_features(news_channels PUBLIC cxx_std_20)
27+
target_compile_features(news_channels PUBLIC ${BEAM_INTERFACE_STANDARD})
2828

wallet/client/extensions/notifications/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ target_link_libraries(notifications
1717
wallet_core
1818
)
1919

20-
target_compile_features(notifications PUBLIC cxx_std_20)
20+
target_compile_features(notifications PUBLIC ${BEAM_INTERFACE_STANDARD})
2121

0 commit comments

Comments
 (0)