diff --git a/CMakeLists.txt b/CMakeLists.txt index 38367542..7ce15320 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}" ) diff --git a/src/ocre/ocre_input_file.h b/src/ocre/ocre_input_file.h index 74a39052..fea12761 100644 --- a/src/ocre/ocre_input_file.h +++ b/src/ocre/ocre_input_file.h @@ -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, @@ -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