Configurations_linux_x86_64.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  9. include(cmake/Platform/Common/Clang/Configurations_clang.cmake)
  10. if(DEFINED LY_LINKER)
  11. set(SPECIFY_LINKER_FLAG "-fuse-ld=${LY_LINKER}")
  12. elseif(NOT ${LLD_LINKER_INSTALLED} STREQUAL "LLD_LINKER_INSTALLED-NOTFOUND")
  13. set(SPECIFY_LINKER_FLAG "-fuse-ld=lld")
  14. endif()
  15. if ($ENV{O3DE_SNAP})
  16. ly_append_configurations_options(
  17. DEFINES
  18. LINUX
  19. __linux__
  20. LINUX64
  21. COMPILATION
  22. -msse4.1
  23. LINK_NON_STATIC
  24. ${SPECIFY_LINKER_FLAG}
  25. -Wl,--no-undefined
  26. -fpie
  27. -Wl,-z,relro,-z,now
  28. -Wl,-z,noexecstack
  29. -L$ENV{SNAP}/lib/x86_64-linux-gnu
  30. -L$ENV{SNAP}/usr/lib/x86_64-linux-gnu
  31. LINK_EXE
  32. ${SPECIFY_LINKER_FLAG}
  33. -fpie
  34. -Wl,-z,relro,-z,now
  35. -Wl,-z,noexecstack
  36. -Wl,--disable-new-dtags
  37. -L$ENV{SNAP}/lib/x86_64-linux-gnu
  38. -L$ENV{SNAP}/usr/lib/x86_64-linux-gnu
  39. )
  40. else()
  41. ly_append_configurations_options(
  42. DEFINES
  43. LINUX
  44. __linux__
  45. LINUX64
  46. COMPILATION
  47. -msse4.1
  48. LINK_NON_STATIC
  49. ${SPECIFY_LINKER_FLAG}
  50. -Wl,--no-undefined
  51. -fpie
  52. -Wl,-z,relro,-z,now
  53. -Wl,-z,noexecstack
  54. LINK_EXE
  55. ${SPECIFY_LINKER_FLAG}
  56. -fpie
  57. -Wl,-z,relro,-z,now
  58. -Wl,-z,noexecstack
  59. -Wl,--disable-new-dtags
  60. )
  61. endif()
  62. ly_set(CMAKE_CXX_EXTENSIONS OFF)
  63. elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  64. include(cmake/Platform/Common/GCC/Configurations_gcc.cmake)
  65. if(LY_GCC_BUILD_FOR_GCOV)
  66. set(LY_GCC_GCOV_LFLAGS "-lgcov")
  67. endif()
  68. if(LY_GCC_BUILD_FOR_GPROF)
  69. set(LY_GCC_GPROF_LFLAGS "-pg")
  70. endif()
  71. ly_append_configurations_options(
  72. DEFINES
  73. LINUX
  74. __linux__
  75. LINUX64
  76. COMPILATION
  77. -msse4.1
  78. LINK_NON_STATIC
  79. ${LY_GCC_GCOV_LFLAGS}
  80. ${LY_GCC_GPROF_LFLAGS}
  81. -Wl,--no-undefined
  82. -lpthread
  83. )
  84. ly_set(CMAKE_CXX_EXTENSIONS OFF)
  85. else()
  86. message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported in ${PAL_PLATFORM_NAME}")
  87. endif()
  88. ly_set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
  89. ly_set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  90. ly_set(CMAKE_INSTALL_RPATH "$ORIGIN")