summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-01-05 16:35:45 -0800
committerGitHub <noreply@github.com>2024-01-05 16:35:45 -0800
commit436d6399d2e915490f980f7f8193e84dc7ed215f (patch)
treeee6af8e1e7bfac7c7fb7f1437eadc4bc687e5667 /src
parentbdafd1116f2fd56ef8a86b3b1a18f3670e4004ed (diff)
downloadbinaryen-436d6399d2e915490f980f7f8193e84dc7ed215f.tar.gz
binaryen-436d6399d2e915490f980f7f8193e84dc7ed215f.tar.bz2
binaryen-436d6399d2e915490f980f7f8193e84dc7ed215f.zip
Rename CMake vars for modified intrinsics file (#6204)
The intrinsics file changed in #6201 and somehow CMake doesn't automatically update itself, and needs a manual step for people with existing checkouts (a new fresh checkout always works). To avoid annoyance for existing checkouts, rename the vars, which forces CMake to recompute the contents.
Diffstat (limited to 'src')
-rw-r--r--src/passes/CMakeLists.txt14
-rw-r--r--src/passes/WasmIntrinsics.cpp.in4
2 files changed, 12 insertions, 6 deletions
diff --git a/src/passes/CMakeLists.txt b/src/passes/CMakeLists.txt
index 1c8418b24..182f4a921 100644
--- a/src/passes/CMakeLists.txt
+++ b/src/passes/CMakeLists.txt
@@ -2,12 +2,18 @@ file(READ wasm-intrinsics.wat WASM_INTRINSICS_WAT HEX)
string(REGEX MATCHALL "([A-Fa-f0-9][A-Fa-f0-9])" SEPARATED_HEX ${WASM_INTRINSICS_WAT})
-set(WASM_INTRINSICS_SIZE 1)
+# WASM_INTRINSICS_EMBED_2 and WASM_INTRINSICS_SIZE_2 should be renamed each time
+# the content of the wat file changes. This is not strictly necessary, as CMake
+# should use the fresh contents each time, but even just re-running CMake
+# manually is not enough in practice (one needs to also erase the CMake temp
+# files, or use a fresh build dir). Renaming the vars keeps things working
+# smoothly for people with existing checkouts.
+set(WASM_INTRINSICS_SIZE_2 1)
foreach (hex IN LISTS SEPARATED_HEX)
- string(APPEND WASM_INTRINSICS_EMBED "0x${hex},")
- math(EXPR WASM_INTRINSICS_SIZE "${WASM_INTRINSICS_SIZE}+1")
+ string(APPEND WASM_INTRINSICS_EMBED_2 "0x${hex},")
+ math(EXPR WASM_INTRINSICS_SIZE_2 "${WASM_INTRINSICS_SIZE_2}+1")
endforeach ()
-string(APPEND WASM_INTRINSICS_EMBED "0x00")
+string(APPEND WASM_INTRINSICS_EMBED_2 "0x00")
configure_file(WasmIntrinsics.cpp.in WasmIntrinsics.cpp @ONLY)
diff --git a/src/passes/WasmIntrinsics.cpp.in b/src/passes/WasmIntrinsics.cpp.in
index 46216842d..c750c56dd 100644
--- a/src/passes/WasmIntrinsics.cpp.in
+++ b/src/passes/WasmIntrinsics.cpp.in
@@ -1,7 +1,7 @@
#include "passes/intrinsics-module.h"
-static const char theModule[@WASM_INTRINSICS_SIZE@] = {
-@WASM_INTRINSICS_EMBED@
+static const char theModule[@WASM_INTRINSICS_SIZE_2@] = {
+@WASM_INTRINSICS_EMBED_2@
};
namespace wasm {