Main.cpp 2.7 KB

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