Skip to content

Commit 257e1c9

Browse files
sbc100radekdoulik
authored andcommitted
Fix cmake dependency on wasm-intrinsics.wat (WebAssembly#6206)
I think this is a nicer/better way to do WebAssembly#6204.
1 parent a385f3b commit 257e1c9

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/passes/CMakeLists.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
file(READ wasm-intrinsics.wat WASM_INTRINSICS_WAT HEX)
2+
set(CMAKE_CONFIGURE_DEPENDS wasm-intrinsics.wat)
23

34
string(REGEX MATCHALL "([A-Fa-f0-9][A-Fa-f0-9])" SEPARATED_HEX ${WASM_INTRINSICS_WAT})
45

5-
# WASM_INTRINSICS_EMBED_2 and WASM_INTRINSICS_SIZE_2 should be renamed each time
6-
# the content of the wat file changes. This is not strictly necessary, as CMake
7-
# should use the fresh contents each time, but even just re-running CMake
8-
# manually is not enough in practice (one needs to also erase the CMake temp
9-
# files, or use a fresh build dir). Renaming the vars keeps things working
10-
# smoothly for people with existing checkouts.
11-
set(WASM_INTRINSICS_SIZE_2 1)
126
foreach (hex IN LISTS SEPARATED_HEX)
13-
string(APPEND WASM_INTRINSICS_EMBED_2 "0x${hex},")
14-
math(EXPR WASM_INTRINSICS_SIZE_2 "${WASM_INTRINSICS_SIZE_2}+1")
7+
string(APPEND WASM_INTRINSICS_EMBED "0x${hex},")
158
endforeach ()
16-
string(APPEND WASM_INTRINSICS_EMBED_2 "0x00")
9+
string(APPEND WASM_INTRINSICS_EMBED "0x00")
1710

1811
configure_file(WasmIntrinsics.cpp.in WasmIntrinsics.cpp @ONLY)
1912

src/passes/WasmIntrinsics.cpp.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "passes/intrinsics-module.h"
22

3-
static const char theModule[@WASM_INTRINSICS_SIZE_2@] = {
4-
@WASM_INTRINSICS_EMBED_2@
3+
static const char theModule[] = {
4+
@WASM_INTRINSICS_EMBED@
55
};
66

77
namespace wasm {

0 commit comments

Comments
 (0)