Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if(NOT "${OCRE_INPUT_FILE}" STREQUAL "")

add_custom_command(
OUTPUT ${CMAKE_CURRENT_LIST_DIR}/src/ocre/ocre_input_file.g
COMMAND xxd -i ${OCRE_INPUT_FILE} | sed 's/unsigned char .*\\[/static const unsigned char wasm_binary[/' | sed 's/unsigned int .*_len/static const unsigned int wasm_binary_len/' > ${CMAKE_CURRENT_LIST_DIR}/src/ocre/ocre_input_file.g
COMMAND xxd -n wasm_binary -i ${OCRE_INPUT_FILE} | sed 's/^unsigned/static const unsigned/' > ${OCRE_ROOT_DIR}/src/ocre/ocre_input_file.g
DEPENDS ${OCRE_INPUT_FILE}
COMMENT "Generating C header from ${OCRE_INPUT_FILE}"
)
Expand Down
4 changes: 2 additions & 2 deletions src/ocre/ocre_input_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef OCRE_INPUT_FILE_H
#define OCRE_INPUT_FILE_H
// Sample WASM binary data
static unsigned char wasm_binary[] = {
static const unsigned char wasm_binary[] = {
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x35, 0x09, 0x60,
0x03, 0x7f, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x03, 0x7f, 0x7e, 0x7f, 0x01,
0x7e, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f,
Expand Down Expand Up @@ -332,6 +332,6 @@ static unsigned char wasm_binary[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00
};

static unsigned int wasm_binary_len = 3850;
static const unsigned int wasm_binary_len = 3850;

#endif // OCRE_INPUT_FILE_H