File tree 1 file changed +11
-8
lines changed 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 5
5
cmake_path(GET RAW_SOURCE_PATH STEM raw_source_basename)
6
6
7
7
file (READ ${RAW_SOURCE_PATH} hex_content HEX)
8
- string (REGEX REPLACE "................" "\\ 0\n " formatted_bytes "${hex_content} " )
9
- string (REGEX REPLACE "[^\n ][^\n ]" "std::byte{0x\\ 0}," formatted_bytes "${formatted_bytes} " )
8
+ string (STRIP "${hex_content} " hex_content)
10
9
11
10
set (header_content
12
- "#include <cstddef>
11
+ "#include <util/strencodings.h>
12
+
13
+ #include <cstddef>
13
14
#include <span>
14
15
16
+ using namespace util::hex_literals;
17
+
15
18
namespace ${RAW_NAMESPACE} {
16
- inline constexpr std::byte detail_${raw_source_basename} _raw[] {
17
- ${formatted_bytes}
18
- };
19
19
20
- inline constexpr std::span ${raw_source_basename} {detail_${raw_source_basename} _raw};
21
- }
20
+ inline constexpr auto ${raw_source_basename} = \" ${hex_content} \" _hex;
21
+ inline constexpr std::span<const std::byte> ${raw_source_basename} _span{${raw_source_basename} };
22
+
23
+ } // namespace ${RAW_NAMESPACE}
22
24
" )
25
+
23
26
file (WRITE ${HEADER_PATH} "${header_content} " )
You can’t perform that action at this time.
0 commit comments