LauncherProject.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. // note that this is the only file pulled into a launcher target that has the
  9. // defines set such as LY_CMAKE_TARGET, and LY_PROJECT_NAME, other files come from a static library
  10. // which do not provide those defines.
  11. // note that the tests use a mock implementation of this file, see Tests/Test.cpp
  12. // If you modify this file or the interface launcher.h, make sure to update the mock implementation as well.
  13. #include <AzCore/std/string/string_view.h>
  14. #if defined(AZ_MONOLITHIC_BUILD)
  15. #include <StaticModules.inl>
  16. #endif // defined(AZ_MONOLITHIC_BUILD)
  17. namespace O3DELauncher
  18. {
  19. //! This file is to be added only to the ${project}.[Game|Server]Launcher build target
  20. //! This function returns the build system target name
  21. AZStd::string_view GetBuildTargetName()
  22. {
  23. #if !defined (LY_CMAKE_TARGET)
  24. #error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
  25. #endif
  26. return { LY_CMAKE_TARGET };
  27. }
  28. AZStd::string_view GetProjectName()
  29. {
  30. #if !defined (LY_PROJECT_NAME)
  31. #error "LY_PROJECT_NAME must be defined in order to for the Launcher to run using a Game Project"
  32. #endif
  33. return { LY_PROJECT_NAME };
  34. }
  35. bool IsGenericLauncher()
  36. {
  37. #if defined(O3DE_IS_GENERIC_LAUNCHER)
  38. return true;
  39. #else
  40. return false;
  41. #endif
  42. }
  43. }