summaryrefslogtreecommitdiff
path: root/indra/cmake/00-Common.cmake
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-06-14 21:38:00 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-06-14 21:38:00 +0300
commitba6ac70596d9f866e15983a4e2fc1d4f3d82b2ec (patch)
treebe9eb80e356af346c17852c116ed481a7d911277 /indra/cmake/00-Common.cmake
parentf5e2708a0fc4e08d3d0a5dc393bbd4bac09e1c55 (diff)
parentc4fc76efefd12c7cb1224dc8a748da2958f4a7f0 (diff)
Merge branch 'release/maint-b' into marchcat/b-merge
# Conflicts: # .github/workflows/build.yaml # indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl # indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl # indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl # indra/newview/llfilepicker.cpp
Diffstat (limited to 'indra/cmake/00-Common.cmake')
-rw-r--r--indra/cmake/00-Common.cmake107
1 files changed, 69 insertions, 38 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 4471380c6b..68348cc9d2 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -15,6 +15,7 @@
include_guard()
include(Variables)
+include(Linker)
# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
@@ -110,51 +111,90 @@ if (WINDOWS)
add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif (WINDOWS)
-
if (LINUX)
- set(CMAKE_SKIP_RPATH TRUE)
-
- # EXTERNAL_TOS
- # force this platform to accept TOS via external browser
+ set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
+ set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib )
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--exclude-libs,ALL")
+
+ find_program(CCACHE_EXE ccache)
+ if(CCACHE_EXE AND NOT DISABLE_CCACHE)
+ set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE} )
+ set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE} )
+ endif()
- # LL_IGNORE_SIGCHLD
- # don't catch SIGCHLD in our base application class for the viewer - some of
- # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The
- # viewer doesn't need to catch SIGCHLD anyway.
+ # LL_IGNORE_SIGCHLD
+ # don't catch SIGCHLD in our base application class for the viewer - some of
+ # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The
+ # viewer doesn't need to catch SIGCHLD anyway.
add_compile_definitions(
_REENTRANT
- _FORTIFY_SOURCE=2
- EXTERNAL_TOS
APPID=secondlife
LL_IGNORE_SIGCHLD
)
+
+ if( ENABLE_ASAN )
+ add_compile_options(-U_FORTIFY_SOURCE
+ -fsanitize=address
+ --param asan-stack=0
+ )
+ add_link_options(-fsanitize=address)
+ else()
+ add_compile_definitions( _FORTIFY_SOURCE=2 )
+ endif()
+
add_compile_options(
- -fexceptions
- -fno-math-errno
- -fno-strict-aliasing
- -fsigned-char
- -msse2
- -mfpmath=sse
- -pthread
- -Wno-parentheses
- -Wno-deprecated
- -fvisibility=hidden
+ -fexceptions
+ -fno-math-errno
+ -fno-strict-aliasing
+ -fsigned-char
+ -msse2
+ -mfpmath=sse
+ -pthread
+ -fvisibility=hidden
+ )
+
+ set(GCC_CLANG_COMPATIBLE_WARNINGS
+ -Wno-parentheses
+ -Wno-deprecated
+ -Wno-c++20-compat
+ -Wno-pessimizing-move
+ )
+
+ set(CLANG_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ # Put clang specific warning configuration here
+ )
+
+ set(GCC_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ -Wno-dangling-pointer
)
- if (ADDRESS_SIZE EQUAL 32)
- add_compile_options(-march=pentium4)
- endif (ADDRESS_SIZE EQUAL 32)
+ add_link_options(
+ -Wl,--no-keep-memory
+ -Wl,--build-id
+ -Wl,--no-undefined
+ )
+ if (NOT GCC_DISABLE_FATAL_WARNINGS)
+ add_compile_options( -Werror )
+ endif (NOT GCC_DISABLE_FATAL_WARNINGS)
# this stops us requiring a really recent glibc at runtime
add_compile_options(-fno-stack-protector)
- # linking can be very memory-hungry, especially the final viewer link
- set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
- set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link
+ add_link_options(
+ -lstdc++
+ -lm
+ )
+ add_compile_options(${CLANG_WARNINGS})
+ else()
+ add_compile_options(${GCC_WARNINGS})
+ endif()
endif (LINUX)
-
if (DARWIN)
# Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default
set(CLANG_DISABLE_FATAL_WARNINGS OFF)
@@ -176,20 +216,11 @@ if (DARWIN)
# required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function
# see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library
add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
-endif (DARWIN)
-if (LINUX OR DARWIN)
set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs)
- if (NOT GCC_DISABLE_FATAL_WARNINGS)
- list(APPEND GCC_WARNINGS -Werror)
- endif (NOT GCC_DISABLE_FATAL_WARNINGS)
-
list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor )
add_compile_options(${GCC_WARNINGS})
add_compile_options(-m${ADDRESS_SIZE})
-endif (LINUX OR DARWIN)
-
-
-
+endif ()