Generate lcf/rpg/fwd.h with all forward declarations
This will be used later to reduce compile times for clients.
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -237,6 +237,7 @@ set(LCF_HEADERS
src/generated/lcf/rpg/eventcommand.h
src/generated/lcf/rpg/eventpage.h
src/generated/lcf/rpg/eventpagecondition.h
+ src/generated/lcf/rpg/fwd.h
src/generated/lcf/rpg/item.h
src/generated/lcf/rpg/itemanimation.h
src/generated/lcf/rpg/learning.h

MODIFY
Makefile.am
Makefile.am
@@ -253,6 +253,7 @@ lcfrpginclude_HEADERS = \
src/generated/lcf/rpg/eventcommand.h \
src/generated/lcf/rpg/eventpage.h \
src/generated/lcf/rpg/eventpagecondition.h \
+ src/generated/lcf/rpg/fwd.h \
src/generated/lcf/rpg/item.h \
src/generated/lcf/rpg/itemanimation.h \
src/generated/lcf/rpg/learning.h \

MODIFY
generator/generate.py
generator/generate.py
@@ -369,6 +369,12 @@ def generate():
structs_flat.append(elem)
filepath = os.path.join(tmp_dir, 'fwd_struct_impl.h')
+ with openToRender(filepath) as f:
+ f.write(fwd_struct_tmpl.render(
+ structs=sorted([x.name for x in structs_flat])
+ ))
+
+ filepath = os.path.join(tmp_dir, 'lcf', 'rpg', 'fwd.h')
with openToRender(filepath) as f:
f.write(fwd_tmpl.render(
structs=sorted([x.name for x in structs_flat])
@@ -439,7 +445,7 @@ def main(argv):
os.mkdir(dest_dir)
global structs, sfields, enums, flags, setup, constants, headers
- global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl, enums_tmpl, fwd_tmpl
+ global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl, enums_tmpl, fwd_tmpl, fwd_struct_tmpl
structs = get_structs('structs.csv','structs_easyrpg.csv')
sfields = get_fields('fields.csv','fields_easyrpg.csv')
@@ -480,7 +486,8 @@ def main(argv):
rpg_source_tmpl = env.get_template('rpg_source.tmpl', globals=globals)
flags_tmpl = env.get_template('flag_reader.tmpl', globals=globals)
enums_tmpl = env.get_template('rpg_enums.tmpl', globals=globals)
- fwd_tmpl = env.get_template('fwd_header.tmpl', globals=globals)
+ fwd_tmpl = env.get_template('fwd.tmpl', globals=globals)
+ fwd_struct_tmpl = env.get_template('fwd_struct.tmpl', globals=globals)
generate()

ADD
generator/templates/fwd.tmpl
+{% include "copyright.tmpl" %}
+#ifndef LCF_RPG_FWD_H
+#define LCF_RPG_FWD_H
+
+namespace lcf {
+namespace rpg {
+ {%- for struct in structs %}
+ class {{ struct }};
+ {%- endfor %}
+} // namespace rpg
+} // namespace lcf
+
+#endif

RENAME
generator/templates/fwd_header.tmpl
generator/templates/fwd_struct.tmpl
ADD
src/generated/lcf/rpg/fwd.h
src/generated/lcf/rpg/fwd.h
Binary files /dev/null and b/src/generated/lcf/rpg/fwd.h differ

Generate lcf/rpg/fwd.h with all forward declarations

This will be used later to reduce compile times for clients.