From 6aa9bd0f77dcb5128167fae62e32aa5252fe85c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 2 Dec 2013 00:55:24 +0100 Subject: Renew the updater branch Now with some actual consensus on what the updater will do! --- .../cmake/modules/GenerateCppResourceFile.cmake | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 mmc_updater/cmake/modules/GenerateCppResourceFile.cmake (limited to 'mmc_updater/cmake') diff --git a/mmc_updater/cmake/modules/GenerateCppResourceFile.cmake b/mmc_updater/cmake/modules/GenerateCppResourceFile.cmake new file mode 100644 index 00000000..59adfd58 --- /dev/null +++ b/mmc_updater/cmake/modules/GenerateCppResourceFile.cmake @@ -0,0 +1,23 @@ + +# Convert a binary data file into a C++ +# source file for embedding into an application binary +# +# Currently only implemented for Unix. Requires the 'xxd' +# tool to be installed. +# +# TARGET_NAME : The name of the target to generate +# +# INPUT_DIR : The directory containing the input binary data file +# +# INPUT_FILE : The name of the binary data file in ${INPUT_DIR} to be converted into a C++ +# source file. The name of the input file will be used as the basis for the +# symbols in the generated C++ file referring to the data buffer and its length. +# +# CPP_FILE : The path of the C++ source file to be generated. +# See the documentation for xxd for information on +# the structure of the generated source file. +# +function (generate_cpp_resource_file TARGET_NAME INPUT_FILE CPP_FILE) + add_custom_command(OUTPUT ${CPP_FILE} COMMAND cd `dirname ${INPUT_FILE}` && xxd -i `basename ${INPUT_FILE}` ${CPP_FILE} DEPENDS ${INPUT_FILE}) + add_custom_target(${TARGET_NAME} ALL DEPENDS ${CPP_FILE}) +endfunction() -- cgit v1.2.3