PALTools.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # PlatformTools enables to deal with tools that perform functionality cross-platform
  9. # For example, the AssetProcessor can generate assets for other platforms. For the
  10. # asset processor to be able to provide that, it requires to have the funcionality enabled.
  11. # This cmake file provides an entry point to discover variables that will allow to enable
  12. # the different platforms and variables that can be passed to enable those platforms to the
  13. # code.
  14. # Discover all the platforms that are available
  15. set(LY_PAL_TOOLS_DEFINES)
  16. file(GLOB pal_tools_files "cmake/Platform/*/PALTools_*.cmake")
  17. foreach(pal_tools_file ${pal_tools_files})
  18. include(${pal_tools_file})
  19. endforeach()
  20. file(GLOB pal_restricted_tools_files "restricted/*/cmake/PALTools_*.cmake")
  21. foreach(pal_restricted_tools_file ${pal_restricted_tools_files})
  22. include(${pal_restricted_tools_file})
  23. endforeach()
  24. # Set the AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS macro using the aggregate of all the LY_PAL_TOOLS_RESTRICTED_PLATFORM_DEFINES variable
  25. if(LY_PAL_TOOLS_RESTRICTED_PLATFORM_DEFINES)
  26. list(JOIN LY_PAL_TOOLS_RESTRICTED_PLATFORM_DEFINES " " RESTRICTED_PLATFORM_DEFINES_MACRO)
  27. list(APPEND LY_PAL_TOOLS_DEFINES "AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS=${RESTRICTED_PLATFORM_DEFINES_MACRO}")
  28. endif()
  29. ly_set(LY_PAL_TOOLS_DEFINES ${LY_PAL_TOOLS_DEFINES})
  30. # Include files to the CMakeFiles project
  31. foreach(enabled_platform ${LY_PAL_TOOLS_ENABLED})
  32. string(TOLOWER ${enabled_platform} enabled_platform_lowercase)
  33. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Platform/${enabled_platform})
  34. ly_include_cmake_file_list(${pal_dir}/pal_tools_${enabled_platform_lowercase}_files.cmake)
  35. endforeach()
  36. function(ly_get_pal_tool_dirs out_list pal_path)
  37. set(pal_paths "")
  38. foreach(platform ${LY_PAL_TOOLS_ENABLED})
  39. o3d_pal_dir(path ${pal_path}/${platform} ${O3DE_ENGINE_RESTRICTED_PATH} ${LY_ROOT_FOLDER})
  40. list(APPEND pal_paths ${path})
  41. endforeach()
  42. set(${out_list} ${pal_paths} PARENT_SCOPE)
  43. endfunction()