bundle_compiler.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2012-2014 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "disk_filesystem.h"
  7. #include "container_types.h"
  8. #include "crown.h"
  9. namespace crown
  10. {
  11. class BundleCompiler
  12. {
  13. public:
  14. BundleCompiler(const char* source_dir, const char* bundle_dir);
  15. bool compile(const char* type, const char* name, Platform::Enum platform);
  16. /// Compiles all the resources found in @a source_dir and puts them in @a bundle_dir.
  17. /// Returns true on success, false otherwise.
  18. bool compile_all(Platform::Enum platform);
  19. void scan(const char* cur_dir, Vector<DynamicString>& files);
  20. private:
  21. DiskFilesystem _source_fs;
  22. DiskFilesystem _bundle_fs;
  23. };
  24. namespace bundle_compiler
  25. {
  26. bool main(bool do_compile, bool do_continue, Platform::Enum platform);
  27. } // namespace bundle_compiler
  28. namespace bundle_compiler_globals
  29. {
  30. /// Creates the global resource compiler.
  31. void init(const char* source_dir, const char* bundle_dir);
  32. /// Destroys the global resource compiler.
  33. void shutdown();
  34. /// Returns the global resource compiler.
  35. /// Returns NULL if the compiler is not available on the
  36. /// running platform.
  37. BundleCompiler* compiler();
  38. } // namespace bundle_compiler_globals
  39. } // namespace crown