🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
548 B

  1. # Read the input file into 'indata', converting each byte to a pair of hex
  2. # characters
  3. file(READ "${INPUT_FILE}" indata HEX)
  4. # For each pair of characters, indent them and prepend the 0x prefix, and
  5. # append a comma separateor.
  6. # TODO: Prettify this. Should group a number of bytes per line instead of one
  7. # per line.
  8. string(REGEX REPLACE "(..)" " 0x\\1,\n" output "${indata}")
  9. # Write the list of hex chars to the output file in a const byte array
  10. file(WRITE "${OUTPUT_FILE}"
  11. "const unsigned char ${VARIABLE_NAME}[] = {\n${output}};\n")