main.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
  9. #include <source/Application.h>
  10. namespace PythonBindingsExample
  11. {
  12. //! This function returns the build system target name
  13. AZStd::string_view GetBuildTargetName()
  14. {
  15. #if !defined (LY_CMAKE_TARGET)
  16. #error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
  17. #endif
  18. return AZStd::string_view{ LY_CMAKE_TARGET };
  19. }
  20. }
  21. int main(int argc, char* argv[])
  22. {
  23. const AZ::Debug::Trace tracer;
  24. int runSuccess = 0;
  25. {
  26. PythonBindingsExample::Application application(&argc, &argv);
  27. // The AZ::ComponentApplication constructor creates the settings registry
  28. // so the CMake target name can be added at this point
  29. AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(
  30. *AZ::SettingsRegistry::Get(), PythonBindingsExample::GetBuildTargetName());
  31. application.SetUp();
  32. runSuccess = application.Run() ? 0 : 1;
  33. }
  34. return runSuccess;
  35. }