Main.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 GenerateBindings(const string& outputBasePath)
  38. {
  39. ProcessAllEnums();
  40. ProcessAllClasses(outputBasePath);
  41. ProcessAllClassesNew();
  42. ProcessAllGlobalVariables();
  43. ProcessAllGlobalFunctions();
  44. SaveResult(outputBasePath);
  45. }
  46. }
  47. namespace LuaBindingGenerator
  48. {
  49. void GenerateBindings(const string& outputBasePath)
  50. {
  51. }
  52. }
  53. namespace JSBindingGenerator
  54. {
  55. void GenerateBindings(const string& outputBasePath)
  56. {
  57. }
  58. }
  59. namespace CSBindingGenerator
  60. {
  61. void GenerateBindings(const string& outputBasePath)
  62. {
  63. }
  64. }
  65. int main(int argc, char* argv[])
  66. {
  67. #ifdef DEVELOP
  68. string inputDir = R"(G:/MyGames/Urho3DCurrent/Build/Source/Tools/BindingGenerator/generated/xml)";
  69. string outputBasePath = R"(G:/MyGames/Urho3DCurrent/Urho3D)";
  70. #else
  71. if (argc != 3)
  72. return -1;
  73. string inputDir = argv[1];
  74. string outputBasePath = argv[2];
  75. #endif
  76. SourceData::LoadAllXmls(inputDir);
  77. ASBindingGenerator::GenerateBindings(outputBasePath);
  78. LuaBindingGenerator::GenerateBindings(outputBasePath);
  79. JSBindingGenerator::GenerateBindings(outputBasePath);
  80. CSBindingGenerator::GenerateBindings(outputBasePath);
  81. return 0;
  82. }