Skip to content

Commit 250bb53

Browse files
committed
Emscripten: Make benches compile again
1 parent 1383a4c commit 250bb53

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,14 @@ if(PLAYER_ENABLE_BENCHMARKS)
15761576
set_target_properties(bench_${name} PROPERTIES WIN32_EXECUTABLE FALSE)
15771577
target_link_libraries(bench_${name} ${PROJECT_NAME})
15781578
target_link_libraries(bench_${name} benchmark)
1579+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
1580+
target_link_libraries(bench_${name} "websocket.js")
1581+
set_property(TARGET bench_${name} PROPERTY LINK_FLAGS
1582+
"-sALLOW_MEMORY_GROWTH -sMODULARIZE \
1583+
-sEXIT_RUNTIME --bind \
1584+
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall'] \
1585+
-sEXPORTED_FUNCTIONS=_main,_malloc,_free")
1586+
endif()
15791587
endforeach()
15801588
endif()
15811589

bench/rtp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@
55

66
static void BM_InitRtp2k(benchmark::State& state) {
77
Output::SetLogLevel(LogLevel::Error);
8-
Player::engine = Player::EngineRpg2k;
8+
Player::game_config.engine = Player::EngineRpg2k;
99

1010
bool no_rtp_flag = false;
1111
bool no_rtp_warning_flag = false;
1212
for (auto _: state) {
1313
FileFinder_RTP(no_rtp_flag, no_rtp_warning_flag, "");
1414
}
1515

16-
Player::engine = Player::EngineNone;
16+
Player::game_config.engine = Player::EngineNone;
1717
Output::SetLogLevel(LogLevel::Debug);
1818
}
1919

2020
BENCHMARK(BM_InitRtp2k);
2121

2222
static void BM_InitRtp2k3(benchmark::State& state) {
2323
Output::SetLogLevel(LogLevel::Error);
24-
Player::engine = Player::EngineRpg2k3;
24+
Player::game_config.engine = Player::EngineRpg2k3;
2525

2626
bool no_rtp_flag = false;
2727
bool no_rtp_warning_flag = false;
2828
for (auto _: state) {
2929
FileFinder_RTP(no_rtp_flag, no_rtp_warning_flag, "");
3030
}
3131

32-
Player::engine = Player::EngineNone;
32+
Player::game_config.engine = Player::EngineNone;
3333
Output::SetLogLevel(LogLevel::Debug);
3434
}
3535

0 commit comments

Comments
 (0)