main.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #if defined(AB_BATCH_MODE)
  9. #include <source/utils/applicationManager.h>
  10. #else
  11. #include <source/utils/GUIApplicationManager.h>
  12. #include <AzQtComponents/Utilities/QtPluginPaths.h>
  13. #endif
  14. #if defined(AZ_TESTS_ENABLED)
  15. #include <AzTest/AzTest.h>
  16. DECLARE_AZ_UNIT_TEST_MAIN();
  17. #endif
  18. int main(int argc, char* argv[])
  19. {
  20. const AZ::Debug::Trace tracer;
  21. #if defined(AZ_TESTS_ENABLED)
  22. INVOKE_AZ_UNIT_TEST_MAIN();
  23. #endif
  24. int runSuccess = 0;
  25. {
  26. //This nested scope is necessary as the applicationManager needs to have its destructor called BEFORE you destroy the allocators
  27. #if defined(AB_BATCH_MODE)
  28. AssetBundler::ApplicationManager applicationManager(&argc, &argv);
  29. #else
  30. // Must be called before using any Qt, or the app won't be able to locate Qt libs
  31. AzQtComponents::PrepareQtPaths();
  32. AssetBundler::GUIApplicationManager applicationManager(&argc, &argv);
  33. #endif
  34. if (!applicationManager.Init())
  35. {
  36. AZ_Error("AssetBundler", false, "AssetBundler initialization failed");
  37. runSuccess = 1;
  38. }
  39. else
  40. {
  41. runSuccess = applicationManager.Run() ? 0 : 1;
  42. }
  43. }
  44. return runSuccess;
  45. }