Configurations_clang.cmake 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. include(cmake/Platform/Common/Configurations_common.cmake)
  9. # Exceptions are disabled by default. Use this to turn them on just for a specific target.
  10. set(O3DE_COMPILE_OPTION_ENABLE_EXCEPTIONS PUBLIC -fexceptions)
  11. # O3DE Sets visibility to hidden by default, requiring explicit export.
  12. # However, some 3rd Party libraries will not export any symbols with this setting
  13. # as they expect to be built with visibility set to default. Use this compile option
  14. # to turn visibility back to default for those 3rd Party targets ONLY.
  15. set(O3DE_COMPILE_OPTION_EXPORT_SYMBOLS PRIVATE -fvisibility=default)
  16. # By default, O3DE sets warning level 4 and sets warnings as errors. If you're pulling in
  17. # external code (from 3rd Party libraries) you can't really control whether they generate
  18. # warnings or not, and its usually out of scope to fix them. Add this compile option to
  19. # those 3rd Party targets ONLY.
  20. set(O3DE_COMPILE_OPTION_DISABLE_WARNINGS PRIVATE -w)
  21. ly_append_configurations_options(
  22. DEFINES_PROFILE
  23. _FORTIFY_SOURCE=2
  24. DEFINES_RELEASE
  25. _FORTIFY_SOURCE=2
  26. COMPILATION
  27. -fno-exceptions
  28. -fvisibility=hidden
  29. -fvisibility-inlines-hidden
  30. -Wall
  31. -Werror
  32. ###################
  33. # Disabled warnings (please do not disable any others without first consulting sig-build)
  34. ###################
  35. -Wno-inconsistent-missing-override # unfortunately there is no warning in MSVC to detect missing overrides,
  36. # MSVC's static analyzer can, but that is a different run that most developers are not aware of. A pass
  37. # was done to fix all hits. Leaving this disabled until there is a matching warning in MSVC.
  38. -Wrange-loop-analysis
  39. -Wno-unknown-warning-option # used as a way to mark warnings that are MSVC only
  40. -Wno-parentheses
  41. -Wno-reorder
  42. -Wno-switch
  43. -Wno-undefined-var-template
  44. -fno-relaxed-template-template-args
  45. -Wno-deprecated-no-relaxed-template-template-args
  46. ###################
  47. # Enabled warnings (that are disabled by default)
  48. ###################
  49. COMPILATION_DEBUG
  50. -O0 # No optimization
  51. -g # debug symbols
  52. -fno-inline # don't inline functions
  53. -fstack-protector-all # Enable stack protectors for all functions
  54. -fstack-check
  55. COMPILATION_PROFILE
  56. -O2
  57. -g # debug symbols
  58. -fstack-protector-all # Enable stack protectors for all functions
  59. -fstack-check
  60. COMPILATION_RELEASE
  61. -O2
  62. )
  63. if(LY_BUILD_WITH_ADDRESS_SANITIZER)
  64. ly_append_configurations_options(
  65. COMPILATION_DEBUG
  66. -fsanitize=address
  67. -fno-omit-frame-pointer
  68. LINK_NON_STATIC_DEBUG
  69. -shared-libsan
  70. -fsanitize=address
  71. )
  72. endif()
  73. include(cmake/Platform/Common/TargetIncludeSystemDirectories_supported.cmake)