diff options
Diffstat (limited to 'indra')
166 files changed, 1872 insertions, 3950 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 68f6e962ef..205ce402a0 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -4,22 +4,43 @@ # other commands to guarantee full compatibility # with the version specified ## 3.8 added VS_DEBUGGER_WORKING_DIRECTORY support -cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) +## 3.13/12 is needed for add_link_options/add_compile_definitions +## 3.14 added FILE CREATE_LINK +## 3.16 is needed for target_precompile_headers +## Nicky: Ideally we want at least 3.21 for good preset support +## We're not there yet, but once done, there is a kludge in Linking.cmake +# "if(${CMAKE_VERSION} VERSION_LESS "3.20.0")" that can also be removed +cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING "The root project/makefile/solution name. Defaults to SecondLife.") project(${ROOT_PROJECT_NAME}) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_BINARY_DIR}") + +include(conanbuildinfo OPTIONAL RESULT_VARIABLE USE_CONAN ) +if( USE_CONAN ) + set( USE_CONAN ON ) + set( USE_AUTOBUILD_3P OFF ) + conan_basic_setup(TARGETS NO_OUTPUT_DIRS) + add_compile_definitions(LL_USESYSTEMLIBS USE_CONAN NO_AUTOBUILD_3P) +else() + set( USE_CONAN OFF ) + set( USE_AUTOBUILD_3P ON ) +endif() + +# The viewer code base can now be successfully compiled with -std=c++14. But +# turning that on in the generic viewer-build-variables/variables file would +# potentially require tweaking each of our ~50 third-party library builds. +# Until we decide to set -std=c++14 in viewer-build-variables/variables, set +# it locally here: we want to at least prevent inadvertently reintroducing +# viewer code that would fail with C++14. +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) include(Variables) include(BuildVersion) -set(LEGACY_STDIO_LIBS) -if (WINDOWS) - set(LEGACY_STDIO_LIBS legacy_stdio_definitions) -endif (WINDOWS) - if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type. One of: Debug Release RelWithDebInfo" FORCE) @@ -59,8 +80,10 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llplugin) add_subdirectory(${LIBS_OPEN_PREFIX}llui) add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components) +if( LL_TESTS ) # Legacy C++ tests. Build always, run if LL_TESTS is true. add_subdirectory(${VIEWER_PREFIX}test) +endif() if (ENABLE_MEDIA_PLUGINS) # viewer media plugins @@ -72,7 +95,6 @@ if (LINUX) include(LLAppearanceUtility) add_subdirectory(${LLAPPEARANCEUTILITY_SRC_DIR} ${LLAPPEARANCEUTILITY_BIN_DIR}) endif (INSTALL_PROPRIETARY) - add_dependencies(viewer linux-crash-logger-strip-target) elseif (WINDOWS) # cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake if (EXISTS ${VIEWER_DIR}win_setup) @@ -87,12 +109,6 @@ if (WINDOWS) endif (EXISTS ${VIEWER_DIR}win_setup) endif (WINDOWS) -# sets the 'startup project' for debugging from visual studio. -set_property( - DIRECTORY ${VIEWER_PREFIX} - PROPERTY VS_STARTUP_PROJECT secondlife-bin - ) - if (USE_BUGSPLAT) if (BUGSPLAT_DB) message(STATUS "Building with BugSplat; database '${BUGSPLAT_DB}'") @@ -108,6 +124,12 @@ add_dependencies(viewer secondlife-bin) add_subdirectory(${VIEWER_PREFIX}doxygen EXCLUDE_FROM_ALL) +# sets the 'startup project' for debugging from visual studio. +set_property( + DIRECTORY ${VIEWER_PREFIX} + PROPERTY VS_STARTUP_PROJECT ${VIEWER_BINARY_NAME} + ) + if (LL_TESTS) # Define after the custom targets are created so # individual apps can add themselves as dependencies diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 572422d080..c848d00710 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 MinSizeRel or Debug builds. -set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release" CACHE STRING - "Supported build types." FORCE) + add_compile_definitions( LL_SEND_CRASH_REPORTS=1) +endif() +# Don't bother with a MinSizeRel or Debug builds. +set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release" CACHE STRING "Supported build types." FORCE) # Platform-specific compilation flags. @@ -66,98 +61,94 @@ 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() - # Preserve first-pass-through versions (ie no FORCE overwrite). Prevents recursive addition of /Zo (04/2021) - set(OG_CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} CACHE STRING "OG_CXX_FLAGS_RELEASE") - set(OG_CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} CACHE STRING "OG_CXX_FLAGS_RELWITHDEBINFO") - - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${OG_CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zo" - CACHE STRING "C++ compiler release-with-debug options" FORCE) - set(CMAKE_CXX_FLAGS_RELEASE - "${OG_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 - ) + # 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 + 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) @@ -173,13 +164,7 @@ if (DARWIN) # see Variables.cmake. string(REPLACE "-gdwarf-2" "-g${CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT}" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - # The viewer code base can now be successfully compiled with -std=c++14. But - # turning that on in the generic viewer-build-variables/variables file would - # potentially require tweaking each of our ~50 third-party library builds. - # Until we decide to set -std=c++14 in viewer-build-variables/variables, set - # it locally here: we want to at least prevent inadvertently reintroducing - # viewer code that would fail with C++14. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags} -std=c++14") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}") # NOTE: it's critical that the optimization flag is put in front. # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered. @@ -188,47 +173,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 ) - 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) diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index 9b64bc6160..8a0939c92c 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -1,54 +1,45 @@ include(Linking) include(Prebuilt) -set(APR_FIND_QUIETLY ON) -set(APR_FIND_REQUIRED ON) +include_guard() -set(APRUTIL_FIND_QUIETLY ON) -set(APRUTIL_FIND_REQUIRED ON) +add_library( ll::apr INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindAPR) -else (USESYSTEMLIBS) - use_prebuilt_binary(apr_suite) - if (WINDOWS) - if (LLCOMMON_LINK_SHARED) - set(APR_selector "lib") - else (LLCOMMON_LINK_SHARED) - set(APR_selector "") - endif (LLCOMMON_LINK_SHARED) - set(APR_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apr-1.lib - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib - ) - set(APRICONV_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apriconv-1.lib - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apriconv-1.lib - ) - set(APRUTIL_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES} - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES} - ) - elseif (DARWIN) - if (LLCOMMON_LINK_SHARED) - set(APR_selector "0.dylib") - set(APRUTIL_selector "0.dylib") - else (LLCOMMON_LINK_SHARED) - set(APR_selector "a") - set(APRUTIL_selector "a") - endif (LLCOMMON_LINK_SHARED) - set(APR_LIBRARIES libapr-1.${APR_selector}) - set(APRUTIL_LIBRARIES libaprutil-1.${APRUTIL_selector}) - set(APRICONV_LIBRARIES iconv) - else (WINDOWS) - set(APR_LIBRARIES apr-1) - set(APRUTIL_LIBRARIES aprutil-1) - set(APRICONV_LIBRARIES iconv) - endif (WINDOWS) - set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/apr-1) +use_system_binary( apr apr-util ) +use_prebuilt_binary(apr_suite) - if (LINUX) - list(APPEND APRUTIL_LIBRARIES uuid) - list(APPEND APRUTIL_LIBRARIES rt) - endif (LINUX) -endif (USESYSTEMLIBS) +if (WINDOWS) + if (LLCOMMON_LINK_SHARED) + set(APR_selector "lib") + else (LLCOMMON_LINK_SHARED) + set(APR_selector "") + endif (LLCOMMON_LINK_SHARED) + target_link_libraries( ll::apr INTERFACE + ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib + ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apriconv-1.lib + ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib + ) +elseif (DARWIN) + if (LLCOMMON_LINK_SHARED) + set(APR_selector "0.dylib") + set(APRUTIL_selector "0.dylib") + else (LLCOMMON_LINK_SHARED) + set(APR_selector "a") + set(APRUTIL_selector "a") + endif (LLCOMMON_LINK_SHARED) + + target_link_libraries( ll::apr INTERFACE + libapr-1.${APR_selector} + libaprutil-1.${APRUTIL_selector} + iconv + ) +else (WINDOWS) + target_link_libraries( ll::apr INTERFACE + apr-1 + aprutil-1 + iconv + uuid + rt + ) +endif (WINDOWS) +target_include_directories( ll::apr SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/apr-1 ) diff --git a/indra/cmake/Atmosphere.cmake b/indra/cmake/Atmosphere.cmake deleted file mode 100644 index 9c14df2a11..0000000000 --- a/indra/cmake/Atmosphere.cmake +++ /dev/null @@ -1,5 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) -use_prebuilt_binary(libatmosphere) -set(LIBATMOSPHERE_LIBRARIES atmosphere) -set(LIBATMOSPHERE_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/atmosphere) diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake index f95439245a..38547bb017 100644 --- a/indra/cmake/Audio.cmake +++ b/indra/cmake/Audio.cmake @@ -1,42 +1,16 @@ # -*- cmake -*- include(Prebuilt) -if (USESYSTEMLIBS) - include(FindPkgConfig) - pkg_check_modules(OGG REQUIRED ogg) - pkg_check_modules(VORBIS REQUIRED vorbis) - pkg_check_modules(VORBISENC REQUIRED vorbisenc) - pkg_check_modules(VORBISFILE REQUIRED vorbisfile) -else (USESYSTEMLIBS) - use_prebuilt_binary(ogg_vorbis) - set(VORBIS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) - set(VORBISENC_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) - set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) +include_guard() +add_library( ll::vorbis INTERFACE IMPORTED ) - if (WINDOWS) - set(OGG_LIBRARIES - optimized ogg_static - debug ogg_static_d) - set(VORBIS_LIBRARIES - optimized vorbis_static - debug vorbis_static_d) - set(VORBISENC_LIBRARIES - optimized vorbisenc_static - debug vorbisenc_static_d) - set(VORBISFILE_LIBRARIES - optimized vorbisfile_static - debug vorbisfile_static_d) - else (WINDOWS) - set(OGG_LIBRARIES ogg) - set(VORBIS_LIBRARIES vorbis) - set(VORBISENC_LIBRARIES vorbisenc) - set(VORBISFILE_LIBRARIES vorbisfile) - endif (WINDOWS) -endif (USESYSTEMLIBS) +use_system_binary(vorbis) +use_prebuilt_binary(ogg_vorbis) +target_include_directories( ll::vorbis SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) + +if (WINDOWS) + target_link_libraries(ll::vorbis INTERFACE ogg_static vorbis_static vorbisenc_static vorbisfile_static ) +else (WINDOWS) + target_link_libraries(ll::vorbis INTERFACE ogg vorbis vorbisenc vorbisfile ) +endif (WINDOWS) -link_directories( - ${VORBIS_LIBRARY_DIRS} - ${VORBISENC_LIBRARY_DIRS} - ${VORBISFILE_LIBRARY_DIRS} - ${OGG_LIBRARY_DIRS} - ) diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index e79dc33245..601a23a86d 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -1,105 +1,50 @@ # -*- cmake -*- include(Prebuilt) -set(Boost_FIND_QUIETLY ON) -set(Boost_FIND_REQUIRED ON) +include_guard() -if (USESYSTEMLIBS) - include(FindBoost) +add_library( ll::boost INTERFACE IMPORTED ) +if( USE_CONAN ) + target_link_libraries( ll::boost INTERFACE CONAN_PKG::boost ) + target_compile_definitions( ll::boost INTERFACE BOOST_ALLOW_DEPRECATED_HEADERS BOOST_BIND_GLOBAL_PLACEHOLDERS ) + return() +endif() - set(BOOST_CONTEXT_LIBRARY boost_context-mt) - set(BOOST_FIBER_LIBRARY boost_fiber-mt) - set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt) - set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt) - set(BOOST_REGEX_LIBRARY boost_regex-mt) - set(BOOST_SIGNALS_LIBRARY boost_signals-mt) - set(BOOST_SYSTEM_LIBRARY boost_system-mt) - set(BOOST_THREAD_LIBRARY boost_thread-mt) -else (USESYSTEMLIBS) - use_prebuilt_binary(boost) - set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) +use_prebuilt_binary(boost) - # As of sometime between Boost 1.67 and 1.72, Boost libraries are suffixed - # with the address size. - set(addrsfx "-x${ADDRESS_SIZE}") +# As of sometime between Boost 1.67 and 1.72, Boost libraries are suffixed +# with the address size. +set(addrsfx "-x${ADDRESS_SIZE}") - if (WINDOWS) - set(BOOST_CONTEXT_LIBRARY - optimized libboost_context-mt${addrsfx} - debug libboost_context-mt${addrsfx}-gd) - set(BOOST_FIBER_LIBRARY - optimized libboost_fiber-mt${addrsfx} - debug libboost_fiber-mt${addrsfx}-gd) - set(BOOST_FILESYSTEM_LIBRARY - optimized libboost_filesystem-mt${addrsfx} - debug libboost_filesystem-mt${addrsfx}-gd) - set(BOOST_PROGRAM_OPTIONS_LIBRARY - optimized libboost_program_options-mt${addrsfx} - debug libboost_program_options-mt${addrsfx}-gd) - set(BOOST_REGEX_LIBRARY - optimized libboost_regex-mt${addrsfx} - debug libboost_regex-mt${addrsfx}-gd) - set(BOOST_SIGNALS_LIBRARY - optimized libboost_signals-mt${addrsfx} - debug libboost_signals-mt${addrsfx}-gd) - set(BOOST_SYSTEM_LIBRARY - optimized libboost_system-mt${addrsfx} - debug libboost_system-mt${addrsfx}-gd) - set(BOOST_THREAD_LIBRARY - optimized libboost_thread-mt${addrsfx} - debug libboost_thread-mt${addrsfx}-gd) - elseif (LINUX) - set(BOOST_CONTEXT_LIBRARY - optimized boost_context-mt${addrsfx} - debug boost_context-mt${addrsfx}-d) - set(BOOST_FIBER_LIBRARY - optimized boost_fiber-mt${addrsfx} - debug boost_fiber-mt${addrsfx}-d) - set(BOOST_FILESYSTEM_LIBRARY - optimized boost_filesystem-mt${addrsfx} - debug boost_filesystem-mt${addrsfx}-d) - set(BOOST_PROGRAM_OPTIONS_LIBRARY - optimized boost_program_options-mt${addrsfx} - debug boost_program_options-mt${addrsfx}-d) - set(BOOST_REGEX_LIBRARY - optimized boost_regex-mt${addrsfx} - debug boost_regex-mt${addrsfx}-d) - set(BOOST_SIGNALS_LIBRARY - optimized boost_signals-mt${addrsfx} - debug boost_signals-mt${addrsfx}-d) - set(BOOST_SYSTEM_LIBRARY - optimized boost_system-mt${addrsfx} - debug boost_system-mt${addrsfx}-d) - set(BOOST_THREAD_LIBRARY - optimized boost_thread-mt${addrsfx} - debug boost_thread-mt${addrsfx}-d) - elseif (DARWIN) - set(BOOST_CONTEXT_LIBRARY - optimized boost_context-mt${addrsfx} - debug boost_context-mt${addrsfx}) - set(BOOST_FIBER_LIBRARY - optimized boost_fiber-mt${addrsfx} - debug boost_fiber-mt${addrsfx}) - set(BOOST_FILESYSTEM_LIBRARY - optimized boost_filesystem-mt${addrsfx} - debug boost_filesystem-mt${addrsfx}) - set(BOOST_PROGRAM_OPTIONS_LIBRARY - optimized boost_program_options-mt${addrsfx} - debug boost_program_options-mt${addrsfx}) - set(BOOST_REGEX_LIBRARY - optimized boost_regex-mt${addrsfx} - debug boost_regex-mt${addrsfx}) - set(BOOST_SIGNALS_LIBRARY - optimized boost_signals-mt${addrsfx} - debug boost_signals-mt${addrsfx}) - set(BOOST_SYSTEM_LIBRARY - optimized boost_system-mt${addrsfx} - debug boost_system-mt${addrsfx}) - set(BOOST_THREAD_LIBRARY - optimized boost_thread-mt${addrsfx} - debug boost_thread-mt${addrsfx}) - endif (WINDOWS) -endif (USESYSTEMLIBS) +if (WINDOWS) + target_link_libraries( ll::boost INTERFACE + libboost_context-mt${addrsfx} + libboost_fiber-mt${addrsfx} + libboost_filesystem-mt${addrsfx} + libboost_program_options-mt${addrsfx} + libboost_regex-mt${addrsfx} + libboost_system-mt${addrsfx} + libboost_thread-mt${addrsfx}) +elseif (LINUX) + target_link_libraries( ll::boost INTERFACE + boost_context-mt${addrsfx} + boost_fiber-mt${addrsfx} + boost_filesystem-mt${addrsfx} + boost_program_options-mt${addrsfx} + boost_regex-mt${addrsfx} + boost_signals-mt${addrsfx} + boost_system-mt${addrsfx} + boost_thread-mt${addrsfx}) +elseif (DARWIN) + target_link_libraries( ll::boost INTERFACE + boost_context-mt${addrsfx} + boost_fiber-mt${addrsfx} + boost_filesystem-mt${addrsfx} + boost_program_options-mt${addrsfx} + boost_regex-mt${addrsfx} + boost_system-mt${addrsfx} + boost_thread-mt${addrsfx}) +endif (WINDOWS) if (LINUX) set(BOOST_SYSTEM_LIBRARY ${BOOST_SYSTEM_LIBRARY} rt) diff --git a/indra/cmake/BuildPackagesInfo.cmake b/indra/cmake/BuildPackagesInfo.cmake index 8f8b6b2330..659ba9d579 100644 --- a/indra/cmake/BuildPackagesInfo.cmake +++ b/indra/cmake/BuildPackagesInfo.cmake @@ -16,5 +16,5 @@ add_custom_command(OUTPUT packages-info.txt COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/run_build_test.py -DAUTOBUILD_ADDRSIZE=${ADDRESS_SIZE} -DAUTOBUILD=${AUTOBUILD_EXECUTABLE} ${PYTHON_EXECUTABLE} - ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py "${VIEWER_CHANNEL}" "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}" > packages-info.txt + ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py "${VIEWER_CHANNEL}" "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}" "${AUTOBUILD_INSTALL_DIR}" > packages-info.txt ) diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake index 157fdd07e4..b531f29ee2 100644 --- a/indra/cmake/BuildVersion.cmake +++ b/indra/cmake/BuildVersion.cmake @@ -19,33 +19,23 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n message(STATUS "Revision (from autobuild environment): ${VIEWER_VERSION_REVISION}") else (DEFINED ENV{revision}) - find_program(MERCURIAL - NAMES hg - PATHS [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG] - PATH_SUFFIXES Mercurial) - mark_as_advanced(MERCURIAL) - if (MERCURIAL) - execute_process(COMMAND ${MERCURIAL} identify --num --rev tip - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE hg_id_result - ERROR_VARIABLE hg_id_error - OUTPUT_VARIABLE VIEWER_VERSION_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (NOT ${hg_id_result} EQUAL 0) - message(SEND_ERROR "Revision number generation failed with output:\n${hg_id_error}") - else (NOT ${hg_id_result} EQUAL 0) - string(REGEX REPLACE "[^0-9a-f]" "" VIEWER_VERSION_REVISION ${VIEWER_VERSION_REVISION}) - endif (NOT ${hg_id_result} EQUAL 0) - if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message(STATUS "Revision (from hg) ${VIEWER_VERSION_REVISION}") - else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message(STATUS "Revision not set (repository not found?); using 0") - set(VIEWER_VERSION_REVISION 0 ) - endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - else (MERCURIAL) - message(STATUS "Revision not set: mercurial not found; using 0") - set(VIEWER_VERSION_REVISION 0) - endif (MERCURIAL) + find_program(GIT git) + if (DEFINED GIT ) + execute_process( + COMMAND ${GIT} rev-list --count HEAD + OUTPUT_VARIABLE VIEWER_VERSION_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision (from git) ${VIEWER_VERSION_REVISION}") + else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision not set (repository not found?); using 0") + set(VIEWER_VERSION_REVISION 0 ) + endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + else (DEFINED GIT ) + message(STATUS "Revision not set: 'git' found; using 0") + set(VIEWER_VERSION_REVISION 0) + endif (DEFINED GIT) endif (DEFINED ENV{revision}) message(STATUS "Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") else ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) diff --git a/indra/cmake/CEFPlugin.cmake b/indra/cmake/CEFPlugin.cmake index 7d8bfb1b0f..9b77becf29 100644 --- a/indra/cmake/CEFPlugin.cmake +++ b/indra/cmake/CEFPlugin.cmake @@ -2,18 +2,14 @@ include(Linking) include(Prebuilt) -if (USESYSTEMLIBS) - set(CEFPLUGIN OFF CACHE BOOL - "CEFPLUGIN support for the llplugin/llmedia test apps.") -else (USESYSTEMLIBS) - use_prebuilt_binary(dullahan) - set(CEFPLUGIN ON CACHE BOOL - "CEFPLUGIN support for the llplugin/llmedia test apps.") - set(CEF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/cef) -endif (USESYSTEMLIBS) +include_guard() +add_library( ll::cef INTERFACE IMPORTED ) + +use_prebuilt_binary(dullahan) +target_include_directories( ll::cef SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/cef) if (WINDOWS) - set(CEF_PLUGIN_LIBRARIES + target_link_libraries( ll::cef INTERFACE libcef.lib libcef_dll_wrapper.lib dullahan.lib @@ -29,7 +25,7 @@ elseif (DARWIN) message(FATAL_ERROR "CEF not found") endif() - set(CEF_PLUGIN_LIBRARIES + target_link_libraries( ll::cef INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libcef_dll_wrapper.a ${ARCH_PREBUILT_DIRS_RELEASE}/libdullahan.a ${APPKIT_LIBRARY} diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 4d70089737..f0b35c08f3 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -5,108 +5,78 @@ include(00-Common) project(cmake) set(cmake_SOURCE_FILES - CMakeLists.txt - - 00-Common.cmake - APR.cmake - Audio.cmake - Boost.cmake - bugsplat.cmake - BuildVersion.cmake - CEFPlugin.cmake - CEFPlugin.cmake - CMakeCopyIfDifferent.cmake - ConfigurePkgConfig.cmake - CURL.cmake - Copy3rdPartyLibs.cmake - DBusGlib.cmake - DeploySharedLibs.cmake - DragDrop.cmake - EXPAT.cmake - FindAPR.cmake - FindAutobuild.cmake - FindGLH.cmake - FindHUNSPELL.cmake - FindJsonCpp.cmake - FindNDOF.cmake - FindOpenJPEG.cmake - FindSCP.cmake - FindURIPARSER.cmake - FindXmlRpcEpi.cmake - FindZLIBNG.cmake - FMODSTUDIO.cmake - FreeType.cmake - GLEXT.cmake - GLH.cmake -## GStreamer010Plugin.cmake - GoogleMock.cmake - Havok.cmake - Hunspell.cmake - JPEG.cmake - JsonCpp.cmake - LLAddBuildTest.cmake - LLAppearance.cmake - LLAudio.cmake - LLCharacter.cmake - LLCommon.cmake - LLCrashLogger.cmake - LLImage.cmake - LLImageJ2COJ.cmake - LLInventory.cmake - LLKDU.cmake - LLLogin.cmake - LLMath.cmake - LLMeshOptimizer.cmake - LLMessage.cmake - LLPhysicsExtensions.cmake - LLPlugin.cmake - LLPrimitive.cmake - LLRender.cmake - LLSharedLibs.cmake - LLTestCommand.cmake - LLUI.cmake - LLFileSystem.cmake - LLWindow.cmake - LLXML.cmake - Linking.cmake - MediaPluginBase.cmake - MESHOPTIMIZER.cmake - NDOF.cmake - OPENAL.cmake - OpenGL.cmake - OpenJPEG.cmake - OpenSSL.cmake - PNG.cmake - PluginAPI.cmake - Prebuilt.cmake - PulseAudio.cmake - Python.cmake - TemplateCheck.cmake - Tut.cmake - UI.cmake - UnixInstall.cmake - URIPARSER.cmake - Variables.cmake - ViewerMiscLibs.cmake - VisualLeakDetector.cmake - LibVLCPlugin.cmake - XmlRpcEpi.cmake - ZLIBNG.cmake - ) + CMakeLists.txt + 00-Common.cmake + APR.cmake + Audio.cmake + Boost.cmake + bugsplat.cmake + BuildVersion.cmake + CEFPlugin.cmake + CEFPlugin.cmake + CMakeCopyIfDifferent.cmake + ConfigurePkgConfig.cmake + CURL.cmake + Copy3rdPartyLibs.cmake + DBusGlib.cmake + DeploySharedLibs.cmake + DragDrop.cmake + EXPAT.cmake + FindAutobuild.cmake + FMODSTUDIO.cmake + FreeType.cmake + GLEXT.cmake + GLH.cmake + GoogleMock.cmake + Havok.cmake + Hunspell.cmake + JsonCpp.cmake + LLAddBuildTest.cmake + LLAppearance.cmake + LLAudio.cmake + LLCommon.cmake + LLImage.cmake + LLKDU.cmake + LLPhysicsExtensions.cmake + LLPrimitive.cmake + LLSharedLibs.cmake + LLTestCommand.cmake + LLWindow.cmake + Linking.cmake + Meshoptimizer.cmake + NDOF.cmake + OPENAL.cmake + OpenGL.cmake + OpenJPEG.cmake + OpenSSL.cmake + PNG.cmake + PluginAPI.cmake + Prebuilt.cmake + PulseAudio.cmake + Python.cmake + TemplateCheck.cmake + Tut.cmake + UI.cmake + UnixInstall.cmake + URIPARSER.cmake + Variables.cmake + ViewerMiscLibs.cmake + VisualLeakDetector.cmake + LibVLCPlugin.cmake + XmlRpcEpi.cmake + ZLIBNG.cmake + ) source_group("Shared Rules" FILES ${cmake_SOURCE_FILES}) set(master_SOURCE_FILES - ../CMakeLists.txt - ) + ../CMakeLists.txt + ) source_group("Master Rules" FILES ${master_SOURCE_FILES}) -set_source_files_properties(${cmake_SOURCE_FILES} ${master_SOURCE_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - add_library(cmake - cmake_dummy.cpp - ${cmake_SOURCE_FILES} - ${master_SOURCE_FILES} - ) + cmake_dummy.cpp + ${cmake_SOURCE_FILES} + ${master_SOURCE_FILES} + ) diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake index 04afae594d..b9f685f37b 100644 --- a/indra/cmake/CURL.cmake +++ b/indra/cmake/CURL.cmake @@ -1,19 +1,14 @@ # -*- cmake -*- include(Prebuilt) -set(CURL_FIND_QUIETLY ON) -set(CURL_FIND_REQUIRED ON) +include_guard() +add_library( ll::libcurl INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindCURL) -else (USESYSTEMLIBS) - use_prebuilt_binary(curl) - if (WINDOWS) - set(CURL_LIBRARIES - debug libcurld.lib - optimized libcurl.lib) - else (WINDOWS) - set(CURL_LIBRARIES libcurl.a) - endif (WINDOWS) - set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) -endif (USESYSTEMLIBS) +use_system_binary(libcurl) +use_prebuilt_binary(curl) +if (WINDOWS) + target_link_libraries(ll::libcurl INTERFACE libcurl.lib) +else (WINDOWS) + target_link_libraries(ll::libcurl INTERFACE libcurl.a) +endif (WINDOWS) +target_include_directories( ll::libcurl SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 04b4202ca3..1ee2a621f2 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -6,6 +6,8 @@ include(CMakeCopyIfDifferent) include(Linking) +include(OPENAL) +include(FMODSTUDIO) # When we copy our dependent libraries, we almost always want to copy them to # both the Release and the RelWithDebInfo staging directories. This has @@ -13,27 +15,27 @@ include(Linking) # copy_if_different commands. Encapsulate that usage. # Pass FROM_DIR, TARGETS and the files to copy. TO_DIR is implicit. # to_staging_dirs diverges from copy_if_different in that it appends to TARGETS. -MACRO(to_staging_dirs from_dir targets) - foreach(staging_dir - "${SHARED_LIB_STAGING_DIR_RELEASE}" - "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}") - copy_if_different("${from_dir}" "${staging_dir}" out_targets ${ARGN}) +macro(to_staging_dirs from_dir targets) + set( targetDir "${SHARED_LIB_STAGING_DIR}") + copy_if_different("${from_dir}" "${targetDir}" out_targets ${ARGN}) + list(APPEND "${targets}" "${out_targets}") - endforeach() -ENDMACRO(to_staging_dirs from_dir to_dir targets) +endmacro() ################################################################### # set up platform specific lists of files that need to be copied ################################################################### if(WINDOWS) - set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}/Debug") - set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo") - set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release") - #******************************* # VIVOX - *NOTE: no debug version set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") - set(slvoice_src_dir "${ARCH_PREBUILT_BIN_RELEASE}") + + # ND, it seems there is no such thing defined. At least when building a viewer + # Does this maybe matter on some LL buildserver? Otherwise this and the snippet using slvoice_src_dir + # can all go + if( ARCH_PREBUILT_BIN_RELEASE ) + set(slvoice_src_dir "${ARCH_PREBUILT_BIN_RELEASE}") + endif() set(slvoice_files SLVoice.exe ) if (ADDRESS_SIZE EQUAL 64) list(APPEND vivox_libs @@ -84,14 +86,14 @@ if(WINDOWS) endif(ADDRESS_SIZE EQUAL 32) endif (USE_BUGSPLAT) - if (FMODSTUDIO) + if (TARGET ll::fmodstudio) set(debug_files ${debug_files} fmodL.dll) set(release_files ${release_files} fmod.dll) - endif (FMODSTUDIO) + endif () - if (OPENAL) + if (TARGET ll::openal) list(APPEND release_files openal32.dll alut.dll) - endif (OPENAL) + endif () #******************************* # Copy MS C runtime dlls, required for packaging. @@ -105,6 +107,8 @@ if(WINDOWS) set(MSVC_VER 140) elseif (MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930) # Visual Studio 2019 set(MSVC_VER 140) + elseif (MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1940) # Visual Studio 2022 + set(MSVC_VER 140) else (MSVC80) MESSAGE(WARNING "New MSVC_VERSION ${MSVC_VERSION} of MSVC: adapt Copy3rdPartyLibs.cmake") endif (MSVC80) @@ -148,10 +152,6 @@ if(WINDOWS) endforeach() elseif(DARWIN) - set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}/Debug/Resources") - set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Resources") - set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release/Resources") - set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(slvoice_files SLVoice) set(vivox_libs @@ -178,10 +178,10 @@ elseif(DARWIN) liburiparser.1.0.27.dylib ) - if (FMODSTUDIO) + if (TARGET ll::fmodstudio) set(debug_files ${debug_files} libfmodL.dylib) set(release_files ${release_files} libfmod.dylib) - endif (FMODSTUDIO) + endif () elseif(LINUX) # linux is weird, multiple side by side configurations aren't supported @@ -209,28 +209,30 @@ elseif(LINUX) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") # *FIX - figure out what to do with duplicate libalut.so here -brad set(release_files - libapr-1.so.0 - libaprutil-1.so.0 - libatk-1.0.so - libdb-5.1.so - ${EXPAT_COPY} - libfreetype.so.6.6.2 - libfreetype.so.6 - libgmodule-2.0.so - libgobject-2.0.so - libhunspell-1.3.so.0.0.0 - libopenal.so - libopenjp2.so - libuuid.so.16 - libuuid.so.16.0.22 - libfontconfig.so.1.8.0 - libfontconfig.so.1 - ) + ${EXPAT_COPY} + ) + + if( USE_AUTOBUILD_3P ) + list( APPEND release_files + libapr-1.so.0 + libaprutil-1.so.0 + libatk-1.0.so + libfreetype.so.6.6.2 + libfreetype.so.6 + libhunspell-1.3.so.0.0.0 + libuuid.so.16 + libuuid.so.16.0.22 + libfontconfig.so.1.8.0 + libfontconfig.so.1 + libgmodule-2.0.so + libgobject-2.0.so + ) + endif() - if (FMODSTUDIO) + if (TARGET ll::fmodstudio) set(debug_files ${debug_files} "libfmodL.so") set(release_files ${release_files} "libfmod.so") - endif (FMODSTUDIO) + endif () else(WINDOWS) message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...") @@ -260,13 +262,16 @@ endif(WINDOWS) # Curiously, slvoice_files are only copied to SHARED_LIB_STAGING_DIR_RELEASE. # It's unclear whether this is oversight or intentional, but anyway leave the # single copy_if_different command rather than using to_staging_dirs. -copy_if_different( - ${slvoice_src_dir} - "${SHARED_LIB_STAGING_DIR_RELEASE}" - out_targets - ${slvoice_files} + +if( slvoice_src_dir ) + copy_if_different( + ${slvoice_src_dir} + "${SHARED_LIB_STAGING_DIR_RELEASE}" + out_targets + ${slvoice_files} ) -list(APPEND third_party_targets ${out_targets}) + list(APPEND third_party_targets ${out_targets}) +endif() to_staging_dirs( ${vivox_lib_dir} @@ -280,9 +285,16 @@ to_staging_dirs( ${release_files} ) -if(NOT USESYSTEMLIBS) - add_custom_target( - stage_third_party_libs ALL - DEPENDS ${third_party_targets} - ) -endif(NOT USESYSTEMLIBS) +add_custom_target( + stage_third_party_libs ALL + DEPENDS ${third_party_targets} +) + +if(DARWIN) + # Support our "@executable_path/../Resources" load path for executables + # that end up in any of the above SHARED_LIB_STAGING_DIR_MUMBLE + # directories. + add_custom_command( TARGET stage_third_party_libs POST_BUILD + COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources + ) +endif() diff --git a/indra/cmake/DBusGlib.cmake b/indra/cmake/DBusGlib.cmake index 5e46b6711a..c9b727ca9d 100644 --- a/indra/cmake/DBusGlib.cmake +++ b/indra/cmake/DBusGlib.cmake @@ -1,29 +1,14 @@ # -*- cmake -*- include(Prebuilt) -if (USESYSTEMLIBS) - include(FindPkgConfig) +add_library( ll::dbus INTERFACE IMPORTED) - pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1) +if( LINUX ) + # Only define this when not using the prebuild 3ps, lls prebuild is broken + if( NOT USE_AUTOBUILD_3P ) + target_compile_definitions( ll::dbus INTERFACE LL_DBUS_ENABLED ) + endif() + use_system_binary(dbus) -elseif (LINUX) use_prebuilt_binary(dbus_glib) - set(DBUSGLIB_FOUND ON FORCE BOOL) - set(DBUSGLIB_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/dbus - ) - # We don't need to explicitly link against dbus-glib itself, because - # the viewer probes for the system's copy at runtime. - set(DBUSGLIB_LIBRARIES - gobject-2.0 - glib-2.0 - ) -endif (USESYSTEMLIBS) - -if (DBUSGLIB_FOUND) - set(DBUSGLIB ON CACHE BOOL "Build with dbus-glib message bus support.") -endif (DBUSGLIB_FOUND) - -if (DBUSGLIB) - add_definitions(-DLL_DBUS_ENABLED=1) -endif (DBUSGLIB) +endif() diff --git a/indra/cmake/DragDrop.cmake b/indra/cmake/DragDrop.cmake index 73ef59b18f..26e7828830 100644 --- a/indra/cmake/DragDrop.cmake +++ b/indra/cmake/DragDrop.cmake @@ -1,20 +1,16 @@ # -*- cmake -*- - set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off") - - if (OS_DRAG_DROP) +set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off") +if (OS_DRAG_DROP) if (WINDOWS) - add_definitions(-DLL_OS_DRAGDROP_ENABLED=1) + add_definitions(-DLL_OS_DRAGDROP_ENABLED=1) endif (WINDOWS) - if (DARWIN) - add_definitions(-DLL_OS_DRAGDROP_ENABLED=1) + add_definitions(-DLL_OS_DRAGDROP_ENABLED=1) endif (DARWIN) - if (LINUX) - add_definitions(-DLL_OS_DRAGDROP_ENABLED=0) + add_definitions(-DLL_OS_DRAGDROP_ENABLED=1) endif (LINUX) - - endif (OS_DRAG_DROP) +endif (OS_DRAG_DROP) diff --git a/indra/cmake/EXPAT.cmake b/indra/cmake/EXPAT.cmake index cddc71b227..327fe8aa72 100644 --- a/indra/cmake/EXPAT.cmake +++ b/indra/cmake/EXPAT.cmake @@ -1,23 +1,20 @@ # -*- cmake -*- include(Prebuilt) -set(EXPAT_FIND_QUIETLY ON) -set(EXPAT_FIND_REQUIRED ON) +include_guard() +add_library( ll::expat INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindEXPAT) -else (USESYSTEMLIBS) - use_prebuilt_binary(expat) - if (WINDOWS) - set(EXPAT_LIBRARIES libexpatMT) - set(EXPAT_COPY libexpatMT.dll) - else (WINDOWS) - set(EXPAT_LIBRARIES expat) - if (DARWIN) - set(EXPAT_COPY libexpat.1.dylib libexpat.dylib) - else () - set(EXPAT_COPY libexpat.so.1 libexpat.so) - endif () - endif (WINDOWS) - set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) -endif (USESYSTEMLIBS) +use_system_binary(expat) +use_prebuilt_binary(expat) +if (WINDOWS) + target_link_libraries( ll::expat INTERFACE libexpatMT ) + set(EXPAT_COPY libexpatMT.dll) +else (WINDOWS) + target_link_libraries( ll::expat INTERFACE expat ) + if (DARWIN) + set(EXPAT_COPY libexpat.1.dylib libexpat.dylib) + else () + set(EXPAT_COPY libexpat.so.1 libexpat.so) + endif () +endif (WINDOWS) +target_include_directories( ll::expat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) diff --git a/indra/cmake/ExamplePlugin.cmake b/indra/cmake/ExamplePlugin.cmake index 5d826c1f66..6234035474 100644 --- a/indra/cmake/ExamplePlugin.cmake +++ b/indra/cmake/ExamplePlugin.cmake @@ -2,15 +2,5 @@ include(Linking) include(Prebuilt) -if (USESYSTEMLIBS) - set(EXAMPLEPLUGIN OFF CACHE BOOL +set(EXAMPLEPLUGIN ON CACHE BOOL "EXAMPLEPLUGIN support for the llplugin/llmedia test apps.") -else (USESYSTEMLIBS) - set(EXAMPLEPLUGIN ON CACHE BOOL - "EXAMPLEPLUGIN support for the llplugin/llmedia test apps.") -endif (USESYSTEMLIBS) - -if (WINDOWS) -elseif (DARWIN) -elseif (LINUX) -endif (WINDOWS) diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index 8840354ac6..c5b21ac4e5 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -1,16 +1,30 @@ # -*- cmake -*- +include_guard() + # FMODSTUDIO can be set when launching the make using the argument -DFMODSTUDIO:BOOL=ON # When building using proprietary binaries though (i.e. having access to LL private servers), # we always build with FMODSTUDIO. if (INSTALL_PROPRIETARY) - set(FMODSTUDIO ON CACHE BOOL "Using FMODSTUDIO sound library.") + set(USE_FMODSTUDIO ON CACHE BOOL "Using FMODSTUDIO sound library.") endif (INSTALL_PROPRIETARY) -if (FMODSTUDIO) +# ND: To streamline arguments passed, switch from FMODSTUDIO to USE_FMODSTUDIO +# To not break all old build scripts convert old arguments but warn about it +if(FMODSTUDIO) + message( WARNING "Use of the FMODSTUDIO argument is deprecated, please switch to USE_FMODSTUDIO") + set(USE_FMODSTUDIO ${FMODSTUDIO}) +endif() + +if (USE_FMODSTUDIO) + add_library( ll::fmodstudio INTERFACE IMPORTED ) + target_compile_definitions( ll::fmodstudio INTERFACE LL_FMODSTUDIO=1) + if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that - set(FMODSTUDIO_LIBRARIES ${FMODSTUDIO_LIBRARY}) + + target_link_libraries(ll::fmodstudio INTERFACE ${FMODSTUDIO_LIBRARY}) + target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${FMODSTUDIO_INCLUDE_DIR}) else (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If not, we're going to try to get the package listed in autobuild.xml # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) @@ -18,21 +32,17 @@ if (FMODSTUDIO) include(Prebuilt) use_prebuilt_binary(fmodstudio) if (WINDOWS) - set(FMODSTUDIO_LIBRARY - debug fmodL_vc - optimized fmod_vc) + target_link_libraries( ll::fmodstudio INTERFACE fmod_vc) elseif (DARWIN) #despite files being called libfmod.dylib, we are searching for fmod - set(FMODSTUDIO_LIBRARY - debug fmodL - optimized fmod) + target_link_libraries( ll::fmodstudio INTERFACE fmod) elseif (LINUX) - set(FMODSTUDIO_LIBRARY - debug fmodL - optimized fmod) + target_link_libraries( ll::fmodstudio INTERFACE fmod) endif (WINDOWS) - set(FMODSTUDIO_LIBRARIES ${FMODSTUDIO_LIBRARY}) - set(FMODSTUDIO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodstudio) + + target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) -endif (FMODSTUDIO) +else() + set( USE_FMODSTUDIO "OFF") +endif () diff --git a/indra/cmake/FindAPR.cmake b/indra/cmake/FindAPR.cmake deleted file mode 100644 index 906b6c9452..0000000000 --- a/indra/cmake/FindAPR.cmake +++ /dev/null @@ -1,94 +0,0 @@ -# -*- cmake -*- - -# - Find Apache Portable Runtime -# Find the APR includes and libraries -# This module defines -# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc. -# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR. -# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR. -# also defined, but not for general use are -# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. - -# APR first. - -FIND_PATH(APR_INCLUDE_DIR apr.h -/usr/local/include/apr-1 -/usr/local/include/apr-1.0 -/usr/include/apr-1 -/usr/include/apr-1.0 -) - -SET(APR_NAMES ${APR_NAMES} apr-1) -FIND_LIBRARY(APR_LIBRARY - NAMES ${APR_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (APR_LIBRARY AND APR_INCLUDE_DIR) - SET(APR_LIBRARIES ${APR_LIBRARY}) - SET(APR_FOUND "YES") -ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) - SET(APR_FOUND "NO") -ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) - - -IF (APR_FOUND) - IF (NOT APR_FIND_QUIETLY) - MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") - ENDIF (NOT APR_FIND_QUIETLY) -ELSE (APR_FOUND) - IF (APR_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find APR library") - ENDIF (APR_FIND_REQUIRED) -ENDIF (APR_FOUND) - -# Deprecated declarations. -SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) - -MARK_AS_ADVANCED( - APR_LIBRARY - APR_INCLUDE_DIR - ) - -# Next, APRUTIL. - -FIND_PATH(APRUTIL_INCLUDE_DIR apu.h -/usr/local/include/apr-1 -/usr/local/include/apr-1.0 -/usr/include/apr-1 -/usr/include/apr-1.0 -) - -SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1) -FIND_LIBRARY(APRUTIL_LIBRARY - NAMES ${APRUTIL_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) - SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) - SET(APRUTIL_FOUND "YES") -ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) - SET(APRUTIL_FOUND "NO") -ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) - - -IF (APRUTIL_FOUND) - IF (NOT APRUTIL_FIND_QUIETLY) - MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") - ENDIF (NOT APRUTIL_FIND_QUIETLY) -ELSE (APRUTIL_FOUND) - IF (APRUTIL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find APRUTIL library") - ENDIF (APRUTIL_FIND_REQUIRED) -ENDIF (APRUTIL_FOUND) - -# Deprecated declarations. -SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) - -MARK_AS_ADVANCED( - APRUTIL_LIBRARY - APRUTIL_INCLUDE_DIR - ) diff --git a/indra/cmake/FindGLH.cmake b/indra/cmake/FindGLH.cmake deleted file mode 100644 index 3d16adaf03..0000000000 --- a/indra/cmake/FindGLH.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# -*- cmake -*- - -# - Find GLH -# Find the Graphic Library Helper includes. -# This module defines -# GLH_INCLUDE_DIR, where to find glh/glh_linear.h. -# GLH_FOUND, If false, do not try to use GLH. - -find_path(GLH_INCLUDE_DIR glh/glh_linear.h - NO_SYSTEM_ENVIRONMENT_PATH - ) - -if (GLH_INCLUDE_DIR) - set(GLH_FOUND "YES") -else (GLH_INCLUDE_DIR) - set(GLH_FOUND "NO") -endif (GLH_INCLUDE_DIR) - -if (GLH_FOUND) - if (NOT GLH_FIND_QUIETLY) - message(STATUS "Found GLH: ${GLH_INCLUDE_DIR}") - set(GLH_FIND_QUIETLY TRUE) # Only alert us the first time - endif (NOT GLH_FIND_QUIETLY) -else (GLH_FOUND) - if (GLH_FIND_REQUIRED) - message(FATAL_ERROR "Could not find GLH") - endif (GLH_FIND_REQUIRED) -endif (GLH_FOUND) - -mark_as_advanced(GLH_INCLUDE_DIR) diff --git a/indra/cmake/FindGooglePerfTools.cmake b/indra/cmake/FindGooglePerfTools.cmake deleted file mode 100644 index bb125d538e..0000000000 --- a/indra/cmake/FindGooglePerfTools.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# -*- cmake -*- - -# - Find Google perftools -# Find the Google perftools includes and libraries -# This module defines -# GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc. -# GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools. -# also defined for general use are -# TCMALLOC_LIBRARIES, where to find the tcmalloc library. -# STACKTRACE_LIBRARIES, where to find the stacktrace library. -# PROFILER_LIBRARIES, where to find the profiler library. - -FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h -/usr/local/include -/usr/include -) - -SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc) -FIND_LIBRARY(TCMALLOC_LIBRARY - NAMES ${TCMALLOC_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY}) - SET(GOOGLE_PERFTOOLS_FOUND "YES") -ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - SET(GOOGLE_PERFTOOLS_FOUND "NO") -ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - -SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace) -FIND_LIBRARY(STACKTRACE_LIBRARY - NAMES ${STACKTRACE_LIBRARY} - PATHS /usr/lib /usr/local/lib - ) - -IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY}) -ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - -SET(PROFILER_NAMES ${PROFILER_NAMES} profiler) -FIND_LIBRARY(PROFILER_LIBRARY - NAMES ${PROFILER_LIBRARY} - PATHS /usr/lib /usr/local/lib - ) - -IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY}) -ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR) - -IF (GOOGLE_PERFTOOLS_FOUND) - IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) - MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}") - ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY) -ELSE (GOOGLE_PERFTOOLS_FOUND) - IF (GOOGLE_PERFTOOLS_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find Google perftools library") - ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED) -ENDIF (GOOGLE_PERFTOOLS_FOUND) - -MARK_AS_ADVANCED( - TCMALLOC_LIBRARY - STACKTRACE_LIBRARY - PROFILER_LIBRARY - GOOGLE_PERFTOOLS_INCLUDE_DIR - ) diff --git a/indra/cmake/FindHUNSPELL.cmake b/indra/cmake/FindHUNSPELL.cmake deleted file mode 100644 index d411bdb9e5..0000000000 --- a/indra/cmake/FindHUNSPELL.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# -*- cmake -*- - -# - Find HUNSPELL -# This module defines -# HUNSPELL_INCLUDE_DIR, where to find libhunspell.h, etc. -# HUNSPELL_LIBRARY, the library needed to use HUNSPELL. -# HUNSPELL_FOUND, If false, do not try to use HUNSPELL. - -find_path(HUNSPELL_INCLUDE_DIR hunspell.h - PATH_SUFFIXES hunspell - ) - -set(HUNSPELL_NAMES ${HUNSPELL_NAMES} libhunspell-1.3 libhunspell) -find_library(HUNSPELL_LIBRARY - NAMES ${HUNSPELL_NAMES} - ) - -if (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) - set(HUNSPELL_FOUND "YES") -else (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) - set(HUNSPELL_FOUND "NO") -endif (HUNSPELL_LIBRARY AND HUNSPELL_INCLUDE_DIR) - - -if (HUNSPELL_FOUND) - if (NOT HUNSPELL_FIND_QUIETLY) - message(STATUS "Found Hunspell: Library in '${HUNSPELL_LIBRARY}' and header in '${HUNSPELL_INCLUDE_DIR}' ") - endif (NOT HUNSPELL_FIND_QUIETLY) -else (HUNSPELL_FOUND) - if (HUNSPELL_FIND_REQUIRED) - message(FATAL_ERROR " * * *\nCould not find HUNSPELL library! * * *") - endif (HUNSPELL_FIND_REQUIRED) -endif (HUNSPELL_FOUND) - -mark_as_advanced( - HUNSPELL_LIBRARY - HUNSPELL_INCLUDE_DIR - ) diff --git a/indra/cmake/FindJsonCpp.cmake b/indra/cmake/FindJsonCpp.cmake deleted file mode 100644 index 9398779cff..0000000000 --- a/indra/cmake/FindJsonCpp.cmake +++ /dev/null @@ -1,60 +0,0 @@ -# -*- cmake -*- - -# - Find JSONCpp -# Find the JSONCpp includes and library -# This module defines -# JSONCPP_INCLUDE_DIR, where to find json.h, etc. -# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp. -# JSONCPP_FOUND, If false, do not try to use jsoncpp. -# also defined, but not for general use are -# JSONCPP_LIBRARY, where to find the jsoncpp library. - -FIND_PATH(JSONCPP_INCLUDE_DIR jsoncpp/json.h -/usr/local/include -/usr/include -) - -# Get the GCC compiler version -EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _gcc_COMPILER_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - -# Try to find a library that was compiled with the same compiler version as we currently use. -SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so) -IF (USESYSTEMLIBS) - # On standalone, assume that the system installed library was compiled with the used compiler. - SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so) -ENDIF (USESYSTEMLIBS) -FIND_LIBRARY(JSONCPP_LIBRARY - NAMES ${JSONCPP_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR) - SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY}) - SET(JSONCPP_FOUND "YES") -ELSE (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR) - SET(JSONCPP_FOUND "NO") -ENDIF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR) - - -IF (JSONCPP_FOUND) - IF (NOT JSONCPP_FIND_QUIETLY) - MESSAGE(STATUS "Found JSONCpp: ${JSONCPP_LIBRARIES}") - ENDIF (NOT JSONCPP_FIND_QUIETLY) -ELSE (JSONCPP_FOUND) - IF (JSONCPP_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find JSONCpp library") - ENDIF (JSONCPP_FIND_REQUIRED) -ENDIF (JSONCPP_FOUND) - -# Deprecated declarations. -SET (NATIVE_JSONCPP_INCLUDE_PATH ${JSONCPP_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_JSONCPP_LIB_PATH ${JSONCPP_LIBRARY} PATH) - -MARK_AS_ADVANCED( - JSONCPP_LIBRARY - JSONCPP_INCLUDE_DIR - ) diff --git a/indra/cmake/FindNDOF.cmake b/indra/cmake/FindNDOF.cmake deleted file mode 100644 index 6dcf590a53..0000000000 --- a/indra/cmake/FindNDOF.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# -*- cmake -*- - -# - Find NDOF -# Find the NDOF includes and library -# This module defines -# NDOF_INCLUDE_DIR, where to find ndofdev_external.h, etc. -# NDOF_LIBRARY, the library needed to use NDOF. -# NDOF_FOUND, If false, do not try to use NDOF. - -find_path(NDOF_INCLUDE_DIR ndofdev_external.h - PATH_SUFFIXES ndofdev - ) - -set(NDOF_NAMES ${NDOF_NAMES} ndofdev libndofdev) -find_library(NDOF_LIBRARY - NAMES ${NDOF_NAMES} - ) - -if (NDOF_LIBRARY AND NDOF_INCLUDE_DIR) - set(NDOF_FOUND "YES") -else (NDOF_LIBRARY AND NDOF_INCLUDE_DIR) - set(NDOF_FOUND "NO") -endif (NDOF_LIBRARY AND NDOF_INCLUDE_DIR) - - -if (NDOF_FOUND) - if (NOT NDOF_FIND_QUIETLY) - message(STATUS "Found NDOF: Library in '${NDOF_LIBRARY}' and header in '${NDOF_INCLUDE_DIR}' ") - endif (NOT NDOF_FIND_QUIETLY) -else (NDOF_FOUND) - if (NDOF_FIND_REQUIRED) - message(FATAL_ERROR " * * *\nCould not find NDOF library!\nIf you don't need Space Navigator Joystick support you can skip this test by configuring with -DNDOF:BOOL=OFF\n * * *") - endif (NDOF_FIND_REQUIRED) -endif (NDOF_FOUND) - -mark_as_advanced( - NDOF_LIBRARY - NDOF_INCLUDE_DIR - ) diff --git a/indra/cmake/FindOpenJPEG.cmake b/indra/cmake/FindOpenJPEG.cmake deleted file mode 100644 index 2d4353b54f..0000000000 --- a/indra/cmake/FindOpenJPEG.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# -*- cmake -*- - -# - Find OpenJPEG -# Find the OpenJPEG includes and library -# This module defines -# OPENJPEG_INCLUDE_DIR, where to find openjpeg.h, etc. -# OPENJPEG_LIBRARIES, the libraries needed to use OpenJPEG. -# OPENJPEG_FOUND, If false, do not try to use OpenJPEG. -# also defined, but not for general use are -# OPENJPEG_LIBRARY, where to find the OpenJPEG library. - -FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h -/usr/local/include/openjpeg -/usr/local/include -/usr/include/openjpeg -/usr/include -include/openjpeg -) - -SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjp2) -FIND_LIBRARY(OPENJPEG_LIBRARY - NAMES ${OPENJPEG_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) - SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) - SET(OPENJPEG_FOUND "YES") -ELSE (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) - SET(OPENJPEG_FOUND "NO") -ENDIF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) - - -IF (OPENJPEG_FOUND) - IF (NOT OPENJPEG_FIND_QUIETLY) - MESSAGE(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES}") - ENDIF (NOT OPENJPEG_FIND_QUIETLY) -ELSE (OPENJPEG_FOUND) - IF (OPENJPEG_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find OpenJPEG library") - ENDIF (OPENJPEG_FIND_REQUIRED) -ENDIF (OPENJPEG_FOUND) - -# Deprecated declarations. -SET (NATIVE_OPENJPEG_INCLUDE_PATH ${OPENJPEG_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_OPENJPEG_LIB_PATH ${OPENJPEG_LIBRARY} PATH) - -MARK_AS_ADVANCED( - OPENJPEG_LIBRARY - OPENJPEG_INCLUDE_DIR - ) diff --git a/indra/cmake/FindURIPARSER.cmake b/indra/cmake/FindURIPARSER.cmake deleted file mode 100644 index 8ab9f0f4ed..0000000000 --- a/indra/cmake/FindURIPARSER.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# -*- cmake -*- - -# - Find uriparser -# Find the URIPARSER includes and library -# This module defines -# URIPARSER_INCLUDE_DIRS, where to find uriparser.h, etc. -# URIPARSER_LIBRARIES, the libraries needed to use uriparser. -# URIPARSER_FOUND, If false, do not try to use uriparser. -# -# This FindURIPARSER is about 43 times as fast the one provided with cmake (2.8.x), -# because it doesn't look up the version of uriparser, resulting in a dramatic -# speed up for configure (from 4 minutes 22 seconds to 6 seconds). -# -# Note: Since this file is only used for standalone, the windows -# specific parts were left out. - -FIND_PATH(URIPARSER_INCLUDE_DIR uriparser/uri.h - NO_SYSTEM_ENVIRONMENT_PATH - ) - -FIND_LIBRARY(URIPARSER_LIBRARY uriparser) - -if (URIPARSER_LIBRARY AND URIPARSER_INCLUDE_DIR) - SET(URIPARSER_INCLUDE_DIRS ${URIPARSER_INCLUDE_DIR}) - SET(URIPARSER_LIBRARIES ${URIPARSER_LIBRARY}) - SET(URIPARSER_FOUND "YES") -else (URIPARSER_LIBRARY AND URIPARSER_INCLUDE_DIR) - SET(URIPARSER_FOUND "NO") -endif (URIPARSER_LIBRARY AND URIPARSER_INCLUDE_DIR) - -if (URIPARSER_FOUND) - if (NOT URIPARSER_FIND_QUIETLY) - message(STATUS "Found URIPARSER: ${URIPARSER_LIBRARIES}") - SET(URIPARSER_FIND_QUIETLY TRUE) - endif (NOT URIPARSER_FIND_QUIETLY) -else (URIPARSER_FOUND) - if (URIPARSER_FIND_REQUIRED) - message(FATAL_ERROR "Could not find URIPARSER library") - endif (URIPARSER_FIND_REQUIRED) -endif (URIPARSER_FOUND) - -mark_as_advanced( - URIPARSER_LIBRARY - URIPARSER_INCLUDE_DIR - ) - diff --git a/indra/cmake/FindXmlRpcEpi.cmake b/indra/cmake/FindXmlRpcEpi.cmake deleted file mode 100644 index ba217e7467..0000000000 --- a/indra/cmake/FindXmlRpcEpi.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -*- cmake -*- - -# - Find XMLRPC-EPI -# Find the XMLRPC-EPI includes and library -# This module defines -# XMLRPCEPI_INCLUDE_DIR, where to find jpeglib.h, etc. -# XMLRPCEPI_LIBRARIES, the libraries needed to use XMLRPC-EPI. -# XMLRPCEPI_FOUND, If false, do not try to use XMLRPC-EPI. -# also defined, but not for general use are -# XMLRPCEPI_LIBRARY, where to find the XMLRPC-EPI library. - -FIND_PATH(XMLRPCEPI_INCLUDE_DIR xmlrpc-epi/xmlrpc.h -/usr/local/include -/usr/include -) - -SET(XMLRPCEPI_NAMES ${XMLRPCEPI_NAMES} xmlrpc-epi) -FIND_LIBRARY(XMLRPCEPI_LIBRARY - NAMES ${XMLRPCEPI_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) - SET(XMLRPCEPI_LIBRARIES ${XMLRPCEPI_LIBRARY}) - SET(XMLRPCEPI_FOUND "YES") -ELSE (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) - SET(XMLRPCEPI_FOUND "NO") -ENDIF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR) - - -IF (XMLRPCEPI_FOUND) - IF (NOT XMLRPCEPI_FIND_QUIETLY) - MESSAGE(STATUS "Found XMLRPC-EPI: ${XMLRPCEPI_LIBRARIES}") - ENDIF (NOT XMLRPCEPI_FIND_QUIETLY) -ELSE (XMLRPCEPI_FOUND) - IF (XMLRPCEPI_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find XMLRPC-EPI library") - ENDIF (XMLRPCEPI_FIND_REQUIRED) -ENDIF (XMLRPCEPI_FOUND) - -# Deprecated declarations. -SET (NATIVE_XMLRPCEPI_INCLUDE_PATH ${XMLRPCEPI_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_XMLRPCEPI_LIB_PATH ${XMLRPCEPI_LIBRARY} PATH) - -MARK_AS_ADVANCED( - XMLRPCEPI_LIBRARY - XMLRPCEPI_INCLUDE_DIR - ) diff --git a/indra/cmake/FindZLIBNG.cmake b/indra/cmake/FindZLIBNG.cmake deleted file mode 100644 index 6e3c8cdddb..0000000000 --- a/indra/cmake/FindZLIBNG.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# -*- cmake -*- - -# - Find zlib-ng -# Find the ZLIB includes and library -# This module defines -# ZLIBNG_INCLUDE_DIRS, where to find zlib.h, etc. -# ZLIBNG_LIBRARIES, the libraries needed to use zlib. -# ZLIBNG_FOUND, If false, do not try to use zlib. -# -# This FindZLIBNG is about 43 times as fast the one provided with cmake (2.8.x), -# because it doesn't look up the version of zlib, resulting in a dramatic -# speed up for configure (from 4 minutes 22 seconds to 6 seconds). -# -# Note: Since this file is only used for standalone, the windows -# specific parts were left out. - -FIND_PATH(ZLIBNG_INCLUDE_DIR zlib.h - NO_SYSTEM_ENVIRONMENT_PATH - ) - -FIND_LIBRARY(ZLIBNG_LIBRARY z) - -if (ZLIBNG_LIBRARY AND ZLIBNG_INCLUDE_DIR) - SET(ZLIBNG_INCLUDE_DIRS ${ZLIBNG_INCLUDE_DIR}) - SET(ZLIBNG_LIBRARIES ${ZLIBNG_LIBRARY}) - SET(ZLIBNG_FOUND "YES") -else (ZLIBNG_LIBRARY AND ZLIBNG_INCLUDE_DIR) - SET(ZLIBNG_FOUND "NO") -endif (ZLINGB_LIBRARY AND ZLIBNG_INCLUDE_DIR) - -if (ZLIBNG_FOUND) - if (NOT ZLIBNG_FIND_QUIETLY) - message(STATUS "Found ZLIBNG: ${ZLIBNG_LIBRARIES}") - SET(ZLIBNG_FIND_QUIETLY TRUE) - endif (NOT ZLIBNG_FIND_QUIETLY) -else (ZLIBNG_FOUND) - if (ZLIBNG_FIND_REQUIRED) - message(FATAL_ERROR "Could not find ZLIBNG library") - endif (ZLIBNG_FIND_REQUIRED) -endif (ZLIBNG_FOUND) - -mark_as_advanced( - ZLIBNG_LIBRARY - ZLIBNG_INCLUDE_DIR - ) - diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake index a36485f6d0..77140af641 100644 --- a/indra/cmake/FreeType.cmake +++ b/indra/cmake/FreeType.cmake @@ -1,14 +1,11 @@ # -*- cmake -*- include(Prebuilt) -if (USESYSTEMLIBS) - include(FindPkgConfig) +include_guard() +add_library( ll::freetype INTERFACE IMPORTED ) - pkg_check_modules(FREETYPE REQUIRED freetype2) -else (USESYSTEMLIBS) - use_prebuilt_binary(freetype) - set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/freetype2/) - set(FREETYPE_LIBRARIES freetype) -endif (USESYSTEMLIBS) +use_system_binary(freetype) +use_prebuilt_binary(freetype) +target_include_directories( ll::freetype SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/freetype2/) +target_link_libraries( ll::freetype INTERFACE freetype ) -link_directories(${FREETYPE_LIBRARY_DIRS}) diff --git a/indra/cmake/GLEXT.cmake b/indra/cmake/GLEXT.cmake index 9fd3923bfd..434b6f0ee8 100644 --- a/indra/cmake/GLEXT.cmake +++ b/indra/cmake/GLEXT.cmake @@ -1,10 +1,11 @@ # -*- cmake -*- include(Prebuilt) +include(GLH) + +add_library( ll::glext INTERFACE IMPORTED ) +if (WINDOWS OR LINUX) + use_system_binary(glext) + use_prebuilt_binary(glext) +endif (WINDOWS OR LINUX) + -if (NOT USESYSTEMLIBS) - if (WINDOWS OR LINUX) - use_prebuilt_binary(glext) - endif (WINDOWS OR LINUX) - use_prebuilt_binary(glh_linear) - set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) -endif (NOT USESYSTEMLIBS) diff --git a/indra/cmake/GLH.cmake b/indra/cmake/GLH.cmake index d5262f2efa..0cefc3543a 100644 --- a/indra/cmake/GLH.cmake +++ b/indra/cmake/GLH.cmake @@ -1,11 +1,7 @@ # -*- cmake -*- include(Prebuilt) -set(GLH_FIND_REQUIRED TRUE) -set(GLH_FIND_QUIETLY TRUE) +add_library( ll::glh_linear INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindGLH) -else (USESYSTEMLIBS) - use_prebuilt_binary(glh_linear) -endif (USESYSTEMLIBS) +use_system_binary( glh_linear ) +use_prebuilt_binary(glh_linear) diff --git a/indra/cmake/GStreamer010Plugin.cmake b/indra/cmake/GStreamer010Plugin.cmake index 3fbc40ef8f..61f6f74033 100644 --- a/indra/cmake/GStreamer010Plugin.cmake +++ b/indra/cmake/GStreamer010Plugin.cmake @@ -1,38 +1,12 @@ # -*- cmake -*- include(Prebuilt) +if (NOT LINUX) + return() +endif() -if (USESYSTEMLIBS) - include(FindPkgConfig) +add_library( ll::gstreamer INTERFACE IMPORTED ) +target_compile_definitions( ll::gstreamer INTERFACE LL_GSTREAMER010_ENABLED=1) +use_system_binary(gstreamer) - pkg_check_modules(GSTREAMER010 REQUIRED gstreamer-0.10) - pkg_check_modules(GSTREAMER010_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10) -elseif (LINUX) - use_prebuilt_binary(gstreamer) - # possible libxml2 should have its own .cmake file instead - use_prebuilt_binary(libxml2) - set(GSTREAMER010_FOUND ON FORCE BOOL) - set(GSTREAMER010_PLUGINS_BASE_FOUND ON FORCE BOOL) - set(GSTREAMER010_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/gstreamer-0.10 - ${LIBS_PREBUILT_DIR}/include/glib-2.0 - ${LIBS_PREBUILT_DIR}/include/libxml2 - ) - # We don't need to explicitly link against gstreamer itself, because - # LLMediaImplGStreamer probes for the system's copy at runtime. - set(GSTREAMER010_LIBRARIES - gobject-2.0 - gmodule-2.0 - dl - gthread-2.0 - glib-2.0 - ) -endif (USESYSTEMLIBS) - -if (GSTREAMER010_FOUND AND GSTREAMER010_PLUGINS_BASE_FOUND) - set(GSTREAMER010 ON CACHE BOOL "Build with GStreamer-0.10 streaming media support.") -endif (GSTREAMER010_FOUND AND GSTREAMER010_PLUGINS_BASE_FOUND) - -if (GSTREAMER010) - add_definitions(-DLL_GSTREAMER010_ENABLED=1) -endif (GSTREAMER010) +use_prebuilt_binary(gstreamer) diff --git a/indra/cmake/GoogleMock.cmake b/indra/cmake/GoogleMock.cmake index 5a00546927..e4520fe96e 100644 --- a/indra/cmake/GoogleMock.cmake +++ b/indra/cmake/GoogleMock.cmake @@ -2,27 +2,31 @@ include(Prebuilt) include(Linking) +include_guard() + +add_library( ll::googlemock INTERFACE IMPORTED ) +if(USE_CONAN) + target_link_libraries( ll::googlemock INTERFACE CONAN_PKG::gtest ) + + #Not very nice, but for the moment we need this for tut.hpp + target_include_directories( ll::googlemock SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) + return() +endif() + use_prebuilt_binary(googlemock) -set(GOOGLEMOCK_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include) +target_include_directories( ll::googlemock SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) if (LINUX) # VWR-24366: gmock is underlinked, it needs gtest. - set(GOOGLEMOCK_LIBRARIES - gmock -Wl,--no-as-needed - gtest -Wl,--as-needed) + target_link_libraries( ll::googlemock INTERFACE gmock gtest) elseif(WINDOWS) - set(GOOGLEMOCK_LIBRARIES - gmock) - set(GOOGLEMOCK_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_DIR}/include/gmock - ${LIBS_PREBUILT_DIR}/include/gmock/boost/tr1/tr1) + target_link_libraries( ll::googlemock INTERFACE gmock) + target_include_directories( ll::googlemock SYSTEM INTERFACE + ${LIBS_PREBUILT_DIR}/include + ${LIBS_PREBUILT_DIR}/include/gmock) elseif(DARWIN) - set(GOOGLEMOCK_LIBRARIES - gmock - gtest) + target_link_libraries( ll::googlemock INTERFACE gmock gtest) endif(LINUX) diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake index 811a126b8f..652760e626 100644 --- a/indra/cmake/Havok.cmake +++ b/indra/cmake/Havok.cmake @@ -1,7 +1,6 @@ # -*- cmake -*- include(Prebuilt) -if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") +include_guard() use_prebuilt_binary(havok-source) @@ -124,4 +123,3 @@ foreach(HAVOK_LIB ${HAVOK_LIBS}) endif (LINUX) endforeach(HAVOK_LIB) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake index 06227b3fe2..bb037c0237 100644 --- a/indra/cmake/Hunspell.cmake +++ b/indra/cmake/Hunspell.cmake @@ -1,22 +1,17 @@ # -*- cmake -*- include(Prebuilt) -set(HUNSPELL_FIND_QUIETLY ON) -set(HUNSPELL_FIND_REQUIRED ON) +include_guard() +use_prebuilt_binary(dictionaries) -if (USESYSTEMLIBS) - include(FindHUNSPELL) -else (USESYSTEMLIBS) - use_prebuilt_binary(libhunspell) - if (WINDOWS) - set(HUNSPELL_LIBRARY libhunspell) - elseif(DARWIN) - set(HUNSPELL_LIBRARY hunspell-1.3) - elseif(LINUX) - set(HUNSPELL_LIBRARY hunspell-1.3) - else() - message(FATAL_ERROR "Invalid platform") - endif() - set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell) - use_prebuilt_binary(dictionaries) -endif (USESYSTEMLIBS) +add_library( ll::hunspell INTERFACE IMPORTED ) +use_system_binary(hunspell) +use_prebuilt_binary(libhunspell) +if (WINDOWS) + target_link_libraries( ll::hunspell INTERFACE libhunspell) +elseif(DARWIN) + target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) +elseif(LINUX) + target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) +endif() +target_include_directories( ll::hunspell SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/hunspell) diff --git a/indra/cmake/JPEG.cmake b/indra/cmake/JPEG.cmake index d6da22aecc..252d7852d4 100644 --- a/indra/cmake/JPEG.cmake +++ b/indra/cmake/JPEG.cmake @@ -2,19 +2,17 @@ include(Prebuilt) include(Linking) -set(JPEG_FIND_QUIETLY ON) -set(JPEG_FIND_REQUIRED ON) -if (USESYSTEMLIBS) - include(FindJPEG) -else (USESYSTEMLIBS) - use_prebuilt_binary(jpeglib) - if (LINUX) - set(JPEG_LIBRARIES jpeg) - elseif (DARWIN) - set(JPEG_LIBRARIES jpeg) - elseif (WINDOWS) - set(JPEG_LIBRARIES jpeglib) - endif (LINUX) - set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) -endif (USESYSTEMLIBS) +include_guard() +add_library( ll::libjpeg INTERFACE IMPORTED ) + +use_system_binary(libjpeg) +use_prebuilt_binary(jpeglib) +if (LINUX) + target_link_libraries( ll::libjpeg INTERFACE jpeg) +elseif (DARWIN) + target_link_libraries( ll::libjpeg INTERFACE jpeg) +elseif (WINDOWS) + target_link_libraries( ll::libjpeg INTERFACE jpeglib) +endif (LINUX) +target_include_directories( ll::libjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake index 079619adf8..17f8e47a97 100644 --- a/indra/cmake/JsonCpp.cmake +++ b/indra/cmake/JsonCpp.cmake @@ -1,22 +1,17 @@ # -*- cmake -*- include(Prebuilt) +include_guard() +add_library( ll::jsoncpp INTERFACE IMPORTED ) -set(JSONCPP_FIND_QUIETLY ON) -set(JSONCPP_FIND_REQUIRED ON) +use_system_binary(jsoncpp) -if (USESYSTEMLIBS) - include(FindJsonCpp) -else (USESYSTEMLIBS) - use_prebuilt_binary(jsoncpp) - if (WINDOWS) - set(JSONCPP_LIBRARIES - debug json_libmdd.lib - optimized json_libmd.lib) - elseif (DARWIN) - set(JSONCPP_LIBRARIES libjson_darwin_libmt.a) - elseif (LINUX) - set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a) - endif (WINDOWS) - set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json") -endif (USESYSTEMLIBS) +use_prebuilt_binary(jsoncpp) +if (WINDOWS) + target_link_libraries( ll::jsoncpp INTERFACE json_libmd.lib ) +elseif (DARWIN) + target_link_libraries( ll::jsoncpp INTERFACE libjson_darwin_libmt.a ) +elseif (LINUX) + target_link_libraries( ll::jsoncpp INTERFACE libjson_linux-gcc-4.1.3_libmt.a ) +endif (WINDOWS) +target_include_directories( ll::jsoncpp SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 4937c2a9d7..bf569e5d99 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -18,100 +18,86 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT) # # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code - # - # WARNING: do NOT modify this code without working with poppy - - # there is another branch that will conflict heavily with any changes here. -INCLUDE(GoogleMock) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") - ENDIF(LL_TEST_VERBOSE) + # This here looks weird, but is needed. It will inject GoogleMock into projects that forgot to include `this` (LLAddBuildTest.cmake) + # But through some other means have access to this macro + include(GoogleMock) + + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}") + endif() # Start with the header and project-wide setup before making targets #project(UNITTEST_PROJECT_${project}) # Setup includes, paths, etc - SET(alltest_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ) - SET(alltest_DEP_TARGETS - # needed by the test harness itself - ${APRUTIL_LIBRARIES} - ${APR_LIBRARIES} - llcommon - ) - IF(NOT "${project}" STREQUAL "llmath") + set(alltest_SOURCE_FILES + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ) + set(alltest_DEP_TARGETS + # needed by the test harness itself + llcommon + ) + + set(alltest_LIBRARIES + llcommon + ll::googlemock + ) + if(NOT "${project}" STREQUAL "llmath") # add llmath as a dep unless the tested module *is* llmath! - LIST(APPEND alltest_DEP_TARGETS - llmath - ) - ENDIF(NOT "${project}" STREQUAL "llmath") - SET(alltest_INCLUDE_DIRS - ${LLMATH_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LIBS_OPEN_DIR}/test - ${GOOGLEMOCK_INCLUDE_DIRS} - ) - SET(alltest_LIBRARIES - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ${WINDOWS_LIBRARIES} - ) + list(APPEND alltest_DEP_TARGETS llmath) + list(APPEND alltest_LIBRARIES llmath ) + endif() + # Headers, for convenience in targets. - SET(alltest_HEADER_FILES - ${CMAKE_SOURCE_DIR}/test/test.h - ) + set(alltest_HEADER_FILES ${CMAKE_SOURCE_DIR}/test/test.h) # start the source test executable definitions - SET(${project}_TEST_OUTPUT "") - FOREACH (source ${sources}) - STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) - STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") - ENDIF(LL_TEST_VERBOSE) + set(${project}_TEST_OUTPUT "") + foreach (source ${sources}) + string( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} ) + string( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} ) + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})") + endif() # # Per-codefile additional / external source, header, and include dir property extraction # # Source GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES) - SET(${name}_test_SOURCE_FILES - ${source} - tests/${name}_test.${extension} - ${alltest_SOURCE_FILES} - ${${name}_test_additional_SOURCE_FILES} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") - ENDIF(LL_TEST_VERBOSE) - - if (USE_BUGSPLAT) - SET_PROPERTY(SOURCE ${${name}_test_SOURCE_FILES} - APPEND PROPERTY COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") - endif (USE_BUGSPLAT) + set(${name}_test_SOURCE_FILES + ${source} + tests/${name}_test.${extension} + ${alltest_SOURCE_FILES} + ${${name}_test_additional_SOURCE_FILES} ) + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}") + endif() # Headers GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES) - SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) - set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) - LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") - ENDIF(LL_TEST_VERBOSE) - # Include dirs + set(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES}) + list(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES}) + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}") + endif() + + # Setup target + add_executable(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) + + # Cannot declare a dependency on ${project} because the executable create above will later declare + # add_dependencies( ${project} ${project}_tests) + # as such grab ${project}'s interface include dirs and inject them here + get_property( ${name}_test_additional_INCLUDE_DIRS TARGET ${project} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ) + target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${${name}_test_additional_INCLUDE_DIRS} ) + GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS) - INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${${name}_test_additional_INCLUDE_DIRS} ) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}") - ENDIF(LL_TEST_VERBOSE) + target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${${name}_test_additional_INCLUDE_DIRS} ) + target_include_directories (PROJECT_${project}_TEST_${name} PRIVATE ${LIBS_OPEN_DIR}/test ) - # Setup target - ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES}) - SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") + set_target_properties(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}") # # Per-codefile additional / external project dep and lib dep property extraction @@ -121,142 +107,133 @@ INCLUDE(GoogleMock) GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS) # Libraries GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES) - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") - ENDIF(LL_TEST_VERBOSE) + + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}") + message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") + endif() + # Add to project - TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) + target_link_libraries(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} ) + add_dependencies( PROJECT_${project}_TEST_${name} ${alltest_DEP_TARGETS}) # Compile-time Definitions GET_OPT_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS) - SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} - PROPERTIES - COMPILE_FLAGS "${${name}_test_additional_CFLAGS}" - COMPILE_DEFINITIONS "LL_TEST=${name};LL_TEST_${name}") - IF(LL_TEST_VERBOSE) - MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}") - ENDIF(LL_TEST_VERBOSE) - + set_target_properties(PROJECT_${project}_TEST_${name} + PROPERTIES + COMPILE_FLAGS "${${name}_test_additional_CFLAGS}" + COMPILE_DEFINITIONS "LL_TEST=${name};LL_TEST_${name}") + if(LL_TEST_VERBOSE) + message("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}") + endif() + # # Setup test targets # - SET(TEST_EXE $<TARGET_FILE:PROJECT_${project}_TEST_${name}>) - SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) - SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) + set(TEST_EXE $<TARGET_FILE:PROJECT_${project}_TEST_${name}>) + set(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt) + set(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19 - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") - ENDIF(LL_TEST_VERBOSE) + if(LL_TEST_VERBOSE) + message(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}") + endif() SET_TEST_PATH(LD_LIBRARY_PATH) LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD}) - IF(LL_TEST_VERBOSE) - MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") - ENDIF(LL_TEST_VERBOSE) - # Add test - ADD_CUSTOM_COMMAND( - OUTPUT ${TEST_OUTPUT} - COMMAND ${TEST_SCRIPT_CMD} - DEPENDS PROJECT_${project}_TEST_${name} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) + if(LL_TEST_VERBOSE) + message(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}") + endif() + + # Add test + add_custom_command( + OUTPUT ${TEST_OUTPUT} + COMMAND ${TEST_SCRIPT_CMD} + DEPENDS PROJECT_${project}_TEST_${name} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) # Why not add custom target and add POST_BUILD command? # Slightly less uncertain behavior # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19 - # > I did not use a post build step as I could not make it notify of a + # > I did not use a post build step as I could not make it notify of a # > failure after the first time you build and fail a test. - daveh 2009-04-20 - LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) - ENDFOREACH (source) + list(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT}) + endforeach (source) # Add the test runner target per-project # (replaces old _test_ok targets all over the place) - ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) - ADD_DEPENDENCIES(${project} ${project}_tests) + add_custom_target(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT}) + add_dependencies(${project} ${project}_tests) ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS) #***************************************************************************** # GET_OPT_SOURCE_FILE_PROPERTY #***************************************************************************** MACRO(GET_OPT_SOURCE_FILE_PROPERTY var filename property) - GET_SOURCE_FILE_PROPERTY(${var} "${filename}" "${property}") - IF("${${var}}" MATCHES NOTFOUND) - SET(${var} "") - ENDIF("${${var}}" MATCHES NOTFOUND) + get_source_file_property(${var} "${filename}" "${property}") + if("${${var}}" MATCHES NOTFOUND) + set(${var} "") + endif() ENDMACRO(GET_OPT_SOURCE_FILE_PROPERTY) #***************************************************************************** # LL_ADD_INTEGRATION_TEST #***************************************************************************** -FUNCTION(LL_ADD_INTEGRATION_TEST - testname - additional_source_files - library_dependencies -# variable args - ) +FUNCTION(LL_ADD_INTEGRATION_TEST + testname + additional_source_files + library_dependencies + # variable args + ) if(TEST_DEBUG) message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on") - endif(TEST_DEBUG) + endif() - SET(source_files - tests/${testname}_test.cpp - ${CMAKE_SOURCE_DIR}/test/test.cpp - ${CMAKE_SOURCE_DIR}/test/lltut.cpp - ${additional_source_files} - ) + set(source_files + tests/${testname}_test.cpp + ${CMAKE_SOURCE_DIR}/test/test.cpp + ${CMAKE_SOURCE_DIR}/test/lltut.cpp + ${additional_source_files} + ) - SET(libraries - ${LEGACY_STDIO_LIBS} - ${library_dependencies} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ) + set(libraries + ${library_dependencies} + ll::googlemock + ) # Add test executable build target if(TEST_DEBUG) message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})") - endif(TEST_DEBUG) - ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files}) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}" - COMPILE_DEFINITIONS "LL_TEST=${testname};LL_TEST_${testname}" - ) - - if(USESYSTEMLIBS) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}") - endif(USESYSTEMLIBS) + endif() - if (USE_BUGSPLAT) - SET_PROPERTY(SOURCE ${source_files} - APPEND PROPERTY COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") - endif (USE_BUGSPLAT) + add_executable(INTEGRATION_TEST_${testname} ${source_files}) + set_target_properties(INTEGRATION_TEST_${testname} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}" + COMPILE_DEFINITIONS "LL_TEST=${testname};LL_TEST_${testname}" + ) - # The following was copied to llcorehttp/CMakeLists.txt's texture_load target. + # The following was copied to llcorehttp/CMakeLists.txt's texture_load target. # Any changes made here should be replicated there. if (WINDOWS) - SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} - PROPERTIES - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" - LINK_FLAGS_RELEASE "" - ) - endif (WINDOWS) + set_target_properties(INTEGRATION_TEST_${testname} + PROPERTIES + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE" + ) + endif () # Add link deps to the executable if(TEST_DEBUG) message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})") - endif(TEST_DEBUG) - TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries}) + endif() + + target_link_libraries(INTEGRATION_TEST_${testname} ${libraries}) + target_include_directories (INTEGRATION_TEST_${testname} PRIVATE ${LIBS_OPEN_DIR}/test ) # Create the test running command - SET(test_command ${ARGN}) - SET(TEST_EXE $<TARGET_FILE:INTEGRATION_TEST_${testname}>) - LIST(FIND test_command "{}" test_exe_pos) - IF(test_exe_pos LESS 0) + set(test_command ${ARGN}) + set(TEST_EXE $<TARGET_FILE:INTEGRATION_TEST_${testname}>) + list(FIND test_command "{}" test_exe_pos) + if(test_exe_pos LESS 0) # The {} marker means "the full pathname of the test executable." # test_exe_pos -1 means we didn't find it -- so append the test executable # name to $ARGN, the variable part of the arg list. This is convenient @@ -265,26 +242,26 @@ FUNCTION(LL_ADD_INTEGRATION_TEST # pathname of the test program as the last of its args. You need specify # {} only if the test program's pathname isn't the last argument in the # desired command line. - LIST(APPEND test_command "${TEST_EXE}") - ELSE (test_exe_pos LESS 0) + list(APPEND test_command "${TEST_EXE}") + else (test_exe_pos LESS 0) # Found {} marker at test_exe_pos. Remove the {}... - LIST(REMOVE_AT test_command test_exe_pos) + list(REMOVE_AT test_command test_exe_pos) # ...and replace it with the actual name of the test executable. - LIST(INSERT test_command test_exe_pos "${TEST_EXE}") - ENDIF (test_exe_pos LESS 0) + list(INSERT test_command test_exe_pos "${TEST_EXE}") + endif() SET_TEST_PATH(LD_LIBRARY_PATH) LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command}) if(TEST_DEBUG) message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}") - endif(TEST_DEBUG) + endif() - ADD_CUSTOM_COMMAND( - TARGET INTEGRATION_TEST_${testname} - POST_BUILD - COMMAND ${TEST_SCRIPT_CMD} - ) + add_custom_command( + TARGET INTEGRATION_TEST_${testname} + POST_BUILD + COMMAND ${TEST_SCRIPT_CMD} + ) # Use CTEST? Not sure how to yet... # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD}) @@ -299,18 +276,14 @@ MACRO(SET_TEST_PATH LISTVAR) # We typically build/package only Release variants of third-party # libraries, so append the Release staging dir in case the library being # sought doesn't have a debug variant. - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release) + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} ${SHARED_LIB_STAGING_DIR}/Release) ELSEIF(DARWIN) # We typically build/package only Release variants of third-party # libraries, so append the Release staging dir in case the library being # sought doesn't have a debug variant. - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib) + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib) ELSE(WINDOWS) # Linux uses a single staging directory anyway. - IF (USESYSTEMLIBS) - set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib) - ELSE (USESYSTEMLIBS) - set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) - ENDIF (USESYSTEMLIBS) + set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib) ENDIF(WINDOWS) ENDMACRO(SET_TEST_PATH) diff --git a/indra/cmake/LLAppearance.cmake b/indra/cmake/LLAppearance.cmake index 675330ec72..bf34b13714 100644 --- a/indra/cmake/LLAppearance.cmake +++ b/indra/cmake/LLAppearance.cmake @@ -2,26 +2,9 @@ include(Variables) include(Boost) -include(LLMessage) include(LLCoreHttp) -set(LLAPPEARANCE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llappearance - ) -if (BUILD_HEADLESS) - set(LLAPPEARANCE_HEADLESS_LIBRARIES - llappearanceheadless - ) -endif (BUILD_HEADLESS) - -set(LLAPPEARANCE_LIBRARIES llappearance - llmessage - llcorehttp - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ) diff --git a/indra/cmake/LLAudio.cmake b/indra/cmake/LLAudio.cmake index 7c248dfc72..c842c69bfe 100644 --- a/indra/cmake/LLAudio.cmake +++ b/indra/cmake/LLAudio.cmake @@ -1,10 +1,3 @@ # -*- cmake -*- include(Audio) - -set(LLAUDIO_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llaudio - ) - -# be exhaustive here -set(LLAUDIO_LIBRARIES llaudio ${VORBISFILE_LIBRARIES} ${VORBIS_LIBRARIES} ${VORBISENC_LIBRARIES} ${OGG_LIBRARIES} ${OPENAL_LIBRARIES}) diff --git a/indra/cmake/LLCharacter.cmake b/indra/cmake/LLCharacter.cmake deleted file mode 100644 index 9b2f5c4956..0000000000 --- a/indra/cmake/LLCharacter.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLCHARACTER_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llcharacter - ) - -set(LLCHARACTER_LIBRARIES llcharacter) diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake index 53871791fd..92045f7b58 100644 --- a/indra/cmake/LLCommon.cmake +++ b/indra/cmake/LLCommon.cmake @@ -5,38 +5,6 @@ include(Boost) include(EXPAT) include(Tracy) include(ZLIBNG) +include(JsonCpp) -set(LLCOMMON_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llcommon - ${APRUTIL_INCLUDE_DIR} - ${APR_INCLUDE_DIR} - ${TRACY_INCLUDE_DIR} - ) -set(LLCOMMON_SYSTEM_INCLUDE_DIRS - ${Boost_INCLUDE_DIRS} - ) - -if (LINUX) - # In order to support using ld.gold on linux, we need to explicitely - # specify all libraries that llcommon uses. - # llcommon uses `clock_gettime' which is provided by librt on linux. - set(LLCOMMON_LIBRARIES llcommon - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - rt - ) -else (LINUX) - set(LLCOMMON_LIBRARIES llcommon - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ) -endif (LINUX) - -set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a static library.") -if(LLCOMMON_LINK_SHARED) - add_definitions(-DLL_COMMON_LINK_SHARED=1) -endif(LLCOMMON_LINK_SHARED) +include(XmlRpcEpi) diff --git a/indra/cmake/LLCoreHttp.cmake b/indra/cmake/LLCoreHttp.cmake index 613453ab5d..22ed5fef9c 100644 --- a/indra/cmake/LLCoreHttp.cmake +++ b/indra/cmake/LLCoreHttp.cmake @@ -2,16 +2,4 @@ include(CURL) include(OpenSSL) -include(Boost) - -set(LLCOREHTTP_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llcorehttp - ${CURL_INCLUDE_DIRS} - ${OPENSSL_INCLUDE_DIRS} - ${BOOST_INCLUDE_DIRS} - ) - -set(LLCOREHTTP_LIBRARIES llcorehttp - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY}) +include(NGHTTP2) diff --git a/indra/cmake/LLCrashLogger.cmake b/indra/cmake/LLCrashLogger.cmake deleted file mode 100644 index f2cb83eb8b..0000000000 --- a/indra/cmake/LLCrashLogger.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLCRASHLOGGER_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llcrashlogger - ) - -set(LLCRASHLOGGER_LIBRARIES llcrashlogger) diff --git a/indra/cmake/LLFileSystem.cmake b/indra/cmake/LLFileSystem.cmake deleted file mode 100644 index 2e6c42c30c..0000000000 --- a/indra/cmake/LLFileSystem.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLFILESYSTEM_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llfilesystem - ) - -set(LLFILESYSTEM_LIBRARIES llfilesystem) diff --git a/indra/cmake/LLImage.cmake b/indra/cmake/LLImage.cmake index ec3da89081..8e0b44dfe4 100644 --- a/indra/cmake/LLImage.cmake +++ b/indra/cmake/LLImage.cmake @@ -1,11 +1,4 @@ # -*- cmake -*- -include(JPEG) +#include(JPEG) include(PNG) - -set(LLIMAGE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llimage - ${JPEG_INCLUDE_DIRS} - ) - -set(LLIMAGE_LIBRARIES llimage) diff --git a/indra/cmake/LLImageJ2COJ.cmake b/indra/cmake/LLImageJ2COJ.cmake deleted file mode 100644 index 1bcf205f2d..0000000000 --- a/indra/cmake/LLImageJ2COJ.cmake +++ /dev/null @@ -1,5 +0,0 @@ -# -*- cmake -*- - -include(OpenJPEG) - -set(LLIMAGEJ2COJ_LIBRARIES llimagej2coj) diff --git a/indra/cmake/LLInventory.cmake b/indra/cmake/LLInventory.cmake deleted file mode 100644 index c3dc077a2b..0000000000 --- a/indra/cmake/LLInventory.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLINVENTORY_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llinventory - ) - -set(LLINVENTORY_LIBRARIES llinventory) diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake index e478b01f84..fda25610da 100644 --- a/indra/cmake/LLKDU.cmake +++ b/indra/cmake/LLKDU.cmake @@ -7,15 +7,20 @@ if (INSTALL_PROPRIETARY) set(USE_KDU ON CACHE BOOL "Use Kakadu library.") endif (INSTALL_PROPRIETARY) +include_guard() +add_library( ll::kdu INTERFACE IMPORTED ) + if (USE_KDU) include(Prebuilt) use_prebuilt_binary(kdu) if (WINDOWS) - set(KDU_LIBRARY kdu.lib) + target_link_libraries( ll::kdu INTERFACE kdu.lib) else (WINDOWS) - set(KDU_LIBRARY libkdu.a) + target_link_libraries( ll::kdu INTERFACE libkdu.a) endif (WINDOWS) - set(KDU_INCLUDE_DIR ${AUTOBUILD_INSTALL_DIR}/include/kdu) - set(LLKDU_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llkdu) - set(LLKDU_LIBRARIES llkdu) + + target_include_directories( ll::kdu SYSTEM INTERFACE + ${AUTOBUILD_INSTALL_DIR}/include/kdu + ${LIBS_OPEN_DIR}/llkdu + ) endif (USE_KDU) diff --git a/indra/cmake/LLLogin.cmake b/indra/cmake/LLLogin.cmake deleted file mode 100644 index 47d171876a..0000000000 --- a/indra/cmake/LLLogin.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLLOGIN_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/viewer_components/login - ) - -set(LLLOGIN_LIBRARIES lllogin) diff --git a/indra/cmake/LLMath.cmake b/indra/cmake/LLMath.cmake index 893920ae6f..a707c75bc4 100644 --- a/indra/cmake/LLMath.cmake +++ b/indra/cmake/LLMath.cmake @@ -1,7 +1,2 @@ # -*- cmake -*- -set(LLMATH_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llmath - ) - -set(LLMATH_LIBRARIES llmath) diff --git a/indra/cmake/LLMeshOptimizer.cmake b/indra/cmake/LLMeshOptimizer.cmake deleted file mode 100644 index b79944f618..0000000000 --- a/indra/cmake/LLMeshOptimizer.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLMESHOPTIMIZER_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llmeshoptimizer - ) - -set(LLMESHOPTIMIZER_LIBRARIES llmeshoptimizer) diff --git a/indra/cmake/LLMessage.cmake b/indra/cmake/LLMessage.cmake deleted file mode 100644 index 7be53ec0ec..0000000000 --- a/indra/cmake/LLMessage.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# -*- cmake -*- - -include(CURL) -include(OpenSSL) -include(XmlRpcEpi) - -set(LLMESSAGE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llmessage - ${CURL_INCLUDE_DIRS} - ${OPENSSL_INCLUDE_DIRS} - ) - -set(LLMESSAGE_LIBRARIES llmessage) diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake index e6afee762e..36821447c9 100644 --- a/indra/cmake/LLPhysicsExtensions.cmake +++ b/indra/cmake/LLPhysicsExtensions.cmake @@ -10,6 +10,9 @@ if (INSTALL_PROPRIETARY) set(HAVOK ON CACHE BOOL "Use Havok physics library") endif (INSTALL_PROPRIETARY) +include_guard() +add_library( llphysicsextensions_impl INTERFACE IMPORTED ) + # Note that the use_prebuilt_binary macros below do not in fact include binaries; # the llphysicsextensions_* packages are source only and are built here. @@ -19,17 +22,14 @@ if (HAVOK) include(Havok) use_prebuilt_binary(llphysicsextensions_source) set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src) - set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensions) - + target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions) elseif (HAVOK_TPV) use_prebuilt_binary(llphysicsextensions_tpv) - set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensions_tpv) - + target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions_tpv) else (HAVOK) use_prebuilt_binary(llphysicsextensions_stub) set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub) - set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensionsstub) - + target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub) endif (HAVOK) -set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) +target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) diff --git a/indra/cmake/LLPlugin.cmake b/indra/cmake/LLPlugin.cmake deleted file mode 100644 index 399cb332dd..0000000000 --- a/indra/cmake/LLPlugin.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -*- cmake -*- - - -set(LLPLUGIN_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llplugin - ) - -if (LINUX) - # In order to support using ld.gold on linux, we need to explicitely - # specify all libraries that llplugin uses. - set(LLPLUGIN_LIBRARIES llplugin pthread) -else (LINUX) - set(LLPLUGIN_LIBRARIES llplugin) -endif (LINUX) diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 4e34951215..3d8499cbc3 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -4,49 +4,49 @@ include(Prebuilt) include(Boost) +include_guard() + +add_library( ll::pcre INTERFACE IMPORTED ) +add_library( ll::minizip-ng INTERFACE IMPORTED ) +add_library( ll::libxml INTERFACE IMPORTED ) +add_library( ll::colladadom INTERFACE IMPORTED ) + +# ND, needs fixup in collada conan pkg +if( USE_CONAN ) + target_include_directories( ll::colladadom SYSTEM INTERFACE + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/" + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" ) +endif() + +use_system_binary( colladadom ) + use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -set(LLPRIMITIVE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llprimitive - ) +target_link_libraries( ll::pcre INTERFACE pcrecpp pcre ) + +if (WINDOWS) + target_link_libraries( ll::minizip-ng INTERFACE libminizip ) +else() + target_link_libraries( ll::minizip-ng INTERFACE minizip ) +endif() + if (WINDOWS) - set(LLPRIMITIVE_LIBRARIES - debug llprimitive - optimized llprimitive - debug libcollada14dom23-sd - optimized libcollada14dom23-s - libxml2_a - debug pcrecppd - optimized pcrecpp - debug pcred - optimized pcre - debug libminizip - optimized libminizip - ${BOOST_SYSTEM_LIBRARIES} + target_link_libraries( ll::libxml INTERFACE libxml2_a) +else() + target_link_libraries( ll::libxml INTERFACE xml2) +endif() + +target_include_directories( ll::colladadom SYSTEM INTERFACE + ${LIBS_PREBUILT_DIR}/include/collada + ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) +if (WINDOWS) + target_link_libraries(ll::colladadom INTERFACE libcollada14dom23-s ll::libxml ll::minizip-ng ) elseif (DARWIN) - set(LLPRIMITIVE_LIBRARIES - llprimitive - debug collada14dom-d - optimized collada14dom - minizip # for collada libminizip.a - xml2 - pcrecpp - pcre - iconv # Required by libxml2 - ) + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) elseif (LINUX) - set(LLPRIMITIVE_LIBRARIES - llprimitive - debug collada14dom-d - optimized collada14dom - minizip - xml2 - pcrecpp - pcre - ) -endif (WINDOWS) - + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) +endif() diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake deleted file mode 100644 index 868922451f..0000000000 --- a/indra/cmake/LLRender.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# -*- cmake -*- - -include(Variables) -include(FreeType) -include(GLH) - -set(LLRENDER_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llrender - ${GLH_INCLUDE_DIR} - ) - -if (BUILD_HEADLESS) - set(LLRENDER_HEADLESS_LIBRARIES - llrenderheadless - ) -endif (BUILD_HEADLESS) -set(LLRENDER_LIBRARIES - llrender - ) - diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index f69b45cd92..e3e2a3b0c6 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -37,40 +37,3 @@ macro(ll_deploy_sharedlibs_command target_exe) endif(NOT DARWIN) endmacro(ll_deploy_sharedlibs_command) - -# ll_stage_sharedlib -# Performs config and adds a copy command for a sharedlib target. -macro(ll_stage_sharedlib DSO_TARGET) - # target gets written to the DLL staging directory. - # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. - set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) - if(NOT WINDOWS) - get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) - get_filename_component(DSO_FILE ${DSO_PATH} NAME) - if(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) - else(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) - endif(DARWIN) - - # *TODO - maybe make this a symbolic link? -brad - add_custom_command( - TARGET ${DSO_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${DSO_PATH} - ${SHARED_LIB_STAGING_DIR_CONFIG}/${DSO_FILE} - COMMENT "Copying llcommon to the staging folder." - ) - endif(NOT WINDOWS) - - if (DARWIN) - set_target_properties(${DSO_TARGET} PROPERTIES - BUILD_WITH_INSTALL_RPATH 1 - INSTALL_NAME_DIR "@executable_path/../Resources" - ) - endif(DARWIN) - -endmacro(ll_stage_sharedlib) diff --git a/indra/cmake/LLUI.cmake b/indra/cmake/LLUI.cmake deleted file mode 100644 index 34de57108b..0000000000 --- a/indra/cmake/LLUI.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -*- cmake -*- - -set(LLUI_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llui - ) - -set(LLUI_LIBRARIES llui) diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake index 80af7ff2ab..b36e970560 100644 --- a/indra/cmake/LLWindow.cmake +++ b/indra/cmake/LLWindow.cmake @@ -4,39 +4,19 @@ include(Variables) include(GLEXT) include(Prebuilt) -if (USESYSTEMLIBS) - include(FindSDL) +include_guard() +add_library( ll::SDL INTERFACE IMPORTED ) - # This should be done by FindSDL. Sigh. - mark_as_advanced( - SDLMAIN_LIBRARY - SDL_INCLUDE_DIR - SDL_LIBRARY - ) -else (USESYSTEMLIBS) - if (LINUX) - use_prebuilt_binary(SDL) - set (SDL_FOUND TRUE) - set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux) - set (SDL_LIBRARY SDL directfb fusion direct X11) - endif (LINUX) -endif (USESYSTEMLIBS) -if (SDL_FOUND) - include_directories(${SDL_INCLUDE_DIR}) -endif (SDL_FOUND) +if (LINUX) + #Must come first as use_system_binary can exit this file early + target_compile_definitions( ll::SDL INTERFACE LL_SDL=1) -set(LLWINDOW_INCLUDE_DIRS - ${GLEXT_INCLUDE_DIR} - ${LIBS_OPEN_DIR}/llwindow - ) + use_system_binary(SDL) + use_prebuilt_binary(SDL) + + target_include_directories( ll::SDL SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) + target_link_libraries( ll::SDL INTERFACE SDL directfb fusion direct X11) +endif (LINUX) -if (BUILD_HEADLESS) - set(LLWINDOW_HEADLESS_LIBRARIES - llwindowheadless - ) -endif (BUILD_HEADLESS) - set(LLWINDOW_LIBRARIES - llwindow - ) diff --git a/indra/cmake/LLXML.cmake b/indra/cmake/LLXML.cmake deleted file mode 100644 index b093c76297..0000000000 --- a/indra/cmake/LLXML.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -*- cmake -*- - -include(Boost) -include(EXPAT) - -set(LLXML_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llxml - ${EXPAT_INCLUDE_DIRS} - ) -set(LLXML_SYSTEM_INCLUDE_DIRS - ${Boost_INCLUDE_DIRS} - ) - -set(LLXML_LIBRARIES llxml) diff --git a/indra/cmake/LibVLCPlugin.cmake b/indra/cmake/LibVLCPlugin.cmake index df829b615a..599ce02844 100644 --- a/indra/cmake/LibVLCPlugin.cmake +++ b/indra/cmake/LibVLCPlugin.cmake @@ -2,29 +2,26 @@ include(Linking) include(Prebuilt) -if (USESYSTEMLIBS) - set(LIBVLCPLUGIN OFF CACHE BOOL - "LIBVLCPLUGIN support for the llplugin/llmedia test apps.") -else (USESYSTEMLIBS) - use_prebuilt_binary(vlc-bin) - set(LIBVLCPLUGIN ON CACHE BOOL +include_guard() +add_library( ll::libvlc INTERFACE IMPORTED ) + +use_prebuilt_binary(vlc-bin) +set(LIBVLCPLUGIN ON CACHE BOOL "LIBVLCPLUGIN support for the llplugin/llmedia test apps.") - set(VLC_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/vlc) -endif (USESYSTEMLIBS) if (WINDOWS) - set(VLC_PLUGIN_LIBRARIES - libvlc.lib - libvlccore.lib + target_link_libraries( ll::libvlc INTERFACE + libvlc.lib + libvlccore.lib ) elseif (DARWIN) - set(VLC_PLUGIN_LIBRARIES - libvlc.dylib - libvlccore.dylib + target_link_libraries( ll::libvlc INTERFACE + libvlc.dylib + libvlccore.dylib ) elseif (LINUX) # Specify a full path to make sure we get a static link - set(VLC_PLUGIN_LIBRARIES + target_link_libraries( ll::libvlc INTERFACE ${LIBS_PREBUILT_DIR}/lib/libvlc.a ${LIBS_PREBUILT_DIR}/lib/libvlccore.a ) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 3cb235a9d5..4a501f420b 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -1,24 +1,34 @@ # -*- 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) 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 ) + # Kludge for older cmake versions, 3.20+ is needed to use a genex in add_custom_command( OUTPUT <var> ... ) + # 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") + 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/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>) + endif() + + if( DARWIN ) + set( SHARED_LIB_STAGING_DIR ${SHARED_LIB_STAGING_DIR}/Resources) + endif() + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>) 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") -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 @@ -27,52 +37,54 @@ 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. - set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") -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_INSTALL_DIR}/lib/$<LOWER_CASE:$<CONFIG>>) +link_directories(${AUTOBUILD_INSTALL_DIR}/lib/release) -link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) +add_library( ll::oslibraries INTERFACE IMPORTED ) if (LINUX) - set(DL_LIBRARY dl) - set(PTHREAD_LIBRARY pthread) -else (LINUX) - set(DL_LIBRARY "") - set(PTHREAD_LIBRARY "") -endif (LINUX) + target_link_libraries( ll::oslibraries INTERFACE + dl + pthread + rt) +elseif (WINDOWS) + target_link_libraries( ll::oslibraries INTERFACE + 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) + + target_link_libraries( ll::oslibraries INTERFACE + ${COCOA_LIBRARY} + ${IOKIT_LIBRARY} + ${COREFOUNDATION_LIBRARY} + ${CARBON_LIBRARY} + ${AGL_LIBRARY} + ${APPKIT_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) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/MESHOPTIMIZER.cmake b/indra/cmake/MESHOPTIMIZER.cmake deleted file mode 100644 index 1c5b47b9bd..0000000000 --- a/indra/cmake/MESHOPTIMIZER.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -*- cmake -*- - -include(Linking) -include(Prebuilt) - -use_prebuilt_binary(meshoptimizer) - -if (WINDOWS) - set(MESHOPTIMIZER_LIBRARIES meshoptimizer.lib) -elseif (LINUX) - set(MESHOPTIMIZER_LIBRARIES meshoptimizer.o) -elseif (DARWIN) - set(MESHOPTIMIZER_LIBRARIES libmeshoptimizer.a) -endif (WINDOWS) - -set(MESHOPTIMIZER_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/meshoptimizer) diff --git a/indra/cmake/MediaPluginBase.cmake b/indra/cmake/MediaPluginBase.cmake deleted file mode 100644 index 2be035b641..0000000000 --- a/indra/cmake/MediaPluginBase.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# -*- cmake -*- - - -set(MEDIA_PLUGIN_BASE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/media_plugins/base/ - ) - -set(MEDIA_PLUGIN_BASE_LIBRARIES media_plugin_base) diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake new file mode 100644 index 0000000000..fd144d2b97 --- /dev/null +++ b/indra/cmake/Meshoptimizer.cmake @@ -0,0 +1,20 @@ +# -*- cmake -*- + +include(Linking) +include(Prebuilt) + +include_guard() +add_library( ll::meshoptimizer INTERFACE IMPORTED ) + +use_system_binary(meshoptimizer) +use_prebuilt_binary(meshoptimizer) + +if (WINDOWS) + target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib) +elseif (LINUX) + target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.o) +elseif (DARWIN) + target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a) +endif (WINDOWS) + +target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/meshoptimizer) diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 388df16a52..b88fbccf2a 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -3,34 +3,22 @@ include(Prebuilt) set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.") -if (NDOF) - if (USESYSTEMLIBS) - set(NDOF_FIND_REQUIRED ON) - include(FindNDOF) - else (USESYSTEMLIBS) - if (WINDOWS OR DARWIN) - use_prebuilt_binary(libndofdev) - elseif (LINUX) - use_prebuilt_binary(open-libndofdev) - endif (WINDOWS OR DARWIN) +include_guard() +add_library( ll::ndof INTERFACE IMPORTED ) - if (WINDOWS) - set(NDOF_LIBRARY libndofdev) - elseif (DARWIN OR LINUX) - set(NDOF_LIBRARY ndofdev) - endif (WINDOWS) +if (NDOF) + if (WINDOWS OR DARWIN) + use_prebuilt_binary(libndofdev) + elseif (LINUX) + use_prebuilt_binary(open-libndofdev) + endif (WINDOWS OR DARWIN) - set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev) - set(NDOF_FOUND 1) - endif (USESYSTEMLIBS) + if (WINDOWS) + target_link_libraries( ll::ndof INTERFACE libndofdev) + elseif (DARWIN OR LINUX) + target_link_libraries( ll::ndof INTERFACE ndofdev) + endif (WINDOWS) + target_compile_definitions( ll::ndof INTERFACE LIB_NDOF=1) endif (NDOF) -if (NDOF_FOUND) - add_definitions(-DLIB_NDOF=1) - include_directories(${NDOF_INCLUDE_DIR}) -else (NDOF_FOUND) - message(STATUS "Building without N-DoF joystick support") - set(NDOF_INCLUDE_DIR "") - set(NDOF_LIBRARY "") -endif (NDOF_FOUND) diff --git a/indra/cmake/NGHTTP2.cmake b/indra/cmake/NGHTTP2.cmake index df191ff3c1..6396a5bd01 100644 --- a/indra/cmake/NGHTTP2.cmake +++ b/indra/cmake/NGHTTP2.cmake @@ -1,20 +1,16 @@ +include(Linking) include(Prebuilt) -set(NGHTTP2_FIND_QUIETLY ON) -set(NGHTTP2_FIND_REQUIRED ON) +include_guard() +add_library( ll::nghttp2 INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindNGHTTP2) -else (USESYSTEMLIBS) - use_prebuilt_binary(nghttp2) - if (WINDOWS) - set(NGHTTP2_LIBRARIES - ${ARCH_PREBUILT_DIRS_RELEASE}/nghttp2.lib - ) - elseif (DARWIN) - set(NGHTTP2_LIBRARIES libnghttp2.dylib) - else (WINDOWS) - set(NGHTTP2_LIBRARIES libnghttp2.a) - endif (WINDOWS) - set(NGHTTP2_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/nghttp2) -endif (USESYSTEMLIBS) +use_system_binary(nghttp2) +use_prebuilt_binary(nghttp2) +if (WINDOWS) + target_link_libraries( ll::nghttp2 INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/nghttp2.lib) +elseif (DARWIN) + target_link_libraries( ll::nghttp2 INTERFACE libnghttp2.dylib) +else (WINDOWS) + target_link_libraries( ll::nghttp2 INTERFACE libnghttp2.a ) +endif (WINDOWS) +target_include_directories( ll::nghttp2 SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/nghttp2) diff --git a/indra/cmake/NVAPI.cmake b/indra/cmake/NVAPI.cmake index 105f442a30..ff5a5428e0 100644 --- a/indra/cmake/NVAPI.cmake +++ b/indra/cmake/NVAPI.cmake @@ -5,12 +5,9 @@ set(NVAPI ON CACHE BOOL "Use NVAPI.") if (NVAPI) if (WINDOWS) + add_library( ll::nvapi INTERFACE IMPORTED ) + target_link_libraries( ll::nvapi INTERFACE nvapi) use_prebuilt_binary(nvapi) - set(NVAPI_LIBRARY nvapi) - else (WINDOWS) - set(NVAPI_LIBRARY "") endif (WINDOWS) -else (NVAPI) - set(NVAPI_LIBRARY "") endif (NVAPI) diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 1bbfff6f98..0b6a7c2853 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -2,31 +2,37 @@ include(Linking) include(Prebuilt) -if (LINUX) - set(OPENAL ON CACHE BOOL "Enable OpenAL") -else (LINUX) - set(OPENAL OFF CACHE BOOL "Enable OpenAL") -endif (LINUX) +include_guard() + +# ND: Turn this off by default, the openal code in the viewer isn't very well maintained, seems +# to have memory leaks, has no option to play music streams +# It probably makes sense to to completely remove it + +set(USE_OPENAL OFF CACHE BOOL "Enable OpenAL") +# ND: To streamline arguments passed, switch from OPENAL to USE_OPENAL +# To not break all old build scripts convert old arguments but warn about it +if(OPENAL) + message( WARNING "Use of the OPENAL argument is deprecated, please switch to USE_OPENAL") + set(USE_OPENAL ${OPENAL}) +endif() + +if (USE_OPENAL) + add_library( ll::openal INTERFACE IMPORTED ) + target_include_directories( ll::openal SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/AL") + target_compile_definitions( ll::openal INTERFACE LL_OPENAL=1) + use_prebuilt_binary(openal) -if (OPENAL) - set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL") - if (USESYSTEMLIBS) - include(FindPkgConfig) - include(FindOpenAL) - pkg_check_modules(OPENAL_LIB REQUIRED openal) - pkg_check_modules(FREEALUT_LIB REQUIRED freealut) - else (USESYSTEMLIBS) - use_prebuilt_binary(openal) - endif (USESYSTEMLIBS) if(WINDOWS) - set(OPENAL_LIBRARIES - OpenAL32 - alut - ) + target_link_libraries( ll::openal INTERFACE + OpenAL32 + alut + ) + elseif(LINUX) + target_link_libraries( ll::openal INTERFACE + openal + alut + ) else() - set(OPENAL_LIBRARIES - openal - alut - ) + message(FATAL_ERROR "OpenAL is not available for this platform") endif() -endif (OPENAL) +endif () diff --git a/indra/cmake/OpenGL.cmake b/indra/cmake/OpenGL.cmake index 2259c99293..bf7cd8366a 100644 --- a/indra/cmake/OpenGL.cmake +++ b/indra/cmake/OpenGL.cmake @@ -2,11 +2,5 @@ include(Variables) include(Prebuilt) - -if (BUILD_HEADLESS) - SET(OPENGL_glu_LIBRARY GLU) - SET(OPENGL_HEADLESS_LIBRARIES OSMesa16 dl GLU) -endif (BUILD_HEADLESS) - include(FindOpenGL) diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index a078c97cb8..c4aab2e9e5 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -1,14 +1,11 @@ # -*- cmake -*- include(Prebuilt) -set(OPENJPEG_FIND_QUIETLY ON) -set(OPENJPEG_FIND_REQUIRED ON) +include_guard() +add_library( ll::openjpeg INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindOpenJPEG) -else (USESYSTEMLIBS) - use_prebuilt_binary(openjpeg) +use_system_binary(openjpeg) +use_prebuilt_binary(openjpeg) - set(OPENJPEG_LIBRARIES openjp2) - set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) -endif (USESYSTEMLIBS) +target_link_libraries(ll::openjpeg INTERFACE openjp2 ) +target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/openjpeg) diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake index 32400f5e4e..3387c74f45 100644 --- a/indra/cmake/OpenSSL.cmake +++ b/indra/cmake/OpenSSL.cmake @@ -1,23 +1,17 @@ # -*- cmake -*- include(Prebuilt) -set(OpenSSL_FIND_QUIETLY ON) -set(OpenSSL_FIND_REQUIRED ON) +include_guard() +add_library( ll::openssl INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindOpenSSL) -else (USESYSTEMLIBS) - use_prebuilt_binary(openssl) - if (WINDOWS) - set(OPENSSL_LIBRARIES libssl libcrypto) - else (WINDOWS) - set(OPENSSL_LIBRARIES ssl crypto) - endif (WINDOWS) - set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) -endif (USESYSTEMLIBS) +use_system_binary(openssl) +use_prebuilt_binary(openssl) +if (WINDOWS) + target_link_libraries(ll::openssl INTERFACE libssl libcrypto) +elseif (LINUX) + target_link_libraries(ll::openssl INTERFACE ssl crypto dl) +else() + target_link_libraries(ll::openssl INTERFACE ssl crypto) +endif (WINDOWS) +target_include_directories( ll::openssl SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) -if (LINUX) - set(CRYPTO_LIBRARIES crypto dl) -elseif (DARWIN) - set(CRYPTO_LIBRARIES crypto) -endif (LINUX) diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake index 248a875a19..044262bc8d 100644 --- a/indra/cmake/PNG.cmake +++ b/indra/cmake/PNG.cmake @@ -1,34 +1,14 @@ # -*- cmake -*- include(Prebuilt) -set(PNG_FIND_QUIETLY ON) -set(PNG_FIND_REQUIRED ON) +include_guard() +add_library( ll::libpng INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindPNG) -else (USESYSTEMLIBS) - use_prebuilt_binary(libpng) - if (WINDOWS) - set(PNG_LIBRARIES libpng16) - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16) - elseif(DARWIN) - set(PNG_LIBRARIES png16) - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16) - else() - # - # When we have updated static libraries in competition with older - # shared libraries and we want the former to win, we need to do some - # extra work. The *_PRELOAD_ARCHIVES settings are invoked early - # and will pull in the entire archive to the binary giving it - # priority in symbol resolution. Beware of cmake moving the - # achive load itself to another place on the link command line. If - # that happens, you can try something like -Wl,-lpng16 here to hide - # the archive. Also be aware that the linker will not tolerate a - # second whole-archive load of the archive. See viewer's - # CMakeLists.txt for more information. - # - set(PNG_PRELOAD_ARCHIVES -Wl,--whole-archive png16 -Wl,--no-whole-archive) - set(PNG_LIBRARIES png16) - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16) - endif() -endif (USESYSTEMLIBS) +use_system_binary(libpng) +use_prebuilt_binary(libpng) +if (WINDOWS) + target_link_libraries(ll::libpng INTERFACE libpng16) +else() + target_link_libraries(ll::libpng INTERFACE png16 ) +endif() +target_include_directories( ll::libpng SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/libpng16) diff --git a/indra/cmake/PluginAPI.cmake b/indra/cmake/PluginAPI.cmake index d1649e8248..114415e514 100644 --- a/indra/cmake/PluginAPI.cmake +++ b/indra/cmake/PluginAPI.cmake @@ -1,7 +1,9 @@ # -*- cmake -*- +add_library( ll::pluginlibraries INTERFACE IMPORTED ) + if (WINDOWS) - set(PLUGIN_API_WINDOWS_LIBRARIES + target_link_libraries( ll::pluginlibraries INTERFACE wsock32 ws2_32 psapi @@ -9,8 +11,6 @@ if (WINDOWS) advapi32 user32 ) -else (WINDOWS) - set(PLUGIN_API_WINDOWS_LIBRARIES "") endif (WINDOWS) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index 33a6d76916..634cc15c21 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -1,7 +1,5 @@ # -*- cmake -*- - -if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") +include_guard() include(FindAutobuild) if(INSTALL_PROPRIETARY) @@ -25,40 +23,50 @@ endif ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${PREBUILD_TRACKING # of previous attempts is serialized in the file # ${PREBUILD_TRACKING_DIR}/${_binary}_installed) macro (use_prebuilt_binary _binary) - if (NOT DEFINED USESYSTEMLIBS_${_binary}) - set(USESYSTEMLIBS_${_binary} ${USESYSTEMLIBS}) - endif (NOT DEFINED USESYSTEMLIBS_${_binary}) + if( NOT DEFINED ${_binary}_installed ) + set( ${_binary}_installed "") + endif() - if (NOT USESYSTEMLIBS_${_binary}) if("${${_binary}_installed}" STREQUAL "" AND EXISTS "${PREBUILD_TRACKING_DIR}/${_binary}_installed") - file(READ ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${_binary}_installed") - if(DEBUG_PREBUILT) - message(STATUS "${_binary}_installed: \"${${_binary}_installed}\"") - endif(DEBUG_PREBUILT) + file(READ ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${_binary}_installed") + if(DEBUG_PREBUILT) + message(STATUS "${_binary}_installed: \"${${_binary}_installed}\"") + endif(DEBUG_PREBUILT) endif("${${_binary}_installed}" STREQUAL "" AND EXISTS "${PREBUILD_TRACKING_DIR}/${_binary}_installed") if(${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0) - if(DEBUG_PREBUILT) - message(STATUS "cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install + if(DEBUG_PREBUILT) + message(STATUS "cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install --install-dir=${AUTOBUILD_INSTALL_DIR} ${_binary} ") - endif(DEBUG_PREBUILT) - execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}" - install - --install-dir=${AUTOBUILD_INSTALL_DIR} - ${_binary} - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE ${_binary}_installed - ) - file(WRITE ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${${_binary}_installed}") + endif(DEBUG_PREBUILT) + execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}" + install + --install-dir=${AUTOBUILD_INSTALL_DIR} + ${_binary} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE ${_binary}_installed + ) + file(WRITE ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${${_binary}_installed}") endif(${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0) if(NOT ${_binary}_installed EQUAL 0) - message(FATAL_ERROR - "Failed to download or unpack prebuilt '${_binary}'." - " Process returned ${${_binary}_installed}.") + message(FATAL_ERROR + "Failed to download or unpack prebuilt '${_binary}'." + " Process returned ${${_binary}_installed}.") endif (NOT ${_binary}_installed EQUAL 0) - endif (NOT USESYSTEMLIBS_${_binary}) endmacro (use_prebuilt_binary _binary) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +#Sadly we need a macro here, otherwise the return() will not properly work +macro ( use_system_binary package ) + if( USE_CONAN ) + target_link_libraries( ll::${package} INTERFACE CONAN_PKG::${package} ) + foreach( extra_pkg "${ARGN}" ) + if( extra_pkg ) + target_link_libraries( ll::${package} INTERFACE CONAN_PKG::${extra_pkg} ) + endif() + endforeach() + return() + endif() +endmacro() + diff --git a/indra/cmake/PulseAudio.cmake b/indra/cmake/PulseAudio.cmake index cce27f1bdd..303db97db6 100644 --- a/indra/cmake/PulseAudio.cmake +++ b/indra/cmake/PulseAudio.cmake @@ -1,28 +1,4 @@ # -*- cmake -*- include(Prebuilt) -set(PULSEAUDIO OFF CACHE BOOL "Build with PulseAudio support, if available.") - -if (PULSEAUDIO) - if (USESYSTEMLIBS) - include(FindPkgConfig) - - pkg_check_modules(PULSEAUDIO libpulse) - - elseif (LINUX) - use_prebuilt_binary(pulseaudio) - set(PULSEAUDIO_FOUND ON FORCE BOOL) - set(PULSEAUDIO_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ) - # We don't need to explicitly link against pulseaudio itself, because - # the viewer probes for the system's copy at runtime. - set(PULSEAUDIO_LIBRARIES - # none needed! - ) - endif (USESYSTEMLIBS) -endif (PULSEAUDIO) - -if (PULSEAUDIO_FOUND) - add_definitions(-DLL_PULSEAUDIO_ENABLED=1) -endif (PULSEAUDIO_FOUND) +message( FATAL_ERROR "Pulseaudio cmake file is broken" ) diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake index ed595f6966..dbf5033ce5 100644 --- a/indra/cmake/Python.cmake +++ b/indra/cmake/Python.cmake @@ -5,32 +5,49 @@ set(PYTHONINTERP_FOUND) if (WINDOWS) # On Windows, explicitly avoid Cygwin Python. - find_program(PYTHON_EXECUTABLE - NAMES python.exe + # if the user has their own version of Python installed, prefer that + foreach(hive HKEY_CURRENT_USER HKEY_LOCAL_MACHINE) + # prefer more recent Python versions to older ones, if multiple versions + # are installed + foreach(pyver 3.11 3.10 3.9 3.8 3.7) + list(APPEND regpaths "[${hive}\\SOFTWARE\\Python\\PythonCore\\${pyver}\\InstallPath]") + endforeach() + endforeach() + + # TODO: This logic has the disadvantage that if you have multiple versions + # of Python installed, the selected path won't necessarily be the newest - + # e.g. this GLOB will prefer Python310 to Python311. But since pymaybe is + # checked AFTER the registry entries, this will only surface as a problem if + # no installed Python appears in the registry. + file(GLOB pymaybe + "$ENV{PROGRAMFILES}/Python*" +## "$ENV{PROGRAMFILES(X86)}/Python*" + # The Windows environment variable is in fact as shown above, but CMake + # disallows querying an environment variable containing parentheses - + # thanks, Windows. Fudge by just appending " (x86)" to $PROGRAMFILES and + # hoping for the best. + "$ENV{PROGRAMFILES} (x86)/Python*" + "c:/Python*") + + find_program(python + NAMES python3.exe python.exe NO_DEFAULT_PATH # added so that cmake does not find cygwin python PATHS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.9\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.10\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.11\\InstallPath] - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath] - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.8\\InstallPath] - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.9\\InstallPath] - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.10\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.11\\InstallPath] + ${regpaths} + ${pymaybe} ) include(FindPythonInterp) else() - find_program(PYTHON_EXECUTABLE python3) + find_program(python python3) - if (PYTHON_EXECUTABLE) + if (python) set(PYTHONINTERP_FOUND ON) - endif (PYTHON_EXECUTABLE) + endif (python) endif (WINDOWS) -if (NOT PYTHON_EXECUTABLE) +if (NOT python) message(FATAL_ERROR "No Python interpreter found") -endif (NOT PYTHON_EXECUTABLE) +endif (NOT python) +set(PYTHON_EXECUTABLE "${python}" CACHE FILEPATH "Python interpreter for builds") mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index cfff956bcf..b3de06a876 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -1,29 +1,18 @@ # -*- cmake -*- include(Prebuilt) +include_guard() +add_library( ll::tracy INTERFACE IMPORTED ) + set(USE_TRACY OFF CACHE BOOL "Use Tracy profiler.") if (USE_TRACY) - set(TRACY_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tracy) - -# See: indra/llcommon/llprofiler.h - add_definitions(-DLL_PROFILER_CONFIGURATION=3) + use_system_binary(tracy) use_prebuilt_binary(tracy) - if (WINDOWS) - MESSAGE(STATUS "Including Tracy for Windows: '${TRACY_INCLUDE_DIR}'") - endif (WINDOWS) + target_include_directories( ll::tracy SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/tracy) - if (DARWIN) - MESSAGE(STATUS "Including Tracy for Darwin: '${TRACY_INCLUDE_DIR}'") - endif (DARWIN) - - if (LINUX) - MESSAGE(STATUS "Including Tracy for Linux: '${TRACY_INCLUDE_DIR}'") - endif (LINUX) -else (USE_TRACY) - # Tracy.cmake should not set LLCOMMON_INCLUDE_DIRS, let LLCommon.cmake do that - set(TRACY_INCLUDE_DIR "") - set(TRACY_LIBRARY "") +# See: indra/llcommon/llprofiler.h + target_compile_definitions(ll::tracy INTERFACE LL_PROFILER_CONFIGURATION=3 ) endif (USE_TRACY) diff --git a/indra/cmake/Tut.cmake b/indra/cmake/Tut.cmake index e11a3c3314..ad93830803 100644 --- a/indra/cmake/Tut.cmake +++ b/indra/cmake/Tut.cmake @@ -1,6 +1,4 @@ # -*- cmake -*- include(Prebuilt) -if (NOT USESYSTEMLIBS) - use_prebuilt_binary(tut) -endif(NOT USESYSTEMLIBS) +use_prebuilt_binary(tut) diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake index 77fd505df3..8b70192efc 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -2,68 +2,53 @@ include(Prebuilt) include(FreeType) -if (USESYSTEMLIBS) - include(FindPkgConfig) - - if (LINUX) - set(PKGCONFIG_PACKAGES - atk - cairo - gdk-2.0 - gdk-pixbuf-2.0 - glib-2.0 - gmodule-2.0 - gtk+-2.0 - gthread-2.0 - libpng - pango - pangoft2 - pangox - pangoxft - sdl - ) - endif (LINUX) +add_library( ll::uilibraries INTERFACE IMPORTED ) - foreach(pkg ${PKGCONFIG_PACKAGES}) - pkg_check_modules(${pkg} REQUIRED ${pkg}) - include_directories(${${pkg}_INCLUDE_DIRS}) - link_directories(${${pkg}_LIBRARY_DIRS}) - list(APPEND UI_LIBRARIES ${${pkg}_LIBRARIES}) - add_definitions(${${pkg}_CFLAGS_OTHERS}) - endforeach(pkg) -else (USESYSTEMLIBS) - if (LINUX) - use_prebuilt_binary(gtk-atk-pango-glib) - endif (LINUX) +if (LINUX) + target_compile_definitions(ll::uilibraries INTERFACE LL_GTK=1 LL_X11=1 ) - if (LINUX) - set(UI_LIBRARIES - atk-1.0 - gdk-x11-2.0 - gdk_pixbuf-2.0 - Xinerama - glib-2.0 - gmodule-2.0 - gobject-2.0 - gthread-2.0 - gtk-x11-2.0 - pango-1.0 - pangoft2-1.0 - pangox-1.0 - pangoxft-1.0 - ${FREETYPE_LIBRARIES} - ) - endif (LINUX) + if( USE_CONAN ) + target_link_libraries( ll::uilibraries INTERFACE CONAN_PKG::gtk ) + return() + endif() + use_prebuilt_binary(gtk-atk-pango-glib) + + target_link_libraries( ll::uilibraries INTERFACE + atk-1.0 + gdk-x11-2.0 + gdk_pixbuf-2.0 + Xinerama + glib-2.0 + gmodule-2.0 + gobject-2.0 + gthread-2.0 + gtk-x11-2.0 + pango-1.0 + pangoft2-1.0 + pangox-1.0 + pangoxft-1.0 + Xinerama + ll::freetype + ) +endif (LINUX) +if( WINDOWS ) + target_link_libraries( ll::uilibraries INTERFACE + opengl32 + comdlg32 + dxguid + kernel32 + odbc32 + odbccp32 + oleaut32 + shell32 + Vfw32 + wer + winspool + imm32 + ) +endif() - include_directories ( - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_DIR}/include - ) - foreach(include ${${LL_ARCH}_INCLUDES}) - include_directories(${LIBS_PREBUILT_DIR}/include/${include}) - endforeach(include) -endif (USESYSTEMLIBS) +target_include_directories( ll::uilibraries SYSTEM INTERFACE + ${LIBS_PREBUILT_DIR}/include + ) -if (LINUX) - add_definitions(-DLL_GTK=1 -DLL_X11=1) -endif (LINUX) diff --git a/indra/cmake/URIPARSER.cmake b/indra/cmake/URIPARSER.cmake index ecc5b74ef1..6c33ff70e1 100644 --- a/indra/cmake/URIPARSER.cmake +++ b/indra/cmake/URIPARSER.cmake @@ -1,35 +1,19 @@ # -*- cmake -*- -set(URIPARSER_FIND_QUIETLY ON) -set(URIPARSER_FIND_REQUIRED ON) +include_guard() include(Prebuilt) -if (USESYSTEMLIBS) - include(FindURIPARSER) -else (USESYSTEMLIBS) - use_prebuilt_binary(uriparser) - if (WINDOWS) - set(URIPARSER_LIBRARIES - debug uriparserd - optimized uriparser) - elseif (LINUX) - # - # When we have updated static libraries in competition with older - # shared libraries and we want the former to win, we need to do some - # extra work. The *_PRELOAD_ARCHIVES settings are invoked early - # and will pull in the entire archive to the binary giving it. - # priority in symbol resolution. Beware of cmake moving the - # achive load itself to another place on the link command line. If - # that happens, you can try something like -Wl,-luriparser here to hide - # the archive. Also be aware that the linker will not tolerate a - # second whole-archive load of the archive. See viewer's - # CMakeLists.txt for more information. - # - set(URIPARSER_PRELOAD_ARCHIVES -Wl,--whole-archive uriparser -Wl,--no-whole-archive) - set(URIPARSER_LIBRARIES uriparser) - elseif (DARWIN) - set(URIPARSER_LIBRARIES liburiparser.dylib) - endif (WINDOWS) - set(URIPARSER_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/uriparser) -endif (USESYSTEMLIBS) +add_library( ll::uriparser INTERFACE IMPORTED ) + +use_system_binary( uriparser ) + +use_prebuilt_binary(uriparser) +if (WINDOWS) + target_link_libraries( ll::uriparser INTERFACE uriparser) +elseif (LINUX) + target_link_libraries( ll::uriparser INTERFACE uriparser) +elseif (DARWIN) + target_link_libraries( ll::uriparser INTERFACE liburiparser.dylib) +endif (WINDOWS) +target_include_directories( ll::uriparser SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/uriparser) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index e72475cbc4..653db2069a 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -12,15 +12,18 @@ # Switches set here and in 00-Common.cmake must agree with # https://bitbucket.org/lindenlab/viewer-build-variables/src/tip/variables # Reading $LL_BUILD is an attempt to directly use those switches. -if ("$ENV{LL_BUILD}" STREQUAL "") +if ("$ENV{LL_BUILD}" STREQUAL "" AND "${LL_BUILD_ENV}" STREQUAL "" ) message(FATAL_ERROR "Environment variable LL_BUILD must be set") +elseif("$ENV{LL_BUILD}" STREQUAL "") + set( ENV{LL_BUILD} "${LL_BUILD_ENV}" ) + message( "Setting ENV{LL_BUILD} to cached variable ${LL_BUILD_ENV}" ) +else() + set( LL_BUILD_ENV "$ENV{LL_BUILD}" CACHE STRING "Save environment" FORCE ) endif () +include_guard() # Relative and absolute paths to subtrees. -if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) -set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") - if(NOT DEFINED COMMON_CMAKE_DIR) set(COMMON_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake") endif(NOT DEFINED COMMON_CMAKE_DIR) @@ -70,39 +73,36 @@ endif (NOT CMAKE_BUILD_TYPE) # If someone has specified an address size, use that to determine the # architecture. Otherwise, let the architecture specify the address size. if (ADDRESS_SIZE EQUAL 32) - #message(STATUS "ADDRESS_SIZE is 32") set(ARCH i686) elseif (ADDRESS_SIZE EQUAL 64) - #message(STATUS "ADDRESS_SIZE is 64") set(ARCH x86_64) else (ADDRESS_SIZE EQUAL 32) - #message(STATUS "ADDRESS_SIZE is UNRECOGNIZED: '${ADDRESS_SIZE}'") - # Use Python's platform.machine() since uname -m isn't available everywhere. - # Even if you can assume cygwin uname -m, the answer depends on whether - # you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will - # report a 64-bit processor. - execute_process(COMMAND - "${PYTHON_EXECUTABLE}" "-c" - "import platform; print platform.machine()" - OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) - # We expect values of the form i386, i686, x86_64, AMD64. - # In CMake, expressing ARCH.endswith('64') is awkward: - string(LENGTH "${ARCH}" ARCH_LENGTH) - math(EXPR ARCH_LEN_2 "${ARCH_LENGTH} - 2") - string(SUBSTRING "${ARCH}" ${ARCH_LEN_2} 2 ARCH_LAST_2) - if (ARCH_LAST_2 STREQUAL 64) - #message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}") + # Note we cannot use if(DARWIN) here, this variable is set way lower + if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) set(ADDRESS_SIZE 64) - else () - #message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}") - set(ADDRESS_SIZE 32) - endif () + set(ARCH x86_64) + else() + # Use Python's platform.machine() since uname -m isn't available everywhere. + # Even if you can assume cygwin uname -m, the answer depends on whether + # you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will + # report a 64-bit processor. + execute_process(COMMAND + "${PYTHON_EXECUTABLE}" "-c" + "import platform; print( platform.machine() )" + OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + string( REGEX MATCH ".*(64)$" RE_MATCH "${ARCH}" ) + if( RE_MATCH AND ${CMAKE_MATCH_1} STREQUAL "64" ) + set(ADDRESS_SIZE 64) + set(ARCH x86_64) + else() + set(ADDRESS_SIZE 32) + set(ARCH i686) + endif() + endif() endif (ADDRESS_SIZE EQUAL 32) if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(WINDOWS ON BOOL FORCE) - set(LL_ARCH ${ARCH}_win32) - set(LL_ARCH_DIR ${ARCH}-win32) endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -129,9 +129,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(ConfigurePkgConfig) - set(LL_ARCH ${ARCH}_linux) - set(LL_ARCH_DIR ${ARCH}-linux) - if (INSTALL_PROPRIETARY) # Only turn on headless if we can find osmesa libraries. include(FindPkgConfig) @@ -200,9 +197,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_OSX_ARCHITECTURES "${ARCH}") string(REPLACE "i686" "i386" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") - - set(LL_ARCH ${ARCH}_darwin) - set(LL_ARCH_DIR universal-darwin) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Default deploy grid @@ -214,10 +208,10 @@ set(ENABLE_SIGNING OFF CACHE BOOL "Enable signing the viewer") set(SIGNING_IDENTITY "" CACHE STRING "Specifies the signing identity to use, if necessary.") set(VERSION_BUILD "0" CACHE STRING "Revision number passed in from the outside") -set(USESYSTEMLIBS OFF CACHE BOOL "Use libraries from your system rather than Linden-supplied prebuilt libraries.") set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header directives where supported.") source_group("CMake Rules" FILES CMakeLists.txt) -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) +get_property(LL_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index fc5bdedb5a..00f8b77106 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -1,12 +1,20 @@ # -*- cmake -*- include(Prebuilt) -if (NOT USESYSTEMLIBS) - if (LINUX) - use_prebuilt_binary(libuuid) +if (LINUX) + #use_prebuilt_binary(libuuid) + add_library( ll::fontconfig INTERFACE IMPORTED ) + + if( NOT USE_CONAN ) use_prebuilt_binary(fontconfig) - endif (LINUX) + else() + target_link_libraries( ll::fontconfig INTERFACE CONAN_PKG::fontconfig ) + endif() +endif (LINUX) + +if( NOT USE_CONAN ) use_prebuilt_binary(libhunspell) - use_prebuilt_binary(slvoice) -endif(NOT USESYSTEMLIBS) +endif() + +use_prebuilt_binary(slvoice) diff --git a/indra/cmake/XmlRpcEpi.cmake b/indra/cmake/XmlRpcEpi.cmake index 8c3790ea89..6409f9d6e2 100644 --- a/indra/cmake/XmlRpcEpi.cmake +++ b/indra/cmake/XmlRpcEpi.cmake @@ -1,20 +1,11 @@ # -*- cmake -*- include(Prebuilt) -set(XMLRPCEPI_FIND_QUIETLY ON) -set(XMLRPCEPI_FIND_REQUIRED ON) +include_guard() +add_library( ll::xmlrpc-epi INTERFACE IMPORTED ) -if (USESYSTEMLIBS) - include(FindXmlRpcEpi) -else (USESYSTEMLIBS) - use_prebuilt_binary(xmlrpc-epi) - if (WINDOWS) - set(XMLRPCEPI_LIBRARIES - debug xmlrpc-epid - optimized xmlrpc-epi - ) - else (WINDOWS) - set(XMLRPCEPI_LIBRARIES xmlrpc-epi) - endif (WINDOWS) - set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) -endif (USESYSTEMLIBS) +use_system_binary( xmlrpc-epi ) + +use_prebuilt_binary(xmlrpc-epi) +target_link_libraries(ll::xmlrpc-epi INTERFACE xmlrpc-epi ) +target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/ZLIBNG.cmake b/indra/cmake/ZLIBNG.cmake index 1f46a23d92..5d99cd9709 100644 --- a/indra/cmake/ZLIBNG.cmake +++ b/indra/cmake/ZLIBNG.cmake @@ -1,35 +1,22 @@ # -*- cmake -*- -set(ZLIBNG_FIND_QUIETLY ON) -set(ZLIBNG_FIND_REQUIRED ON) - include(Prebuilt) -if (USESYSTEMLIBS) - include(FindZLIBNG) -else (USESYSTEMLIBS) - use_prebuilt_binary(zlib-ng) - if (WINDOWS) - set(ZLIBNG_LIBRARIES - debug zlib - optimized zlib) - elseif (LINUX) - # - # When we have updated static libraries in competition with older - # shared libraries and we want the former to win, we need to do some - # extra work. The *_PRELOAD_ARCHIVES settings are invoked early - # and will pull in the entire archive to the binary giving it - # priority in symbol resolution. Beware of cmake moving the - # achive load itself to another place on the link command line. If - # that happens, you can try something like -Wl,-lz here to hide - # the archive. Also be aware that the linker will not tolerate a - # second whole-archive load of the archive. See viewer's - # CMakeLists.txt for more information. - # - set(ZLIBNG_PRELOAD_ARCHIVES -Wl,--whole-archive z -Wl,--no-whole-archive) - set(ZLIBNG_LIBRARIES z) - elseif (DARWIN) - set(ZLIBNG_LIBRARIES z) - endif (WINDOWS) - set(ZLIBNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib-ng) -endif (USESYSTEMLIBS) +include_guard() +add_library( ll::zlib-ng INTERFACE IMPORTED ) + +if(USE_CONAN ) + target_link_libraries( ll::zlib-ng INTERFACE CONAN_PKG::zlib ) + return() +endif() + +use_prebuilt_binary(zlib-ng) +if (WINDOWS) + target_link_libraries( ll::zlib-ng INTERFACE zlib ) +else() + target_link_libraries( ll::zlib-ng INTERFACE z ) +endif (WINDOWS) + +if( NOT LINUX ) + target_include_directories( ll::zlib-ng SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/zlib-ng) +endif() diff --git a/indra/cmake/bugsplat.cmake b/indra/cmake/bugsplat.cmake index 4edc4c59cd..509981d72c 100644 --- a/indra/cmake/bugsplat.cmake +++ b/indra/cmake/bugsplat.cmake @@ -9,29 +9,33 @@ else (INSTALL_PROPRIETARY) set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system") endif (INSTALL_PROPRIETARY) +include_guard() +add_library( ll::bugsplat INTERFACE IMPORTED ) + if (USE_BUGSPLAT) - if (NOT USESYSTEMLIBS) - include(Prebuilt) - use_prebuilt_binary(bugsplat) - if (WINDOWS) - set(BUGSPLAT_LIBRARIES + include(Prebuilt) + use_prebuilt_binary(bugsplat) + if (WINDOWS) + target_link_libraries( ll::bugsplat INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/bugsplat.lib ) - elseif (DARWIN) - find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED + target_include_directories( ll::bugsplat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/bugsplat) + elseif (DARWIN) + find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}") - else (WINDOWS) - message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF") - endif (WINDOWS) - else (NOT USESYSTEMLIBS) - set(BUGSPLAT_FIND_QUIETLY ON) - set(BUGSPLAT_FIND_REQUIRED ON) - include(FindBUGSPLAT) - endif (NOT USESYSTEMLIBS) + target_link_libraries( ll::bugsplat INTERFACE + ${BUGSPLAT_LIBRARIES} + ) + else (WINDOWS) + message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF") + endif (WINDOWS) - set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name") + if( NOT BUGSPLAT_DB ) + message( FATAL_ERROR "You need to set BUGSPLAT_DB when setting USE_BUGSPLAT" ) + endif() - set(BUGSPLAT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/bugsplat) - set(BUGSPLAT_DEFINE "LL_BUGSPLAT") + set_property( TARGET ll::bugsplat APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS LL_BUGSPLAT) +else() + set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name") endif (USE_BUGSPLAT) diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index 1e92868ae7..1f040bded5 100755 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -73,7 +73,7 @@ def main(command, arguments=[], libpath=[], vars={}): if sys.platform == "win32": lpvars = ["PATH"] elif sys.platform == "darwin": - lpvars = ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"] + lpvars = ["LD_LIBRARY_PATH"] # , "DYLD_LIBRARY_PATH"] elif sys.platform.startswith("linux"): lpvars = ["LD_LIBRARY_PATH"] else: diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt index bd59f57e49..ee2890778b 100644 --- a/indra/integration_tests/llimage_libtest/CMakeLists.txt +++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt @@ -12,16 +12,6 @@ include(LLImageJ2COJ) include(LLKDU) include(LLFileSystem) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - set(llimage_libtest_SOURCE_FILES llimage_libtest.cpp ) @@ -31,9 +21,6 @@ set(llimage_libtest_HEADER_FILES llimage_libtest.h ) -set_source_files_properties(${llimage_libtest_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES}) add_executable(llimage_libtest @@ -48,37 +35,21 @@ set_target_properties(llimage_libtest FALSE ) -# OS-specific libraries -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COREFOUNDATION_LIBRARY CoreFoundation) - set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY}) -elseif (WINDOWS) - set(OS_LIBRARIES) -elseif (LINUX) - set(OS_LIBRARIES) -else (DARWIN) - message(FATAL_ERROR "Unknown platform") -endif (DARWIN) - # Libraries on which this application depends on # Sort by high-level to low-level target_link_libraries(llimage_libtest - ${LEGACY_STDIO_LIBS} - ${LLCOMMON_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLKDU_LIBRARIES} - ${KDU_LIBRARY} - ${LLIMAGEJ2COJ_LIBRARIES} - ${OS_LIBRARIES} - ) + llcommon + llfilesystem + llmath + llimage + llkdu + llimagej2coj + ) if (DARWIN) # Path inside the app bundle where we'll need to copy libraries set(LLIMAGE_LIBTEST_DESTINATION_DIR - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llimage_libtest.app/Contents/Resources + ${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/llimage_libtest.app/Contents/Resources ) # Create the Contents/Resources directory add_custom_command( diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt index 3957ede77f..d603e57aab 100644 --- a/indra/integration_tests/llui_libtest/CMakeLists.txt +++ b/indra/integration_tests/llui_libtest/CMakeLists.txt @@ -22,23 +22,6 @@ include(Hunspell) include(Linking) # include(Tut) -include_directories( - ${FREETYPE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLUI_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LIBS_PREBUILD_DIR}/include/hunspell - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) - set(llui_libtest_SOURCE_FILES llui_libtest.cpp llwidgetreg.cpp @@ -50,50 +33,26 @@ set(llui_libtest_HEADER_FILES llwidgetreg.h ) -set_source_files_properties(${llui_libtest_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llui_libtest_SOURCE_FILES ${llui_libtest_HEADER_FILES}) add_executable(llui_libtest ${llui_libtest_SOURCE_FILES}) -# Link with OS-specific libraries for LLWindow dependency -if (DARWIN) - find_library(COCOA_LIBRARY Cocoa) - find_library(IOKIT_LIBRARY IOKit) - set(OS_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY}) -elseif (WINDOWS) - #ll_stack_trace needs this now... - list(APPEND WINDOWS_LIBRARIES dbghelp) - set(OS_LIBRARIES ${WINDOWS_LIBRARIES}) -elseif (LINUX) - set(OS_LIBRARIES) -else (DARWIN) - message(FATAL_ERROR "unknown platform") -endif (DARWIN) - # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level target_link_libraries(llui_libtest - ${LEGACY_STDIO_LIBS} - llui - llinventory - llmessage - ${LLRENDER_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLKDU_LIBRARIES} - ${KDU_LIBRARY} - ${LLIMAGEJ2COJ_LIBRARIES} - ${OS_LIBRARIES} - ${GOOGLE_PERFTOOLS_LIBRARIES} - ${HUNSPELL_LIBRARY} - ) + llui + llinventory + llmessage + llrender + llimage + llkdu + llimagej2coj + ) if (WINDOWS) set_target_properties(llui_libtest PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMTD" ) # Copy over OpenJPEG.dll @@ -101,7 +60,7 @@ if (WINDOWS) set(OPENJPEG_RELEASE "${ARCH_PREBUILT_DIRS_RELEASE}/openjp2.dll") add_custom_command( TARGET llui_libtest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OPENJPEG_RELEASE} ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Copying OpenJPEG DLLs to binary directory" ) diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 5b277846b7..820f356dae 100755 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -125,7 +125,7 @@ BASE_ARGUMENTS=[ but not application name (used internally)""", default=None), dict(name='configuration', - description="""The build configuration used.""", + description="""The build configurations sub directory used.""", default="Release"), dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE), dict(name='grid', diff --git a/indra/linux_crash_logger/CMakeLists.txt b/indra/linux_crash_logger/CMakeLists.txt index aa82ed12cc..1793aa82b9 100644 --- a/indra/linux_crash_logger/CMakeLists.txt +++ b/indra/linux_crash_logger/CMakeLists.txt @@ -45,9 +45,6 @@ set(linux_crash_logger_HEADER_FILES llcrashloggerlinux.h ) -set_source_files_properties(${linux_crash_logger_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND linux_crash_logger_SOURCE_FILES ${linux_crash_logger_HEADER_FILES} ) @@ -61,19 +58,14 @@ set(LIBRT_LIBRARY rt) target_link_libraries(linux-crash-logger - ${LLCRASHLOGGER_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${UI_LIBRARIES} - ${DB_LIBRARIES} - ${FREETYPE_LIBRARIES} - ${LIBRT_LIBRARY} + llcrashlogger + llfilesystem + llxml + llmessage + llmath + llcorehttp + llcommon + ll::uilibraries ) add_custom_target(linux-crash-logger-target ALL diff --git a/indra/llappearance/CMakeLists.txt b/indra/llappearance/CMakeLists.txt index 268849ad74..75c0e276eb 100644 --- a/indra/llappearance/CMakeLists.txt +++ b/indra/llappearance/CMakeLists.txt @@ -4,30 +4,11 @@ project(llappearance) include(00-Common) include(LLCommon) -include(LLCharacter) include(LLImage) -include(LLInventory) -include(LLMath) -include(LLMessage) include(LLCoreHttp) -include(LLRender) -include(LLFileSystem) include(LLWindow) -include(LLXML) include(Linking) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCHARACTER_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLINVENTORY_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) - set(llappearance_SOURCE_FILES llavatarappearance.cpp llavatarjoint.cpp @@ -71,41 +52,37 @@ set(llappearance_HEADER_FILES llavatarappearancedefines.h ) -set_source_files_properties(${llappearance_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llappearance_SOURCE_FILES ${llappearance_HEADER_FILES}) add_library (llappearance ${llappearance_SOURCE_FILES}) target_link_libraries(llappearance - ${LLCHARACTER_LIBRARIES} - ${LLINVENTORY_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLRENDER_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLCOMMON_LIBRARIES} + llcharacter + llinventory + llimage + llrender + llfilesystem + llmath + llxml + llmessage + llcorehttp + llcommon ) +target_include_directories( llappearance INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if (BUILD_HEADLESS) add_library (llappearanceheadless ${llappearance_SOURCE_FILES}) - + target_include_directories( llappearanceheadless INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries(llappearanceheadless - ${LLCHARACTER_LIBRARIES} - ${LLINVENTORY_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLRENDERHEADLESS_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLCOMMON_LIBRARIES} + llcharacter + llinventory + llimage + llfilesystem + llmath + llxml + llmessage + llcorehttp + llcommon ) endif (BUILD_HEADLESS) diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt index 92a5cfe22f..4f469b9bb5 100644 --- a/indra/llaudio/CMakeLists.txt +++ b/indra/llaudio/CMakeLists.txt @@ -7,23 +7,6 @@ include(LLAudio) include(FMODSTUDIO) include(OPENAL) include(LLCommon) -include(LLMath) -include(LLMessage) -include(LLFileSystem) - -include_directories( - ${LLAUDIO_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${OGG_INCLUDE_DIRS} - ${VORBISENC_INCLUDE_DIRS} - ${VORBISFILE_INCLUDE_DIRS} - ${VORBIS_INCLUDE_DIRS} - ${OPENAL_LIB_INCLUDE_DIRS} - ${FREEAULT_LIB_INCLUDE_DIRS} - ) set(llaudio_SOURCE_FILES llaudioengine.cpp @@ -42,10 +25,7 @@ set(llaudio_HEADER_FILES llwindgen.h ) -if (FMODSTUDIO) - include_directories( - ${FMODSTUDIO_INCLUDE_DIR} - ) +if (TARGET ll::fmodstudio) list(APPEND llaudio_SOURCE_FILES llaudioengine_fmodstudio.cpp lllistener_fmodstudio.cpp @@ -57,13 +37,9 @@ if (FMODSTUDIO) lllistener_fmodstudio.h llstreamingaudio_fmodstudio.h ) -endif (FMODSTUDIO) - -if (OPENAL) - include_directories( - ${OPENAL_LIBRARIES} - ) +endif () +if (TARGET ll::openal) list(APPEND llaudio_SOURCE_FILES llaudioengine_openal.cpp lllistener_openal.cpp @@ -73,22 +49,23 @@ if (OPENAL) llaudioengine_openal.h lllistener_openal.h ) -endif (OPENAL) - -set_source_files_properties(${llaudio_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) +endif () list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) add_library (llaudio ${llaudio_SOURCE_FILES}) -target_link_libraries( - llaudio - ${LLCOMMON_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${VORBISENC_LIBRARIES} - ${VORBISFILE_LIBRARIES} - ${VORBIS_LIBRARIES} - ${OGG_LIBRARIES} +target_include_directories( llaudio INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries( llaudio + llcommon + llmath + llmessage + llfilesystem + ll::vorbis ) + +if( TARGET ll::openal ) + target_link_libraries( llaudio ll::openal ) +endif() +if( TARGET ll::fmodstudio ) + target_link_libraries( llaudio ll::fmodstudio ) +endif() diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt index d90ffb5543..bc45eb474a 100644 --- a/indra/llcharacter/CMakeLists.txt +++ b/indra/llcharacter/CMakeLists.txt @@ -4,22 +4,6 @@ project(llcharacter) include(00-Common) include(LLCommon) -include(LLMath) -include(LLMessage) -include(LLFileSystem) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llcharacter_SOURCE_FILES llanimationstates.cpp @@ -73,18 +57,16 @@ set(llcharacter_HEADER_FILES llvisualparam.h ) -set_source_files_properties(${llcharacter_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES}) add_library (llcharacter ${llcharacter_SOURCE_FILES}) +target_include_directories( llcharacter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries( - llcharacter - ${LLCOMMON_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLXML_LIBRARIES} + llcharacter + llcommon + llmath + llmessage + llfilesystem + llxml ) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 108149b5f7..3d073b009c 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -14,19 +14,6 @@ include(ZLIBNG) include(URIPARSER) include(Tracy) -include_directories( - ${EXPAT_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${JSONCPP_INCLUDE_DIR} - ${ZLIBNG_INCLUDE_DIRS} - ${URIPARSER_INCLUDE_DIRS} - ${TRACY_INCLUDE_DIR} - ) - -# add_executable(lltreeiterators lltreeiterators.cpp) -# -# target_link_libraries(lltreeiterators -# ${LLCOMMON_LIBRARIES}) set(llcommon_SOURCE_FILES indra_constants.cpp @@ -271,52 +258,25 @@ if (DARWIN) list(APPEND llcommon_SOURCE_FILES llsys_objc.mm) endif (DARWIN) -set_source_files_properties(${llcommon_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - -if (USE_BUGSPLAT) - set_source_files_properties(${llcommon_SOURCE_FILES} - PROPERTIES COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") -endif (USE_BUGSPLAT) - list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) -if(LLCOMMON_LINK_SHARED) - add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) - if(NOT ADDRESS_SIZE EQUAL 32) - if(WINDOWS) - ##add_definitions(/FIXED:NO) - else(WINDOWS) # not windows therefore gcc LINUX and DARWIN - add_definitions(-fPIC) - endif(WINDOWS) - endif(NOT ADDRESS_SIZE EQUAL 32) - if(WINDOWS) - # always generate llcommon.pdb, even for "Release" builds - set_target_properties(llcommon PROPERTIES LINK_FLAGS "/DEBUG") - endif(WINDOWS) - ll_stage_sharedlib(llcommon) -else(LLCOMMON_LINK_SHARED) - add_library (llcommon ${llcommon_SOURCE_FILES}) -endif(LLCOMMON_LINK_SHARED) +add_library (llcommon ${llcommon_SOURCE_FILES}) target_link_libraries( - llcommon - ${APRUTIL_LIBRARIES} - ${APR_LIBRARIES} - ${EXPAT_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${ZLIBNG_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_PROGRAM_OPTIONS_LIBRARY} - ${BOOST_REGEX_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ${GOOGLE_PERFTOOLS_LIBRARIES} - ${URIPARSER_LIBRARIES} - ${TRACY_LIBRARY} + llcommon + ll::apr + ll::expat + ll::jsoncpp + ll::zlib-ng + ll::boost + ll::uriparser + ll::oslibraries + ll::tracy ) +target_include_directories(llcommon INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(llcommon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + add_dependencies(llcommon stage_third_party_libs) if (LL_TESTS) @@ -327,14 +287,7 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llcommon "${llcommon_TEST_SOURCE_FILES}") #set(TEST_DEBUG on) - set(test_libs llcommon - ${LLCOMMON_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY}) + set(test_libs llcommon) LL_ADD_INTEGRATION_TEST(bitpack "" "${test_libs}") LL_ADD_INTEGRATION_TEST(classic_callback "" "${test_libs}") LL_ADD_INTEGRATION_TEST(commonmisc "" "${test_libs}") diff --git a/indra/llcommon/apply.h b/indra/llcommon/apply.h new file mode 100644 index 0000000000..7c58d63bc0 --- /dev/null +++ b/indra/llcommon/apply.h @@ -0,0 +1,115 @@ +/** + * @file apply.h + * @author Nat Goodspeed + * @date 2022-06-18 + * @brief C++14 version of std::apply() + * + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ + * Copyright (c) 2022, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_APPLY_H) +#define LL_APPLY_H + +#include <boost/type_traits/function_traits.hpp> +#include <tuple> + +namespace LL +{ + +/** + * USAGE NOTE: + * https://stackoverflow.com/a/40523474/5533635 + * + * If you're trying to pass apply() a variadic function, the compiler + * complains that it can't deduce the callable type, presumably because it + * doesn't know which arity to reify to pass. + * + * But it works to wrap the variadic function in a generic lambda, e.g.: + * + * @CODE + * LL::apply( + * [](auto&&... args) + * { + * return variadic(std::forward<decltype(args)>(args)...); + * }, + * args); + * @ENDCODE + * + * Presumably this is because there's only one instance of the generic lambda + * @em type, with a variadic <tt>operator()()</tt>. + * + * It's pointless to provide a wrapper @em function that implicitly supplies + * the generic lambda. You couldn't pass your variadic function to our wrapper + * function, for the same original reason! + * + * Instead we provide a wrapper @em macro. Sorry, Dr. Stroustrup. + */ +#define VAPPLY(FUNC, ARGS) \ + LL::apply( \ + [](auto&&... args) \ + { \ + return (FUNC)(std::forward<decltype(args)>(args)...); \ + }, \ + (ARGS)) + +#if __cplusplus >= 201703L + +// C++17 implementation +using std::apply; + +#else // C++14 + +// Derived from https://stackoverflow.com/a/20441189 +// and https://en.cppreference.com/w/cpp/utility/apply +template <typename CALLABLE, typename TUPLE, std::size_t... I> +auto apply_impl(CALLABLE&& func, TUPLE&& args, std::index_sequence<I...>) +{ + // call func(unpacked args) + return std::forward<CALLABLE>(func)(std::move(std::get<I>(args))...); +} + +template <typename CALLABLE, typename... ARGS> +auto apply(CALLABLE&& func, const std::tuple<ARGS...>& args) +{ + // std::index_sequence_for is the magic sauce here, generating an argument + // pack of indexes for each entry in args. apply_impl() can then pass + // those to std::get() to unpack args into individual arguments. + return apply_impl(std::forward<CALLABLE>(func), + args, + std::index_sequence_for<ARGS...>{}); +} + +// per https://stackoverflow.com/a/57510428/5533635 +template <typename CALLABLE, typename T, size_t SIZE> +auto apply(CALLABLE&& func, const std::array<T, SIZE>& args) +{ + return apply(std::forward<CALLABLE>(func), std::tuple_cat(args)); +} + +// per https://stackoverflow.com/a/28411055/5533635 +template <typename CALLABLE, typename T, std::size_t... I> +auto apply_impl(CALLABLE&& func, const std::vector<T>& args, std::index_sequence<I...>) +{ + return apply_impl(std::forward<CALLABLE>(func), + std::make_tuple(std::forward<T>(args[I])...), + I...); +} + +// this goes beyond C++17 std::apply() +template <typename CALLABLE, typename T> +auto apply(CALLABLE&& func, const std::vector<T>& args) +{ + constexpr auto arity = boost::function_traits<CALLABLE>::arity; + assert(args.size() == arity); + return apply_impl(std::forward<CALLABLE>(func), + args, + std::make_index_sequence<arity>()); +} + +#endif // C++14 + +} // namespace LL + +#endif /* ! defined(LL_APPLY_H) */ diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 8ddd132793..3ff8d16bbb 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -68,10 +68,6 @@ void setup_signals(); void default_unix_signal_handler(int signum, siginfo_t *info, void *); #if LL_LINUX -#include "google_breakpad/minidump_descriptor.h" -static bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, - void* context, - bool succeeded); #else // Called by breakpad exception handler after the minidump has been generated. bool unix_post_minidump_callback(const char *dump_dir, @@ -856,47 +852,8 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) } #if LL_LINUX -bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded) -{ - // Copy minidump file path into fixed buffer in the app instance to avoid - // heap allocations in a crash handler. - - // path format: <dump_dir>/<minidump_id>.dmp - - //HACK: *path points to the buffer in getMiniDumpFilename which has already allocated space - //to avoid doing allocation during crash. - char * path = LLApp::instance()->getMiniDumpFilename(); - int dir_path_len = strlen(path); - - // The path must not be truncated. - S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH - dir_path_len; - - llassert( (remaining - strlen(minidump_desc.path())) > 5); - - path += dir_path_len; - - if (dir_path_len > 0 && path[-1] != '/') - { - *path++ = '/'; - --remaining; - } - - strncpy(path, minidump_desc.path(), remaining); - - LL_INFOS("CRASHREPORT") << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << LL_ENDL; - LLApp::runErrorHandler(); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - clear_signals(); - return false; -#else - return true; #endif -} -#endif - - bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 24cb9bbce1..3daaef44fc 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -421,42 +421,42 @@ public: static std::string typeString(Type type); // Return human-readable type as a string }; -struct llsd_select_bool : public std::unary_function<LLSD, LLSD::Boolean> +struct llsd_select_bool { LLSD::Boolean operator()(const LLSD& sd) const { return sd.asBoolean(); } }; -struct llsd_select_integer : public std::unary_function<LLSD, LLSD::Integer> +struct llsd_select_integer { LLSD::Integer operator()(const LLSD& sd) const { return sd.asInteger(); } }; -struct llsd_select_real : public std::unary_function<LLSD, LLSD::Real> +struct llsd_select_real { LLSD::Real operator()(const LLSD& sd) const { return sd.asReal(); } }; -struct llsd_select_float : public std::unary_function<LLSD, F32> +struct llsd_select_float { F32 operator()(const LLSD& sd) const { return (F32)sd.asReal(); } }; -struct llsd_select_uuid : public std::unary_function<LLSD, LLSD::UUID> +struct llsd_select_uuid { LLSD::UUID operator()(const LLSD& sd) const { return sd.asUUID(); } }; -struct llsd_select_string : public std::unary_function<LLSD, LLSD::String> +struct llsd_select_string { LLSD::String operator()(const LLSD& sd) const { diff --git a/indra/llcommon/llsdjson.h b/indra/llcommon/llsdjson.h index 2be7112404..e56cf03b45 100644 --- a/indra/llcommon/llsdjson.h +++ b/indra/llcommon/llsdjson.h @@ -34,7 +34,7 @@ #include "stdtypes.h" #include "llsd.h" -#include "value.h" +#include "json/value.h" /// Convert a parsed JSON structure into LLSD maintaining member names and /// array indexes. diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index a90c2c7e08..25131291f9 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -142,7 +142,7 @@ struct DeletePairedPointerArray // llselect2nd<map_type::value_type>())); template<typename T> -struct DeletePointerFunctor : public std::unary_function<T*, bool> +struct DeletePointerFunctor { bool operator()(T* ptr) const { @@ -153,7 +153,7 @@ struct DeletePointerFunctor : public std::unary_function<T*, bool> // See notes about DeleteArray for why you should consider avoiding this. template<typename T> -struct DeleteArrayFunctor : public std::unary_function<T*, bool> +struct DeleteArrayFunctor { bool operator()(T* ptr) const { @@ -395,16 +395,17 @@ OutputIter ll_transform_n( // select... with the stl. Look up usage on the sgi website. template <class _Pair> -struct _LLSelect1st : public std::unary_function<_Pair, typename _Pair::first_type> { - const typename _Pair::first_type& operator()(const _Pair& __x) const { +struct _LLSelect1st +{ + const auto& operator()(const _Pair& __x) const { return __x.first; } }; template <class _Pair> -struct _LLSelect2nd : public std::unary_function<_Pair, typename _Pair::second_type> +struct _LLSelect2nd { - const typename _Pair::second_type& operator()(const _Pair& __x) const { + const auto& operator()(const _Pair& __x) const { return __x.second; } }; @@ -416,9 +417,7 @@ template <class _Pair> struct llselect2nd : public _LLSelect2nd<_Pair> {}; // compose... with the stl. Look up usage on the sgi website. template <class _Operation1, class _Operation2> -class ll_unary_compose : - public std::unary_function<typename _Operation2::argument_type, - typename _Operation1::result_type> +class ll_unary_compose { protected: _Operation1 __op1; @@ -426,8 +425,9 @@ protected: public: ll_unary_compose(const _Operation1& __x, const _Operation2& __y) : __op1(__x), __op2(__y) {} - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const { + template <typename _Op2Arg> + auto + operator()(const _Op2Arg& __x) const { return __op1(__op2(__x)); } }; @@ -441,8 +441,7 @@ llcompose1(const _Operation1& __op1, const _Operation2& __op2) template <class _Operation1, class _Operation2, class _Operation3> class ll_binary_compose - : public std::unary_function<typename _Operation2::argument_type, - typename _Operation1::result_type> { +{ protected: _Operation1 _M_op1; _Operation2 _M_op2; @@ -451,8 +450,9 @@ public: ll_binary_compose(const _Operation1& __x, const _Operation2& __y, const _Operation3& __z) : _M_op1(__x), _M_op2(__y), _M_op3(__z) { } - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const { + template<typename OP2ARG> + auto + operator()(const OP2ARG& __x) const { return _M_op1(_M_op2(__x), _M_op3(__x)); } }; @@ -468,54 +468,51 @@ llcompose2(const _Operation1& __op1, const _Operation2& __op2, // helpers to deal with the fact that MSDev does not package // bind... with the stl. Again, this is from sgi. -template <class _Operation> -class llbinder1st : - public std::unary_function<typename _Operation::second_argument_type, - typename _Operation::result_type> { +template <class _Operation, typename _Arg1> +class llbinder1st +{ protected: _Operation op; - typename _Operation::first_argument_type value; + _Arg1 value; public: - llbinder1st(const _Operation& __x, - const typename _Operation::first_argument_type& __y) + llbinder1st(const _Operation& __x, const _Arg1& __y) : op(__x), value(__y) {} - typename _Operation::result_type - operator()(const typename _Operation::second_argument_type& __x) const { - return op(value, __x); - } + template <typename _Arg2> + auto + operator()(const _Arg2& __x) const { + return op(value, __x); + } }; template <class _Operation, class _Tp> -inline llbinder1st<_Operation> +inline auto llbind1st(const _Operation& __oper, const _Tp& __x) { - typedef typename _Operation::first_argument_type _Arg1_type; - return llbinder1st<_Operation>(__oper, _Arg1_type(__x)); + return llbinder1st<_Operation, _Tp>(__oper, __x); } -template <class _Operation> +template <class _Operation, typename _Arg2> class llbinder2nd - : public std::unary_function<typename _Operation::first_argument_type, - typename _Operation::result_type> { +{ protected: _Operation op; - typename _Operation::second_argument_type value; + _Arg2 value; public: llbinder2nd(const _Operation& __x, - const typename _Operation::second_argument_type& __y) + const _Arg2& __y) : op(__x), value(__y) {} - typename _Operation::result_type - operator()(const typename _Operation::first_argument_type& __x) const { + template <typename _Arg1> + auto + operator()(const _Arg1& __x) const { return op(__x, value); } }; template <class _Operation, class _Tp> -inline llbinder2nd<_Operation> +inline auto llbind2nd(const _Operation& __oper, const _Tp& __x) { - typedef typename _Operation::second_argument_type _Arg2_type; - return llbinder2nd<_Operation>(__oper, _Arg2_type(__x)); + return llbinder2nd<_Operation, _Tp>(__oper, __x); } /** @@ -548,8 +545,7 @@ bool before(const std::type_info* lhs, const std::type_info* rhs) namespace std { template <> - struct less<const std::type_info*>: - public std::binary_function<const std::type_info*, const std::type_info*, bool> + struct less<const std::type_info*> { bool operator()(const std::type_info* lhs, const std::type_info* rhs) const { @@ -558,8 +554,7 @@ namespace std }; template <> - struct less<std::type_info*>: - public std::binary_function<std::type_info*, std::type_info*, bool> + struct less<std::type_info*> { bool operator()(std::type_info* lhs, std::type_info* rhs) const { diff --git a/indra/llcommon/stringize.h b/indra/llcommon/stringize.h index 12df693910..c0b13135f9 100644 --- a/indra/llcommon/stringize.h +++ b/indra/llcommon/stringize.h @@ -30,7 +30,7 @@ #define LL_STRINGIZE_H #include <sstream> -#include <llstring.h> +#include "llstring.h" #include <boost/call_traits.hpp> /** diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9754353ab0..7ee36a9ea6 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -15,10 +15,10 @@ #include "llleap.h" // STL headers // std headers +#include <functional> // external library headers #include <boost/assign/list_of.hpp> #include <boost/phoenix/core/argument.hpp> -#include <boost/foreach.hpp> // other Linden headers #include "../test/lltut.h" #include "../test/namedtempfile.h" @@ -29,7 +29,6 @@ #include "llstring.h" #include "stringize.h" #include "StringVec.h" -#include <functional> using boost::assign::list_of; @@ -110,11 +109,6 @@ namespace tut "import os\n" "import sys\n" "\n" - // Don't forget that this Python script is written to some - // temp directory somewhere! Its __file__ is useless in - // finding indra/lib/python. Use our __FILE__, with - // raw-string syntax to deal with Windows pathnames. - "mydir = os.path.dirname(r'" << __FILE__ << "')\n" "from llbase import llsd\n" "\n" "class ProtocolError(Exception):\n" @@ -241,9 +235,9 @@ namespace tut "import sys\n" "sys.stderr.write('''Hello from Python!\n" "note partial line''')\n"); + StringVec vcommand{ PYTHON, script.getName() }; CaptureLog log(LLError::LEVEL_INFO); - waitfor(LLLeap::create(get_test_name(), - sv(list_of(PYTHON)(script.getName())))); + waitfor(LLLeap::create(get_test_name(), vcommand)); log.messageWith("Hello from Python!"); log.messageWith("note partial line"); } @@ -531,7 +525,7 @@ namespace tut result.ensure(); } - struct TestLargeMessage: public std::binary_function<size_t, size_t, bool> + struct TestLargeMessage { TestLargeMessage(const std::string& PYTHON_, const std::string& reader_module_, const std::string& test_name_): diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index c591680250..87796abd3c 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -10,19 +10,10 @@ include(NGHTTP2) include(ZLIBNG) include(LLCoreHttp) include(LLAddBuildTest) -include(LLMessage) include(LLCommon) include(Tut) include(bugsplat) -include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - -include_directories( - ${LLMESSAGE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOREHTTP_INCLUDE_DIRS} - ) - set(llcorehttp_SOURCE_FILES bufferarray.cpp bufferstream.cpp @@ -80,8 +71,6 @@ set(llcorehttp_HEADER_FILES _thread.h ) -set_source_files_properties(${llcorehttp_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) if (DARWIN OR LINUX) # Boost headers define unused members in condition_variable so... set_source_files_properties(${llcorehttp_SOURCE_FILES} @@ -92,14 +81,17 @@ list(APPEND llcorehttp_SOURCE_FILES ${llcorehttp_HEADER_FILES}) add_library (llcorehttp ${llcorehttp_SOURCE_FILES}) target_link_libraries( - llcorehttp - ${CURL_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} + llcorehttp + llcommon + ll::libcurl + ll::openssl + ll::nghttp2 ) +target_include_directories( llcorehttp INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +# llmessage depends on llcorehttp, yet llcorehttp also depends on llmessage (at least for includes). +# Cannot/Should not use target_link_libraries here to add llmessage to the dependencies, as that would +# lead to circular dependencies (or in case of cmake, the first project declaring it's dependencies wins) +target_include_directories( llcorehttp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../llmessage) # tests set(LLCOREHTTP_TESTS ON CACHE BOOL @@ -119,26 +111,15 @@ if (LL_TESTS AND LLCOREHTTP_TESTS) tests/test_bufferstream.hpp ) - set_source_files_properties(${llcorehttp_TEST_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llcorehttp_TEST_SOURCE_FILES ${llcorehttp_TEST_HEADER_FILES}) # LL_ADD_PROJECT_UNIT_TESTS(llcorehttp "${llcorehttp_TEST_SOURCE_FILES}") # set(TEST_DEBUG on) set(test_libs - ${LLCOREHTTP_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${CURL_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} + llcorehttp + llmessage + llcommon ) # If http_proxy is in the current environment (e.g. to fetch s3-proxy @@ -155,7 +136,7 @@ if (LL_TESTS AND LLCOREHTTP_TESTS) if (DARWIN) # Path inside the app bundle where we'll need to copy libraries set(LL_TEST_DESTINATION_DIR - ${CMAKE_BINARY_DIR}/sharedlibs/Resources + ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,,../>Resources ) # Create the Contents/Resources directory @@ -200,18 +181,9 @@ endif (DARWIN) ) set(example_libs - ${LEGACY_STDIO_LIBS} - ${LLCOREHTTP_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${CURL_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${BOOST_THREAD_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} + llcorehttp + llmessage + llcommon ) add_executable(http_texture_load diff --git a/indra/llcrashlogger/CMakeLists.txt b/indra/llcrashlogger/CMakeLists.txt index d70a1e0fb0..6ac73c0d32 100644 --- a/indra/llcrashlogger/CMakeLists.txt +++ b/indra/llcrashlogger/CMakeLists.txt @@ -5,23 +5,6 @@ project(llcrashlogger) include(00-Common) include(LLCoreHttp) include(LLCommon) -include(LLMath) -include(LLMessage) -include(LLFileSystem) -include(LLXML) - -include_directories( - ${LLCOREHTTP_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llcrashlogger_SOURCE_FILES llcrashlogger.cpp @@ -30,14 +13,11 @@ set(llcrashlogger_SOURCE_FILES set(llcrashlogger_HEADER_FILES CMakeLists.txt - llcrashlogger.h llcrashlock.h ) -set_source_files_properties(${llcrashlogger_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llcrashlogger_SOURCE_FILES ${llcrashlogger_HEADER_FILES}) add_library(llcrashlogger ${llcrashlogger_SOURCE_FILES}) +target_link_libraries( llcrashlogger llcommon llmessage llcorehttp llxml llfilesystem ) diff --git a/indra/llfilesystem/CMakeLists.txt b/indra/llfilesystem/CMakeLists.txt index 09c4c33ebf..9f24f75eab 100644 --- a/indra/llfilesystem/CMakeLists.txt +++ b/indra/llfilesystem/CMakeLists.txt @@ -4,12 +4,6 @@ project(llfilesystem) include(00-Common) include(LLCommon) -include(UnixInstall) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) set(llfilesystem_SOURCE_FILES lldir.cpp @@ -53,29 +47,14 @@ if (WINDOWS) LIST(APPEND llfilesystem_HEADER_FILES lldir_win32.h) endif (WINDOWS) -set_source_files_properties(${llfilesystem_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llfilesystem_SOURCE_FILES ${llfilesystem_HEADER_FILES}) add_library (llfilesystem ${llfilesystem_SOURCE_FILES}) -set(cache_BOOST_LIBRARIES - ${BOOST_FILESYSTEM_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ) - target_link_libraries(llfilesystem - ${LLCOMMON_LIBRARIES} - ${cache_BOOST_LIBRARIES} + llcommon ) - -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COCOA_LIBRARY Cocoa) - target_link_libraries(llfilesystem ${COCOA_LIBRARY}) -endif (DARWIN) - +target_include_directories( llfilesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Add tests if (LL_TESTS) @@ -85,14 +64,10 @@ if (LL_TESTS) lldiriterator.cpp ) - set_source_files_properties(lldiriterator.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${cache_BOOST_LIBRARIES}" - ) LL_ADD_PROJECT_UNIT_TESTS(llfilesystem "${llfilesystem_TEST_SOURCE_FILES}") # INTEGRATION TESTS - set(test_libs llmath llcommon llfilesystem ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) + set(test_libs llmath llcommon llfilesystem ) # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}") diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt index 436b8dd1a2..cc75c463bc 100644 --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -5,24 +5,13 @@ project(llimage) include(00-Common) include(LLCommon) include(LLImage) -include(LLMath) -include(LLFileSystem) +include(JPEG) include(LLKDU) -include(LLImageJ2COJ) include(ZLIBNG) include(LLAddBuildTest) include(bugsplat) include(Tut) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${PNG_INCLUDE_DIRS} - ${ZLIBNG_INCLUDE_DIRS} - ) - set(llimage_SOURCE_FILES llimagebmp.cpp llimage.cpp @@ -54,27 +43,24 @@ set(llimage_HEADER_FILES llpngwrapper.h ) -set_source_files_properties(${llimage_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES}) add_library (llimage ${llimage_SOURCE_FILES}) +target_include_directories( llimage INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (USE_KDU) - target_link_libraries(llimage ${LLKDU_LIBRARIES}) + target_link_libraries(llimage llkdu) else (USE_KDU) - target_link_libraries(llimage ${LLIMAGEJ2COJ_LIBRARIES}) + target_link_libraries(llimage llimagej2coj) endif (USE_KDU) target_link_libraries(llimage - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${JPEG_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIBNG_LIBRARIES} + llfilesystem + llmath + llcommon + ll::libpng + ll::libjpeg ) # Add tests diff --git a/indra/llimagej2coj/CMakeLists.txt b/indra/llimagej2coj/CMakeLists.txt index c9423d50dd..93e85668dd 100644 --- a/indra/llimagej2coj/CMakeLists.txt +++ b/indra/llimagej2coj/CMakeLists.txt @@ -7,12 +7,6 @@ include(LLCommon) include(LLImage) include(OpenJPEG) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${OPENJPEG_INCLUDE_DIR} - ) - set(llimagej2coj_SOURCE_FILES llimagej2coj.cpp ) @@ -23,15 +17,13 @@ set(llimagej2coj_HEADER_FILES llimagej2coj.h ) -set_source_files_properties(${llimagej2coj_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llimagej2coj_SOURCE_FILES ${llimagej2coj_HEADER_FILES}) add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES}) -target_link_libraries( - llimagej2coj - ${OPENJPEG_LIBRARIES} +target_link_libraries( llimagej2coj + llcommon + llimage + ll::openjpeg ) diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 04975940aa..93a586759f 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -5,17 +5,6 @@ project(llinventory) include(00-Common) include(LLCommon) include(LLCoreHttp) -include(LLMath) -include(LLMessage) -include(LLFileSystem) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) set(llinventory_SOURCE_FILES llcategory.cpp @@ -63,14 +52,12 @@ set(llinventory_HEADER_FILES lluserrelations.h ) -set_source_files_properties(${llinventory_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES}) add_library (llinventory ${llinventory_SOURCE_FILES}) - +target_link_libraries( llinventory llcommon llmath llmessage llxml ) +target_include_directories( llinventory INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) #add unit tests if (LL_TESTS) @@ -81,7 +68,7 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}") #set(TEST_DEBUG on) - set(test_libs llinventory ${LLMESSAGE_LIBRARIES} ${LLFILESYSTEM_LIBRARIES} ${LLCOREHTTP_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) + set(test_libs llinventory llmath llcorehttp llfilesystem ) LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}") endif (LL_TESTS) diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 134e783053..bba2e2505d 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -1271,5 +1271,5 @@ U32 LLParcel::countExperienceKeyType( U32 type ) return std::count_if( boost::begin(mExperienceKeys | boost::adaptors::map_values), boost::end(mExperienceKeys | boost::adaptors::map_values), - std::bind2nd(std::equal_to<U32>(), type)); + [type](U32 key){ return (key == type); }); } diff --git a/indra/llkdu/CMakeLists.txt b/indra/llkdu/CMakeLists.txt index cb0e204e91..7cd9f5eb24 100644 --- a/indra/llkdu/CMakeLists.txt +++ b/indra/llkdu/CMakeLists.txt @@ -13,15 +13,6 @@ include(00-Common) include(LLCommon) include(LLImage) include(LLKDU) -include(LLMath) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${KDU_INCLUDE_DIR} - ${LLKDU_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ) set(llkdu_SOURCE_FILES llimagej2ckdu.cpp @@ -30,14 +21,10 @@ set(llkdu_SOURCE_FILES set(llkdu_HEADER_FILES CMakeLists.txt - llimagej2ckdu.h llkdumem.h ) -set_source_files_properties(${llkdu_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llkdu_SOURCE_FILES ${llkdu_HEADER_FILES}) # Our KDU package is built with KDU_X86_INTRINSICS in its .vcxproj file. @@ -51,11 +38,14 @@ set_source_files_properties(${llkdu_SOURCE_FILES} if (USE_KDU) add_library (llkdu ${llkdu_SOURCE_FILES}) - target_link_libraries(llkdu - ${KDU_LIBRARY}) - + target_link_libraries(llkdu ll::kdu llimage llcommon) + target_include_directories( llkdu INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + # Add tests - if (LL_TESTS) + # ND: llkdu tests are very strange as they include stubs for KDU classes/methods + # if not having access to the right KDU version this test will fail to compile, incidentally I do not + # have access to a matching version of KDU and thus cannot get this tests to compile + if (LL_TESTS_KDU) include(LLAddBuildTest) include(Tut) SET(llkdu_TEST_SOURCE_FILES @@ -66,11 +56,12 @@ if (USE_KDU) llkdumem.h lltut.h ) - SET(llkdu_test_additional_INCLUDE_DIRS - ${KDU_INCLUDE_DIR} - ${LLKDU_INCLUDE_DIRS} - ) + + get_property( llimage_include_dir TARGET llimage PROPERTY INTERFACE_INCLUDE_DIRECTORIES ) + set_property( SOURCE ${llkdu_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_LIBRARIES ll::kdu llcommon) + set_property( SOURCE ${llkdu_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_INCLUDE_DIRS ${llimage_include_dir}) + LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}") - endif (LL_TESTS) + endif (LL_TESTS_KDU) endif (USE_KDU) diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 4617309606..eb29df245a 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -4,16 +4,9 @@ project(llmath) include(00-Common) include(LLCommon) -include(LLMeshOptimizer) include(bugsplat) include(Boost) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLMESHOPTIMIZER_INCLUDE_DIRS} - ) - set(llmath_SOURCE_FILES llbbox.cpp llbboxlocal.cpp @@ -102,17 +95,12 @@ set(llmath_HEADER_FILES xform.h ) -set_source_files_properties(${llmath_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES}) add_library (llmath ${llmath_SOURCE_FILES}) -target_link_libraries(llmath - ${LLCOMMON_LIBRARIES} - ${LLMESHOPTIMIZER_LIBRARIES} - ) +target_link_libraries(llmath llcommon llmeshoptimizer) +target_include_directories( llmath INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Add tests if (LL_TESTS) @@ -127,15 +115,11 @@ if (LL_TESTS) v4color.cpp v4coloru.cpp ) - set_source_files_properties( - ${llmath_TEST_SOURCE_FILES} - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_THREAD_LIBRARY}" - ) + LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}") # INTEGRATION TESTS - set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) + set(test_libs llmath llcommon) # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. LL_ADD_INTEGRATION_TEST(alignment "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}") diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index e2388d6702..dff5bf3af3 100644 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -81,28 +81,28 @@ struct LLCalcParser : grammar<LLCalcParser> ; unary_func = - ((str_p("SIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sin)(self,arg1)]) | - (str_p("COS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_cos)(self,arg1)]) | - (str_p("TAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_tan)(self,arg1)]) | - (str_p("ASIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_asin)(self,arg1)]) | - (str_p("ACOS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_acos)(self,arg1)]) | - (str_p("ATAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_atan)(self,arg1)]) | - (str_p("SQRT") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sqrt)(self,arg1)]) | - (str_p("LOG") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_log)(self,arg1)]) | - (str_p("EXP") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_exp)(self,arg1)]) | - (str_p("ABS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_fabs)(self,arg1)]) | - (str_p("FLR") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_floor)(self,arg1)]) | - (str_p("CEIL") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_ceil)(self,arg1)]) + ((str_p("SIN") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_sin)(self,arg1)]) | + (str_p("COS") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_cos)(self,arg1)]) | + (str_p("TAN") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_tan)(self,arg1)]) | + (str_p("ASIN") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_asin)(self,arg1)]) | + (str_p("ACOS") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_acos)(self,arg1)]) | + (str_p("ATAN") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_atan)(self,arg1)]) | + (str_p("SQRT") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_sqrt)(self,arg1)]) | + (str_p("LOG") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_log)(self,arg1)]) | + (str_p("EXP") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_exp)(self,arg1)]) | + (str_p("ABS") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_fabs)(self,arg1)]) | + (str_p("FLR") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_floor)(self,arg1)]) | + (str_p("CEIL") >> '(' >> expression[unary_func.value = phoenix::bind(&LLCalcParser::_ceil)(self,arg1)]) ) >> assert_syntax(ch_p(')')) ; binary_func = ((str_p("ATAN2") >> '(' >> expression[binary_func.value = arg1] >> ',' >> - expression[binary_func.value = bind(&LLCalcParser::_atan2)(self, binary_func.value, arg1)]) | + expression[binary_func.value = phoenix::bind(&LLCalcParser::_atan2)(self, binary_func.value, arg1)]) | (str_p("MIN") >> '(' >> expression[binary_func.value = arg1] >> ',' >> - expression[binary_func.value = bind(&LLCalcParser::_min)(self, binary_func.value, arg1)]) | + expression[binary_func.value = phoenix::bind(&LLCalcParser::_min)(self, binary_func.value, arg1)]) | (str_p("MAX") >> '(' >> expression[binary_func.value = arg1] >> ',' >> - expression[binary_func.value = bind(&LLCalcParser::_max)(self, binary_func.value, arg1)]) + expression[binary_func.value = phoenix::bind(&LLCalcParser::_max)(self, binary_func.value, arg1)]) ) >> assert_syntax(ch_p(')')) ; @@ -118,10 +118,10 @@ struct LLCalcParser : grammar<LLCalcParser> // Lookup throws an Unknown Symbol error if it is unknown, while this works fine, // would be "neater" to handle symbol lookup from here with an assertive parser. // constants_p[factor.value = arg1]| - identifier[factor.value = bind(&LLCalcParser::lookup)(self, arg1, arg2)] + identifier[factor.value = phoenix::bind(&LLCalcParser::lookup)(self, arg1, arg2)] ) >> // Detect and throw math errors. - assert_domain(eps_p(bind(&LLCalcParser::checkNaN)(self, factor.value))) + assert_domain(eps_p(phoenix::bind(&LLCalcParser::checkNaN)(self, factor.value))) ; unary_expr = @@ -131,14 +131,14 @@ struct LLCalcParser : grammar<LLCalcParser> power = unary_expr[power.value = arg1] >> - *('^' >> assert_syntax(unary_expr[power.value = bind(&powf)(power.value, arg1)])) + *('^' >> assert_syntax(unary_expr[power.value = phoenix::bind(&powf)(power.value, arg1)])) ; term = power[term.value = arg1] >> *(('*' >> assert_syntax(power[term.value *= arg1])) | ('/' >> assert_syntax(power[term.value /= arg1])) | - ('%' >> assert_syntax(power[term.value = bind(&fmodf)(term.value, arg1)])) + ('%' >> assert_syntax(power[term.value = phoenix::bind(&fmodf)(term.value, arg1)])) ) ; diff --git a/indra/llmeshoptimizer/CMakeLists.txt b/indra/llmeshoptimizer/CMakeLists.txt index 016794cfad..dfac44c296 100644 --- a/indra/llmeshoptimizer/CMakeLists.txt +++ b/indra/llmeshoptimizer/CMakeLists.txt @@ -2,43 +2,33 @@ project(llmeshoptimizer) -include(MESHOPTIMIZER) +include(Meshoptimizer) include(00-Common) include(LLCommon) include(LLMath) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESHOPTIMIZER_INCLUDE_DIR} - ${MESHOPTIMIZER_INCLUDE_DIRS} - ${LIBS_PREBUILT_DIR}/include #access to boost headers, needed for LLError - ) - set(llmeshoptimizer_SOURCE_FILES - llmeshoptimizer.cpp - ) + llmeshoptimizer.cpp + ) set(llmeshoptimizer_HEADER_FILES - CMakeLists.txt - - llmeshoptimizer.h - ) + CMakeLists.txt + llmeshoptimizer.h + ) set_source_files_properties(${llmeshoptimizer_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) + PROPERTIES HEADER_FILE_ONLY TRUE) list(APPEND llmeshoptimizer_SOURCE_FILES ${llmeshoptimizer_HEADER_FILES}) -#if (USE_MESHOPT) - add_library (llmeshoptimizer ${llmeshoptimizer_SOURCE_FILES}) +add_library (llmeshoptimizer ${llmeshoptimizer_SOURCE_FILES}) +target_include_directories( llmeshoptimizer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(llmeshoptimizer + llcommon + llmath + ll::meshoptimizer) - target_link_libraries(llmeshoptimizer - ${LLCOMMON_LIBRARIES} - ${LLMATH_LIBRARIES} - ${MESHOPTIMIZER_LIBRARIES}) - - # Add tests +# Add tests -#endif (USE_MESHOPT) diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index f0a1dfe940..4786956e85 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -7,26 +7,12 @@ include(GoogleMock) include(LLAddBuildTest) include(LLCommon) include(LLCoreHttp) -include(LLMath) -include(LLMessage) -include(LLFileSystem) include(LLAddBuildTest) include(Python) include(Tut) include(Python) include(JsonCpp) -include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOREHTTP_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${JSONCPP_INCLUDE_DIR} - ) - set(llmessage_SOURCE_FILES llassetstorage.cpp llavatarname.cpp @@ -197,49 +183,19 @@ set(llmessage_HEADER_FILES sound_ids.h ) -set_source_files_properties(${llmessage_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) add_library (llmessage ${llmessage_SOURCE_FILES}) -if (LINUX) -target_link_libraries( - llmessage - ${CURL_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${XMLRPCEPI_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - rt - ) -else (LINUX) target_link_libraries( - llmessage - ${CURL_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${XMLRPCEPI_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ) -endif(LINUX) + llmessage + llcommon + llfilesystem + llmath + llcorehttp + ll::xmlrpc-epi +) +target_include_directories( llmessage INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # tests if (LL_TESTS) @@ -249,43 +205,18 @@ if (LL_TESTS) lltrustedmessageservice.cpp lltemplatemessagedispatcher.cpp ) + set_property( SOURCE ${llmessage_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_LIBRARIES llmath llcorehttp) LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}") - # set(TEST_DEBUG on) - -if (LINUX) - set(test_libs - ${WINDOWS_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${CURL_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - rt - ${GOOGLEMOCK_LIBRARIES} - ) -else (LINUX) + set(test_libs - ${WINDOWS_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${CURL_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${GOOGLEMOCK_LIBRARIES} - ) -endif(LINUX) + llfilesystem + llmath + llcorehttp + llmessage + llcommon + ) #LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}") diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 7031f1aa8c..c8c9280029 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -35,8 +35,8 @@ #include "llsd.h" #include "llsdjson.h" #include "llsdserialize.h" -#include "reader.h" // JSON -#include "writer.h" // JSON +#include "json/reader.h" // JSON +#include "json/writer.h" // JSON #include "llfilesystem.h" #include "message.h" // for getting the port diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index 0abdafbdfc..c63ce5f441 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -75,7 +75,13 @@ #include <sstream> #include <iterator> + +#ifdef LL_USESYSTEMLIBS +#include <xmlrpc.h> +#else #include <xmlrpc-epi/xmlrpc.h> +#endif + #include "apr_base64.h" #include "llbuffer.h" diff --git a/indra/llmessage/llioutil.h b/indra/llmessage/llioutil.h index e8d245f530..c404a98bed 100644 --- a/indra/llmessage/llioutil.h +++ b/indra/llmessage/llioutil.h @@ -147,7 +147,7 @@ protected: * } * </code> */ -class LLChangeChannel //: public unary_function<T, void> +class LLChangeChannel { public: /** diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index 579d6d7187..14582aaf32 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -32,18 +32,8 @@ #include "llframetimer.h" // This is used for the stl search_n function. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n -struct eq_message_throttle_entry : public std::binary_function< LLMessageThrottleEntry, LLMessageThrottleEntry, bool > -{ - bool operator()(const LLMessageThrottleEntry& a, const LLMessageThrottleEntry& b) const - { - return a.getHash() == b.getHash(); - } -}; -#else bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b) { return a.getHash() == b.getHash(); } -#endif const U64 SEC_TO_USEC = 1000000; @@ -118,14 +108,8 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n - // SJB: This *should* work but has not been tested yet *TODO: Test! - message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(), - std::bind2nd(eq_message_throttle_entry(), entry)); -#else message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 1, entry, eq_message_throttle_entry); -#endif if (found == message_list->end()) { // This message was not found. Add it to the list. @@ -152,15 +136,8 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n - // SJB: This *should* work but has not been tested yet *TODO: Test! - message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(), - std::bind2nd(eq_message_throttle_entry(), entry)); -#else message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 1, entry, eq_message_throttle_entry); -#endif - if (found == message_list->end()) { // This message was not found. Add it to the list. diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 935af2aa5a..e659414e8c 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -435,12 +435,6 @@ BOOL LLThrottleGroup::dynamicAdjust() { channel_over_nominal[i] = FALSE; } - - //if (total) - //{ - // LL_INFOS() << i << ": B" << channel_busy[i] << " I" << channel_idle[i] << " N" << channel_over_nominal[i]; - // LL_CONT << " Nom: " << mNominalBPS[i] << " Cur: " << mCurrentBPS[i] << " BS: " << mBitsSentHistory[i] << LL_ENDL; - //} } if (channels_busy) diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 5cc129a267..14a69afe6e 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -6,26 +6,7 @@ include(00-Common) include(CURL) include(LLCommon) include(LLImage) -include(LLMath) -include(LLMessage) -include(LLRender) -include(LLXML) include(LLWindow) -include(Boost) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llplugin_SOURCE_FILES llpluginclassmedia.cpp @@ -39,7 +20,6 @@ set(llplugin_SOURCE_FILES set(llplugin_HEADER_FILES CMakeLists.txt - llpluginclassmedia.h llpluginclassmediaowner.h llplugininstance.h @@ -51,9 +31,6 @@ set(llplugin_HEADER_FILES llpluginsharedmemory.h ) -set_source_files_properties(${llplugin_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - if(NOT ADDRESS_SIZE EQUAL 32) if(WINDOWS) ##add_definitions(/FIXED:NO) @@ -65,6 +42,7 @@ endif(NOT ADDRESS_SIZE EQUAL 32) list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES}) add_library (llplugin ${llplugin_SOURCE_FILES}) - +target_include_directories( llplugin INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries( llplugin llcommon llmath llrender llmessage ) add_subdirectory(slplugin) diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index e4f64448c5..0ea6495eac 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -2,25 +2,8 @@ project(SLPlugin) include(00-Common) include(LLCommon) -include(LLPlugin) include(Linking) include(PluginAPI) -include(LLMessage) - -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COCOA_LIBRARY Cocoa) -endif (DARWIN) - ### SLPlugin @@ -37,9 +20,6 @@ if (DARWIN) ) endif (DARWIN) -set_source_files_properties(${SLPlugin_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - if (SLPlugin_HEADER_FILES) list(APPEND SLPlugin_SOURCE_FILES ${SLPlugin_HEADER_FILES}) endif (SLPlugin_HEADER_FILES) @@ -63,23 +43,20 @@ set_target_properties(SLPlugin endif () target_link_libraries(SLPlugin - ${LEGACY_STDIO_LIBS} - ${LLPLUGIN_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${PLUGIN_API_WINDOWS_LIBRARIES} -) + llplugin + llmessage + llcommon + ll::pluginlibraries + ) if (DARWIN) - # Mac version needs to link against Carbon - target_link_libraries(SLPlugin ${COCOA_LIBRARY}) # Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later) add_custom_command( TARGET SLPlugin POST_BUILD COMMAND mkdir ARGS -p - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/SLPlugin.app/Contents/Resources + ${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/SLPlugin.app/Contents/Resources ) endif (DARWIN) diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index 7b6d04b096..d69cd958a0 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -4,27 +4,10 @@ project(llprimitive) include(00-Common) include(LLCommon) -include(LLMath) -include(LLMessage) include(LLCoreHttp) -include(LLXML) include(LLPhysicsExtensions) -include(LLCharacter) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LIBS_PREBUILT_DIR}/include/collada - ${LIBS_PREBUILT_DIR}/include/collada/1.4 - ${LLCHARACTER_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} - ) +include(LLPrimitive) +include(GLH) set(llprimitive_SOURCE_FILES lldaeloader.cpp @@ -64,26 +47,24 @@ set(llprimitive_HEADER_FILES material_codes.h object_flags.h ) - -set_source_files_properties(${llprimitive_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES}) add_library (llprimitive ${llprimitive_SOURCE_FILES}) +target_include_directories( llprimitive INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(llprimitive - ${LLCOMMON_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLPHYSICSEXTENSIONS_LIBRARIES} - ${LLCHARACTER_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ) - + llcommon + llmath + llmessage + llcorehttp + llxml + llcharacter + llphysicsextensions_impl + ll::colladadom + ll::pcre + ll::glh_linear + ) #add unit tests if (LL_TESTS) diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index baab09a104..c5cf1100d5 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -7,26 +7,7 @@ include(OpenGL) include(FreeType) include(LLCommon) include(LLImage) -include(LLMath) -include(LLRender) include(LLWindow) -include(LLXML) -include(LLFileSystem) - -include_directories( - ${FREETYPE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llrender_SOURCE_FILES llatmosphere.cpp @@ -83,9 +64,6 @@ set(llrender_HEADER_FILES llglcommonfunc.h ) -set_source_files_properties(${llrender_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) if (BUILD_HEADLESS) @@ -98,34 +76,29 @@ if (BUILD_HEADLESS) ) target_link_libraries(llrenderheadless - ${LLCOMMON_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLRENDER_HEADLESS_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLWINDOW_HEADLESS_LIBRARIES} - ${OPENGL_HEADLESS_LIBRARIES}) - + llcommon + llimage + llmath + llrender + llxml + llfilesystem + ) endif (BUILD_HEADLESS) add_library (llrender ${llrender_SOURCE_FILES}) - -if (SDL_FOUND) - set_property(TARGET llrender - PROPERTY COMPILE_DEFINITIONS LL_SDL=1 - ) -endif (SDL_FOUND) +target_include_directories( llrender INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level -target_link_libraries(llrender - ${LLCOMMON_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLWINDOW_LIBRARIES} - ${FREETYPE_LIBRARIES} - ${OPENGL_LIBRARIES}) +target_link_libraries(llrender + llcommon + llimage + llmath + llfilesystem + llxml + llwindow + ll::freetype + OpenGL::GL + OpenGL::GLU + ) diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index bc1a2f8887..9750bd4fa1 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -239,7 +239,7 @@ std::string currentOsName() return "Windows"; #elif LL_DARWIN return "Mac"; -#elif LL_SDL || LL_MESA_HEADLESS +#elif LL_LINUX return "Linux"; #else return ""; diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 3d93cc0762..e1ecc6a6ca 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -59,11 +59,6 @@ # include "GL/glh_extensions.h" # undef __APPLE__ -/* Although SDL very likely ends up calling glXGetProcAddress() itself, - if we use SDL_GL_GetProcAddress() then we get bogus addresses back on - some systems. Weird. */ -/*# include "SDL/SDL.h" - # define GLH_EXT_GET_PROC_ADDRESS(p) SDL_GL_GetProcAddress(p) */ #define GLX_GLXEXT_PROTOTYPES 1 # include "GL/glx.h" # include "GL/glxext.h" diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 185c1450c8..da24d999b0 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -278,10 +278,10 @@ void LLGLSLShader::readProfileQuery(U32 count, U32 mode) glEndQueryARB(GL_TIME_ELAPSED); glEndQueryARB(GL_SAMPLES_PASSED); - U64 time_elapsed = 0; + GLuint64 time_elapsed = 0; glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); - U64 samples_passed = 0; + GLuint64 samples_passed = 0; glGetQueryObjectui64v(mSamplesQuery, GL_QUERY_RESULT, &samples_passed); sTotalTimeElapsed += time_elapsed; diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index e0579352d3..9108c6143c 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -6,33 +6,9 @@ include(00-Common) include(Hunspell) include(LLCommon) include(LLImage) -include(LLInventory) -include(LLMath) -include(LLMessage) include(LLCoreHttp) -include(LLRender) include(LLWindow) include(LLCoreHttp) -include(LLFileSystem) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOREHTTP_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLINVENTORY_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LIBS_PREBUILD_DIR}/include/hunspell - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llui_SOURCE_FILES llaccordionctrl.cpp @@ -260,9 +236,6 @@ set(llui_HEADER_FILES llxyvector.h ) -set_source_files_properties(${llui_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - SET(llurlentry_TEST_DEPENDENCIES llurlmatch.cpp llurlregistry.cpp @@ -276,42 +249,37 @@ set_source_files_properties(llurlentry.cpp list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES}) add_library (llui ${llui_SOURCE_FILES}) +target_include_directories( llui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level target_link_libraries(llui - ${LLRENDER_LIBRARIES} - ${LLWINDOW_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLINVENTORY_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLXUIXML_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLMATH_LIBRARIES} - ${HUNSPELL_LIBRARY} - ${LLMESSAGE_LIBRARIES} - ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender + llrender + llwindow + llimage + llinventory + llmessage + llcorehttp + llfilesystem + llxml + llmath + ll::hunspell + llcommon ) # Add tests if(LL_TESTS) include(LLAddBuildTest) + set(test_libs llmessage llcorehttp llxml llrender llcommon ll::hunspell) + SET(llui_TEST_SOURCE_FILES llurlmatch.cpp ) + set_property( SOURCE ${llui_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_LIBRARIES ${test_libs}) LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") # INTEGRATION TESTS - set(test_libs llui llmessage llcorehttp llcommon - ${HUNSPELL_LIBRARY} - ${LLCOMMON_LIBRARIES} - ${BOOST_FIBER_LIBRARY} ${BOOST_CONTEXT_LIBRARY} ${BOOST_SYSTEM_LIBRARY} - ${WINDOWS_LIBRARIES}) + if(NOT LINUX) - if(WINDOWS) - LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "imm32;${test_libs}") - else(WINDOWS) - LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") - endif(WINDOWS) + set(test_libs llui llmessage llcorehttp llxml llrender llcommon ll::hunspell ) + LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") endif(NOT LINUX) endif(LL_TESTS) diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 89c9852f4a..5d90b3ef4e 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -30,6 +30,7 @@ #include "llerror.h" #include "llfloater.h" #include "lldockcontrol.h" +#include <memory> /** * Represents floater that can dock. @@ -131,7 +132,7 @@ protected: boost::function<BOOL ()> mIsDockedStateForcedCallback; private: - std::auto_ptr<LLDockControl> mDockControl; + std::unique_ptr<LLDockControl> mDockControl; LLUIImagePtr mDockTongue; static LLHandle<LLFloater> sInstanceHandle; /** diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 55befaef51..ca08e38f77 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -14,26 +14,9 @@ include(00-Common) include(DragDrop) include(LLCommon) include(LLImage) -include(LLMath) -include(LLRender) -include(LLFileSystem) include(LLWindow) -include(LLXML) include(UI) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) +include(ViewerMiscLibs) set(llwindow_SOURCE_FILES llcursortypes.cpp @@ -64,22 +47,21 @@ set(viewer_HEADER_FILES llmousehandler.h ) +set(llwindow_LINK_LIBRARIES + llcommon + llimage + llmath + llrender + llfilesystem + llxml + ll::glh_linear + ll::glext + ll::uilibraries + ll::SDL + ) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) - set(llwindow_LINK_LIBRARIES - ${LLCOMMON_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLRENDER_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLWINDOW_LIBRARIES} - ${LLXML_LIBRARIES} - ${UI_LIBRARIES} # for GTK - ${SDL_LIBRARY} - fontconfig # For FCInit and other FC* functions. - ) - list(APPEND viewer_SOURCE_FILES llkeyboardsdl.cpp llwindowsdl.cpp @@ -157,9 +139,6 @@ if (SOLARIS) ) endif (SOLARIS) -set_source_files_properties(${llwindow_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - if (BUILD_HEADLESS) set(llwindowheadless_SOURCE_FILES llwindowmesaheadless.cpp @@ -197,10 +176,10 @@ if (SDL_FOUND) endif (SDL_FOUND) target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) + target_include_directories(llwindow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if (DARWIN) include(CMakeFindFrameworks) find_library(CARBON_LIBRARY Carbon) target_link_libraries(llwindow ${CARBON_LIBRARY}) endif (DARWIN) - diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index f924b17090..a0fc91399b 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -634,7 +634,6 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits // Get the view instead. mGLView = createOpenGLView(mWindow, mFSAASamples, enable_vsync); mContext = getCGLContextObj(mGLView); - gGLManager.mVRAM = getVramSize(mGLView); } diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index 3a7a54e51d..508c2b919b 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -4,18 +4,6 @@ project(llxml) include(00-Common) include(LLCommon) -include(LLMath) -include(LLFileSystem) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ) -include_directories( - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) set(llxml_SOURCE_FILES llcontrol.cpp @@ -33,20 +21,19 @@ set(llxml_HEADER_FILES llxmltree.h ) -set_source_files_properties(${llxml_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND llxml_SOURCE_FILES ${llxml_HEADER_FILES}) add_library (llxml ${llxml_SOURCE_FILES}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level target_link_libraries( llxml - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${EXPAT_LIBRARIES} + llfilesystem + llmath + llcommon + ll::expat ) +target_include_directories( llxml INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + # tests @@ -62,11 +49,10 @@ if (LL_TESTS) # set(TEST_DEBUG on) set(test_libs - ${LLXML_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ) + llxml + llmath + llcommon + ) LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") endif (LL_TESTS) diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt index 1a5cc8ec9a..972bb7dd2d 100644 --- a/indra/media_plugins/CMakeLists.txt +++ b/indra/media_plugins/CMakeLists.txt @@ -3,8 +3,7 @@ add_subdirectory(base) if (LINUX) - add_subdirectory(gstreamer010) - add_subdirectory(libvlc) + #add_subdirectory(gstreamer010) add_subdirectory(example) endif (LINUX) diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt index 7f2b82ffdd..64b6a4228d 100644 --- a/indra/media_plugins/base/CMakeLists.txt +++ b/indra/media_plugins/base/CMakeLists.txt @@ -5,25 +5,9 @@ project(media_plugin_base) include(00-Common) include(LLCommon) include(LLImage) -include(LLPlugin) -include(LLMath) -include(LLRender) include(LLWindow) include(Linking) include(PluginAPI) -include(OpenGL) - -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) ### media_plugin_base @@ -48,5 +32,7 @@ set(media_plugin_base_HEADER_FILES add_library(media_plugin_base ${media_plugin_base_SOURCE_FILES} - ) + ) +target_link_libraries( media_plugin_base llplugin ) +target_include_directories( media_plugin_base INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt index 2acce03d08..410778114d 100644 --- a/indra/media_plugins/cef/CMakeLists.txt +++ b/indra/media_plugins/cef/CMakeLists.txt @@ -5,29 +5,12 @@ project(media_plugin_cef) include(Boost) include(00-Common) include(LLCommon) -include(LLPlugin) -include(LLMath) -include(LLRender) include(LLWindow) include(Linking) include(PluginAPI) -include(MediaPluginBase) include(CEFPlugin) -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${CEF_INCLUDE_DIR} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - ### media_plugin_cef @@ -47,13 +30,6 @@ set(media_plugin_cef_HEADER_FILES volume_catcher.h ) -set (media_plugin_cef_LINK_LIBRARIES - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - ${CEF_PLUGIN_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${PLUGIN_API_WINDOWS_LIBRARIES}) - # Select which VolumeCatcher implementation to use if (LINUX) message(FATAL_ERROR "CEF plugin has been enabled for a Linux compile.\n" @@ -62,7 +38,7 @@ elseif (DARWIN) list(APPEND media_plugin_cef_SOURCE_FILES mac_volume_catcher_null.cpp) find_library(CORESERVICES_LIBRARY CoreServices) find_library(AUDIOUNIT_LIBRARY AudioUnit) - list(APPEND media_plugin_cef_LINK_LIBRARIES + set( media_plugin_cef_LINK_LIBRARIES ${CORESERVICES_LIBRARY} # for Component Manager calls ${AUDIOUNIT_LIBRARY} # for AudioUnit calls ) @@ -70,9 +46,6 @@ elseif (WINDOWS) list(APPEND media_plugin_cef_SOURCE_FILES windows_volume_catcher.cpp) endif (LINUX) -set_source_files_properties(${media_plugin_cef_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND media_plugin_cef_SOURCE_FILES ${media_plugin_cef_HEADER_FILES}) add_library(media_plugin_cef @@ -85,7 +58,8 @@ add_library(media_plugin_cef #) target_link_libraries(media_plugin_cef - ${media_plugin_cef_LINK_LIBRARIES} + media_plugin_base + ll::cef ) if (WINDOWS) @@ -93,7 +67,6 @@ if (WINDOWS) media_plugin_cef PROPERTIES LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099" - LINK_FLAGS_DEBUG "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMTD /IGNORE:4099" ) endif (WINDOWS) diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt index eb067a7f6e..7d3e7f663b 100644 --- a/indra/media_plugins/example/CMakeLists.txt +++ b/indra/media_plugins/example/CMakeLists.txt @@ -5,31 +5,12 @@ project(media_plugin_example) include(00-Common) include(LLCommon) include(LLImage) -include(LLPlugin) -include(LLMath) -include(LLRender) include(LLWindow) include(Linking) include(PluginAPI) -include(MediaPluginBase) -include(OpenGL) include(ExamplePlugin) -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - - ### media_plugin_example if(NOT ADDRESS_SIZE EQUAL 32) @@ -49,21 +30,7 @@ add_library(media_plugin_example ${media_plugin_example_SOURCE_FILES} ) -target_link_libraries(media_plugin_example - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${EXAMPLE_PLUGIN_LIBRARIES} - ${PLUGIN_API_WINDOWS_LIBRARIES} -) - -add_dependencies(media_plugin_example - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - # Using ${LLCOMMON_LIBRARIES} here drags in a whole bunch of Boost stuff - # that only produces CMake warnings about nonexistent dependencies. - llcommon -) +target_link_libraries(media_plugin_example media_plugin_base ) if (WINDOWS) set_target_properties( diff --git a/indra/media_plugins/gstreamer010/CMakeLists.txt b/indra/media_plugins/gstreamer010/CMakeLists.txt index 571eb57b24..38fc8201bf 100644 --- a/indra/media_plugins/gstreamer010/CMakeLists.txt +++ b/indra/media_plugins/gstreamer010/CMakeLists.txt @@ -5,32 +5,14 @@ project(media_plugin_gstreamer010) include(00-Common) include(LLCommon) include(LLImage) -include(LLPlugin) include(LLMath) -include(LLRender) include(LLWindow) include(Linking) include(PluginAPI) -include(MediaPluginBase) include(OpenGL) include(GStreamer010Plugin) -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${GSTREAMER010_INCLUDE_DIRS} - ${GSTREAMER010_PLUGINS_BASE_INCLUDE_DIRS} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - ### media_plugin_gstreamer010 if(NOT ADDRESS_SIZE EQUAL 32) @@ -59,17 +41,6 @@ add_library(media_plugin_gstreamer010 ) target_link_libraries(media_plugin_gstreamer010 - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${PLUGIN_API_WINDOWS_LIBRARIES} - ${GSTREAMER010_LIBRARIES} -) - -add_dependencies(media_plugin_gstreamer010 - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - ${LLCOMMON_LIBRARIES} -) - - + media_plugin_base + ll::gstreamer + ) diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt index 97392bbe08..a3c1c4ef99 100644 --- a/indra/media_plugins/libvlc/CMakeLists.txt +++ b/indra/media_plugins/libvlc/CMakeLists.txt @@ -5,32 +5,12 @@ project(media_plugin_libvlc) include(00-Common) include(LLCommon) include(LLImage) -include(LLPlugin) -include(LLMath) -include(LLRender) include(LLWindow) include(Linking) include(PluginAPI) -include(MediaPluginBase) -include(OpenGL) include(LibVLCPlugin) -include_directories( - ${LLPLUGIN_INCLUDE_DIRS} - ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${VLC_INCLUDE_DIR} -) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ) - - ### media_plugin_libvlc if(NOT ADDRESS_SIZE EQUAL 32) @@ -51,27 +31,8 @@ add_library(media_plugin_libvlc ) target_link_libraries(media_plugin_libvlc - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${VLC_PLUGIN_LIBRARIES} - ${PLUGIN_API_WINDOWS_LIBRARIES} -) - -add_dependencies(media_plugin_libvlc - ${LLPLUGIN_LIBRARIES} - ${MEDIA_PLUGIN_BASE_LIBRARIES} -##${LLCOMMON_LIBRARIES} - # Just say 'llcommon' here. LLCOMMON_LIBRARIES is specified for use in - # target_link_libraries: it includes several Boost libraries, which are - # absolutely NOT dependencies in the sense intended here. Those Boost - # library macros, in turn, specify 'debug' and 'optimized' and a different - # library name for each, producing several wordy errors: - # Policy CMP0046 is not set: Error on non-existent dependency in - # add_dependencies. - # Really, the only dependency we should mention from LLCOMMON_LIBRARIES is - # llcommon itself. - llcommon + media_plugin_base + ll::libvlc ) if (WINDOWS) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 837efee7b1..361718a13e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -23,25 +23,13 @@ include(JsonCpp) include(LLAppearance) include(LLAudio) include(LLCA) -include(LLCharacter) include(LLCommon) include(LLCoreHttp) include(LLImage) -include(LLImageJ2COJ) -include(LLInventory) include(LLKDU) -include(LLLogin) -include(LLMath) -include(LLMeshOptimizer) -include(LLMessage) include(LLPhysicsExtensions) -include(LLPlugin) include(LLPrimitive) -include(LLRender) -include(LLUI) -include(LLFileSystem) include(LLWindow) -include(LLXML) include(NDOF) include(NVAPI) include(OPENAL) @@ -52,64 +40,36 @@ include(TemplateCheck) include(ThreeJS) include(Tracy) include(UI) -include(UnixInstall) include(ViewerMiscLibs) include(ViewerManager) include(VisualLeakDetector) include(ZLIBNG) include(URIPARSER) +include(LLPrimitive) if (NOT HAVOK_TPV) # When using HAVOK_TPV, the library is precompiled, so no need for this - add_subdirectory(${LLPHYSICSEXTENSIONS_SRC_DIR} llphysicsextensions) -endif (NOT HAVOK_TPV) -if(FMODSTUDIO) - include_directories(${FMODSTUDIO_INCLUDE_DIR}) -endif(FMODSTUDIO) - -include_directories( - ${DBUSGLIB_INCLUDE_DIRS} - ${JSONCPP_INCLUDE_DIR} - ${LLAUDIO_INCLUDE_DIRS} - ${LLCHARACTER_INCLUDE_DIRS} - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOREHTTP_INCLUDE_DIRS} - ${LLPHYSICS_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLKDU_INCLUDE_DIRS} - ${LLINVENTORY_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESHOPTIMIZER_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLPLUGIN_INCLUDE_DIRS} - ${LLPRIMITIVE_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLUI_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LLLOGIN_INCLUDE_DIRS} - ${LIBS_PREBUILT_DIR}/include/collada - ${LIBS_PREBUILD_DIR}/include/hunspell - ${OPENAL_LIB_INCLUDE_DIRS} - ${LIBS_PREBUILT_DIR}/include/collada/1.4 - ${LLAPPEARANCE_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR} - ${TRACY_INCLUDE_DIR} - ) + # Stub and probably havok lib itself is a hack, autobuild loads a 3p that really is a source tarball + # which includes a CMakeList.txt and then this whole source tree gets pushed into out build ... :/ + # To make matters worse there is a internal assumption about the structure of the viewers CMake layout, + # which means we need to duct tape this togther ... -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} - ) + add_subdirectory(${LLPHYSICSEXTENSIONS_SRC_DIR} llphysicsextensions) + + # Another hack that works with newer cmake versions: + cmake_policy( SET CMP0079 NEW) + if( TARGET llphysicsextensionsstub ) + target_link_libraries(llphysicsextensionsstub llcommon llmath) + endif() + if( TARGET llphysicsextensions ) + target_link_libraries(llphysicsextensions llrender ) + if (DARWIN) + target_compile_options( llphysicsextensions PRIVATE -Wno-unused-local-typedef) + endif (DARWIN) + endif() +endif (NOT HAVOK_TPV) -if (USE_BUGSPLAT) - include_directories(AFTER - ${BUGSPLAT_INCLUDE_DIR} - ) -endif (USE_BUGSPLAT) set(viewer_SOURCE_FILES groupchatlistener.cpp @@ -1414,25 +1374,6 @@ if (DARWIN) COMPILE_FLAGS "-fmodules -fcxx-modules -Wno-nullability-completeness" ) - find_library(AGL_LIBRARY AGL) - find_library(APPKIT_LIBRARY AppKit) - find_library(COCOA_LIBRARY Cocoa) - find_library(IOKIT_LIBRARY IOKit) - find_library(COREAUDIO_LIBRARY CoreAudio) - - set(viewer_LIBRARIES - ${COCOA_LIBRARY} - ${AGL_LIBRARY} - ${IOKIT_LIBRARY} - ${COREAUDIO_LIBRARY} - ) - - if (USE_BUGSPLAT) - list(APPEND viewer_LIBRARIES - ${BUGSPLAT_LIBRARIES} - ) - endif (USE_BUGSPLAT) - # Add resource files to the project. set(viewer_RESOURCE_FILES secondlife.icns @@ -1446,12 +1387,7 @@ if (DARWIN) Japanese.lproj/language.txt Korean.lproj/language.txt ) - set_source_files_properties( - ${viewer_RESOURCE_FILES} - PROPERTIES - HEADER_FILE_ONLY TRUE - #MACOSX_PACKAGE_LOCATION Resources #don't do this! this tells cmake to copy the files. - ) + SOURCE_GROUP("Resources" FILES ${viewer_RESOURCE_FILES}) list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) endif (DARWIN) @@ -1466,12 +1402,6 @@ if (LINUX) LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") - set(viewer_LIBRARIES - Xinerama - ) - if (OPENAL) - LIST(APPEND viewer_LIBRARIES ${OPENAL_LIBRARIES}) - endif (OPENAL) endif (LINUX) if (WINDOWS) @@ -1490,19 +1420,6 @@ if (WINDOWS) llwindebug.h ) - # precompiled header configuration - # llviewerprecompiledheaders.cpp generates - # the .pch file. - # All sources added to viewer_SOURCE_FILES - # at this point use it. - if(USE_PRECOMPILED_HEADERS) - set_source_files_properties(llviewerprecompiledheaders.cpp - PROPERTIES - COMPILE_FLAGS "/Ycllviewerprecompiledheaders.h" - ) - set(viewer_SOURCE_FILES "${viewer_SOURCE_FILES}" llviewerprecompiledheaders.cpp) - endif(USE_PRECOMPILED_HEADERS) - # Replace the icons with the appropriate ones for the channel # ('test' is the default) set(ICON_PATH "test") @@ -1599,26 +1516,7 @@ if (WINDOWS) SOURCE_GROUP("Resource Files" FILES ${viewer_RESOURCE_FILES}) - if (NOT USESYSTEMLIBS) - list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) - endif (NOT USESYSTEMLIBS) - -# see EXP-1765 - theory is opengl32.lib needs to be included before gdi32.lib (windows libs) - set(viewer_LIBRARIES - opengl32 - ${WINDOWS_LIBRARIES} - comdlg32 - dxguid - imm32 - kernel32 - odbc32 - odbccp32 - oleaut32 - shell32 - Vfw32 - wer - winspool - ) + list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) find_library(INTEL_MEMOPS_LIBRARY NAMES ll_intel_memops @@ -1628,8 +1526,10 @@ if (WINDOWS) ) mark_as_advanced(INTEL_MEMOPS_LIBRARY) + if (INTEL_MEMOPS_LIBRARY) - list(APPEND viewer_LIBRARIES ${INTEL_MEMOPS_LIBRARY}) + add_library( ll::intel_memops INTERFACE IMPORTED ) + target_link_libraries( ll::intel_memops ${INTEL_MEMOPS_LIBRARY} ) endif (INTEL_MEMOPS_LIBRARY) if (ADDRESS_SIZE EQUAL 64) @@ -1641,9 +1541,6 @@ if (WINDOWS) LIST(APPEND viewer_SOURCE_FILES windows.manifest) endif (ADDRESS_SIZE EQUAL 64) - if (OPENAL) - LIST(APPEND viewer_LIBRARIES ${OPENAL_LIBRARIES}) - endif (OPENAL) endif (WINDOWS) # Add the xui files. This is handy for searching for xui elements @@ -1722,9 +1619,7 @@ source_group("Character File" FILES ${viewer_CHARACTER_FILES}) set_source_files_properties(${viewer_CHARACTER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -if (NOT USESYSTEMLIBS) - list(APPEND viewer_SOURCE_FILES ${viewer_CHARACTER_FILES}) -endif (NOT USESYSTEMLIBS) +list(APPEND viewer_SOURCE_FILES ${viewer_CHARACTER_FILES}) if (WINDOWS) file(GLOB viewer_INSTALLER_FILES installers/windows/*.nsi) @@ -1737,28 +1632,18 @@ if (WINDOWS) list(APPEND viewer_SOURCE_FILES ${viewer_INSTALLER_FILES}) endif (WINDOWS) -if (OPENAL) - set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_OPENAL") -endif (OPENAL) - -if (FMODSTUDIO) - set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO") - set(FMODWRAPPER_LIBRARY ${FMODSTUDIO_LIBRARY}) -endif (FMODSTUDIO) - -set_source_files_properties(llstartup.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}") - if (HAVOK OR HAVOK_TPV) set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_HAVOK") endif (HAVOK OR HAVOK_TPV) -# progress view disables/enables icons based on available packages -set_source_files_properties(llprogressview.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}") +if( DEFINED LLSTARTUP_COMPILE_FLAGS ) + # progress view disables/enables icons based on available packages + set_source_files_properties(llprogressview.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}") -list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) + set_source_files_properties(llstartup.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}") +endif() -set_source_files_properties(${viewer_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) +list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) add_executable(${VIEWER_BINARY_NAME} WIN32 @@ -1766,17 +1651,6 @@ add_executable(${VIEWER_BINARY_NAME} ${viewer_SOURCE_FILES} ) -if (SDL_FOUND) - set_property(TARGET ${VIEWER_BINARY_NAME} - PROPERTY COMPILE_DEFINITIONS LL_SDL=1 - ) -endif (SDL_FOUND) - -if (USE_BUGSPLAT) - set_property(TARGET ${VIEWER_BINARY_NAME} - PROPERTY COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") -endif (USE_BUGSPLAT) - # add package files file(GLOB EVENT_HOST_SCRIPT_GLOB_LIST ${CMAKE_CURRENT_SOURCE_DIR}/../viewer_components/*.py) @@ -1795,11 +1669,7 @@ if (WINDOWS) ) if(USE_PRECOMPILED_HEADERS) - set_target_properties( - ${VIEWER_BINARY_NAME} - PROPERTIES - COMPILE_FLAGS "/Yullviewerprecompiledheaders.h" - ) + target_precompile_headers( ${VIEWER_BINARY_NAME} PRIVATE llviewerprecompiledheaders.h ) endif(USE_PRECOMPILED_HEADERS) # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency @@ -1818,67 +1688,51 @@ if (WINDOWS) # The following commented dependencies are determined at variably at build time. Can't do this here. ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll - ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll - ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll - ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt - ${GOOGLE_PERF_TOOLS_SOURCE} + ${SHARED_LIB_STAGING_DIR}/openjp2.dll + ${SHARED_LIB_STAGING_DIR}/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/uriparser.dll + #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe + #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll + #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxoal.dll + ${AUTOBUILD_INSTALL_DIR}/ca-bundle.crt ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt - ${CMAKE_CURRENT_SOURCE_DIR}/featuretable_xp.txt ${viewer_APPSETTINGS_FILES} SLPlugin media_plugin_cef media_plugin_libvlc media_plugin_example - winmm_shim ) if (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll - ) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/ortp_x64.dll + ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll + ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll + ) else (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll - ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll - ) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/ortp.dll + ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll + ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll + ) endif (ADDRESS_SIZE EQUAL 64) - if (FMODSTUDIO) + if (TARGET ll::fmodstudio) list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/fmod.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod.dll + ${SHARED_LIB_STAGING_DIR}/fmod.dll ${SHARED_LIB_STAGING_DIR}/Debug/fmodL.dll ) - endif (FMODSTUDIO) + endif () - if (OPENAL) + if (TARGET ll::openal) list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/OpenAL32.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll + ${SHARED_LIB_STAGING_DIR}/OpenAL32.dll + ${SHARED_LIB_STAGING_DIR}/alut.dll ) - endif (OPENAL) + endif () add_custom_command( OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat @@ -1889,16 +1743,16 @@ if (WINDOWS) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} - --buildtype=${CMAKE_BUILD_TYPE} + --buildtype=$<CONFIG> "--channel=${VIEWER_CHANNEL}" --configuration=${CMAKE_CFG_INTDIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,> --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat + --touch=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/copy_touched.bat --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1945,21 +1799,21 @@ if (WINDOWS) OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat COMMAND ${PYTHON_EXECUTABLE} ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - --arch=${ARCH} - --artwork=${ARTWORK_DIR} - "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" - --build=${CMAKE_CURRENT_BINARY_DIR} - --buildtype=${CMAKE_BUILD_TYPE} - "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} - --grid=${GRID} - --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat - --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} + --artwork=${ARTWORK_DIR} + "--bugsplat=${BUGSPLAT_DB}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" + --build=${CMAKE_CURRENT_BINARY_DIR} + --buildtype=$<CONFIG> + "--channel=${VIEWER_CHANNEL}" + --configuration=${CMAKE_CFG_INTDIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,> + --grid=${GRID} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --touch=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/touched.bat + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -1968,8 +1822,7 @@ if (WINDOWS) ) add_custom_target(llpackage ALL DEPENDS - ${CMAKE_CFG_INTDIR}/touched.bat - windows-setup-build-all + ${CMAKE_CFG_INTDIR}/touched.bat ) # temporarily disable packaging of event_host until hg subrepos get # sorted out on the parabuild cluster... @@ -2018,61 +1871,38 @@ endif (WINDOWS) # modern version. target_link_libraries(${VIEWER_BINARY_NAME} - ${LEGACY_STDIO_LIBS} - ${PNG_PRELOAD_ARCHIVES} - ${ZLIBNG_PRELOAD_ARCHIVES} - ${URIPARSER_PRELOAD_ARCHIVES} - ${GOOGLE_PERFTOOLS_LIBRARIES} - ${LLAUDIO_LIBRARIES} - ${LLCHARACTER_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLINVENTORY_LIBRARIES} - ${LLMESHOPTIMIZER_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLPLUGIN_LIBRARIES} - ${LLPRIMITIVE_LIBRARIES} - ${LLRENDER_LIBRARIES} - ${FREETYPE_LIBRARIES} - ${LLUI_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLWINDOW_LIBRARIES} - ${LLXML_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${NDOF_LIBRARY} - ${NVAPI_LIBRARY} - ${HUNSPELL_LIBRARY} - ${viewer_LIBRARIES} - ${BOOST_PROGRAM_OPTIONS_LIBRARY} - ${BOOST_REGEX_LIBRARY} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${DBUSGLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${FMODWRAPPER_LIBRARY} # must come after LLAudio - ${OPENGL_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${SDL_LIBRARY} - ${SMARTHEAP_LIBRARY} - ${UI_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${EXPAT_LIBRARIES} - ${XMLRPCEPI_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${LLLOGIN_LIBRARIES} - ${LLPHYSICS_LIBRARIES} - ${LLPHYSICSEXTENSIONS_LIBRARIES} - ${LLAPPEARANCE_LIBRARIES} - ${TRACY_LIBRARY} - ) + llaudio + llcharacter + llimage + llinventory + llmessage + llplugin + llprimitive + llrender + llui + llfilesystem + llwindow + llxml + llmath + llcorehttp + llcommon + llmeshoptimizer + ll::ndof + lllogin + llprimitive + llappearance + ${LLPHYSICSEXTENSIONS_LIBRARIES} + ll::bugsplat + ll::tracy + ) -if (USE_BUGSPLAT) - target_link_libraries(${VIEWER_BINARY_NAME} - ${BUGSPLAT_LIBRARIES} - ) -endif (USE_BUGSPLAT) +if( TARGET ll::intel_memops ) + target_link_libraries(${VIEWER_BINARY_NAME} ll::intel_memops ) +endif() + +if( TARGET ll::nvapi ) + target_link_libraries(${VIEWER_BINARY_NAME} ll::nvapi ) +endif() set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to artwork files.") @@ -2084,14 +1914,13 @@ if (LINUX) set(COPY_INPUT_DEPENDENCIES ${VIEWER_BINARY_NAME} SLPlugin - media_plugin_gstreamer010 - media_plugin_libvlc + #media_plugin_gstreamer010 llcommon ) - if (NOT USE_BUGSPLAT) - LIST(APPEND COPY_INPUT_DEPENDENCIES linux-crash-logger) - endif (NOT USE_BUGSPLAT) + #if (NOT USE_BUGSPLAT) + # LIST(APPEND COPY_INPUT_DEPENDENCIES linux-crash-logger) + #endif (NOT USE_BUGSPLAT) add_custom_command( OUTPUT ${product}.tar.bz2 @@ -2101,8 +1930,8 @@ if (LINUX) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2129,8 +1958,8 @@ if (LINUX) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" @@ -2188,7 +2017,7 @@ if (DARWIN) XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}" ) - set(VIEWER_APP_BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app") + set(VIEWER_APP_BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/${product}.app") set(VIEWER_APP_EXE "${VIEWER_APP_BUNDLE}/Contents/MacOS/${product}") set(VIEWER_APP_DSYM "${VIEWER_APP_EXE}.dSYM") set(VIEWER_APP_XCARCHIVE "${VIEWER_APP_BUNDLE}/../${product}.xcarchive.zip") @@ -2207,10 +2036,10 @@ if (DARWIN) --arch=${ARCH} --artwork=${ARTWORK_DIR} "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" --build=${CMAKE_CURRENT_BINARY_DIR} - --buildtype=${CMAKE_BUILD_TYPE} + --buildtype=$<CONFIG> --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} "--channel=${VIEWER_CHANNEL}" --configuration=${CMAKE_CFG_INTDIR} @@ -2238,22 +2067,22 @@ if (DARWIN) TARGET llpackage POST_BUILD COMMAND ${PYTHON_EXECUTABLE} ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - --arch=${ARCH} - --artwork=${ARTWORK_DIR} - "--bugsplat=${BUGSPLAT_DB}" - "--fmodstudio=${FMODSTUDIO}" - "--openal=${OPENAL}" - --build=${CMAKE_CURRENT_BINARY_DIR} - --buildtype=${CMAKE_BUILD_TYPE} - "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} - --dest=${VIEWER_APP_BUNDLE} - --grid=${GRID} - --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched - --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt - ${SIGNING_SETTING} + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} + --artwork=${ARTWORK_DIR} + "--bugsplat=${BUGSPLAT_DB}" + "--fmodstudio=${USE_FMODSTUDIO}" + "--openal=${USE_OPENAL}" + --build=${CMAKE_CURRENT_BINARY_DIR} + --buildtype=$<CONFIG> + "--channel=${VIEWER_CHANNEL}" + --configuration=${CMAKE_CFG_INTDIR} + --dest=${VIEWER_APP_BUNDLE} + --grid=${GRID} + --source=${CMAKE_CURRENT_SOURCE_DIR} + --touch=${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/.${product}.bat + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + ${SIGNING_SETTING} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ) @@ -2382,10 +2211,15 @@ if (LL_TESTS) ) set(test_libs - ${LLCOMMON_LIBRARIES} - ${JSONCPP_LIBRARIES} - ${CURL_LIBRARIES} - ${NGHTTP2_LIBRARIES} + llcommon + llfilesystem + llxml + llmessage + llcharacter + llui + lllogin + llplugin + llappearance ) set_source_files_properties( @@ -2394,17 +2228,6 @@ if (LL_TESTS) LL_TEST_ADDITIONAL_LIBRARIES "${test_libs}" ) - set_source_files_properties( - llviewerhelputil.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_SYSTEM_LIBRARY}" - ) - - set_source_files_properties( - llremoteparcelrequest.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_SYSTEM_LIBRARY}" - ) set_source_files_properties( llworldmap.cpp @@ -2412,83 +2235,49 @@ if (LL_TESTS) PROPERTIES LL_TEST_ADDITIONAL_SOURCE_FILES tests/llviewertexture_stub.cpp - #llviewertexturelist.cpp - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_SYSTEM_LIBRARY}" ) set_source_files_properties( llmediadataclient.cpp PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${LLPRIMITIVE_LIBRARIES}" - ) - - set_source_files_properties( - llagentaccess.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_SYSTEM_LIBRARY}" + LL_TEST_ADDITIONAL_LIBRARIES llprimitive ) set_source_files_properties( lllogininstance.cpp PROPERTIES LL_TEST_ADDITIONAL_SOURCE_FILES llversioninfo.cpp - LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_SYSTEM_LIBRARY}" + ) + set_property( SOURCE + ${viewer_TEST_SOURCE_FILES} + PROPERTY + LL_TEST_ADDITIONAL_LIBRARIES ${test_libs} ) - ################################################## - # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS - ################################################## - # if(USE_PRECOMPILED_HEADERS) - # set_source_files_properties( - # ${viewer_TEST_SOURCE_FILES} - # PROPERTIES - # LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp - # ) - # endif(USE_PRECOMPILED_HEADERS) LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}") #set(TEST_DEBUG on) - ################################################## - # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS - ################################################## - # if(USE_PRECOMPILED_HEADERS) - # set(test_sources "${test_sources}" llviewerprecompiledheaders.cpp) - # endif(USE_PRECOMPILED_HEADERS) - set(test_libs - ${LLMESSAGE_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ) - - if (LINUX) - # llcommon uses `clock_gettime' which is provided by librt on linux. - set(LIBRT_LIBRARY - rt - ) - endif (LINUX) set(test_libs - ${WINDOWS_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${LIBRT_LIBRARY} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ) + llfilesystem + llmath + llcommon + llmessage + llcorehttp + llxml + llui + llplugin + llappearance + lllogin + llprimitive + lllogin + ) LL_ADD_INTEGRATION_TEST(cppfeatures "" "${test_libs}" ) + LL_ADD_INTEGRATION_TEST(llsechandler_basic llsechandler_basic.cpp "${test_libs}" @@ -2504,7 +2293,6 @@ if (LL_TESTS) llviewernetwork.cpp ) - LL_ADD_INTEGRATION_TEST(llslurl "${llslurl_test_sources}" "${test_libs}" @@ -2527,15 +2315,6 @@ if (LL_TESTS) #ADD_VIEWER_BUILD_TEST(lltextureinfo viewer) #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer) -include(LLAddBuildTest) -SET(viewer_TEST_SOURCE_FILES - llagentaccess.cpp - ) -set_source_files_properties( - ${viewer_TEST_SOURCE_FILES} - PROPERTIES - LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp - ) endif (LL_TESTS) diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 8a55a848db..cf953d21ac 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -35,6 +35,7 @@ #include "llinventoryobserver.h" #include "llviewerinventory.h" #include "llcorehttputil.h" +#include <memory> class LLWearableHoldingPattern; class LLInventoryCallback; @@ -276,7 +277,7 @@ private: LLUUID mCOFImageID; - std::auto_ptr<LLOutfitUnLockTimer> mUnlockOutfitTimer; + std::unique_ptr<LLOutfitUnLockTimer> mUnlockOutfitTimer; // Set of temp attachment UUIDs that should be removed typedef std::set<LLUUID> doomed_temp_attachments_t; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 283794209f..9e06fc3ac0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -307,7 +307,7 @@ S32 gLastExecDuration = -1; // (<0 indicates unknown) # define LL_PLATFORM_KEY "mac" #elif LL_LINUX # define LL_PLATFORM_KEY "lnx" -else +#else # error "Unknown Platform" #endif const char* gPlatform = LL_PLATFORM_KEY; @@ -1190,12 +1190,8 @@ bool LLAppViewer::init() { LL_WARNS("InitInfo") << "Skipping updater check." << LL_ENDL; } +#endif //LL_RELEASE_FOR_DOWNLOAD - if (mUpdaterNotFound) - { - LL_WARNS("InitInfo") << "Failed to launch updater. Skipping Leap commands." << LL_ENDL; - } - else { // Iterate over --leap command-line options. But this is a bit tricky: if // there's only one, it won't be an array at all. @@ -1228,7 +1224,6 @@ bool LLAppViewer::init() << "lleventhost no longer supported as a dynamic library" << LL_ENDL; } -#endif //LL_RELEASE_FOR_DOWNLOAD LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index a39ec7f51b..6457c13ef3 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -75,7 +75,7 @@ // Bugsplat (http://bugsplat.com) crash reporting tool #ifdef LL_BUGSPLAT #include "BugSplat.h" -#include "reader.h" // JsonCpp +#include "json/reader.h" // JsonCpp #include "llagent.h" // for agent location #include "llviewerregion.h" #include "llvoavatarself.h" // for agent name diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 70e8437190..cdce6f7156 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -878,8 +878,11 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) if (getChildList()->size() > 0) { //find last visible child to get the rightest button offset - child_list_const_reverse_iter_t last_visible_it = std::find_if(childs->rbegin(), childs->rend(), - std::mem_fun(&LLView::getVisible)); + child_list_const_reverse_iter_t last_visible_it = + std::find_if( + childs->rbegin(), childs->rend(), + [](const child_list_t::value_type& child) + { return child->getVisible(); }); if(last_visible_it != childs->rend()) { last_right_edge = (*last_visible_it)->getRect().mRight; diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index e3a695fc79..b5f6f80b39 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -1206,7 +1206,7 @@ static std::string add_save_texture_filter_to_gtkchooser(GtkWindow *picker) return caption; } -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) +BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { BOOL rtn = FALSE; @@ -1423,7 +1423,7 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) // Hacky stubs designed to facilitate fake getSaveFile and getOpenFile with // static results, when we don't have a real filepicker. -BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) +BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index eff94bd195..542a1ea39b 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -898,8 +898,10 @@ const std::string LLFloater360Capture::generate_proposed_filename() // this looks complex but it's straightforward - removes all non-alpha chars from a string // which in this case is the SL region name - we use it as a proposed filename but the user is free to change std::string region_name = region->getName(); - std::replace_if(region_name.begin(), region_name.end(), std::not1(std::ptr_fun(isalnum)), '_'); - if (region_name.length() > 0) + std::replace_if(region_name.begin(), region_name.end(), + [](char c){ return ! std::isalnum(c); }, + '_'); + if (! region_name.empty()) { filename << region_name; filename << "_"; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 07d4dcae38..64f84cbe4f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -657,13 +657,11 @@ void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) } // call refresh from region on all panels - std::for_each( - mInfoPanels.begin(), - mInfoPanels.end(), - llbind2nd( - std::mem_fun(&LLPanelRegionInfo::refreshFromRegion), - region)); - mEnvironmentPanel->refreshFromRegion(region); + for (const auto& infoPanel : mInfoPanels) + { + infoPanel->refreshFromRegion(region); + } + mEnvironmentPanel->refreshFromRegion(region); } // public diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 489d34edca..c0f773968d 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -757,11 +757,11 @@ S32 LLGestureMgr::getPlayingCount() const } -struct IsGesturePlaying : public std::unary_function<LLMultiGesture*, bool> +struct IsGesturePlaying { bool operator()(const LLMultiGesture* gesture) const { - return gesture->mPlaying ? true : false; + return bool(gesture->mPlaying); } }; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 0784a010bf..0bbf201dc6 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -4595,7 +4595,6 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore: { gInventory.updateItem(*it); } - gInventory.notifyObservers(); gViewerWindow->getWindow()->decBusyCount(); } diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index ce4ec668f1..a34dafb19a 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -482,7 +482,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) { LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); F32 depth = water_height - camera_height; - LLColor4 water_fog_color(pwater->getWaterFogColor()); // adjust the color based on depth. We're doing linear approximations diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 2d726409c6..6f3d40bb3a 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -42,8 +42,8 @@ #include "llviewermedia.h" #include "llviewernetwork.h" #include "llviewerregion.h" -#include "reader.h" // JSON -#include "writer.h" // JSON +#include "json/reader.h" // JSON +#include "json/writer.h" // JSON #include "lleventcoro.h" #include "llcoros.h" #include "llcorehttputil.h" diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index e250f9bc7a..5e339a52bf 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -207,7 +207,7 @@ void LLSceneView::draw() for (U32 i = 0; i < count; ++i) { F32 rad = size[idx][i]; - total += rad; + total += rad; F32 y = (rad-size_domain[0])/size_range*size_rect.getHeight()+size_rect.mBottom; F32 x = (F32) i / count * size_rect.getWidth() + size_rect.mLeft; diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index d0da3387ec..8e8f2f4fe0 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -355,7 +355,7 @@ LLSD cert_name_from_X509_NAME(X509_NAME* name) char buffer[32]; X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index); - std::string name_value = std::string((const char*)ASN1_STRING_data(X509_NAME_ENTRY_get_data(entry)), + std::string name_value = std::string((const char*)ASN1_STRING_get0_data(X509_NAME_ENTRY_get_data(entry)), ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry))); ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry); diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index cf3519c1c7..8bdccfd9f6 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -264,6 +264,9 @@ void LLSkinningUtil::getPerVertexSkinMatrix( // SL-366 - with weight validation/cleanup code, it should no longer be // possible to hit the bad scale case. llassert(valid_weights); + // When building for Release, the above llassert() goes away. Ward off + // variable-set-but-unused error. + (void)valid_weights; } void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar) diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 69074b1670..ab559f1e6f 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -35,6 +35,7 @@ #include "llviewercontrol.h" #include "lltexteditor.h" +#include <memory> #define MOUSE_LEAVE false #define MOUSE_ENTER true @@ -222,7 +223,7 @@ private: LLPanel* mWrapperPanel; // timer counts a lifetime of a toast - std::auto_ptr<LLToastLifeTimer> mTimer; + std::unique_ptr<LLToastLifeTimer> mTimer; F32 mToastLifetime; // in seconds F32 mToastFadingTime; // in seconds diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index a2c696c762..4b9f322dfa 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -36,7 +36,7 @@ #include "llversioninfo.h" #include "llviewercontrol.h" #include "llcoros.h" -#include "reader.h" +#include "json/reader.h" #include "llcorehttputil.h" #include "llurlregistry.h" diff --git a/indra/newview/llviewerprecompiledheaders.cpp b/indra/newview/llviewerprecompiledheaders.cpp deleted file mode 100644 index 307e903726..0000000000 --- a/indra/newview/llviewerprecompiledheaders.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file llviewerprecompiledheaders.cpp - * @brief precompiled headers for newview project - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// source file that includes just the standard includes -// newview.pch will be the pre-compiled header -// llviewerprecompiledheaders.obj will contain the pre-compiled type information - -#include "llviewerprecompiledheaders.h" - -// TODO: reference any additional headers you need in llviewerprecompiledheaders.h -// and not in this file diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 93ae1670c8..6306e15f5c 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1180,6 +1180,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) { LLViewerFetchedTexture* imagep = *iter3++; imagep->updateFetch(); + if (min_count <= min_update_count) { mLastFetchKey = LLTextureKey(imagep->getID(), (ETexListType)imagep->getTextureListType()); diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index f3affbeb33..51cf5f20c6 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -909,7 +909,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - S32 idx = draw_vec.size()-1; BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp index 0aa0280b25..ceff5cc8ee 100644 --- a/indra/newview/llwatchdog.cpp +++ b/indra/newview/llwatchdog.cpp @@ -222,18 +222,17 @@ void LLWatchdog::run() if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER)) { LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL; - std::for_each(mSuspects.begin(), - mSuspects.end(), - std::mem_fun(&LLWatchdogEntry::reset) - ); + for (const auto& suspect : mSuspects) + { + suspect->reset(); + } } else { SuspectsRegistry::iterator result = std::find_if(mSuspects.begin(), - mSuspects.end(), - std::not1(std::mem_fun(&LLWatchdogEntry::isAlive)) - ); + mSuspects.end(), + [](const LLWatchdogEntry* suspect){ return ! suspect->isAlive(); }); if(result != mSuspects.end()) { // error!!! diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 3cc82621c4..f2d7e4585a 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -42,7 +42,7 @@ #include "llcorehttputil.h" // third-party -#include "reader.h" // JSON +#include "json/reader.h" // JSON /* * Workflow: diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 871583e071..3201440b95 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -764,13 +764,10 @@ void LLWorld::updateParticles() void LLWorld::renderPropertyLines() { - S32 region_count = 0; - for (region_list_t::iterator iter = mVisibleRegionList.begin(); iter != mVisibleRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; - region_count++; regionp->renderPropertyLines(); } } diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index 4401f61059..b816f9a3b5 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -38,7 +38,13 @@ // external library headers #include <boost/scoped_ptr.hpp> #include <boost/range.hpp> // boost::begin(), boost::end() + +#ifdef LL_USESYSTEMLIBS +#include <xmlrpc.h> +#else #include <xmlrpc-epi/xmlrpc.h> +#endif + #include "curl/curl.h" // other Linden headers @@ -343,7 +349,9 @@ public: switch (curlcode) { +#if CURLE_SSL_PEER_CERTIFICATE != CURLE_SSL_CACERT case CURLE_SSL_PEER_CERTIFICATE: +#endif case CURLE_SSL_CACERT: data["certificate"] = mTransaction->getErrorCertData(); break; diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 5c56a1d34f..8d178dbbdc 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -44,7 +44,12 @@ #include "llviewercontrol.h" // Have to include these last to avoid queue redefinition! + +#ifdef LL_USESYSTEMLIBS +#include <xmlrpc.h> +#else #include <xmlrpc-epi/xmlrpc.h> +#endif #include "llappviewer.h" #include "lltrans.h" @@ -508,10 +513,11 @@ void LLXMLRPCTransaction::Impl::setHttpStatus(const LLCore::HttpStatus &status) message = LLTrans::getString("couldnt_resolve_host", args); break; +#if CURLE_SSL_PEER_CERTIFICATE != CURLE_SSL_CACERT case CURLE_SSL_PEER_CERTIFICATE: message = LLTrans::getString("ssl_peer_certificate"); break; - +#endif case CURLE_SSL_CACERT: case CURLE_SSL_CONNECT_ERROR: message = LLTrans::getString("ssl_connect_error"); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 6d68fd5453..89481add29 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -75,7 +75,7 @@ class ViewerManifest(LLManifest): # include the entire shaders directory recursively self.path("shaders") # include the extracted list of contributors - contributions_path = "../../doc/contributions.txt" + contributions_path = os.path.join(self.args['source'], "..", "..", "doc", "contributions.txt") contributor_names = self.extract_names(contributions_path) self.put_in_file(contributor_names.encode(), "contributors.txt", src=contributions_path) @@ -435,7 +435,7 @@ class WindowsManifest(ViewerManifest): self.cmakedirs(os.path.dirname(dst)) self.created_paths.append(dst) if not os.path.isdir(src): - if(self.args['configuration'].lower() == 'debug'): + if(self.args['buildtype'].lower() == 'debug'): test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "8.0.50727.4053") else: test_assembly_binding(src, "Microsoft.VC80.CRT", "8.0.50727.4053") @@ -458,7 +458,7 @@ class WindowsManifest(ViewerManifest): self.created_paths.append(dst) if not os.path.isdir(src): try: - if(self.args['configuration'].lower() == 'debug'): + if(self.args['buildtype'].lower() == 'debug'): test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "") else: test_assembly_binding(src, "Microsoft.VC80.CRT", "") @@ -504,10 +504,10 @@ class WindowsManifest(ViewerManifest): # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, - 'sharedlibs', self.args['configuration'])): + 'sharedlibs', self.args['buildtype'])): # Get fmodstudio dll if needed if self.args['fmodstudio'] == 'ON': - if(self.args['configuration'].lower() == 'debug'): + if(self.args['buildtype'].lower() == 'debug'): self.path("fmodL.dll") else: self.path("fmod.dll") @@ -603,7 +603,7 @@ class WindowsManifest(ViewerManifest): # MSVC DLLs needed for CEF and have to be in same directory as plugin with self.prefix(src=os.path.join(self.args['build'], os.pardir, - 'sharedlibs', 'Release')): + 'sharedlibs', self.args['buildtype'])): self.path("msvcp140.dll") self.path("vcruntime140.dll") self.path_optional("vcruntime140_1.dll") @@ -909,7 +909,7 @@ class DarwinManifest(ViewerManifest): # Let exception, if any, propagate -- if this doesn't # work, we need the build to noisily fail! oldpath = subprocess.check_output( - ['objdump', '-macho', '-dylib-id', '-non-verbose', + ['objdump', '--macho', '--dylib-id', '--non-verbose', os.path.join(relpkgdir, "BugsplatMac.framework", "BugsplatMac")] ).splitlines()[-1] # take the last line of output self.run_command( @@ -1040,7 +1040,7 @@ class DarwinManifest(ViewerManifest): # Fmod studio dylibs (vary based on configuration) if self.args['fmodstudio'] == 'ON': - if self.args['configuration'].lower() == 'debug': + if self.args['buildtype'].lower() == 'debug': for libfile in ( "libfmodL.dylib", ): diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 084aa8d9f7..b7a39a7450 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -5,35 +5,12 @@ project (lltest) include(00-Common) include(LLCommon) include(LLCoreHttp) -include(LLInventory) -include(LLMath) -include(LLMessage) -include(LLFileSystem) -include(LLXML) include(Linking) include(Tut) include(LLAddBuildTest) include(bugsplat) include(GoogleMock) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLCOREHTTP_INCLUDE_DIRS} - ${LLDATABASE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLMESSAGE_INCLUDE_DIRS} - ${LLINVENTORY_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ${LSCRIPT_INCLUDE_DIRS} - ${GOOGLEMOCK_INCLUDE_DIRS} - ${TUT_INCLUDE_DIR} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) - set(test_SOURCE_FILES io.cpp llapp_tut.cpp @@ -76,39 +53,20 @@ if (NOT WINDOWS) ) endif (NOT WINDOWS) -set_source_files_properties(${test_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND test_SOURCE_FILES ${test_HEADER_FILES}) add_executable(lltest ${test_SOURCE_FILES}) -if (USE_BUGSPLAT) - set_target_properties(lltest PROPERTIES COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") -endif (USE_BUGSPLAT) - target_link_libraries(lltest - ${LEGACY_STDIO_LIBS} - ${LLDATABASE_LIBRARIES} - ${LLINVENTORY_LIBRARIES} - ${LLMESSAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLXML_LIBRARIES} - ${LSCRIPT_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${EXPAT_LIBRARIES} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ${WINDOWS_LIBRARIES} - ${BOOST_PROGRAM_OPTIONS_LIBRARY} - ${BOOST_REGEX_LIBRARY} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ${DL_LIBRARY} - ) + llinventory + llmessage + llmath + llfilesystem + llxml + llcommon + llcorehttp + ll::googlemock + ) if (WINDOWS) set_target_properties(lltest @@ -120,10 +78,10 @@ endif (WINDOWS) set(TEST_EXE $<TARGET_FILE:lltest>) -SET_TEST_PATH(DYLD_LIBRARY_PATH) +SET_TEST_PATH(LD_LIBRARY_PATH) LL_TEST_COMMAND(command - "${DYLD_LIBRARY_PATH}" + "${LD_LIBRARY_PATH}" "${TEST_EXE}" "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt") @@ -144,4 +102,13 @@ set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt) # developers choose to disable LL_TESTS. if (LL_TESTS) add_custom_target(tests_ok ALL DEPENDS ${test_results}) + if(DARWIN) + # Support our "@executable_path/../Resources" load path for our test + # executable. This SHOULD properly be "$<TARGET_FILE_DIR:lltest>/Resources", + # but the CMake $<TARGET_FILE_DIR> generator expression isn't evaluated by + # CREATE_LINK, so fudge it. + add_custom_command( TARGET lltest POST_BUILD + COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/test/Resources + ) + endif() endif (LL_TESTS) diff --git a/indra/test/lldoubledispatch_tut.cpp b/indra/test/lldoubledispatch_tut.cpp index ad8f6454d4..dbf55e666f 100644 --- a/indra/test/lldoubledispatch_tut.cpp +++ b/indra/test/lldoubledispatch_tut.cpp @@ -35,8 +35,9 @@ #include "lldoubledispatch.h" // STL headers // std headers -#include <string> #include <iostream> +#include <memory> +#include <string> #include <typeinfo> // external library headers // other Linden headers @@ -135,10 +136,10 @@ namespace tut // Instantiate a few GameObjects. Make sure we refer to them // polymorphically, and don't let them leak. - std::auto_ptr<GameObject> home; - std::auto_ptr<GameObject> obstacle; - std::auto_ptr<GameObject> tug; - std::auto_ptr<GameObject> patrol; + std::unique_ptr<GameObject> home; + std::unique_ptr<GameObject> obstacle; + std::unique_ptr<GameObject> tug; + std::unique_ptr<GameObject> patrol; // prototype objects Asteroid dummyAsteroid; diff --git a/indra/viewer_components/login/CMakeLists.txt b/indra/viewer_components/login/CMakeLists.txt index 23518b791c..8381803b03 100644 --- a/indra/viewer_components/login/CMakeLists.txt +++ b/indra/viewer_components/login/CMakeLists.txt @@ -7,21 +7,7 @@ if(LL_TESTS) include(LLAddBuildTest) endif(LL_TESTS) include(LLCommon) -include(LLMath) -include(LLXML) -include(Boost) include(LLCoreHttp) -include(LLMessage) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(login_SOURCE_FILES lllogin.cpp @@ -31,9 +17,6 @@ set(login_HEADER_FILES lllogin.h ) -set_source_files_properties(${login_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND login_SOURCE_FILES ${login_HEADER_FILES} @@ -42,17 +25,14 @@ list(APPEND add_library(lllogin ${login_SOURCE_FILES} ) +target_include_directories( lllogin INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(lllogin - ${LLMESSAGE_LIBRARIES} - ${LLCOREHTTP_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLXML_LIBRARIES} - ${BOOST_THREAD_LIBRARY} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} + llmessage + llcorehttp + llcommon + llmath + llxml ) if(LL_TESTS) @@ -62,7 +42,7 @@ if(LL_TESTS) set_source_files_properties( lllogin.cpp PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${LLMESSAGE_LIBRARIES};${LLCOREHTTP_LIBRARIES};${LLCOMMON_LIBRARIES};${BOOST_FIBER_LIBRARY};${BOOST_CONTEXT_LIBRARY};${BOOST_THREAD_LIBRARY};${BOOST_SYSTEM_LIBRARY}" + LL_TEST_ADDITIONAL_LIBRARIES llmessage llcorehttp llcommon ) LL_ADD_PROJECT_UNIT_TESTS(lllogin "${lllogin_TEST_SOURCE_FILES}") |