Main.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright (c) 2008-2022 the Urho3D project
  2. // License: MIT
  3. #include <chrono>
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7. //#define DEVELOP
  8. // Path to Urho3D's root folder (CMAKE_SOURCE_DIR). There must be no slash at the end
  9. string _sourceDir;
  10. namespace SourceData
  11. {
  12. void LoadAllXmls(const string& dir);
  13. }
  14. namespace ASBindingGenerator
  15. {
  16. void ProcessAllEnums();
  17. void ProcessAllClasses();
  18. void ProcessAllGlobalVariables();
  19. void ProcessAllGlobalFunctions();
  20. void SaveResult();
  21. void GenerateTemplates();
  22. void GenerateBindings()
  23. {
  24. ProcessAllEnums();
  25. ProcessAllClasses();
  26. ProcessAllGlobalVariables();
  27. ProcessAllGlobalFunctions();
  28. SaveResult();
  29. GenerateTemplates();
  30. }
  31. }
  32. namespace LuaBindingGenerator
  33. {
  34. void GenerateBindings()
  35. {
  36. }
  37. }
  38. namespace JSBindingGenerator
  39. {
  40. void GenerateBindings()
  41. {
  42. }
  43. }
  44. namespace CSBindingGenerator
  45. {
  46. void GenerateBindings()
  47. {
  48. }
  49. }
  50. int main(int argc, char* argv[])
  51. {
  52. #ifdef DEVELOP
  53. string inputDir = R"(G:/MyGames/urho3d_fork/build_vs/Source/Tools/BindingGenerator/generated/xml)";
  54. _sourceDir = R"(G:/MyGames/urho3d_fork/repo)";
  55. #else
  56. if (argc != 3)
  57. return -1;
  58. string inputDir = argv[1];
  59. _sourceDir = argv[2];
  60. #endif
  61. auto start = chrono::high_resolution_clock::now();
  62. SourceData::LoadAllXmls(inputDir);
  63. auto end = chrono::high_resolution_clock::now();
  64. cout << "Loaded in " << chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms\n";
  65. start = chrono::high_resolution_clock::now();
  66. ASBindingGenerator::GenerateBindings();
  67. end = chrono::high_resolution_clock::now();
  68. cout << "Generated in " << chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms\n";
  69. LuaBindingGenerator::GenerateBindings();
  70. JSBindingGenerator::GenerateBindings();
  71. CSBindingGenerator::GenerateBindings();
  72. return 0;
  73. }