Tuning.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // Copyright (c) 2008-2022 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. // Functions that users can change to affect the work BindingGenerator
  23. #include "XmlSourceData.h"
  24. #include "Tuning.h"
  25. #include "Utils.h"
  26. using namespace std;
  27. // Some parts of the engine are compiled only if there are defines
  28. string InsideDefine(const string& headerFile)
  29. {
  30. string dir = WithoutFileName(headerFile);
  31. if (dir == "../Network")
  32. return "URHO3D_NETWORK";
  33. if (dir == "../Database")
  34. return "URHO3D_DATABASE";
  35. if (dir == "../IK")
  36. return "URHO3D_IK";
  37. if (dir == "../Physics")
  38. return "URHO3D_PHYSICS";
  39. if (dir == "../Navigation")
  40. return "URHO3D_NAVIGATION";
  41. if (dir == "../Urho2D")
  42. return "URHO3D_URHO2D";
  43. return string();
  44. }
  45. // Users can prevent the automatic creation of bindings for certain files and dirs
  46. bool IsIgnoredHeader(const string& headerFile)
  47. {
  48. static vector<string> ignoredDirs = {
  49. "../AngelScript",
  50. //"../Container",
  51. "../LuaScript",
  52. "../Graphics/Direct3D11",
  53. "../Graphics/Direct3D9",
  54. "../Graphics/OpenGL",
  55. "../Database/ODBC",
  56. "../Database/SQLite",
  57. };
  58. static vector<string> ignoredHeaders = {
  59. //"../Graphics/Drawable.h",
  60. };
  61. if (CONTAINS(SourceData::ignoredHeaders_, headerFile))
  62. return true;
  63. if (CONTAINS(ignoredHeaders, headerFile))
  64. return true;
  65. string dir = WithoutFileName(headerFile);
  66. if (CONTAINS(ignoredDirs, dir))
  67. return true;
  68. return false;
  69. }