PAL_linux.cmake 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. ly_set(PAL_EXECUTABLE_APPLICATION_FLAG)
  9. ly_set(PAL_LINKOPTION_MODULE MODULE)
  10. ly_set(PAL_TRAIT_BUILD_HOST_GUI_TOOLS FALSE)
  11. ly_set(PAL_TRAIT_BUILD_HOST_TOOLS TRUE)
  12. ly_set(PAL_TRAIT_BUILD_SERVER_SUPPORTED TRUE)
  13. ly_set(PAL_TRAIT_BUILD_UNIFIED_SUPPORTED TRUE)
  14. ly_set(PAL_TRAIT_BUILD_UNITY_SUPPORTED TRUE)
  15. ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS)
  16. ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE)
  17. ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED TRUE)
  18. ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE)
  19. # Determine if tests are supported based on the PAL_TRAIT_BUILD_TESTS_SUPPORTED_DEFAULT global property
  20. get_property(is_test_supported_default_set GLOBAL PROPERTY PAL_TRAIT_BUILD_TESTS_SUPPORTED_DEFAULT SET)
  21. if (is_test_supported_default_set)
  22. get_property(test_supported_default GLOBAL PROPERTY PAL_TRAIT_BUILD_TESTS_SUPPORTED_DEFAULT)
  23. ly_set(PAL_TRAIT_BUILD_TESTS_SUPPORTED ${test_supported_default})
  24. else()
  25. ly_set(PAL_TRAIT_BUILD_TESTS_SUPPORTED TRUE)
  26. endif()
  27. # Test library support
  28. ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE)
  29. ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE)
  30. ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED TRUE)
  31. ly_set(PAL_TRAIT_TEST_PYTEST_SUPPORTED TRUE)
  32. ly_set(PAL_TRAIT_TEST_TARGET_TYPE MODULE)
  33. if ($ENV{O3DE_SNAP})
  34. list(APPEND CMAKE_PREFIX_PATH "$ENV{SNAP}/usr/lib/x86_64-linux-gnu")
  35. endif()
  36. get_property(O3DE_SCRIPT_ONLY GLOBAL PROPERTY "O3DE_SCRIPT_ONLY")
  37. if (O3DE_SCRIPT_ONLY)
  38. if (NOT CMAKE_CXX_COMPILER_ID)
  39. set(CMAKE_CXX_COMPILER_ID "Clang")
  40. set(CMAKE_C_COMPILER_ID "Clang")
  41. endif()
  42. endif()
  43. if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  44. ly_set(PAL_TRAIT_COMPILER_ID Clang)
  45. ly_set(PAL_TRAIT_COMPILER_ID_LOWERCASE clang)
  46. elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  47. ly_set(PAL_TRAIT_COMPILER_ID GCC)
  48. ly_set(PAL_TRAIT_COMPILER_ID_LOWERCASE gcc)
  49. else()
  50. message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported in ${PAL_PLATFORM_NAME}")
  51. endif()
  52. # Set the default asset type for deployment
  53. set(LY_ASSET_DEPLOY_ASSET_TYPE "linux" CACHE STRING "Set the asset type for deployment.")
  54. # Set the python cmd tool
  55. ly_set(LY_PYTHON_CMD ${CMAKE_CURRENT_SOURCE_DIR}/python/python.sh)
  56. # Compiler flag to export all symbols from a library
  57. ly_set(PAL_TRAIT_EXPORT_ALL_SYMBOLS_COMPILE_OPTIONS -fvisibility=default)
  58. # Set the default window manager that applications should be using on Linux
  59. # Note: Only ("xcb" or "wayland" should be considered)
  60. set(PAL_TRAIT_LINUX_WINDOW_MANAGER "xcb" CACHE STRING "Sets the Window Manager type to use when configuring Linux")
  61. set_property(CACHE PAL_TRAIT_LINUX_WINDOW_MANAGER PROPERTY STRINGS xcb wayland)
  62. # Use system default libunwind instead of maintaining an O3DE version for Linux
  63. include(${CMAKE_CURRENT_LIST_DIR}/libunwind_linux.cmake)
  64. # Use system default libzstd instead of maintaining an O3DE version for Linux
  65. include(${CMAKE_CURRENT_LIST_DIR}/libzstd_linux.cmake)