12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #
- # Copyright (c) Contributors to the Open 3D Engine Project.
- # For complete copyright and license terms please see the LICENSE at the root of this distribution.
- #
- # SPDX-License-Identifier: Apache-2.0 OR MIT
- #
- #
- # Generated by O3DE
- include(FindPackageHandleStandardArgs)
- # This will be called from within the installed engine's CMakeLists.txt
- macro(ly_find_o3de_packages)
- if(LY_MONOLITHIC_GAME)
- set(monolithic_file "${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Monolithic/o3de_subdirectories_${PAL_PLATFORM_NAME_LOWERCASE}.cmake")
- if(NOT EXISTS ${monolithic_file})
- message(FATAL_ERROR "O3DE SDK was not generated to support monolithic builds")
- endif()
- include("${monolithic_file}")
- else()
- include("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Default/o3de_subdirectories_${PAL_PLATFORM_NAME_LOWERCASE}.cmake")
- endif()
- find_package(LauncherGenerator)
- endmacro()
- function(o3de_current_file_path path)
- set(${path} ${CMAKE_CURRENT_FUNCTION_LIST_DIR} PARENT_SCOPE)
- endfunction()
- o3de_current_file_path(find_o3de_path)
- cmake_path(SET engine_root_folder NORMALIZE ${find_o3de_path}/..)
- set_property(GLOBAL PROPERTY O3DE_ENGINE_ROOT_FOLDER "${engine_root_folder}")
- # If the generation of the SDK layout had LY_DISABLE_TEST_MODULES cache variable set,
- # then the PAL_TRAIT_BUILD_TESTS_SUPPORTED value needs to be propagated as FALSE
- set(disable_test_modules @LY_DISABLE_TEST_MODULES@)
- if (disable_test_modules)
- set_property(GLOBAL PROPERTY PAL_TRAIT_BUILD_TESTS_SUPPORTED_DEFAULT FALSE)
- else()
- set_property(GLOBAL PROPERTY PAL_TRAIT_BUILD_TESTS_SUPPORTED_DEFAULT TRUE)
- endif()
- if ($ENV{O3DE_SNAP})
- list(APPEND CMAKE_REQUIRED_INCLUDES "$ENV{SNAP}/usr/include;$ENV{SNAP}/usr/include/x86_64-linux-gnu")
- list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "Wl,-L$ENV{SNAP}/usr/lib/x86_64-linux-gnu")
- list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-print-target-triple")
- endif()
- # Inject the CompilerSettings.cmake to be included before the project command
- set(CMAKE_PROJECT_INCLUDE_BEFORE "${engine_root_folder}cmake/CompilerSettings.cmake")
- # We are using the engine's CMakeLists.txt to handle initialization/importing targets
- # Since this is external to the project's source, we need to specify an output directory
- # even though we don't build
- macro(o3de_initialize)
- set(INSTALLED_ENGINE TRUE)
- set(LY_PROJECTS ${CMAKE_SOURCE_DIR})
- o3de_current_file_path(current_path)
- add_subdirectory(${current_path}/.. o3de)
- endmacro()
|