Daniele Bartolini 10 лет назад
Родитель
Сommit
e09690505f
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      src/compilers/compile_options.h

+ 18 - 0
src/compilers/compile_options.h

@@ -7,6 +7,8 @@
 
 #include "filesystem.h"
 #include "log.h"
+#include "vector.h"
+#include "temp_allocator.h"
 #include <setjmp.h>
 
 #define RESOURCE_COMPILER_ASSERT(condition, opts, msg, ...) do { if (!(condition))\
@@ -22,6 +24,7 @@ struct CompileOptions
 		, _output(output)
 		, _platform(platform)
 		, _jmpbuf(buf)
+		, _dependencies(default_allocator())
 	{
 	}
 
@@ -41,6 +44,8 @@ struct CompileOptions
 
 	Buffer read(const char* path)
 	{
+		add_dependency(path);
+
 		File* file = _fs.open(path, FOM_READ);
 		uint32_t size = file->size();
 		Buffer buf(default_allocator());
@@ -81,10 +86,23 @@ struct CompileOptions
 		return _platform;
 	}
 
+	const Vector<DynamicString>& dependencies() const
+	{
+		return _dependencies;
+	}
+
+	void add_dependency(const char* path)
+	{
+		TempAllocator256 ta;
+		DynamicString dep(path, ta);
+		vector::push_back(_dependencies, dep);
+	}
+
 	Filesystem& _fs;
 	Buffer& _output;
 	const char* _platform;
 	jmp_buf* _jmpbuf;
+	Vector<DynamicString> _dependencies;
 };
 
 } // namespace crown