@@ -63,7 +63,17 @@ macro(daemon_embed_files BASENAME SLUG FORMAT TARGETNAME)
6363 set (EMBED_${kind} _TEXT "${DAEMON_GENERATED_HEADER} " )
6464 endforeach ()
6565
66- string (APPEND EMBED_CPP_TEXT "#include \" ${EMBED_H_FILE} \"\n\n " )
66+ string (APPEND EMBED_CPP_TEXT
67+ "#include \" ${EMBED_H_FILE} \"\n "
68+ "\n "
69+ "namespace ${BASENAME} {\n "
70+ )
71+
72+ string (APPEND EMBED_H_TEXT
73+ "#include \" common/Common.h\"\n "
74+ "\n "
75+ "namespace ${BASENAME} {\n "
76+ )
6777
6878 set (EMBED_MAP_TEXT "" )
6979
@@ -88,16 +98,22 @@ macro(daemon_embed_files BASENAME SLUG FORMAT TARGETNAME)
8898 set_property (TARGET "${TARGETNAME} " APPEND PROPERTY SOURCES ${outpath} )
8999
90100 string (APPEND EMBED_CPP_TEXT
91- "#include \" ${BASENAME} /${filename_symbol} .h\"\n " )
101+ "#include \" ${BASENAME} /${filename_symbol} .h\"\n "
102+ )
103+
104+ string (APPEND EMBED_H_TEXT
105+ "extern const unsigned char ${filename_symbol} [];\n "
106+ )
107+
92108 string (APPEND EMBED_MAP_TEXT
93109 "\t { \" ${filename} \" , "
94110 "std::string(reinterpret_cast<const char *>( ${filename_symbol} ), "
95- "sizeof( ${filename_symbol} )) },\n " )
111+ "sizeof( ${filename_symbol} )) },\n "
112+ )
96113 endforeach ()
97114
98115 string (APPEND EMBED_CPP_TEXT
99116 "\n "
100- "namespace ${BASENAME} {\n "
101117 "const std::unordered_map<std::string, std::string> FileMap\n {\n "
102118 "${EMBED_MAP_TEXT} "
103119 "};\n "
@@ -111,9 +127,6 @@ macro(daemon_embed_files BASENAME SLUG FORMAT TARGETNAME)
111127 )
112128
113129 string (APPEND EMBED_H_TEXT
114- "#include \" common/Common.h\"\n "
115- "\n "
116- "namespace ${BASENAME} {\n "
117130 "extern const std::unordered_map<std::string, std::string> FileMap;\n "
118131 "const char* ReadFile(Str::StringRef filename);\n "
119132 "};\n "
0 commit comments