From 786b291d9c6b784c7ce6ceef0e38a4ec76ea14db Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 16:32:52 +0200 Subject: Move CMake files to modernized cmake syntax, step 1. Change projects to cmake targetsto get rid of havig to hardcore include directories and link libraries in consumer projects. --- indra/cmake/00-Common.cmake | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 0ab7fa2456..45c81b1b30 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -70,12 +70,6 @@ if (WINDOWS) 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") @@ -87,15 +81,16 @@ if (WINDOWS) # /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 ) # Nicky: x64 implies SSE2 -- cgit v1.2.3 From 248b6a25841fd2ceb07e04cb532b64b4238da83c Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 23:28:33 +0200 Subject: Don't bother with debug builds,, they are long deprecated. --- indra/cmake/00-Common.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 45c81b1b30..e8c956bce3 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -42,9 +42,8 @@ if(NON_RELEASE_CRASH_REPORTING) 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) +# 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. -- cgit v1.2.3 From 37595f90f9f45efc27409795a9b8c21486518882 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 9 Apr 2022 19:05:58 +0200 Subject: Cleanup ... use the appropriate functions to set options. Before this everythig was over the place how it was set, worse even with wrong functions like: - add_definitions( /arch:SSE2 ) - add_definitions(/WX) Those are each options to cl, not definitons. --- indra/cmake/00-Common.cmake | 97 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 50 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index e8c956bce3..4f0a6063db 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -27,25 +27,23 @@ 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() + 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. if (WINDOWS) @@ -65,22 +63,20 @@ 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() # 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( - /Zo /GS /TP @@ -90,57 +86,61 @@ if (WINDOWS) /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( + -D_REENTRANT + -D_FORTIFY_SOURCE=2 + -DEXTERNAL_TOS + -DAPPID=secondlife + -DLL_IGNORE_SIGCHLD + ) add_compile_options( - -fexceptions - -fno-math-errno - -fno-strict-aliasing - -fsigned-char - -msse2 - -mfpmath=sse - -pthread - ) + -fexceptions + -fno-math-errno + -fno-strict-aliasing + -fsigned-char + -msse2 + -mfpmath=sse + -pthread + -Wno-parentheses + -Wno-deprecated + -Wno-unused-but-set-variable + -Wno-unused-variable + -fvisibility=hidden + ) - # force this platform to accept TOS via external browser - add_definitions(-DEXTERNAL_TOS) - - 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) @@ -195,11 +195,8 @@ if (LINUX OR DARWIN) set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder -Wno-non-virtual-dtor") - 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_CXX_WARNINGS}) + add_compile_options(-m${ADDRESS_SIZE}) endif (LINUX OR DARWIN) @@ -207,7 +204,7 @@ if (USESYSTEMLIBS) add_definitions(-DLL_USESYSTEMLIBS=1) if (LINUX AND ADDRESS_SIZE EQUAL 32) - add_definitions(-march=pentiumpro) + add_compile_options(-march=pentiumpro) endif (LINUX AND ADDRESS_SIZE EQUAL 32) else (USESYSTEMLIBS) -- cgit v1.2.3 From d01e81f4d122a1f8942f1b296b5d3a4d1cc22ec3 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 9 Apr 2022 23:40:22 +0200 Subject: Fix warning supression for Linux/OSX, this was broken after the first round of cmake changes on Windows. -Wno-unused-but-set-variable/-Wno-unused-variable moved from just Linux to also OSX (clang) as there's a lot of those in the code where newer xcode complains. Fixing all those places is going beyond the scope of modernizing cmake. --- indra/cmake/00-Common.cmake | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 4f0a6063db..d203d43545 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -132,8 +132,6 @@ if (LINUX) -pthread -Wno-parentheses -Wno-deprecated - -Wno-unused-but-set-variable - -Wno-unused-variable -fvisibility=hidden ) @@ -183,19 +181,15 @@ if (LINUX OR DARWIN) 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 ) - add_compile_options(${GCC_CXX_WARNINGS}) + add_compile_options(${GCC_WARNINGS}) add_compile_options(-m${ADDRESS_SIZE}) endif (LINUX OR DARWIN) -- cgit v1.2.3 From d3521b4462195cfe882b2cc8eb4e7c5e948c0fb6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 10:28:46 +0200 Subject: Remove obsolete and unmaintained USE_SYSTEMLIBS --- indra/cmake/00-Common.cmake | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index d203d43545..54b74b14fb 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -139,12 +139,10 @@ if (LINUX) add_compile_options(-march=pentium4) endif (ADDRESS_SIZE EQUAL 32) - 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) @@ -194,21 +192,12 @@ if (LINUX OR DARWIN) endif (LINUX OR DARWIN) -if (USESYSTEMLIBS) - add_definitions(-DLL_USESYSTEMLIBS=1) - - if (LINUX AND ADDRESS_SIZE EQUAL 32) - add_compile_options(-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) +set(${ARCH}_linux_INCLUDES + atk-1.0 + glib-2.0 + gstreamer-0.10 + gtk-2.0 + pango-1.0 + ) endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -- cgit v1.2.3 From 241919e7f7986c11586a49bff53cf19c2c0e0ea6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 19:21:55 +0200 Subject: Rework cmake, the original plan was to maybe be able to use conan targets with the same name (that's why 3ps had names like apr::apr), but it's safer and saner to put the LL 3ps under the ll:: prefix. This also allows means it is possible to get rid of that bad "if( TRAGET ...) return() endif()" pattern and rather use include_guard(). --- indra/cmake/00-Common.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 54b74b14fb..ec0e195b56 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) @@ -200,4 +198,3 @@ set(${ARCH}_linux_INCLUDES pango-1.0 ) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -- cgit v1.2.3 From 3eec716b240167cda6a5c652584152af8756b56d Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 17:17:32 +0200 Subject: Do not use ${ARCH}_linux_INCLUDES atm --- indra/cmake/00-Common.cmake | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index ec0e195b56..5320fc193c 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -190,11 +190,3 @@ if (LINUX OR DARWIN) endif (LINUX OR DARWIN) -set(${ARCH}_linux_INCLUDES - atk-1.0 - glib-2.0 - gstreamer-0.10 - gtk-2.0 - pango-1.0 - ) - -- cgit v1.2.3 From 1434b4ff96963854c96a7dc5f9d8475a97cc1184 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 19:35:27 +0200 Subject: Remove unused variable. --- indra/cmake/00-Common.cmake | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 5320fc193c..25ab731842 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -171,12 +171,7 @@ 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") - set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs) if (NOT GCC_DISABLE_FATAL_WARNINGS) -- cgit v1.2.3 From 4416db9a261443f48034a1c0a2457510cffd05b0 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 18 Apr 2022 03:08:46 +0200 Subject: Remvoe -D that had been passed in front of each entry of add_compile_definitions, this lead to '-D-D' --- indra/cmake/00-Common.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 25ab731842..7be5e7b0a0 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -114,11 +114,11 @@ if (LINUX) set(CMAKE_SKIP_RPATH TRUE) add_compile_definitions( - -D_REENTRANT - -D_FORTIFY_SOURCE=2 - -DEXTERNAL_TOS - -DAPPID=secondlife - -DLL_IGNORE_SIGCHLD + _REENTRANT + _FORTIFY_SOURCE=2 + EXTERNAL_TOS + APPID=secondlife + LL_IGNORE_SIGCHLD ) add_compile_options( -fexceptions -- cgit v1.2.3 From 59f6062685efd4c52f06c526e52a9fa00ddfabeb Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 5 Jun 2022 16:15:00 +0200 Subject: Bring back comments for EXTERNAL_TOS and LL_IGNORE_SIGCHLD --- indra/cmake/00-Common.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 8c6ec9a6cc..279e7ca1b9 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -113,6 +113,14 @@ endif (WINDOWS) if (LINUX) set(CMAKE_SKIP_RPATH TRUE) + # EXTERNAL_TOS + # force this platform to accept TOS via external browser + + # 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 -- cgit v1.2.3