diff options
Diffstat (limited to 'indra/cmake')
82 files changed, 905 insertions, 2075 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 572422d080..279e7ca1b9 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) @@ -188,47 +179,17 @@ if (DARWIN) ##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.") endif (DARWIN) - if (LINUX OR DARWIN) - if (CMAKE_CXX_COMPILER MATCHES ".*clang") - set(CMAKE_COMPILER_IS_CLANGXX 1) - endif (CMAKE_CXX_COMPILER MATCHES ".*clang") - - if (CMAKE_COMPILER_IS_GNUCXX) - set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs") - elseif (CMAKE_COMPILER_IS_CLANGXX) - set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs") - endif() + set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs) if (NOT GCC_DISABLE_FATAL_WARNINGS) - set(GCC_WARNINGS "${GCC_WARNINGS} -Werror") + list(APPEND GCC_WARNINGS -Werror) endif (NOT GCC_DISABLE_FATAL_WARNINGS) - set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder -Wno-non-virtual-dtor") + list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor -Wno-unused-but-set-variable -Wno-unused-variable ) - set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}") - - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ADDRESS_SIZE}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${ADDRESS_SIZE}") + add_compile_options(${GCC_WARNINGS}) + add_compile_options(-m${ADDRESS_SIZE}) endif (LINUX OR DARWIN) -if (USESYSTEMLIBS) - add_definitions(-DLL_USESYSTEMLIBS=1) - - if (LINUX AND ADDRESS_SIZE EQUAL 32) - add_definitions(-march=pentiumpro) - endif (LINUX AND ADDRESS_SIZE EQUAL 32) - -else (USESYSTEMLIBS) - set(${ARCH}_linux_INCLUDES - atk-1.0 - glib-2.0 - gstreamer-0.10 - gtk-2.0 - pango-1.0 - ) -endif (USESYSTEMLIBS) - -endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) 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..ec143d86c9 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 ff705101de..e43d4757bb 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. @@ -148,10 +150,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 +176,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 +207,31 @@ 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 - libopenjpeg.so - libuuid.so.16 - libuuid.so.16.0.22 - libfontconfig.so.1.8.0 - libfontconfig.so.1 - ) + ${EXPAT_COPY} + ) - if (FMODSTUDIO) + 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 (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 +261,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 +284,7 @@ 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} +) diff --git a/indra/cmake/DBusGlib.cmake b/indra/cmake/DBusGlib.cmake index 5e46b6711a..f75018ad0e 100644 --- a/indra/cmake/DBusGlib.cmake +++ b/indra/cmake/DBusGlib.cmake @@ -1,29 +1,13 @@ # -*- cmake -*- include(Prebuilt) -if (USESYSTEMLIBS) - include(FindPkgConfig) +add_library( ll::dbus INTERFACE IMPORTED) - pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1) +# 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) +use_prebuilt_binary(dbus_glib) -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) 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 949384eec4..0000000000 --- a/indra/cmake/FindOpenJPEG.cmake +++ /dev/null @@ -1,50 +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 -) - -SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg) -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..fa95e08dcd 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -36,30 +36,26 @@ INCLUDE(GoogleMock) ) SET(alltest_DEP_TARGETS # needed by the test harness itself - ${APRUTIL_LIBRARIES} - ${APR_LIBRARIES} llcommon ) + + SET(alltest_INCLUDE_DIRS + ${LIBS_OPEN_DIR}/test + ) + 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 - ) + llmath + ) + LIST(APPEND alltest_LIBRARIES + 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} - ) + # Headers, for convenience in targets. SET(alltest_HEADER_FILES ${CMAKE_SOURCE_DIR}/test/test.h @@ -88,15 +84,9 @@ INCLUDE(GoogleMock) 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) - # 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}") @@ -126,7 +116,8 @@ INCLUDE(GoogleMock) MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}") ENDIF(LL_TEST_VERBOSE) # 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} @@ -206,14 +197,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST ) SET(libraries - ${LEGACY_STDIO_LIBS} - ${library_dependencies} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - ${GOOGLEMOCK_LIBRARIES} - ${PTHREAD_LIBRARY} - ) + ${library_dependencies} + ll::googlemock + ) # Add test executable build target if(TEST_DEBUG) @@ -226,15 +212,6 @@ FUNCTION(LL_ADD_INTEGRATION_TEST 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) - - if (USE_BUGSPLAT) - SET_PROPERTY(SOURCE ${source_files} - APPEND PROPERTY COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}") - endif (USE_BUGSPLAT) - # The following was copied to llcorehttp/CMakeLists.txt's texture_load target. # Any changes made here should be replicated there. if (WINDOWS) @@ -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..e56625d051 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)
\ No newline at end of file diff --git a/indra/cmake/LLCoreHttp.cmake b/indra/cmake/LLCoreHttp.cmake index 613453ab5d..a166c96043 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)
\ No newline at end of file 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/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..9c628b84b1 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 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 INTERFACE llphysicsextensions) elseif (HAVOK_TPV) use_prebuilt_binary(llphysicsextensions_tpv) - set(LLPHYSICSEXTENSIONS_LIBRARIES llphysicsextensions_tpv) - + target_link_libraries( llphysicsextensions 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 INTERFACE llphysicsextensionsstub) endif (HAVOK) -set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) +target_include_directories( llphysicsextensions 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..04afe5e405 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..29aa6e89ea 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -1,24 +1,22 @@ # -*- 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 ) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>) + 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 +25,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 index 1c5b47b9bd..d1d4df067f 100644 --- a/indra/cmake/MESHOPTIMIZER.cmake +++ b/indra/cmake/MESHOPTIMIZER.cmake @@ -3,14 +3,19 @@ include(Linking) include(Prebuilt) +include_guard() +add_library( ll::meshoptimizer INTERFACE IMPORTED ) + +use_system_binary(meshoptimizer) use_prebuilt_binary(meshoptimizer) if (WINDOWS) - set(MESHOPTIMIZER_LIBRARIES meshoptimizer.lib) + target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib) + set(MESHOPTIMIZER_LIBRARIES ) elseif (LINUX) - set(MESHOPTIMIZER_LIBRARIES meshoptimizer.o) + target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.o) elseif (DARWIN) - set(MESHOPTIMIZER_LIBRARIES libmeshoptimizer.a) + target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a) endif (WINDOWS) -set(MESHOPTIMIZER_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/meshoptimizer) +target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${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/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 bf0bde2ba7..f0311439bf 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -1,22 +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) - - if(WINDOWS) - # Windows has differently named release and debug openjpeg(d) libs. - set(OPENJPEG_LIBRARIES - debug openjpegd - optimized openjpeg) - else(WINDOWS) - set(OPENJPEG_LIBRARIES openjpeg) - endif(WINDOWS) - - set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg) -endif (USESYSTEMLIBS) +use_system_binary(openjpeg) +use_prebuilt_binary(openjpeg) + +target_link_libraries(ll::openjpeg INTERFACE openjpeg ) +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..f0239711aa 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/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..c02ad3e161 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..f645d9d449 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 + 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") + target_include_directories( ll::bugsplat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/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) |