From 37f652206b580e2f174f3e49753b2f702e9c932a Mon Sep 17 00:00:00 2001 From: Nicky Date: Thu, 7 Apr 2022 02:41:35 +0200 Subject: Using Ninja leads to subtly different path than using a multi config generate like xcode or visual studio. --- indra/cmake/Linking.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 3cb235a9d5..d3e82f8c3a 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -18,6 +18,11 @@ elseif (LINUX) elseif (DARWIN) set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") + if( ${CMAKE_GENERATOR} STREQUAL "Ninja") + set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/${CMAKE_BUILD_TYPE} ") + else() + set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") + endif() endif (WINDOWS) # Autobuild packages must provide 'release' versions of libraries, but may provide versions for @@ -30,7 +35,13 @@ endif (WINDOWS) if(WINDOWS OR DARWIN) # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us # fortunately both windows and darwin are case insensitive filesystems so this works. - set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") + # Ninja on the other hand needs the the full path + if( ${CMAKE_GENERATOR} STREQUAL "Ninja") + string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) + set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}) + else() + set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") + endif() else(WINDOWS OR DARWIN) # else block is for linux and any other makefile based generators string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) -- 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/Linking.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index d3e82f8c3a..4a57a6a3ef 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -1,8 +1,6 @@ # -*- cmake -*- -if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") - +include_guard() include(Variables) set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) @@ -86,4 +84,3 @@ endif (WINDOWS) mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -- cgit v1.2.3 From bb85651d987a6cb969de7dd7c2b130411de6203c Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 15:29:02 +0200 Subject: Create a new target ll::oslibrary to link against libs specific to the OS compiled on. This gets rid of the a few OS specific set and uses variables (which some even seemed mostly duplicate like WINDOWS_LIBRARIES ans UI_LIBRARIES) and it also solves the problem of having them to tack on every target, as of no they come as a transitive dependency from llcommon --- indra/cmake/Linking.cmake | 70 +++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 26 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 4a57a6a3ef..ccbb27ca42 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -55,32 +55,50 @@ endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) +create_target(ll::oslibraries) + if (LINUX) - set(DL_LIBRARY dl) - set(PTHREAD_LIBRARY pthread) -else (LINUX) - set(DL_LIBRARY "") - set(PTHREAD_LIBRARY "") -endif (LINUX) + set_target_libraries( ll::oslibraries + dl + pthread + rt) +elseif (WINDOWS) + set_target_libraries( ll::oslibraries + advapi32 + shell32 + ws2_32 + mswsock + psapi + winmm + netapi32 + wldap32 + gdi32 + user32 + ole32 + dbghelp + legacy_stdio_definitions + ) +else() + include(CMakeFindFrameworks) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(CARBON_LIBRARY Carbon) + find_library(COCOA_LIBRARY Cocoa) + find_library(IOKIT_LIBRARY IOKit) + + find_library(AGL_LIBRARY AGL) + find_library(APPKIT_LIBRARY AppKit) + find_library(COREAUDIO_LIBRARY CoreAudio) + + set_target_libraries( ll::oslibraries + ${COCOA_LIBRARY} + ${IOKIT_LIBRARY} + ${COREFOUNDATION_LIBRARY} + ${CARBON_LIBRARY} + ${AGL_LIBRARY} + ${APPKITT_LIBRARY} + ${COREAUDIO_LIBRARY} + ) +endif() + -if (WINDOWS) - set(WINDOWS_LIBRARIES - advapi32 - shell32 - ws2_32 - mswsock - psapi - winmm - netapi32 - wldap32 - gdi32 - user32 - ole32 - dbghelp - ) -else (WINDOWS) - set(WINDOWS_LIBRARIES "") -endif (WINDOWS) - -mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) -- cgit v1.2.3 From b9f94c08977ff76f41a32a2bb9f25883e578eea3 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 15:33:32 +0200 Subject: Now there is a oslibrary target get rid of some more obsolete vars: LEGACY_STDIO_LIBS (was only used for Windows) PTHREAD_LIBRARY (only Linux) LLDATABASE_LIBRARIES (that one was supposed for Linux, but never needed anyway) --- indra/cmake/Linking.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index ccbb27ca42..4d99026dfc 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -88,7 +88,7 @@ else() find_library(AGL_LIBRARY AGL) find_library(APPKIT_LIBRARY AppKit) find_library(COREAUDIO_LIBRARY CoreAudio) - + set_target_libraries( ll::oslibraries ${COCOA_LIBRARY} ${IOKIT_LIBRARY} -- cgit v1.2.3 From 4c1ce6bd72803536445525130d4dd627910961a3 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 17:13:28 +0200 Subject: Fix a typo. --- indra/cmake/Linking.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 4d99026dfc..253c24f927 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -95,7 +95,7 @@ else() ${COREFOUNDATION_LIBRARY} ${CARBON_LIBRARY} ${AGL_LIBRARY} - ${APPKITT_LIBRARY} + ${APPKIT_LIBRARY} ${COREAUDIO_LIBRARY} ) endif() -- cgit v1.2.3 From 6d0bba9c03da0d8aca5e88fcb9289cb2f89f3467 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 17:32:14 +0200 Subject: Switch over to standard target_link_libraries (cmake requirements are high enough now). --- indra/cmake/Linking.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 253c24f927..7b89e8707f 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -58,12 +58,12 @@ link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) create_target(ll::oslibraries) if (LINUX) - set_target_libraries( ll::oslibraries + target_link_libraries( ll::oslibraries INTERFACE dl pthread rt) elseif (WINDOWS) - set_target_libraries( ll::oslibraries + target_link_libraries( ll::oslibraries INTERFACE advapi32 shell32 ws2_32 @@ -89,7 +89,7 @@ else() find_library(APPKIT_LIBRARY AppKit) find_library(COREAUDIO_LIBRARY CoreAudio) - set_target_libraries( ll::oslibraries + target_link_libraries( ll::oslibraries INTERFACE ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} -- cgit v1.2.3 From 363f2df4fa22b3eb95ff4603d73b7a042f3fefd1 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:28:55 +0200 Subject: Remove function create_target and instead directly use add_library --- indra/cmake/Linking.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 7b89e8707f..5a16776e57 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -55,7 +55,7 @@ endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) -create_target(ll::oslibraries) +add_library( ll::oslibraries INTERFACE IMPORTED ) if (LINUX) target_link_libraries( ll::oslibraries INTERFACE -- cgit v1.2.3 From 756a10eeace5891c17c6894b0df44f2b9b3ea078 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 1 May 2022 13:37:44 +0200 Subject: Simplify cmake files by uaing generator expressions and be more configuration specific, rather than staging files to Release and RelWithdebInfo all the time --- indra/cmake/Linking.cmake | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 5a16776e57..ecabd0c374 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -30,30 +30,8 @@ endif (WINDOWS) # windows) and CMAKE_BUILD_TYPE on Makefile based generators (like linux). The reason for this is # that CMAKE_BUILD_TYPE is essentially meaningless at configuration time for IDE generators and # CMAKE_CFG_INTDIR is meaningless at build time for Makefile generators -if(WINDOWS OR DARWIN) - # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us - # fortunately both windows and darwin are case insensitive filesystems so this works. - # Ninja on the other hand needs the the full path - if( ${CMAKE_GENERATOR} STREQUAL "Ninja") - string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) - set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}) - else() - set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") - endif() -else(WINDOWS OR DARWIN) - # else block is for linux and any other makefile based generators - string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) - set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}) -endif(WINDOWS OR DARWIN) - -if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") - # When we're building something other than Release, append the - # packages/lib/release directory to deal with autobuild packages that don't - # provide (e.g.) lib/debug libraries. - list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE}) -endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") -link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) +link_directories(${AUTOBUILD_INSTALL_DIR}/lib/$>) add_library( ll::oslibraries INTERFACE IMPORTED ) -- cgit v1.2.3 From db423fa972e70b647b53eeb5f1797e93facda37f Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 1 May 2022 13:53:22 +0200 Subject: ${AUTOBUILD_INSTALL_DIR}/lib/release is always needed as a fallback linking directory. --- indra/cmake/Linking.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index ecabd0c374..d0181c5122 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -32,6 +32,7 @@ endif (WINDOWS) # CMAKE_CFG_INTDIR is meaningless at build time for Makefile generators link_directories(${AUTOBUILD_INSTALL_DIR}/lib/$>) +link_directories(${AUTOBUILD_INSTALL_DIR}/lib/release) add_library( ll::oslibraries INTERFACE IMPORTED ) -- cgit v1.2.3 From 767464a2627036e8a16ac323c886e0a1712e0a5f Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 7 May 2022 02:19:51 +0200 Subject: Adapt gnerator expression usage to work on OSX. --- indra/cmake/Linking.cmake | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index d0181c5122..29aa6e89ea 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -7,21 +7,16 @@ set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) set(ARCH_PREBUILT_DIRS_PLUGINS ${AUTOBUILD_INSTALL_DIR}/plugins) set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) -if (WINDOWS) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) +if (WINDOWS OR DARWIN ) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$,$,>) + if( DARWIN ) + set( SHARED_LIB_STAGING_DIR ${SHARED_LIB_STAGING_DIR}/Resources) + endif() + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$,$,>) elseif (LINUX) set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) -elseif (DARWIN) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") - if( ${CMAKE_GENERATOR} STREQUAL "Ninja") - set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/${CMAKE_BUILD_TYPE} ") - else() - set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") - endif() -endif (WINDOWS) +endif () # Autobuild packages must provide 'release' versions of libraries, but may provide versions for # specific build types. AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then -- cgit v1.2.3 From 7a71cea15bcef59c7085657fba9ae6bdb058cc5b Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 17 Sep 2022 12:02:25 +0200 Subject: Workaround to keep old cmake versions limping around. --- indra/cmake/Linking.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 29aa6e89ea..5edb713cfa 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -8,7 +8,15 @@ set(ARCH_PREBUILT_DIRS_PLUGINS ${AUTOBUILD_INSTALL_DIR}/plugins) set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) if (WINDOWS OR DARWIN ) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$,$,>) + # Kludge for older cmake versions, 3.20+ is needed to use a genex in add_custom_command( OUTPUT ... ) + # Using this will work okay-ish, as Debug is not supported anyway. But for property multi config and also + # ninja support the genex version is preferred. + if(${CMAKE_VERSION} VERSION_LESS "3.20.0") + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/Release) + else() + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$,$,>) + endif() + if( DARWIN ) set( SHARED_LIB_STAGING_DIR ${SHARED_LIB_STAGING_DIR}/Resources) endif() -- cgit v1.2.3 From 7471788271174a673db10426b11db418928e1dd7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 17 Sep 2022 14:30:40 +0300 Subject: SL-17238 MacOS build does not recognize no-unused-but-set-variable --- indra/cmake/Linking.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/cmake/Linking.cmake') diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 5edb713cfa..4a501f420b 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -11,8 +11,12 @@ if (WINDOWS OR DARWIN ) # Kludge for older cmake versions, 3.20+ is needed to use a genex in add_custom_command( OUTPUT ... ) # Using this will work okay-ish, as Debug is not supported anyway. But for property multi config and also # ninja support the genex version is preferred. - if(${CMAKE_VERSION} VERSION_LESS "3.20.0") - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/Release) + if(${CMAKE_VERSION} VERSION_LESS "3.20.0") + if(CMAKE_BUILD_TYPE MATCHES Release) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/Release) + elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/RelWithDebInfo) + endif() else() set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$,$,>) endif() -- cgit v1.2.3