Configurations_clang.cmake 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. ly_append_configurations_options(
  10. DEFINES_PROFILE
  11. _FORTIFY_SOURCE=2
  12. DEFINES_RELEASE
  13. _FORTIFY_SOURCE=2
  14. COMPILATION
  15. -Wno-reorder-ctor
  16. -Wno-logical-not-parentheses
  17. -Wno-logical-op-parentheses
  18. -Wno-switch
  19. -Wno-undefined-var-template
  20. -Wno-inconsistent-missing-override
  21. -Wno-parentheses
  22. -Wno-unused-parameter
  23. -Wno-sign-compare
  24. -Wno-ignored-qualifiers
  25. -Wno-missing-field-initializers
  26. # disable warning introduced by -fsized-deallocation, pybind11 used.
  27. -Wno-unknown-argument
  28. /fp:fast # allows the compiler to reorder, combine, or simplify floating-point operations to optimize floating-point code for speed and space
  29. /Gd # Use _cdecl calling convention for all functions
  30. /MP # Multicore compilation in Visual Studio
  31. /nologo # Suppress Copyright and version number message
  32. /W4 # Warning level 4
  33. /WX # Warnings as errors
  34. /permissive- # Conformance with standard
  35. /Zc:preprocessor # Forces preprocessor into conformance mode: https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170
  36. /Zc:forScope # Force Conformance in for Loop Scope
  37. /diagnostics:caret # Compiler diagnostic options: includes the column where the issue was found and places a caret (^) under the location in the line of code where the issue was detected.
  38. /Zc:__cplusplus
  39. /bigobj # Increase number of sections in obj files. Profiling has shown no meaningful impact in memory nore build times
  40. /GS # Enable Buffer security check
  41. /sdl
  42. COMPILATION_DEBUG
  43. /MDd # defines _DEBUG, _MT, and _DLL and causes the application to use the debug multithread-specific and DLL-specific version of the run-time library.
  44. # It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
  45. /Ob0 # Disables inline expansions
  46. /Od # Disables optimization
  47. COMPILATION_PROFILE
  48. /GF # Enable string pooling
  49. /Gy # Function level linking
  50. /MD # Causes the application to use the multithread-specific and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler
  51. # to place the library name MSVCRT.lib into the .obj file.
  52. /O2 # Maximinize speed, equivalent to /Og /Oi /Ot /Oy /Ob2 /GF /Gy
  53. /Zc:inline # Removes unreferenced functions or data that are COMDATs or only have internal linkage
  54. /Zc:wchar_t # Use compiler native wchar_t
  55. /Zi # Generate debugging information (no Edit/Continue)
  56. COMPILATION_RELEASE
  57. /Ox # Full optimization
  58. /Ob2 # Inline any suitable function
  59. /Ot # Favor fast code over small code
  60. /Oi # Use Intrinsic Functions
  61. /Oy # Omit the frame pointer
  62. LINK
  63. /NOLOGO # Suppress Copyright and version number message
  64. /IGNORE:4099 # 3rdParty linking produces noise with LNK4099
  65. LINK_NON_STATIC_PROFILE
  66. /OPT:REF # Eliminates functions and data that are never referenced
  67. /OPT:ICF # Perform identical COMDAT folding. Redundant COMDATs can be removed from the linker output
  68. /INCREMENTAL:NO
  69. /DEBUG # Generate pdbs
  70. LINK_NON_STATIC_RELEASE
  71. /OPT:REF # Eliminates functions and data that are never referenced
  72. /OPT:ICF # Perform identical COMDAT folding. Redundant COMDATs can be removed from the linker output
  73. /INCREMENTAL:NO
  74. )
  75. if(LY_BUILD_WITH_ADDRESS_SANITIZER)
  76. ly_append_configurations_options(
  77. COMPILATION_DEBUG
  78. -fsanitize=address
  79. -fno-omit-frame-pointer
  80. LINK_NON_STATIC_DEBUG
  81. -shared-libsan
  82. -fsanitize=address
  83. )
  84. endif()
  85. include(cmake/Platform/Common/TargetIncludeSystemDirectories_supported.cmake)