summaryrefslogtreecommitdiff
path: root/indra/cmake/00-Common.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'indra/cmake/00-Common.cmake')
-rw-r--r--indra/cmake/00-Common.cmake168
1 files changed, 63 insertions, 105 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 0ab7fa2456..7be5e7b0a0 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -12,9 +12,7 @@
# Also realize that CMAKE_CXX_FLAGS may already be partially populated on
# entry to this file.
#*****************************************************************************
-
-if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
-set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
+include_guard()
include(Variables)
@@ -27,25 +25,22 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
# as well?
# Portable compilation flags.
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DADDRESS_SIZE=${ADDRESS_SIZE}")
+add_compile_definitions( ADDRESS_SIZE=${ADDRESS_SIZE})
# Configure crash reporting
set(RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in release builds")
set(NON_RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in developer builds")
if(RELEASE_CRASH_REPORTING)
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DLL_SEND_CRASH_REPORTS=1")
+ add_compile_definitions( LL_SEND_CRASH_REPORTS=1)
endif()
if(NON_RELEASE_CRASH_REPORTING)
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLL_SEND_CRASH_REPORTS=1")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLL_SEND_CRASH_REPORTS=1")
-endif()
-
-# Don't bother with a MinSizeRel build.
-set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING
- "Supported build types." FORCE)
+ add_compile_definitions( LL_SEND_CRASH_REPORTS=1)
+endif()
+# Don't bother with a MinSizeRel or Debug build.
+set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release" CACHE STRING "Supported build types." FORCE)
# Platform-specific compilation flags.
@@ -66,93 +61,86 @@ if (WINDOWS)
# CP changed to only append the flag for 32bit builds - on 64bit builds,
# locally at least, the build output is spammed with 1000s of 'D9002'
# warnings about this switch being ignored.
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if( ADDRESS_SIZE EQUAL 32 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /p:PreferredToolArchitecture=x64")
endif()
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
- "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zo"
- CACHE STRING "C++ compiler release-with-debug options" FORCE)
- set(CMAKE_CXX_FLAGS_RELEASE
- "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /Zo"
- CACHE STRING "C++ compiler release options" FORCE)
# zlib has assembly-language object files incompatible with SAFESEH
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE /SAFESEH:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099")
-
- set(CMAKE_CXX_STANDARD_LIBRARIES "")
- set(CMAKE_C_STANDARD_LIBRARIES "")
+ add_link_options(/LARGEADDRESSAWARE
+ /SAFESEH:NO
+ /NODEFAULTLIB:LIBCMT
+ /IGNORE:4099)
add_definitions(
- /DNOMINMAX
+ -DNOMINMAX
# /DDOM_DYNAMIC # For shared library colladadom
)
add_compile_options(
- /GS
- /TP
- /W3
- /c
- /Zc:forScope
- /nologo
- /Oy-
-# /arch:SSE2
- /fp:fast
+ /Zo
+ /GS
+ /TP
+ /W3
+ /c
+ /Zc:forScope
+ /nologo
+ /Oy-
+ /fp:fast
+ /MP
)
# Nicky: x64 implies SSE2
if( ADDRESS_SIZE EQUAL 32 )
- add_definitions( /arch:SSE2 )
+ add_compile_options( /arch:SSE2 )
endif()
# Are we using the crummy Visual Studio KDU build workaround?
if (NOT VS_DISABLE_FATAL_WARNINGS)
- add_definitions(/WX)
+ add_compile_options(/WX)
endif (NOT VS_DISABLE_FATAL_WARNINGS)
+
+ #ND: When using something like buildcache (https://github.com/mbitsnbites/buildcache)
+ # to make those wrappers work /Zi must be changed to /Z7, as /Zi due to it's nature is not compatible with caching
+ if( ${CMAKE_CXX_COMPILER_LAUNCHER} MATCHES ".*cache.*")
+ add_compile_options( /Z7 )
+ string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ endif()
endif (WINDOWS)
if (LINUX)
set(CMAKE_SKIP_RPATH TRUE)
- add_definitions(-D_FORTIFY_SOURCE=2)
-
- set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-unused-but-set-variable -Wno-unused-variable ${CMAKE_CXX_FLAGS}")
-
- # gcc 4.3 and above don't like the LL boost and also
- # cause warnings due to our use of deprecated headers
- add_definitions(-Wno-parentheses)
-
- add_definitions(
- -D_REENTRANT
- )
+ add_compile_definitions(
+ _REENTRANT
+ _FORTIFY_SOURCE=2
+ EXTERNAL_TOS
+ APPID=secondlife
+ LL_IGNORE_SIGCHLD
+ )
add_compile_options(
- -fexceptions
- -fno-math-errno
- -fno-strict-aliasing
- -fsigned-char
- -msse2
- -mfpmath=sse
- -pthread
- )
-
- # force this platform to accept TOS via external browser
- add_definitions(-DEXTERNAL_TOS)
+ -fexceptions
+ -fno-math-errno
+ -fno-strict-aliasing
+ -fsigned-char
+ -msse2
+ -mfpmath=sse
+ -pthread
+ -Wno-parentheses
+ -Wno-deprecated
+ -fvisibility=hidden
+ )
- add_definitions(-DAPPID=secondlife)
- add_compile_options(-fvisibility=hidden)
- # 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_definitions(-DLL_IGNORE_SIGCHLD)
if (ADDRESS_SIZE EQUAL 32)
add_compile_options(-march=pentium4)
endif (ADDRESS_SIZE EQUAL 32)
- #add_compile_options(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
- if (NOT USESYSTEMLIBS)
- # 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")
- endif (NOT USESYSTEMLIBS)
+
+ # 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}")
endif (LINUX)
@@ -183,47 +171,17 @@ if (DARWIN)
##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.")
endif (DARWIN)
-
if (LINUX OR DARWIN)
- if (CMAKE_CXX_COMPILER MATCHES ".*clang")
- set(CMAKE_COMPILER_IS_CLANGXX 1)
- endif (CMAKE_CXX_COMPILER MATCHES ".*clang")
-
- if (CMAKE_COMPILER_IS_GNUCXX)
- set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs")
- elseif (CMAKE_COMPILER_IS_CLANGXX)
- set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs")
- endif()
+ set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs)
if (NOT GCC_DISABLE_FATAL_WARNINGS)
- set(GCC_WARNINGS "${GCC_WARNINGS} -Werror")
+ list(APPEND GCC_WARNINGS -Werror)
endif (NOT GCC_DISABLE_FATAL_WARNINGS)
- set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder -Wno-non-virtual-dtor")
+ list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor -Wno-unused-but-set-variable -Wno-unused-variable )
- set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
- set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
-
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ADDRESS_SIZE}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${ADDRESS_SIZE}")
+ add_compile_options(${GCC_WARNINGS})
+ add_compile_options(-m${ADDRESS_SIZE})
endif (LINUX OR DARWIN)
-if (USESYSTEMLIBS)
- add_definitions(-DLL_USESYSTEMLIBS=1)
-
- if (LINUX AND ADDRESS_SIZE EQUAL 32)
- add_definitions(-march=pentiumpro)
- endif (LINUX AND ADDRESS_SIZE EQUAL 32)
-
-else (USESYSTEMLIBS)
- set(${ARCH}_linux_INCLUDES
- atk-1.0
- glib-2.0
- gstreamer-0.10
- gtk-2.0
- pango-1.0
- )
-endif (USESYSTEMLIBS)
-
-endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)