summaryrefslogtreecommitdiff
path: root/indra/cmake/bugsplat.cmake
blob: 8916cb282c1b7661cdcf8c0a8618cd15f526308a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
if (INSTALL_PROPRIETARY AND NOT LINUX)
    # Note that viewer_manifest.py makes decision based on BUGSPLAT_DB and not USE_BUGSPLAT
    if (BUGSPLAT_DB)
        set(USE_BUGSPLAT ON  CACHE BOOL "Use the BugSplat crash reporting system")
    else (BUGSPLAT_DB)
        set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system")
    endif (BUGSPLAT_DB)
else ()
    set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system")
    set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name")
endif ()

include_guard()
add_library( ll::bugsplat INTERFACE IMPORTED )

if (USE_BUGSPLAT AND NOT LINUX)
    include(Prebuilt)
    use_prebuilt_binary(bugsplat)
    if (WINDOWS)
        target_link_libraries( ll::bugsplat INTERFACE
                ${ARCH_PREBUILT_DIRS_RELEASE}/bugsplat.lib
                )
        target_include_directories( ll::bugsplat SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/bugsplat)
    elseif (DARWIN)
        find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED
                NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
        target_link_libraries( ll::bugsplat INTERFACE
                ${BUGSPLAT_LIBRARIES}
                )
    else (WINDOWS)
        message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF")
    endif (WINDOWS)

    if( NOT BUGSPLAT_DB )
        message( FATAL_ERROR "You need to set BUGSPLAT_DB when setting USE_BUGSPLAT" )
    endif()

    set_property( TARGET ll::bugsplat APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS LL_BUGSPLAT)
else()
    set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system" FORCE)
    set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name" FORCE)
endif ()