Main.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // Copyright (c) 2008-2020 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #include <string>
  23. using namespace std;
  24. //#define DEVELOP
  25. namespace SourceData
  26. {
  27. void LoadAllXmls(const string& dir);
  28. }
  29. namespace ASBindingGenerator
  30. {
  31. void ProcessAllEnums();
  32. void ProcessAllClasses(const string& outputBasePath);
  33. void ProcessAllClassesNew();
  34. void ProcessAllGlobalVariables();
  35. void ProcessAllGlobalFunctions();
  36. void SaveResult(const string& outputBasePath);
  37. void GenerateTemplates(const string& outputBasePath);
  38. void GenerateBindings(const string& outputBasePath)
  39. {
  40. ProcessAllEnums();
  41. ProcessAllClasses(outputBasePath);
  42. ProcessAllClassesNew();
  43. ProcessAllGlobalVariables();
  44. ProcessAllGlobalFunctions();
  45. SaveResult(outputBasePath);
  46. GenerateTemplates(outputBasePath);
  47. }
  48. }
  49. namespace LuaBindingGenerator
  50. {
  51. void GenerateBindings(const string& outputBasePath)
  52. {
  53. }
  54. }
  55. namespace JSBindingGenerator
  56. {
  57. void GenerateBindings(const string& outputBasePath)
  58. {
  59. }
  60. }
  61. namespace CSBindingGenerator
  62. {
  63. void GenerateBindings(const string& outputBasePath)
  64. {
  65. }
  66. }
  67. int main(int argc, char* argv[])
  68. {
  69. #ifdef DEVELOP
  70. string inputDir = R"(G:/MyGames/Urho3DFork/Build/Source/Tools/BindingGenerator/generated/xml)";
  71. string outputBasePath = R"(G:/MyGames/Urho3DFork/Urho3D)";
  72. #else
  73. if (argc != 3)
  74. return -1;
  75. string inputDir = argv[1];
  76. string outputBasePath = argv[2];
  77. #endif
  78. SourceData::LoadAllXmls(inputDir);
  79. ASBindingGenerator::GenerateBindings(outputBasePath);
  80. LuaBindingGenerator::GenerateBindings(outputBasePath);
  81. JSBindingGenerator::GenerateBindings(outputBasePath);
  82. CSBindingGenerator::GenerateBindings(outputBasePath);
  83. return 0;
  84. }