This commit is contained in:
Shyotl
2016-04-03 13:22:36 -05:00
596 changed files with 16286 additions and 34539 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
* text=auto

12
.gitignore vendored
View File

@@ -1,5 +1,3 @@
/installed.xml
/indra/llcommon/llversionviewer.h
/indra/build-*
/indra/tools/vstool/obj/
*.aps
@@ -12,13 +10,14 @@
/indra/viewer-*
/indra/newview/vivox-runtime/
/indra/newview/dbghelp.dll
indra/newview/res/viewer_icon.*
indra/newview/res-sdl/viewer_icon.*
/libraries/
/lib/
*.pyc
*.orig
*.rej
*.bak
*~
*.DS_Store
/LICENSES/
/edited-files.txt
@@ -26,12 +25,5 @@ qtcreator-build/
/.pc
/build-*
/viewer-*
/indra/newview/res/viewerRes.rc
/indra/newview/res/viewerRes_bc.rc
/indra/newview/English.lproj/InfoPlist.strings
/indra/newview/linux_tools/handle_secondlifeprotocol.sh
/indra/newview/linux_tools/install.sh
/indra/newview/linux_tools/refresh_desktop_app_entry.sh
/indra/newview/linux_tools/wrapper.sh

View File

@@ -1,81 +0,0 @@
->> Features implemented in Ascent:
In-World:
-------------------------------------------------
* Alpha skins and Tattoo Layers
* Inventory Pre-caching
* Avatar Radar
* Multiple Attachment Points
* Idle time of avatars around you (Not perfect)
* Client tags/coloring for various clients, and extra client definitions
* Force Away button to fake being away if you really want to avoid someone :V
* Double-Click teleport (Not all the functionality of Emerald yet)
Preferences (Options are in Ascent Options):
* Disable Look At
* Disable Point At and beam end
* Fetch inventory in background on login (No waiting for caching when searching)
* Display your client tag to yourself
* Display your client tag color to yourself
* Rez objects as land group when possible
* Some settings can now be saved per account after changing an option in the preferences. Currently affected settings:
Edit Beam color
Client Tag Color
Communication Window:
- Friend List:
* Friend List Online/Total counts (Not perfect)
* Shows what rights your friends have given you (Mod, See on map, Online)
Chat Bar:
* Emerald-style Chatbar as Commandline (See Preferences)
* MU-style poses.
* OOC Auto-close.
Instant Messages:
* MU-style poses.
* OOC Auto-close.
Advanced -> Ascent:
* Fake Away Status
* Force Ground Sit (Lets you sit anywhere)
* Phantom Avatar (Prevents you visually from being pushed.)
* Toggle IM Notification (Ability to hide '%n is typing...' notification from being sent.)
* Close All Dialogs
* Message Log
* Message Builder
* Sound Explorer
* Asset Blacklist
* AO options
Object Pie Menus:
* Measure: Select on one object, then another, to get the exact distance between the two
* Data: Reports prim rotation and position in a format usable in LSL scripts.
* Script Counter
Self Pie Menu:
* Animation Explorer
Agent Pie Menus:
* Script Counter
* Copy Agent UUID
* Debug
Parcel Window:
-------------------------------------------------
- General tab:
- Objects tab:
* In Sim/Online/Offline indicators for Parcel Object Owner listings (Online is currently wonky - This is an issue with SL, Emerald has the same problem.)
Build Window:
-------------------------------------------------
- General tab:
* Last Owner shown in Build "General" Tab
* Group object is set to has a "View" button to see the group's profile
* Copy Object Key button
- Build Tab:
* Copy/Paste Position buttons
* Copy/Paste Size buttons
* Copy/Paste Rotation buttons
* Copy/Paste Primitive Parameters buttons
Known issues:
Online/Total counts in the friends list sometimes go haywire. Not often or by a large margin, but it happens.

3228
autobuild.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
SLASSET_LIBS_WIN32=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-win32-libs-oss-viewer-1.23.4.0.zip
SLASSET_MD5=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/md5sums-oss-viewer-1.23.4.0.txt
SLASSET_LIBS_DARWIN=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-darwin-libs-oss-viewer-1.23.4.0.tar.gz
SLASSET_ART=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-artwork-oss-viewer-1.23.4.0.zip
SLASSET_LIBS_LINUXI386=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-linux-libs-oss-viewer-1.23.4.0.tar.gz

View File

@@ -1,5 +0,0 @@
For full release notes, see:
http://wiki.secondlife.com/wiki/Release_Notes
For a log of viewer changes, see:
doc/viewer-changes.txt

View File

View File

@@ -3,19 +3,12 @@
# cmake_minimum_required should appear before any
# other commands to guarantee full compatibility
# with the version specified
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
# Eventually the third-party support modules (cmake/*.cmake) should
# know the full path to all libraries. Until that happens we need
# per-configuration link directory "libraries/<arch>/lib/debug" for
# Debug and "libraries/<arch>/lib/release" for Release,
# RelWithDebInfo, and MinSizeRel. CMake 2.6 does not directly support
# per-configuration link directory specification. However, we can set
# CMP0003 to OLD and link to one library (apr) on a per-configuration
# basis to convince CMake to add the proper link directory. This line
# can be removed when we use full paths for all libraries.
#cmake_policy(SET CMP0003 OLD)
## prior to 2.8, the add_custom_target commands used in setting the version did not work correctly
if(WIN32)
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
else()
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
endif()
set(ROOT_PROJECT_NAME "Singularity" CACHE STRING
"The root project/makefile/solution name. Defaults to Singularity.")
@@ -24,26 +17,12 @@ project(${ROOT_PROJECT_NAME})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(Variables)
# Load versions now. Install locations need them.
include(BuildVersion)
include(UnixInstall)
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# Create a 'prepare' target in which to perform setup actions. This
# must be the first target created so other targets can depend on it.
if(NOT STANDALONE)
# We prepare prebuilt binaries when not building standalone.
set(prepare_depends ${CMAKE_BINARY_DIR}/prepare/prebuilt)
endif(NOT STANDALONE)
if(WINDOWS)
set(prepare_depends ${prepare_depends} copy_win_libs)
endif(WINDOWS)
add_custom_target(prepare DEPENDS ${prepare_depends})
endif (NOT CMAKE_BUILD_TYPE)
add_subdirectory(cmake)
add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine)
@@ -66,12 +45,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs)
add_subdirectory(${LIBS_OPEN_PREFIX}llwindow)
add_subdirectory(${LIBS_OPEN_PREFIX}llxml)
if(STANDALONE)
add_subdirectory(${LIBS_OPEN_PREFIX}llqtwebkit)
endif(STANDALONE)
#add_subdirectory(${LIBS_OPEN_PREFIX}lscript)
if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)
add_subdirectory(${LIBS_CLOSED_PREFIX}copy_win_scripts)
endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)
@@ -83,42 +56,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llui)
# viewer plugins directory
add_subdirectory(${LIBS_OPEN_PREFIX}plugins)
# llplugin testbed code (is this the right way to include it?)
#if (NOT LINUX)
# add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest)
#endif (NOT LINUX)
add_subdirectory(${VIEWER_PREFIX}newview/statemachine)
add_subdirectory(${VIEWER_PREFIX}newview)
add_dependencies(viewer secondlife-bin)
add_dependencies(viewer singularity-bin)
# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records
# packages in the PREBUILT property of the 'prepare' target.
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
# Create a script to download the needed binaries.
configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
# Drive the download script at build time. Depend on 'install.xml'
# to aqcuire new binaries when needed.
add_custom_command(
COMMENT "Obtaining prebuilt binaries..."
OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
)
if(WINDOWS)
configure_file(${CMAKE_SOURCE_DIR}/cmake/CopyWinLibs.cmake.in
${CMAKE_BINARY_DIR}/CopyWinLibs.cmake @ONLY)
add_custom_command(
COMMENT "Copying prebuilt libraries to viewer executable directory"
OUTPUT ${CMAKE_BINARY_DIR}/CopyWinLibs
COMMAND ${CMAKE_COMMAND} -DCUR_CONFIG:STRING=${CMAKE_CFG_INTDIR} -P ${CMAKE_BINARY_DIR}/CopyWinLibs.cmake
DEPENDS ${CMAKE_BINARY_DIR}/prepare/prebuilt ${CMAKE_BINARY_DIR}/CopyWinLibs.cmake
)
add_custom_target(copy_win_libs DEPENDS ${CMAKE_BINARY_DIR}/CopyWinLibs)
endif(WINDOWS)

View File

@@ -39,5 +39,3 @@ set_source_files_properties(${aistatemachine_HEADER_FILES}
list(APPEND aistatemachine_SOURCE_FILES ${aistatemachine_HEADER_FILES})
add_library (aistatemachine ${aistatemachine_SOURCE_FILES})
add_dependencies(aistatemachine prepare)

View File

@@ -34,6 +34,7 @@
#include "aistatemachine.h"
#include "llthread.h"
#include "aithreadsafe.h"
#include <boost/format.hpp>
#ifdef EXAMPLE_CODE // undefined
@@ -235,7 +236,7 @@ class AIStateMachineThread : public AIStateMachineThreadBase {
/*virtual*/ const char* getName() const
{
#define STRIZE(arg) #arg
return "AIStateMachineThread<"STRIZE(THREAD_IMPL)">";
return (boost::format("%1%%2%%3%") % "AIStateMachineThread<" % STRIZE(THREAD_IMPL) % ">").str().c_str();
#undef STRIZE
}

View File

@@ -40,22 +40,6 @@ set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING
# Platform-specific compilation flags.
if (WINDOWS)
# Various libs are compiler specific, generate some variables here we can just use
# when we require them instead of reimplementing the test each time.
if (MSVC10)
set(MSVC_DIR 10.0)
set(MSVC_SUFFIX 100)
elseif (MSVC12)
set(MSVC_DIR 12.0)
set(MSVC_SUFFIX 120)
endif (MSVC10)
# Remove default /Zm1000 flag that cmake inserts
string (REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Always use /Zm140
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm140")
# Don't build DLLs.
set(BUILD_SHARED_LIBS OFF)
@@ -65,61 +49,78 @@ if (WINDOWS)
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP"
CACHE STRING "C++ compiler release-with-debug options" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /fp:fast -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
"${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /Zo /MD /MP /Ob2 /Zc:inline /fp:fast -D_ITERATOR_DEBUG_LEVEL=0"
CACHE STRING "C++ compiler release options" FORCE)
set(CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} ${LL_C_FLAGS} /O2 /Zi /MD /MP /fp:fast"
CACHE STRING "C compiler release options" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
if (WORD_SIZE EQUAL 32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif (WORD_SIZE EQUAL 32)
if (USE_LTO)
if(INCREMENTAL_LINK)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG:INCREMENTAL")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG:INCREMENTAL")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG:INCREMENTAL")
else(INCREMENTAL_LINK)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG")
endif(INCREMENTAL_LINK)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG")
elseif (INCREMENTAL_LINK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR")
else ()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO")
endif ()
set(CMAKE_CXX_STANDARD_LIBRARIES "")
set(CMAKE_C_STANDARD_LIBRARIES "")
add_definitions(
/DLL_WINDOWS=1
/DNOMINMAX
/DUNICODE
/D_UNICODE
/D_UNICODE
/GS
/TP
/W3
/c
/Zc:forScope
/Zc:wchar_t-
/Zc:rvalueCast
/Zc:wchar_t
/nologo
/Oy-
/Zm140
/wd4267
/wd4244
)
# SSE2 is implied on win64
if(WORD_SIZE EQUAL 32)
add_definitions(/arch:SSE2 /D_ATL_XP_TARGETING)
else(WORD_SIZE EQUAL 32)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4250 /wd4244")
endif(WORD_SIZE EQUAL 32)
if (USE_LTO)
add_compile_options(
/GL
/Gy
/Gw
)
endif (USE_LTO)
if (WORD_SIZE EQUAL 32)
# configure win32 API for windows XP+ compatibility
set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}")
else (WORD_SIZE EQUAL 32)
# configure win32 API for windows vista+ compatibility
set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}")
add_compile_options(/arch:SSE2)
endif (WORD_SIZE EQUAL 32)
# Use special XP-compatible toolchain on 32-bit builds
if (MSVC12 AND (WORD_SIZE EQUAL 32))
set(CMAKE_GENERATOR_TOOLSET "v120xp")
endif (MSVC12 AND (WORD_SIZE EQUAL 32))
# Are we using the crummy Visual Studio KDU build workaround?
if (NOT DISABLE_FATAL_WARNINGS)
add_definitions(/WX)
endif (NOT DISABLE_FATAL_WARNINGS)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO")
# configure win32 API for windows Vista+ compatibility
set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}")
endif (WINDOWS)
set (GCC_EXTRA_OPTIMIZATIONS "-ffast-math")
@@ -140,7 +141,10 @@ if (LINUX)
-pthread
)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
# 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!
@@ -195,16 +199,14 @@ if (LINUX)
# End of hacks.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
endif (NOT STANDALONE)
if (${ARCH} STREQUAL "x86_64")
add_definitions(-DLINUX64=1 -pipe)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
add_definitions(-pipe)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math")
else (${ARCH} STREQUAL "x86_64")
@@ -219,11 +221,6 @@ if (LINUX)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -mfpmath=sse,387 -msse2 ${GCC_EXTRA_OPTIMIZATIONS}")
endif (${ARCH} STREQUAL "x86_64")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
endif (NOT STANDALONE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}${MARCH_FLAG} -fno-inline -msse2")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}${MARCH_FLAG} -fno-inline -msse2")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}${MARCH_FLAG} -msse2")
@@ -231,12 +228,6 @@ if (LINUX)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
endif (NOT STANDALONE)
if (NOT STANDALONE)
set(MARCH_FLAG " -axsse4.1 -msse2")
endif (NOT STANDALONE)
@@ -316,13 +307,14 @@ if (STANDALONE)
add_definitions(-DLL_STANDALONE=1)
else (STANDALONE)
set(${ARCH}_linux_INCLUDES
ELFIO
atk-1.0
cairo
glib-2.0
gdk-pixbuf-2.0
gstreamer-0.10
gtk-2.0
freetype2
pango-1.0
pixman-1
)
endif (STANDALONE)

View File

@@ -1,4 +1,3 @@
include(BerkeleyDB)
include(Linking)
include(Prebuilt)
@@ -13,39 +12,41 @@ if (STANDALONE)
else (STANDALONE)
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 libapr-1.lib
optimized libapr-1.lib
debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apr-1.lib
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib
)
set(APRICONV_LIBRARIES
debug libapriconv-1.lib
optimized libapriconv-1.lib
debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apriconv-1.lib
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apriconv-1.lib
)
set(APRUTIL_LIBRARIES
debug libaprutil-1.lib
optimized libaprutil-1.lib
debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES}
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES}
)
if(NOT LLCOMMON_LINK_SHARED)
list(APPEND APR_LIBRARIES Rpcrt4)
endif(NOT LLCOMMON_LINK_SHARED)
elseif (DARWIN)
set(APR_LIBRARIES
debug libapr-1.0.dylib
optimized libapr-1.0.dylib
)
set(APRUTIL_LIBRARIES
debug libaprutil-1.dylib
optimized libaprutil-1.dylib
)
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
${LIBS_PREBUILT_LEGACY_DIR}/include/apr-1
)
if (LINUX)
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES})
endif (LINUX)
set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/apr-1)
endif (STANDALONE)

View File

@@ -8,11 +8,8 @@ if (STANDALONE)
pkg_check_modules(VORBISENC REQUIRED vorbisenc)
pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
else (STANDALONE)
use_prebuilt_binary(ogg-vorbis)
set(VORBIS_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
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})

View File

@@ -1,20 +0,0 @@
include(Prebuilt)
set(DB_FIND_QUIETLY ON)
set(DB_FIND_REQUIRED ON)
if (STANDALONE)
include(FindBerkeleyDB)
else (STANDALONE)
if (LINUX)
# Need to add dependency pthread explicitely to support ld.gold.
use_prebuilt_binary(db)
set(DB_LIBRARIES db-5.1 pthread)
else (LINUX)
set(DB_LIBRARIES db-4.2)
endif (LINUX)
set(DB_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
endif (STANDALONE)

View File

@@ -11,11 +11,8 @@ if (STANDALONE)
find_package(Boost 1.51.0 COMPONENTS date_time filesystem program_options regex system thread wave context)
else (STANDALONE)
use_prebuilt_binary(boost)
set(Boost_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(Boost_VERSION "1.52")
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
set(Boost_VERSION "1.60")
if (WINDOWS)
set(Boost_CONTEXT_LIBRARY

View File

@@ -0,0 +1,11 @@
# -*- cmake -*-
# Construct the version and copyright information based on package data.
include(Python)
include(Variables)
add_custom_command(OUTPUT packages-info.txt
COMMENT "Generating packages-info.txt for the about box"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/../autobuild.xml
DEPENDS ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py -p=${AUTOBUILD_PLATFORM_NAME} > packages-info.txt
)

View File

@@ -1,81 +1,54 @@
# -*- cmake -*-
# Construct the viewer version number based on the indra/VIEWER_VERSION file
# Read version components from the header file.
file(STRINGS ${LIBS_OPEN_DIR}/llcommon/llversionviewer.h.in lines
REGEX " LL_VERSION_")
foreach(line ${lines})
string(REGEX REPLACE ".*LL_VERSION_([A-Z]+).*" "\\1" comp "${line}")
string(REGEX REPLACE ".* = ([0-9]+);.*" "\\1" value "${line}")
set(v${comp} "${value}")
endforeach(line)
if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/newview/
set(VIEWER_VERSION_BASE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/newview/VIEWER_VERSION.txt")
execute_process(
COMMAND git rev-list HEAD
OUTPUT_VARIABLE GIT_REV_LIST_STR
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if ( EXISTS ${VIEWER_VERSION_BASE_FILE} )
file(STRINGS ${VIEWER_VERSION_BASE_FILE} VIEWER_SHORT_VERSION REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+")
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VIEWER_VERSION_MAJOR ${VIEWER_SHORT_VERSION})
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" VIEWER_VERSION_MINOR ${VIEWER_SHORT_VERSION})
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" VIEWER_VERSION_PATCH ${VIEWER_SHORT_VERSION})
if(GIT_REV_LIST_STR)
string(REPLACE "\n" ";" GIT_REV_LIST ${GIT_REV_LIST_STR})
else()
string(REPLACE "\n" ";" GIT_REV_LIST "")
endif()
if (DEFINED ENV{revision})
set(VIEWER_VERSION_REVISION $ENV{revision})
message("Revision (from environment): ${VIEWER_VERSION_REVISION}")
if(GIT_REV_LIST)
list(LENGTH GIT_REV_LIST vBUILD)
else()
set(vBUILD 99)
endif()
else (DEFINED ENV{revision})
execute_process(
COMMAND git rev-list HEAD
OUTPUT_VARIABLE GIT_REV_LIST_STR
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(
${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h.in
${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h
)
if(GIT_REV_LIST_STR)
string(REPLACE "\n" ";" GIT_REV_LIST ${GIT_REV_LIST_STR})
else()
string(REPLACE "\n" ";" GIT_REV_LIST "")
endif()
if (WINDOWS)
configure_file(
${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc.in
${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc
)
endif (WINDOWS)
if(GIT_REV_LIST)
list(LENGTH GIT_REV_LIST VIEWER_VERSION_REVISION)
else(GIT_REV_LIST)
set(VIEWER_VERSION_REVISION 99)
endif(GIT_REV_LIST)
endif (DEFINED ENV{revision})
message("Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}")
else ( EXISTS ${VIEWER_VERSION_BASE_FILE} )
message(SEND_ERROR "Cannot get viewer version from '${VIEWER_VERSION_BASE_FILE}'")
endif ( EXISTS ${VIEWER_VERSION_BASE_FILE} )
if (DARWIN)
configure_file(
${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings.in
${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings
)
endif (DARWIN)
if (LINUX)
configure_file(
${CMAKE_SOURCE_DIR}/newview/linux_tools/wrapper.sh.in
${CMAKE_SOURCE_DIR}/newview/linux_tools/wrapper.sh
@ONLY
)
configure_file(
${CMAKE_SOURCE_DIR}/newview/linux_tools/handle_secondlifeprotocol.sh.in
${CMAKE_SOURCE_DIR}/newview/linux_tools/handle_secondlifeprotocol.sh
@ONLY
)
configure_file(
${CMAKE_SOURCE_DIR}/newview/linux_tools/install.sh.in
${CMAKE_SOURCE_DIR}/newview/linux_tools/install.sh
@ONLY
)
configure_file(
${CMAKE_SOURCE_DIR}/newview/linux_tools/refresh_desktop_app_entry.sh.in
${CMAKE_SOURCE_DIR}/newview/linux_tools/refresh_desktop_app_entry.sh
@ONLY
)
endif (LINUX)
# Compose the version.
set(${ROOT_PROJECT_NAME}_VERSION "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}")
if (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$")
message(STATUS "Version is ${${ROOT_PROJECT_NAME}_VERSION}")
else (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$")
message(FATAL_ERROR "Could not determine version (${${ROOT_PROJECT_NAME}_VERSION})")
endif (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$")
if ("${VIEWER_VERSION_REVISION}" STREQUAL "")
message("Ultimate fallback, revision was blank or not set: will use 0")
set(VIEWER_VERSION_REVISION 0)
endif ("${VIEWER_VERSION_REVISION}" STREQUAL "")
set(VIEWER_CHANNEL_VERSION_DEFINES
"LL_VIEWER_CHANNEL=\"${VIEWER_CHANNEL}\""
"LL_VIEWER_VERSION_MAJOR=${VIEWER_VERSION_MAJOR}"
"LL_VIEWER_VERSION_MINOR=${VIEWER_VERSION_MINOR}"
"LL_VIEWER_VERSION_PATCH=${VIEWER_VERSION_PATCH}"
"LL_VIEWER_VERSION_BUILD=${VIEWER_VERSION_REVISION}"
)
endif (NOT DEFINED VIEWER_SHORT_VERSION)

View File

@@ -20,8 +20,5 @@ else (STANDALONE)
else (WINDOWS)
set(CARES_LIBRARIES cares)
endif (WINDOWS)
set(CARES_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/ares
${LIBS_PREBUILT_LEGACY_DIR}/include/ares
)
set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares)
endif (STANDALONE)

View File

@@ -0,0 +1,45 @@
# -*- cmake -*-
include(Linking)
include(Prebuilt)
if (USESYSTEMLIBS)
set(CEFPLUGIN OFF CACHE BOOL
"CEFPLUGIN support for the llplugin/llmedia test apps.")
else (USESYSTEMLIBS)
use_prebuilt_binary(llceflib)
set(CEFPLUGIN ON CACHE BOOL
"CEFPLUGIN support for the llplugin/llmedia test apps.")
set(CEF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/cef)
endif (USESYSTEMLIBS)
if (WINDOWS)
set(CEF_PLUGIN_LIBRARIES
libcef.lib
libcef_dll_wrapper.lib
llceflib.lib
)
elseif (DARWIN)
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
if (NOT APPKIT_LIBRARY)
message(FATAL_ERROR "AppKit not found")
endif()
FIND_LIBRARY(CEF_LIBRARY "Chromium Embedded Framework" ${ARCH_PREBUILT_DIRS_RELEASE})
if (NOT CEF_LIBRARY)
message(FATAL_ERROR "CEF not found")
endif()
set(CEF_PLUGIN_LIBRARIES
${ARCH_PREBUILT_DIRS_RELEASE}/libcef_dll_wrapper.a
${ARCH_PREBUILT_DIRS_RELEASE}/libLLCefLib.a
${APPKIT_LIBRARY}
${CEF_LIBRARY}
)
elseif (LINUX)
set(CEF_PLUGIN_LIBRARIES
llceflib
cef_dll_wrapper
cef
)
endif (WINDOWS)

View File

@@ -12,36 +12,30 @@ set(cmake_SOURCE_FILES
APR.cmake
Audio.cmake
BasicPluginBase.cmake
BerkeleyDB.cmake
Boost.cmake
BuildVersion.cmake
CARes.cmake
CEFPlugin.cmake
CMakeCopyIfDifferent.cmake
CURL.cmake
Colladadom.cmake
ConfigurePkgConfig.cmake
CopyBackToSource.cmake
CopyWinLibs.cmake
Copy3rdPartyLibs.cmake
Cwdebug.cmake
DBusGlib.cmake
DirectX.cmake
DownloadPrebuilt.cmake.in
ELFIO.cmake
DeploySharedLibs.cmake
EXPAT.cmake
ExamplePlugin.cmake
FMODEX.cmake
FMODSTUDIO.cmake
FindAPR.cmake
FindBerkeleyDB.cmake
FindAutobuild.cmake
FindCARes.cmake
FindColladadom.cmake
FindELFIO.cmake
FindGLOD.cmake
FindGoogleBreakpad.cmake
FindGooglePerfTools.cmake
FindHunSpell.cmake
FindJsonCpp.cmake
FindLLQtWebkit.cmake
FindNDOF.cmake
FindOpenJPEG.cmake
FindTut.cmake
@@ -71,8 +65,8 @@ set(cmake_SOURCE_FILES
LLPrimitive.cmake
LLPhysicsExtensions.cmake
LLSharedLibs.cmake
LLQtWebkit.cmake
LLRender.cmake
LLSharedLibs.cmake
LLUI.cmake
LLVFS.cmake
LLWindow.cmake
@@ -91,7 +85,6 @@ set(cmake_SOURCE_FILES
Prebuilt.cmake
PulseAudio.cmake
Python.cmake
Qt4.cmake
QuickTimePlugin.cmake
RunBuildTest.cmake
StateMachine.cmake
@@ -101,7 +94,7 @@ set(cmake_SOURCE_FILES
UnixInstall.cmake
Variables.cmake
ViewerMiscLibs.cmake
WebKitLibPlugin.cmake
WinManifest.cmake
XmlRpcEpi.cmake
ZLIB.cmake
)
@@ -110,7 +103,6 @@ source_group("Shared Rules" FILES ${cmake_SOURCE_FILES})
set(master_SOURCE_FILES
../CMakeLists.txt
../develop.py
)
source_group("Master Rules" FILES ${master_SOURCE_FILES})

View File

@@ -13,13 +13,8 @@ else (STANDALONE)
debug libcurld
optimized libcurl)
else (WINDOWS)
set(CURL_LIBRARIES curl)
if(LINUX AND WORD_SIZE EQUAL 64)
list(APPEND CURL_LIBRARIES idn)
endif(LINUX AND WORD_SIZE EQUAL 64)
use_prebuilt_binary(libidn)
set(CURL_LIBRARIES curl idn)
endif (WINDOWS)
set(CURL_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@@ -10,49 +10,22 @@ if (STANDALONE)
include (FindColladadom)
else (STANDALONE)
use_prebuilt_binary(colladadom)
if (NOT WINDOWS AND NOT LINUX)
use_prebuilt_binary(pcre)
endif (NOT WINDOWS AND NOT LINUX)
if (NOT DARWIN AND NOT WINDOWS)
use_prebuilt_binary(libxml)
endif (NOT DARWIN AND NOT WINDOWS)
set(COLLADADOM_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/collada
${LIBS_PREBUILT_DIR}/include/collada/1.4
${LIBS_PREBUILT_LEGACY_DIR}/include/collada
${LIBS_PREBUILT_LEGACY_DIR}/include/collada/1.4
)
${LIBS_PREBUILT_DIR}/include/collada
${LIBS_PREBUILT_DIR}/include/collada/1.4
)
if (WINDOWS)
if(MSVC12)
use_prebuilt_binary(pcre)
use_prebuilt_binary(libxml)
set(COLLADADOM_LIBRARIES
debug libcollada14dom23-sd
optimized libcollada14dom23-s
libxml2_a
debug pcrecppd
optimized pcrecpp
debug pcred
optimized pcre
${BOOST_SYSTEM_LIBRARIES}
)
else(MSVC12)
add_definitions(-DDOM_DYNAMIC)
set(COLLADADOM_LIBRARIES
debug libcollada14dom22-d
optimized libcollada14dom22
)
endif(MSVC12)
else (WINDOWS)
set(COLLADADOM_LIBRARIES
collada14dom
minizip
xml2
)
set(COLLADADOM_LIBRARIES
debug libcollada14dom23-sd
optimized libcollada14dom23-s
)
else(WINDOWS)
set(COLLADADOM_LIBRARIES
debug collada14dom-d
optimized collada14dom
minizip
)
endif (WINDOWS)
endif (STANDALONE)

View File

@@ -0,0 +1,241 @@
# -*- cmake -*-
# The copy_win_libs folder contains file lists and a script used to
# copy dlls, exes and such needed to run the SecondLife from within
# VisualStudio.
include(CMakeCopyIfDifferent)
include(Linking)
###################################################################
# 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_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(vivox_files
SLVoice.exe
ca-bundle.crt
libsndfile-1.dll
vivoxplatform.dll
vivoxsdk.dll
ortp.dll
zlib1.dll
vivoxoal.dll
)
#*******************************
# Misc shared libs
set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
set(debug_files
libapr-1.dll
libaprutil-1.dll
libapriconv-1.dll
ssleay32.dll
libeay32.dll
glod.dll
libhunspell.dll
)
set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(release_files
libapr-1.dll
libaprutil-1.dll
libapriconv-1.dll
ssleay32.dll
libeay32.dll
glod.dll
libhunspell.dll
)
if(NOT DISABLE_TCMALLOC)
set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll)
set(release_files ${release_files} libtcmalloc_minimal.dll)
endif(NOT DISABLE_TCMALLOC)
if (FMODSTUDIO)
if(WORD_SIZE STREQUAL 64)
set(debug_files ${debug_files} fmodL64.dll)
set(release_files ${release_files} fmod64.dll)
else(WORD_SIZE STREQUAL 64)
set(debug_files ${debug_files} fmodL.dll)
set(release_files ${release_files} fmod.dll)
endif(WORD_SIZE STREQUAL 64)
endif (FMODSTUDIO)
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_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(vivox_files
SLVoice
ca-bundle.crt
libsndfile.dylib
libvivoxoal.dylib
libortp.dylib
libvivoxplatform.dylib
libvivoxsdk.dylib
)
set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
set(debug_files
)
set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(release_files
libapr-1.0.dylib
libapr-1.dylib
libaprutil-1.0.dylib
libaprutil-1.dylib
libexception_handler.dylib
libexpat.1.5.2.dylib
libexpat.dylib
libGLOD.dylib
libhunspell-1.3.0.dylib
libndofdev.dylib
)
if (FMODSTUDIO)
set(debug_files ${debug_files} libfmodL.dylib)
set(release_files ${release_files} libfmod.dylib)
endif (FMODSTUDIO)
elseif(LINUX)
# linux is weird, multiple side by side configurations aren't supported
# and we don't seem to have any debug shared libs built yet anyways...
set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}")
set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}")
set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}")
set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(vivox_files
libsndfile.so.1
libortp.so
libvivoxoal.so.1
libvivoxplatform.so
libvivoxsdk.so
SLVoice
# ca-bundle.crt #No cert for linux. It is actually still 3.2SDK.
)
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
set(debug_files
)
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
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
libexpat.so
libexpat.so.1
libfreetype.so.6.12.3
libfreetype.so.6
libfreetype.so
libGLOD.so
libgmodule-2.0.so
libgobject-2.0.so
libopenal.so
libfontconfig.so.1.8.0
libfontconfig.so.1
libfontconfig.so
)
if (USE_TCMALLOC)
set(release_files ${release_files} "libtcmalloc_minimal.so")
endif (USE_TCMALLOC)
if (FMODSTUDIO)
set(debug_files ${debug_files} "libfmodL.so")
set(release_files ${release_files} "libfmod.so")
endif (FMODSTUDIO)
else(WINDOWS)
message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...")
set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
set(vivox_files "")
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/debug")
set(debug_files "")
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/release")
set(release_files "")
set(debug_llkdu_src "")
set(debug_llkdu_dst "")
set(release_llkdu_src "")
set(release_llkdu_dst "")
set(relwithdebinfo_llkdu_dst "")
endif(WINDOWS)
################################################################
# Done building the file lists, now set up the copy commands.
################################################################
copy_if_different(
${vivox_src_dir}
"${SHARED_LIB_STAGING_DIR_DEBUG}"
out_targets
${vivox_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
${vivox_src_dir}
"${SHARED_LIB_STAGING_DIR_RELEASE}"
out_targets
${vivox_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
${vivox_src_dir}
"${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
out_targets
${vivox_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
${debug_src_dir}
"${SHARED_LIB_STAGING_DIR_DEBUG}"
out_targets
${debug_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
${release_src_dir}
"${SHARED_LIB_STAGING_DIR_RELEASE}"
out_targets
${release_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
${release_src_dir}
"${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
out_targets
${release_files}
)
set(third_party_targets ${third_party_targets} ${out_targets})
if(NOT USESYSTEMLIBS)
add_custom_target(
stage_third_party_libs ALL
DEPENDS ${third_party_targets}
)
endif(NOT USESYSTEMLIBS)

View File

@@ -1,16 +0,0 @@
# -*- cmake -*-
# Copies a binary back to the source directory
MACRO(COPY_BACK_TO_SOURCE target)
SET(FROM $<TARGET_FILE:${target}>)
SET(TO ${CMAKE_CURRENT_SOURCE_DIR})
#MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}")
ADD_CUSTOM_COMMAND(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}
DEPENDS ${FROM}
COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}"
)
ENDMACRO(COPY_BACK_TO_SOURCE)

View File

@@ -1,181 +0,0 @@
# -*- cmake -*-
# The copy_win_libs folder contains file lists and a script used to
# copy dlls, exes and such needed to run the SecondLife from within
# VisualStudio.
set(LIBS_PREBUILT_DIR "@LIBS_PREBUILT_DIR@")
set(LIBS_PREBUILT_LEGACY_DIR "@LIBS_PREBUILT_LEGACY_DIR@")
set(MSVC10 "@MSVC10@")
set(WORD_SIZE "@WORD_SIZE@")
set(LIBS_RELEASE_DIR
${LIBS_PREBUILT_DIR}/lib/release
${LIBS_PREBUILT_LEGACY_DIR}/lib/release
)
set(LIBS_DEBUG_DIR
${LIBS_PREBUILT_DIR}/lib/debug
${LIBS_PREBUILT_LEGACY_DIR}/lib/debug
)
function(copy_files paths names dest)
string(FIND ${dest} ${CUR_CONFIG} idx)
if(${idx} LESS 0)
return()
endif(${idx} LESS 0)
foreach(f ${names})
foreach(p ${paths})
set(from_file "${p}/${f}")
set(to_dest "${CMAKE_BINARY_DIR}/newview/${dest}/")
if(EXISTS ${from_file})
message("Copying ${from_file} to ${to_dest}")
if(NOT EXISTS ${to_dest})
execute_process(COMMAND md "${to_dest}")
endif(NOT EXISTS ${to_dest})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${from_file}" "${to_dest}${f}" RESULT_VARIABLE result)
if(${result})
message(SEND_ERROR "Unsuccessful.")
endif(${result})
set(found 1)
break()
endif(EXISTS ${from_file})
endforeach(p)
if(NOT found)
message(SEND_ERROR "Failed to find library: ${f}")
endif(NOT found)
endforeach(f)
endfunction(copy_files)
set(vivox_files
ca-bundle.crt
libsndfile-1.dll
ortp.dll
SLVoice.exe
vivoxoal.dll
vivoxplatform.dll
vivoxsdk.dll
zlib1.dll
)
copy_files("${LIBS_RELEASE_DIR}" "${vivox_files}" "Release" )
copy_files("${LIBS_RELEASE_DIR}" "${vivox_files}" "RelWithDebInfo")
copy_files("${LIBS_DEBUG_DIR}" "${vivox_files}" "Debug")
set(release_files
libhunspell.dll
libapr-1.dll
libaprutil-1.dll
libapriconv-1.dll
libeay32.dll
ssleay32.dll
glod.dll
qtcore4.dll
)
copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "Release")
copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "RelWithDebInfo")
copy_files("${LIBS_DEBUG_DIR}" "${release_files}" "Debug")
if(MSVC10)
copy_files("${LIBS_DEBUG_DIR}" "libcollada14dom22-d.dll" "Debug")
endif(MSVC10)
if(WORD_SIZE EQUAL 32)
set(release_files
libcollada14dom22.dll
libtcmalloc_minimal.dll
)
copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "Release")
copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "RelWithDebInfo")
endif(WORD_SIZE EQUAL 32)
set(plugins_release_files
libeay32.dll
qtcore4.dll
qtgui4.dll
qtnetwork4.dll
qtopengl4.dll
qtwebkit4.dll
ssleay32.dll
qtxmlpatterns4.dll
)
copy_files("${LIBS_RELEASE_DIR}" "${plugins_release_files}" "Release/llplugin")
copy_files("${LIBS_RELEASE_DIR}" "${plugins_release_files}" "RelWithDebInfo/llplugin")
if(0)
copy_files("${LIBS_RELEASE_DIR}" "${plugin_release_files}" "../test_apps/llplugintest/Release")
copy_files("${LIBS_RELEASE_DIR}" "${plugin_release_files}" "../test_apps/llplugintest/RelWithDebInfo")
endif(0)
# Debug config runtime files required for the plugins
set(plugins_debug_files
libeay32.dll
qtcored4.dll
qtguid4.dll
qtnetworkd4.dll
qtopengld4.dll
qtwebkitd4.dll
ssleay32.dll
qtxmlpatternsd4.dll
)
copy_files("${LIBS_DEBUG_DIR}" "${plugins_debug_files}" "Debug/llplugin")
if(0)
copy_files("${LIBS_DEBUG_DIR}" "${plugins_debug_files}" "../test_apps/llplugintest/Debug")
endif(0)
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
set(plugin_image_release_files
qgif4.dll
qico4.dll
qjpeg4.dll
qmng4.dll
qsvg4.dll
qtiff4.dll
)
copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "Release/llplugin/imageformats")
copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "RelWithDebInfo/llplugin/imageformats")
if(0)
copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "../test_apps/llplugintest/imageformats/Release")
copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "../test_apps/llplugintest/imageformats/RelWithDebInfo")
endif(0)
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
set(plugin_image_debug_files
qgifd4.dll
qicod4.dll
qjpegd4.dll
qmngd4.dll
qsvgd4.dll
qtiffd4.dll
)
copy_files("${LIBS_DEBUG_DIR}/imageformats" "${plugin_image_debug_files}" "Debug/llplugin/imageformats")
if(0)
copy_files("${LIBS_DEBUG_DIR}/imageformats" "${plugin_image_debug_files}" "../test_apps/llplugintest/imageformats/Debug")
endif(0)
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
set(plugin_codec_release_files
qcncodecs4.dll
qjpcodecs4.dll
qkrcodecs4.dll
qtwcodecs4.dll
)
copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "Release/llplugin/codecs")
copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "RelWithDebInfo/llplugin/codecs")
if(0)
copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "../test_apps/llplugintest/codecs/Release")
copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "../test_apps/llplugintest/codecs/RelWithDebInfo")
endif(0)
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
set(plugin_codec_debug_files
qcncodecsd4.dll
qjpcodecsd4.dll
qkrcodecsd4.dll
qtwcodecsd4.dll
)
copy_files("${LIBS_DEBUG_DIR}/codecs" "${plugin_codec_debug_files}" "Debug/llplugin/codecs")
if(0)
copy_files("${LIBS_DEBUG_DIR}/codecs" "${plugin_codec_debug_files}" "../test_apps/llplugintest/codecs/Debug")
endif(0)

View File

@@ -7,12 +7,11 @@ if (STANDALONE)
pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1)
elseif (LINUX)
use_prebuilt_binary(dbusglib)
use_prebuilt_binary(dbus-glib)
set(DBUSGLIB_FOUND ON FORCE BOOL)
set(DBUSGLIB_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/dbus
${LIBS_PREBUILT_LEGACY_DIR}/include/dbus
)
${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

View File

@@ -0,0 +1,70 @@
# DeploySharedLibs.cmake
# This is a script to be run at build time! Its not part of the cmake configuration!
# See indra/cmake/LLSharedLibs.cmake for a macro that simplifies adding a command to a target to run this script.
# This script requires a few cmake variable to be set on the command line:
# BIN_NAME= The full path the the binary to search for dependecies.
# SEARCH_DIRS= The full paths to dirs to search for dependencies.
# DST_PATH= The full path where the dependecies will be copied.
get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
include(GetPrerequisites)
message("Getting recursive dependencies for file: ${BIN_NAME}")
set(EXCLUDE_SYSTEM 1)
set(RECURSE 0)
get_filename_component(EXE_PATH ${BIN_NAME} PATH)
get_prerequisites( ${BIN_NAME} RESULTS ${EXCLUDE_SYSTEM} ${RECURSE} "${EXE_PATH}" "${SEARCH_DIRS}" )
foreach(DEP ${RESULTS})
Message("Processing dependency: ${DEP}")
get_filename_component(DEP_FILE ${DEP} NAME)
set(DEP_FILES ${DEP_FILES} ${DEP_FILE})
endforeach(DEP)
if(DEP_FILES)
list(REMOVE_DUPLICATES DEP_FILES)
endif(DEP_FILES)
foreach(DEP_FILE ${DEP_FILES})
if(FOUND_FILES)
list(FIND FOUND_FILES ${DEP_FILE} FOUND)
else(FOUND_FILES)
set(FOUND -1)
endif(FOUND_FILES)
if(FOUND EQUAL -1)
find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH)
if(DEP_PATH)
set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}")
set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call.
else(DEP_PATH)
set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE})
endif(DEP_PATH)
endif(FOUND EQUAL -1)
endforeach(DEP_FILE)
if(MISSING_FILES)
message("Missing:")
foreach(FILE ${MISSING_FILES})
message(" ${FILE}")
endforeach(FILE)
message("Searched in:")
foreach(SEARCH_DIR ${SEARCH_DIRS})
message(" ${SEARCH_DIR}")
endforeach(SEARCH_DIR)
message(FATAL_ERROR "Failed")
endif(MISSING_FILES)
if(FOUND_FILES)
foreach(FILE ${FOUND_FILES})
get_filename_component(DST_FILE ${FILE} NAME)
set(DST_FILE "${DST_PATH}/${DST_FILE}")
message("Copying ${FILE} to ${DST_FILE}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE}
)
endforeach(FILE ${FOUND_FILES})
endif(FOUND_FILES)
message("Success!")

View File

@@ -1,82 +0,0 @@
# -*- cmake -*-
include(Variables)
if (WINDOWS)
if (WORD_SIZE EQUAL 32)
set (DIRECTX_ARCHITECTURE x86)
elseif (WORD_SIZE EQUAL 64)
set (DIRECTX_ARCHITECTURE x64)
else (WORD_SIZE EQUAL 32)
set (DIRECTX_ARCHITECTURE x86)
endif (WORD_SIZE EQUAL 32)
SET(program_files $ENV{ProgramW6432})
if(NOT program_files)
SET(program_files $ENV{ProgramFiles})
endif(NOT program_files)
SET(program_files_x86 "ProgramFiles(x86)")
SET(program_files_x86 $ENV{${program_files_x86}})
find_path(DIRECTX_ROOT_DIR Include/dxdiag.h
PATHS
"$ENV{DXSDK_DIR}"
"${program_files}/Microsoft DirectX SDK (June 2010)"
"${program_files_x86}/Microsoft DirectX SDK (June 2010)"
"${program_files}/Microsoft DirectX SDK (February 2010)"
"${program_files_x86}/Microsoft DirectX SDK (February 2010)"
"${program_files}/Microsoft DirectX SDK (March 2009)"
"${program_files_x86}/Microsoft DirectX SDK (March 2009)"
"${program_files}/Microsoft DirectX SDK (August 2008)"
"${program_files_x86}/Microsoft DirectX SDK (August 2008)"
"${program_files}/Microsoft DirectX SDK (June 2008)"
"${program_files_x86}/Microsoft DirectX SDK (June 2008)"
"${program_files}/Microsoft DirectX SDK (March 2008)"
"${program_files_x86}/Microsoft DirectX SDK (March 2008)"
"${program_files}/Microsoft DirectX SDK (November 2007)"
"${program_files_x86}/Microsoft DirectX SDK (November 2007)"
"${program_files}/Microsoft DirectX SDK (August 2007)"
"${program_files_x86}/Microsoft DirectX SDK (August 2007)"
)
if (DIRECTX_ROOT_DIR)
set (DIRECTX_INCLUDE_DIR "${DIRECTX_ROOT_DIR}/Include")
set (DIRECTX_LIBRARY_DIR "${DIRECTX_ROOT_DIR}/Lib/${DIRECTX_ARCHITECTURE}")
else (DIRECTX_ROOT_DIR)
find_path (WIN_KIT_ROOT_DIR Include/um/windows.h
PATHS
"${program_files}/Windows Kits/8.1"
"${program_files_x86}/Windows Kits/8.1"
"${program_files}/Windows Kits/8.0"
"${program_files_x86}/Windows Kits/8.0"
)
find_path (WIN_KIT_LIB_DIR dxguid.lib
"${WIN_KIT_ROOT_DIR}/Lib/winv6.3/um/${DIRECTX_ARCHITECTURE}"
"${WIN_KIT_ROOT_DIR}/Lib/Win8/um/${DIRECTX_ARCHITECTURE}"
)
if (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR)
set (DIRECTX_INCLUDE_DIR "${WIN_KIT_ROOT_DIR}/Include/um" "${WIN_KIT_ROOT_DIR}/Include/shared")
set (DIRECTX_LIBRARY_DIR "${WIN_KIT_LIB_DIR}")
endif (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR)
endif (DIRECTX_ROOT_DIR)
if (DIRECTX_INCLUDE_DIR)
include_directories(${DIRECTX_INCLUDE_DIR})
if (DIRECTX_FIND_QUIETLY)
message(STATUS "Found DirectX include: ${DIRECTX_INCLUDE_DIR}")
endif (DIRECTX_FIND_QUIETLY)
else (DIRECTX_INCLUDE_DIR)
message(FATAL_ERROR "Could not find DirectX SDK Include")
endif (DIRECTX_INCLUDE_DIR)
if (DIRECTX_LIBRARY_DIR)
if (DIRECTX_FIND_QUIETLY)
message(STATUS "Found DirectX include: ${DIRECTX_LIBRARY_DIR}")
endif (DIRECTX_FIND_QUIETLY)
else (DIRECTX_LIBRARY_DIR)
message(FATAL_ERROR "Could not find DirectX SDK Libraries")
endif (DIRECTX_LIBRARY_DIR)
endif (WINDOWS)

View File

@@ -1,45 +0,0 @@
# This script drives download of prebuilt packages during the build.
# The top-level CMakeLists.txt configures packages and tool locations.
set(packages "@PREBUILT_PACKAGES@")
set(python "@PYTHON_EXECUTABLE@")
set(install_dir "@CMAKE_BINARY_DIR@/packages")
set(scp "@SCP_EXECUTABLE@")
set(scripts_dir "@SCRIPTS_DIR@")
set(sentinel_dir "@CMAKE_BINARY_DIR@/prepare")
set(prebuilt_type "@PREBUILT_TYPE@")
# In proprietary mode we use scp for download.
set(proprietary "@INSTALL_PROPRIETARY@")
if(proprietary)
set(scp_option "--scp=${scp}")
set(proprietary_message " proprietary")
endif(proprietary)
foreach(package ${packages})
if(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed)
# This package is missing or out of date.
message(STATUS "Obtaining${proprietary_message} prebuilt '${package}'")
execute_process(
COMMAND ${python} install.py -p${prebuilt_type} --install-dir=${install_dir} --installed-manifest=${install_dir}/installed.xml ${scp_option} ${package}
WORKING_DIRECTORY ${scripts_dir}
RESULT_VARIABLE result
)
if(result STREQUAL 0)
# Write a sentinel to avoid attempting a download again.
file(WRITE ${sentinel_dir}/${package}_installed "Obtained '${package}'")
else(result STREQUAL 0)
# Remove the sentinel to ensure a download is attempted again.
file(REMOVE ${sentinel_dir}/prebuilt
${sentinel_dir}/${package}_installed)
message(FATAL_ERROR
"Failed to download or unpack prebuilt '${package}'. "
"Process returned: ${result}")
endif(result STREQUAL 0)
else(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed)
# This package is ready.
message(STATUS "Prebuilt '${package}' is up-to-date")
endif(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed)
endforeach(package)
# Store a sentinel to avoid running this script unnecessarily.
file(WRITE ${sentinel_dir}/prebuilt "All prebuilts obtained successfully\n")

View File

@@ -1,22 +0,0 @@
# -*- cmake -*-
include(Prebuilt)
set(ELFIO_FIND_QUIETLY ON)
if (STANDALONE)
include(FindELFIO)
elseif (LINUX)
use_prebuilt_binary(elfio)
set(ELFIO_LIBRARIES ELFIO)
set(ELFIO_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(ELFIO_FOUND "YES")
endif (STANDALONE)
if (ELFIO_FOUND)
add_definitions(-DLL_ELFBIN=1)
else (ELFIO_FOUND)
set(ELFIO_INCLUDE_DIR "")
endif (ELFIO_FOUND)

View File

@@ -9,16 +9,9 @@ if (STANDALONE)
else (STANDALONE)
use_prebuilt_binary(expat)
if (WINDOWS)
if (MSVC12)
set(EXPAT_LIBRARIES expat)
else (MSVC12)
set(EXPAT_LIBRARIES libexpatMT)
endif (MSVC12)
set(EXPAT_LIBRARIES expat)
else (WINDOWS)
set(EXPAT_LIBRARIES expat)
endif (WINDOWS)
set(EXPAT_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@@ -1,116 +0,0 @@
# -*- cmake -*-
include(Linking)
if (FMODEX AND FMODSTUDIO)
message( FATAL_ERROR "You can not enable two FMOD variants at the same time." )
endif (FMODEX AND FMODSTUDIO)
unset(FMOD_LIBRARY_RELEASE CACHE)
unset(FMOD_LIBRARY_DEBUG CACHE)
unset(FMOD_INCLUDE_DIR CACHE)
set(FMOD_EXTERNAL_LIB OFF)
if(STANDALONE OR WINDOWS)
if (NOT FMODEX_SDK_DIR AND WINDOWS)
GET_FILENAME_COMPONENT(REG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Programmers\ API\ Windows] ABSOLUTE)
set(FMODEX_SDK_DIR ${REG_DIR} CACHE PATH "Path to the FMOD Ex SDK." FORCE)
endif (NOT FMODEX_SDK_DIR AND WINDOWS)
if(NOT FMODEX_SDK_DIR AND STANDALONE)
message(FATAL_ERROR "FMODEX_SDK_DIR not set!")
endif(NOT FMODEX_SDK_DIR AND STANDALONE)
endif(STANDALONE OR WINDOWS)
if(FMODEX_SDK_DIR)
set(fmod_lib_paths "${FMODEX_SDK_DIR}/api" "${FMODEX_SDK_DIR}/api/lib" )
set(fmod_inc_paths "${FMODEX_SDK_DIR}/api/inc")
if(WINDOWS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
endif(WINDOWS)
if(WORD_SIZE EQUAL 64)
find_library(FMOD_LIBRARY_RELEASE fmodex64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LIBRARY_DEBUG fmodexL64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
else(WORD_SIZE EQUAL 64)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin.
find_library(FMOD_LIBRARY_RELEASE fmodex PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LIBRARY_DEBUG fmodexL PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
endif(WORD_SIZE EQUAL 64)
if(WINDOWS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
if(WORD_SIZE EQUAL 64)
find_library(FMOD_LINK_LIBRARY_RELEASE fmodex64_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LINK_LIBRARY_DEBUG fmodexL64_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
else(WORD_SIZE EQUAL 64)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin.
find_library(FMOD_LINK_LIBRARY_RELEASE fmodex_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LINK_LIBRARY_DEBUG fmodexL_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
endif(WORD_SIZE EQUAL 64)
else(WINDOWS)
set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
endif(WINDOWS)
find_path(FMOD_INCLUDE_DIR fmod.hpp ${fmod_inc_paths})
if(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
if(STANDALONE)
message(FATAL_ERROR "Provided FMODEX_SDK_DIR path not found '{$FMODEX_SDK_DIR}'")
else(STANDALONE)
message(STATUS "Provided FMODEX_SDK_DIR path not found '${FMODEX_SDK_DIR}'. Falling back to prebuilts")
endif(STANDALONE)
else(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
message(STATUS "Using system-provided FMOD Ex Libraries")
set(FMOD_EXTERNAL_LIB ON)
endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
endif (FMODEX_SDK_DIR)
if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
if(WINDOWS)
set(lib_suffix .dll)
elseif(DARWIN)
set(lib_suffix .dylib)
else(WINDOWS)
set(lib_suffix .so)
endif(WINDOWS)
if(WINDOWS)
if(WORD_SIZE EQUAL 64)
set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/fmodex64${lib_suffix})
set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/fmodexL64${lib_suffix})
else(WORD_SIZE EQUAL 64)
set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/fmodex${lib_suffix})
set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/fmodexL${lib_suffix})
endif(WORD_SIZE EQUAL 64)
else(WINDOWS)
if(WORD_SIZE EQUAL 64)
set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/libfmodex64${lib_suffix})
set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/libfmodex64L${lib_suffix})
else(WORD_SIZE EQUAL 64)
set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/libfmodex${lib_suffix})
set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/libfmodexL${lib_suffix})
endif(WORD_SIZE EQUAL 64)
endif(WINDOWS)
set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
if(WINDOWS)
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
endif(WINDOWS)
use_prebuilt_binary(fmodex)
set(FMOD_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include/fmodex)
endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
if(FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR)
set(FMOD ON)
if (NOT FMOD_LIBRARY_DEBUG) #Use release library in debug configuration if debug library is absent.
set(FMOD_LIBRARY_DEBUG ${FMOD_LIBRARY_RELEASE})
endif (NOT FMOD_LIBRARY_DEBUG)
else (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR)
message(STATUS "No support for FMOD EX audio (need to set FMODEX_SDK_DIR?)")
set(FMOD OFF)
set(FMODEX OFF)
endif (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR)
if (FMOD)
message(STATUS "Building with FMOD Ex audio support")
set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODEX")
endif (FMOD)

View File

@@ -1,70 +1,8 @@
# -*- cmake -*-
include(Linking)
if (FMODEX AND FMODSTUDIO)
message( FATAL_ERROR "You can not enable two FMOD variants at the same time." )
endif (FMODEX AND FMODSTUDIO)
unset(FMOD_LIBRARY_RELEASE CACHE)
unset(FMOD_LIBRARY_DEBUG CACHE)
unset(FMOD_INCLUDE_DIR CACHE)
set(FMOD_EXTERNAL_LIB OFF)
if(STANDALONE OR WINDOWS)
if (NOT FMODSTUDIO_SDK_DIR AND WINDOWS)
#GET_FILENAME_COMPONENT(REG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Studio\ API\ Windows] ABSOLUTE)
#set(FMODSTUDIO_SDK_DIR ${REG_DIR} CACHE PATH "Path to the FMOD Studio SDK." FORCE)
endif (NOT FMODSTUDIO_SDK_DIR AND WINDOWS)
if(NOT FMODSTUDIO_SDK_DIR AND STANDALONE)
message(FATAL_ERROR "FMODSTUDIO_SDK_DIR not set!")
endif(NOT FMODSTUDIO_SDK_DIR AND STANDALONE)
endif(STANDALONE OR WINDOWS)
if(FMODSTUDIO_SDK_DIR)
if(LINUX AND WORD_SIZE EQUAL 32)
set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib/x86" )
elseif(LINUX)
set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib/x86_64")
else(LINUX AND WORD_SIZE EQUAL 32)
set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib")
endif(LINUX AND WORD_SIZE EQUAL 32)
set(fmod_inc_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/inc")
if(WINDOWS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
endif(WINDOWS)
if(WORD_SIZE EQUAL 64 AND WINDOWS)
find_library(FMOD_LIBRARY_RELEASE fmod64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LIBRARY_DEBUG fmodL64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
else(WORD_SIZE EQUAL 64 AND WINDOWS)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin.
find_library(FMOD_LIBRARY_RELEASE fmod PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
find_library(FMOD_LIBRARY_DEBUG fmodL PATHS ${fmod_lib_paths} NO_DEFAULT_PATH)
endif(WORD_SIZE EQUAL 64 AND WINDOWS)
if(WINDOWS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
else(WINDOWS)
set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
endif(WINDOWS)
find_path(FMOD_INCLUDE_DIR fmod.hpp ${fmod_inc_paths})
if(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
if(STANDALONE)
message(FATAL_ERROR "Provided FMODSTUDIO_SDK_DIR path not found '{$FMODSTUDIO_SDK_DIR}'")
else(STANDALONE)
message(STATUS "Provided FMODSTUDIO_SDK_DIR path not found '${FMODSTUDIO_SDK_DIR}'. Falling back to prebuilts")
endif(STANDALONE)
else(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
message(STATUS "Using system-provided FMOD Studio Libraries")
set(FMOD_EXTERNAL_LIB ON)
endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
endif (FMODSTUDIO_SDK_DIR)
if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
include(Variables)
if (FMODSTUDIO)
use_prebuilt_binary(fmodstudio)
if(WINDOWS)
set(lib_suffix .dll)
elseif(DARWIN)
@@ -86,14 +24,19 @@ if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
endif(WINDOWS)
set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
if(WINDOWS)
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE})
string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG})
endif(WINDOWS)
use_prebuilt_binary(fmodstudio)
set(FMOD_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include/fmodstudio)
endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR)
set (FMOD_LIBRARY
debug ${FMOD_LINK_LIBRARY_DEBUG}
optimized ${FMOD_LINK_LIBRARY_RELEASE}
)
set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodstudio)
endif(FMODSTUDIO)
if(FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR)
set(FMOD ON)
@@ -108,5 +51,6 @@ endif (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR)
if (FMOD)
message(STATUS "Building with FMOD Studio audio support")
set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO")
set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO=1")
endif (FMOD)

View File

@@ -0,0 +1,43 @@
# -*- cmake -*-
#
# Find the autobuild tool
#
# Output variables:
#
# AUTOBUILD_EXECUTABLE - path to autobuild executable
IF (NOT AUTOBUILD_EXECUTABLE)
# If cmake was executed by autobuild, autobuild will have set the AUTOBUILD env var
IF (DEFINED ENV{AUTOBUILD})
SET(AUTOBUILD_EXECUTABLE $ENV{AUTOBUILD})
ELSE (DEFINED ENV{AUTOBUILD})
IF(WIN32)
SET(AUTOBUILD_EXE_NAMES autobuild.exe autobuild.cmd)
ELSE(WIN32)
SET(AUTOBUILD_EXE_NAMES autobuild)
ENDIF(WIN32)
SET(AUTOBUILD_EXECUTABLE)
FIND_PROGRAM(
AUTOBUILD_EXECUTABLE
NAMES ${AUTOBUILD_EXE_NAMES}
PATHS
ENV PATH
${CMAKE_SOURCE_DIR}/..
${CMAKE_SOURCE_DIR}/../..
${CMAKE_SOURCE_DIR}/../../..
PATH_SUFFIXES "/autobuild/bin/"
)
ENDIF (DEFINED ENV{AUTOBUILD})
IF (NOT AUTOBUILD_EXECUTABLE)
IF (AUTOBUILD_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find autobuild executable")
ENDIF (AUTOBUILD_FIND_REQUIRED)
ENDIF (NOT AUTOBUILD_EXECUTABLE)
MARK_AS_ADVANCED(AUTOBUILD_EXECUTABLE)
ENDIF (NOT AUTOBUILD_EXECUTABLE)

View File

@@ -1,50 +0,0 @@
# -*- cmake -*-
# - Find BerkeleyDB
# Find the BerkeleyDB includes and library
# This module defines
# DB_INCLUDE_DIR, where to find db.h, etc.
# DB_LIBRARIES, the libraries needed to use BerkeleyDB.
# DB_FOUND, If false, do not try to use BerkeleyDB.
# also defined, but not for general use are
# DB_LIBRARY, where to find the BerkeleyDB library.
FIND_PATH(DB_INCLUDE_DIR db.h
/usr/local/include/db4
/usr/local/include
/usr/include/db4
/usr/include
)
SET(DB_NAMES ${DB_NAMES} db)
FIND_LIBRARY(DB_LIBRARY
NAMES ${DB_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_LIBRARIES ${DB_LIBRARY})
SET(DB_FOUND "YES")
ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_FOUND "NO")
ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)
IF (DB_FOUND)
IF (NOT DB_FIND_QUIETLY)
MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}")
ENDIF (NOT DB_FIND_QUIETLY)
ELSE (DB_FOUND)
IF (DB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library")
ENDIF (DB_FIND_REQUIRED)
ENDIF (DB_FOUND)
# Deprecated declarations.
SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)
MARK_AS_ADVANCED(
DB_LIBRARY
DB_INCLUDE_DIR
)

View File

@@ -1,48 +0,0 @@
# -*- cmake -*-
# - Find ELFIO
# Find the ELFIO includes and library
# This module defines
# ELFIO_INCLUDE_DIR, where to find elfio.h, etc.
# ELFIO_LIBRARIES, the libraries needed to use ELFIO.
# ELFIO_FOUND, If false, do not try to use ELFIO.
# also defined, but not for general use are
# ELFIO_LIBRARY, where to find the ELFIO library.
FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h
/usr/local/include
/usr/include
)
SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO)
FIND_LIBRARY(ELFIO_LIBRARY
NAMES ${ELFIO_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY})
SET(ELFIO_FOUND "YES")
ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
SET(ELFIO_FOUND "NO")
ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
IF (ELFIO_FOUND)
IF (NOT ELFIO_FIND_QUIETLY)
MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}")
ENDIF (NOT ELFIO_FIND_QUIETLY)
ELSE (ELFIO_FOUND)
IF (ELFIO_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ELFIO library")
ENDIF (ELFIO_FIND_REQUIRED)
ENDIF (ELFIO_FOUND)
# Deprecated declarations.
SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH)
MARK_AS_ADVANCED(
ELFIO_LIBRARY
ELFIO_INCLUDE_DIR
)

View File

@@ -1,62 +0,0 @@
# -*- cmake -*-
# - Find llqtwebkit
# Find the llqtwebkit includes and library
# This module defines
# LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc.
# LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path.
# LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit.
# also defined, but not for general use are
# LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit.
# LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library.
# LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS})
# before compiling code that includes llqtwebkit library files.
# Try to use pkg-config first.
# This allows to have two different libllqtwebkit packages installed:
# one for viewer 2.x and one for viewer 1.x.
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED)
else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
set(_PACKAGE_ARGS libllqtwebkit)
endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")
# As virtually nobody will have a pkg-config file for this, do this check always quiet.
# Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'.
set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET)
endif ()
pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS})
endif (PKG_CONFIG_FOUND)
set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER})
find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS})
find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS})
if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config.
set(LLQTWEBKIT_LIBRARIES llqtwebkit)
get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH)
endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)
# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
LLQTWEBKIT
DEFAULT_MSG
LLQTWEBKIT_LIBRARY
LLQTWEBKIT_INCLUDE_DIR
LLQTWEBKIT_LIBRARIES
LLQTWEBKIT_LIBRARY_DIRS
)
mark_as_advanced(
LLQTWEBKIT_LIBRARY
LLQTWEBKIT_INCLUDE_DIR
LLQTWEBKIT_LIBRARIES
LLQTWEBKIT_LIBRARY_DIRS
LLQTWEBKIT_DEFINITIONS
)

View File

@@ -7,18 +7,7 @@ if (STANDALONE)
pkg_check_modules(FREETYPE REQUIRED freetype2)
else (STANDALONE)
use_prebuilt_binary(freetype)
if(MSVC12)
set(FREETYPE_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/freetype2
${LIBS_PREBUILT_LEGACY_DIR}/include/freetype2
)
else(MSVC12)
set(FREETYPE_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
endif (MSVC12)
set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/freetype2)
set(FREETYPE_LIBRARIES freetype)
endif (STANDALONE)

View File

@@ -7,10 +7,8 @@ set(GLOD_FIND_REQUIRED ON)
if (STANDALONE)
include(FindGLOD)
else (STANDALONE)
use_prebuilt_binary(GLOD)
set(GLOD_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(GLOD_LIBRARIES glod)
use_prebuilt_binary(glod)
set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glod)
set(GLOD_LIBRARIES GLOD)
endif (STANDALONE)

View File

@@ -1,30 +1,9 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
include(FindPkgConfig)
pkg_check_modules(GSTREAMER010 REQUIRED gstreamer-0.10)
pkg_check_modules(GSTREAMER010_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10)
else (STANDALONE)
# Possibly libxml and glib should have their own .cmake file instead...
use_prebuilt_binary(glib) # gstreamer needs glib
use_prebuilt_binary(libxml)
use_prebuilt_binary(gstreamer)
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}/includeg/lib-2.0
${LIBS_PREBUILT_DIR}/include/libxml2
${LIBS_PREBUILT_LEGACY_DIR}/include/gstreamer-0.10
${LIBS_PREBUILT_LEGACY_DIR}/include/glib-2.0
${LIBS_PREBUILT_LEGACY_DIR}/include/libxml2
)
endif (STANDALONE)
if (WINDOWS)
# We don't need to explicitly link against gstreamer itself, because

View File

@@ -4,16 +4,12 @@ include(Prebuilt)
if (STANDALONE)
include(FindHunSpell)
else (STANDALONE)
use_prebuilt_binary(hunspell)
set(HUNSPELL_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include/hunspell
${LIBS_PREBUILT_LEGACY_DIR}/include/hunspell
)
use_prebuilt_binary(libhunspell)
if (LINUX OR DARWIN)
set(HUNSPELL_LIBRARY hunspell-1.3)
else (LINUX OR DARWIN)
set(HUNSPELL_LIBRARY libhunspell)
endif (LINUX OR DARWIN)
if (LINUX OR DARWIN)
set(HUNSPELL_LIBRARY hunspell-1.3)
else (LINUX OR DARWIN)
set(HUNSPELL_LIBRARY libhunspell)
endif (LINUX OR DARWIN)
set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/hunspell)
endif (STANDALONE)

View File

@@ -19,8 +19,5 @@ else (STANDALONE)
elseif (WINDOWS)
set(JPEG_LIBRARIES jpeglib)
endif (LINUX)
set(JPEG_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@@ -10,22 +10,13 @@ if (STANDALONE)
else (STANDALONE)
use_prebuilt_binary(jsoncpp)
if (WINDOWS)
if(MSVC12)
set(JSONCPP_LIBRARIES
debug json_vc${MSVC_SUFFIX}debug_libmt.lib
optimized json_vc${MSVC_SUFFIX}_libmt)
else(MSVC12)
set(JSONCPP_LIBRARIES
debug json_vc${MSVC_SUFFIX}d
optimized json_vc${MSVC_SUFFIX})
endif(MSVC12)
set(JSONCPP_LIBRARIES
debug jsoncppd.lib
optimized jsoncpp.lib)
elseif (DARWIN)
set(JSONCPP_LIBRARIES json_linux-gcc-4.0.1_libmt)
elseif (LINUX)
set(JSONCPP_LIBRARIES jsoncpp)
endif (WINDOWS)
set(JSONCPP_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include/jsoncpp
${LIBS_PREBUILT_LEGACY_DIR}/include/jsoncpp
)
set(JSONCPP_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/)
endif (STANDALONE)

View File

@@ -1,6 +1,7 @@
# -*- cmake -*-
include(Audio)
include(OPENAL)
set(LLAUDIO_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llaudio

View File

@@ -28,7 +28,7 @@ else (LINUX)
set(LLCOMMON_LIBRARIES llcommon)
endif (LINUX)
set(LLCOMMON_LINK_SHARED ON CACHE BOOL "Build the llcommon target as a shared library.")
set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a shared library.")
if(LLCOMMON_LINK_SHARED)
add_definitions(-DLL_COMMON_LINK_SHARED=1)
endif(LLCOMMON_LINK_SHARED)

View File

@@ -1,22 +1,32 @@
# -*- cmake -*-
# these should be moved to their own cmake file
include(Prebuilt)
include(Boost)
include(Colladadom)
use_prebuilt_binary(libxml2)
set(LLPRIMITIVE_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llprimitive
${COLLADADOM_INCLUDE_DIRS}
)
if (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
debug llprimitive
optimized llprimitive
${COLLADADOM_LIBRARIES}
)
set(LLPRIMITIVE_LIBRARIES
llprimitive
${COLLADADOM_LIBRARIES}
libxml2_a
${BOOST_SYSTEM_LIBRARIES}
)
else (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
llprimitive
${COLLADADOM_LIBRARIES}
)
set(LLPRIMITIVE_LIBRARIES
llprimitive
${COLLADADOM_LIBRARIES}
${BOOST_SYSTEM_LIBRARIES}
minizip
xml2
)
endif (WINDOWS)

View File

@@ -1,11 +0,0 @@
# -*- cmake -*-
if (STANDALONE)
set(LLQTWEBKIT_INCLUDE_DIR
${LIBS_OPEN_DIR}/llqtwebkit
)
set(LLQTWEBKIT_LIBRARY
llqtwebkit
)
endif (STANDALONE)

View File

@@ -1,13 +1,12 @@
# ll_deploy_sharedlibs_command
# target_exe: the cmake target of the executable for which the shared libs will be deployed.
macro(ll_deploy_sharedlibs_command target_exe)
SET(OUTPUT_PATH $<TARGET_FILE:${target_exe}>)
set(OUTPUT_PATH $<TARGET_FILE_DIR:${target_exe}>)
if(DARWIN)
SET_TEST_PATH(SEARCH_DIRS)
get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE)
if(IS_BUNDLE)
# If its a bundle the exe is not in the target location, this should find it.
set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources)
endif(IS_BUNDLE)
elseif(WINDOWS)
@@ -38,8 +37,7 @@ macro(ll_stage_sharedlib DSO_TARGET)
# 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)
SET(DSO_PATH $<TARGET_FILE:${DSO_TARGET}>)
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)

View File

@@ -14,18 +14,10 @@ if (STANDALONE)
)
else (STANDALONE)
if (LINUX)
use_prebuilt_binary(mesa)
use_prebuilt_binary(SDL)
set (SDL_FOUND TRUE)
set (SDL_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
if(WORD_SIZE EQUAL 64)
set (SDL_LIBRARY SDL)
else(WORD_SIZE EQUAL 64)
set (SDL_LIBRARY SDL directfb fusion direct)
endif(WORD_SIZE EQUAL 64)
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
set (SDL_LIBRARY SDL)
endif (LINUX)
endif (STANDALONE)

View File

@@ -1,42 +1,50 @@
# -*- cmake -*-
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
include(Variables)
if (NOT STANDALONE)
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)
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)
if(CMAKE_BUILD_TYPE)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
endif(CMAKE_BUILD_TYPE)
# 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
# the 'release' directory (as a default fallback).
# *NOTE - we have to take special care to use CMAKE_CFG_INTDIR on IDE generators (like mac and
# 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(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
# 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(ARCH_PREBUILT_LINK_DIRS
${LIBS_PREBUILT_DIR}/lib
${LIBS_PREBUILT_LEGACY_DIR}/lib
)
else(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
# else block is for linux and any other makefile based generators
set(ARCH_PREBUILT_LINK_DIRS
${LIBS_PREBUILT_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}
${LIBS_PREBUILT_LEGACY_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}
)
endif(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode")
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")
if (NOT "${CMAKE_BUILD_TYPE_LOWER}" 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 ARCH_PREBUILT_LINK_DIRS
${LIBS_PREBUILT_DIR}/lib/release
${LIBS_PREBUILT_LEGACY_DIR}/lib/release
)
endif (NOT "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release")
endif (NOT STANDALONE)
link_directories(${ARCH_PREBUILT_LINK_DIRS})
link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
if (LINUX)
set(DL_LIBRARY dl)
@@ -46,10 +54,11 @@ else (LINUX)
set(PTHREAD_LIBRARY "")
endif (LINUX)
if (WINDOWS)
if (WINDOWS)
set(WINDOWS_LIBRARIES
advapi32
shell32
ole32
ws2_32
mswsock
psapi

View File

@@ -7,7 +7,11 @@ if (STANDALONE)
message(STATUS "Building without N-DoF joystick support")
endif(NOT NDOF_FOUND)
else (STANDALONE)
use_prebuilt_binary(ndofdev)
if (WINDOWS OR DARWIN)
use_prebuilt_binary(libndofdev)
elseif (LINUX)
use_prebuilt_binary(libndofdev-open)
endif (WINDOWS OR DARWIN)
if (WINDOWS)
set(NDOF_LIBRARY libndofdev)
@@ -15,10 +19,11 @@ else (STANDALONE)
set(NDOF_LIBRARY ndofdev)
endif (WINDOWS)
set(NDOF_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/include/ndofdev
${LIBS_PREBUILT_LEGACY_DIR}/include/ndofdev
)
if (WINDOWS)
set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
else (WINDOWS)
set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/ndofdev)
endif (WINDOWS)
set(NDOF_FOUND 1)
endif (STANDALONE)
@@ -26,6 +31,8 @@ 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)

View File

@@ -16,16 +16,13 @@ if (OPENAL)
pkg_check_modules(OPENAL_LIB REQUIRED openal)
pkg_check_modules(FREEALUT_LIB REQUIRED freealut)
else (STANDALONE)
use_prebuilt_binary(openal-soft)
use_prebuilt_binary(openal)
endif (STANDALONE)
set(OPENAL_LIBRARIES
openal
alut
)
set(OPENAL_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(OPENAL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (OPENAL)
if (OPENAL)

View File

@@ -7,16 +7,13 @@ set(OpenSSL_FIND_REQUIRED ON)
if (STANDALONE OR USE_SYSTEM_OPENSSL)
include(FindOpenSSL)
else (STANDALONE OR USE_SYSTEM_OPENSSL)
use_prebuilt_binary(openSSL)
use_prebuilt_binary(openssl)
if (WINDOWS)
set(OPENSSL_LIBRARIES ssleay32 libeay32)
else (WINDOWS)
set(OPENSSL_LIBRARIES ssl)
endif (WINDOWS)
set(OPENSSL_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE OR USE_SYSTEM_OPENSSL)
if (LINUX)

View File

@@ -9,11 +9,7 @@ if (STANDALONE)
else (STANDALONE)
use_prebuilt_binary(libpng)
if (WINDOWS)
if(MSVC12)
set(PNG_LIBRARIES libpng16)
else(MSVC12)
set(PNG_LIBRARIES libpng15)
endif(MSVC12)
set(PNG_LIBRARIES libpng16)
elseif(DARWIN)
set(PNG_LIBRARIES png15)
else(LINUX)
@@ -36,15 +32,5 @@ else (STANDALONE)
set(PNG_LIBRARIES png16)
endif ()
endif()
if (WINDOWS)
set(PNG_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/${PNG_LIBRARIES}
${LIBS_PREBUILT_LEGACY_DIR}/include/${PNG_LIBRARIES}
)
else (WINDOWS)
set(PNG_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/lib${PNG_LIBRARIES}
${LIBS_PREBUILT_LEGACY_DIR}/include/lib${PNG_LIBRARIES}
)
endif (WINDOWS)
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16)
endif (STANDALONE)

View File

@@ -3,14 +3,64 @@
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
include(FindAutobuild)
include(Variables)
if(INSTALL_PROPRIETARY)
include(FindSCP)
endif(INSTALL_PROPRIETARY)
set(PREBUILD_TRACKING_DIR ${AUTOBUILD_INSTALL_DIR}/cmake_tracking)
# For the library installation process;
# see cmake/Prebuild.cmake for the counterpart code.
if ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${PREBUILD_TRACKING_DIR}/sentinel_installed")
file(MAKE_DIRECTORY ${PREBUILD_TRACKING_DIR})
file(WRITE ${PREBUILD_TRACKING_DIR}/sentinel_installed "0")
endif ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${PREBUILD_TRACKING_DIR}/sentinel_installed")
# The use_prebuilt_binary macro handles automated installation of package
# dependencies using autobuild. The goal is that 'autobuild install' should
# only be run when we know we need to install a new package. This should be
# the case in a clean checkout, or if autobuild.xml has been updated since the
# last run (encapsulated by the file ${PREBUILD_TRACKING_DIR}/sentinel_installed),
# or if a previous attempt to install the package has failed (the exit status
# of previous attempts is serialized in the file
# ${PREBUILD_TRACKING_DIR}/${_binary}_installed)
macro (use_prebuilt_binary _binary)
if(NOT STANDALONE)
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
list(FIND PREBUILT_PACKAGES ${_binary} _index)
if(_index LESS 0)
set_property(TARGET prepare APPEND PROPERTY PREBUILT ${_binary})
endif(_index LESS 0)
endif(NOT STANDALONE)
if (NOT DEFINED USESYSTEMLIBS_${_binary})
set(USESYSTEMLIBS_${_binary} ${USESYSTEMLIBS})
endif (NOT DEFINED USESYSTEMLIBS_${_binary})
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)
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("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}
-p ${AUTOBUILD_PLATFORM_NAME}
${_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}.")
endif (NOT ${_binary}_installed EQUAL 0)
endif (NOT USESYSTEMLIBS_${_binary})
endmacro (use_prebuilt_binary _binary)
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)

View File

@@ -1,7 +1,7 @@
# -*- cmake -*-
include(Prebuilt)
set(PULSEAUDIO ON CACHE BOOL "Build with PulseAudio support, if available.")
set(PULSEAUDIO OFF CACHE BOOL "Build with PulseAudio support, if available.")
if (PULSEAUDIO)
if (STANDALONE)
@@ -13,9 +13,8 @@ if (PULSEAUDIO)
use_prebuilt_binary(pulseaudio)
set(PULSEAUDIO_FOUND ON FORCE BOOL)
set(PULSEAUDIO_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
${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

View File

@@ -1,12 +0,0 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
set(Qt4_FIND_REQUIRED ON)
include(FindQt4)
find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
endif (STANDALONE)

View File

@@ -1,9 +1,11 @@
# -*- cmake -*-
if(INSTALL_PROPRIETARY)
if(INSTALL_PROPRIETARY OR USE_QUICKTIME_PREBUILT)
include(Prebuilt)
use_prebuilt_binary(quicktime)
endif(INSTALL_PROPRIETARY)
if (WINDOWS)
use_prebuilt_binary(quicktime)
endif (WINDOWS)
endif(INSTALL_PROPRIETARY OR USE_QUICKTIME_PREBUILT)
if (DARWIN)
include(CMakeFindFrameworks)
@@ -23,15 +25,13 @@ elseif (WINDOWS AND WORD_SIZE EQUAL 32)
find_library(DEBUG_QUICKTIME_LIBRARY qtmlclient
PATHS
${LIBS_PREBUILT_DIR}/lib/debug
${LIBS_PREBUILT_LEGACY_DIR}/lib/debug
${ARCH_PREBUILT_DIRS_DEBUG}
"${QUICKTIME_SDK_DIR}\\libraries"
)
find_library(RELEASE_QUICKTIME_LIBRARY qtmlclient
PATHS
${LIBS_PREBUILT_DIR}/lib/release
${LIBS_PREBUILT_LEGACY_DIR}/lib/release
${ARCH_PREBUILT_DIRS_RELEASE}
"${QUICKTIME_SDK_DIR}\\libraries"
)
@@ -45,7 +45,6 @@ elseif (WINDOWS AND WORD_SIZE EQUAL 32)
include_directories(
${LIBS_PREBUILT_DIR}/include/quicktime
${LIBS_PREBUILT_LEGACY_DIR}/include/quicktime
"${QUICKTIME_SDK_DIR}\\CIncludes"
)
endif (DARWIN)

View File

@@ -8,7 +8,7 @@ macro (check_message_template _target)
PRE_LINK
COMMAND ${PYTHON_EXECUTABLE}
ARGS ${SCRIPTS_DIR}/template_verifier.py
--mode=development --cache_master
COMMENT "Verifying message template"
--mode=development --cache_master --master_url=${TEMPLATE_VERIFIER_MASTER_URL} ${TEMPLATE_VERIFIER_OPTIONS}
COMMENT "Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py"
)
endmacro (check_message_template)

View File

@@ -1,5 +1,6 @@
# -*- cmake -*-
include(Prebuilt)
include(FreeType)
if (STANDALONE)
include(FindPkgConfig)
@@ -32,11 +33,10 @@ if (STANDALONE)
endforeach(pkg)
else (STANDALONE)
if (LINUX)
use_prebuilt_binary(glib) # gtk-etc needs glib
use_prebuilt_binary(gtk-atk-pango-glib)
set(UI_LIBRARIES
atk-1.0
X11
cairo
gdk-x11-2.0
gdk_pixbuf-2.0
Xinerama
@@ -48,25 +48,19 @@ else (STANDALONE)
gtk-x11-2.0
pango-1.0
pangoft2-1.0
pangox-1.0
pangoxft-1.0
pangocairo-1.0
pixman-1
X11
${FREETYPE_LIBRARIES}
)
endif (LINUX)
include_directories (
${LIBS_PREBUILT_DIR}/packages/include
${LIBS_PREBUILT_DIR}/packages/include/cairo
${LIBS_PREBUILT_DIR}/packages/include/pixman-1
${LIBS_PREBUILT_LEGACY_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include/cairo
${LIBS_PREBUILT_LEGACY_DIR}/include/pixman-1
${LIBS_PREBUILT_DIR}/include
)
foreach(include ${${LL_ARCH}_INCLUDES})
include_directories(
${LIBS_PREBUILT_DIR}/include/${include}
${LIBS_PREBUILT_LEGACY_DIR}/include/${include}
)
include_directories(${LIBS_PREBUILT_DIR}/include/${include})
endforeach(include)
endif (STANDALONE)

View File

@@ -23,26 +23,62 @@ set(LIBS_CLOSED_PREFIX)
set(LIBS_OPEN_PREFIX)
set(SCRIPTS_PREFIX ../scripts)
set(VIEWER_PREFIX)
set(INTEGRATION_TESTS_PREFIX)
set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation)")
# Compiler and toolchain options
set(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)")
set(DISABLE_FATAL_WARNINGS TRUE CACHE BOOL "Set this to FALSE to enable fatal warnings.")
option(INCREMENTAL_LINK "Use incremental linking or incremental LTCG for LTO on win32 builds (enable for faster links on some machines)" OFF)
option(USE_LTO "Enable Whole Program Optimization and related folding and binary reduction routines" OFF)
if(LIBS_CLOSED_DIR)
file(TO_CMAKE_PATH "${LIBS_CLOSED_DIR}" LIBS_CLOSED_DIR)
else(LIBS_CLOSED_DIR)
set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX})
endif(LIBS_CLOSED_DIR)
if(LIBS_COMMON_DIR)
file(TO_CMAKE_PATH "${LIBS_COMMON_DIR}" LIBS_COMMON_DIR)
else(LIBS_COMMON_DIR)
set(LIBS_COMMON_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX})
endif(LIBS_COMMON_DIR)
set(LIBS_OPEN_DIR ${LIBS_COMMON_DIR})
set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX})
set(LIBS_OPEN_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX})
set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX})
set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX})
set(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)")
set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation)")
set(DISABLE_FATAL_WARNINGS TRUE CACHE BOOL "Set this to FALSE to enable fatal warnings.")
set(AUTOBUILD_INSTALL_DIR ${CMAKE_BINARY_DIR}/packages)
set(LIBS_PREBUILT_DIR ${AUTOBUILD_INSTALL_DIR} CACHE PATH
"Location of prebuilt libraries.")
if (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
# We use this as a marker that you can try to use the proprietary libraries.
set(INSTALL_PROPRIETARY ON CACHE BOOL "Install proprietary binaries")
endif (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
set(TEMPLATE_VERIFIER_OPTIONS "" CACHE STRING "Options for scripts/template_verifier.py")
set(TEMPLATE_VERIFIER_MASTER_URL "http://bitbucket.org/lindenlab/master-message-template/raw/tip/message_template.msg" CACHE STRING "Location of the master message template")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
endif (NOT CMAKE_BUILD_TYPE)
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS ON BOOL FORCE)
if (WORD_SIZE EQUAL 32)
set(ARCH i686)
if (WORD_SIZE EQUAL 64)
set(ARCH x86_64 CACHE STRING "Viewer Architecture")
set(LL_ARCH ${ARCH}_win64)
set(LL_ARCH_DIR ${ARCH}-win64)
set(WORD_SIZE 64)
set(AUTOBUILD_PLATFORM_NAME "windows64")
else (WORD_SIZE EQUAL 64)
set(ARCH i686 CACHE STRING "Viewer Architecture")
set(LL_ARCH ${ARCH}_win32)
set(LL_ARCH_DIR ${ARCH}-win32)
elseif (WORD_SIZE EQUAL 64)
set(ARCH x86_64)
set(LL_ARCH ${ARCH}_win)
set(LL_ARCH_DIR ${ARCH}-win)
endif (WORD_SIZE EQUAL 32)
set(WORD_SIZE 32)
set(AUTOBUILD_PLATFORM_NAME "windows")
endif (WORD_SIZE EQUAL 64)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -51,17 +87,26 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# If someone has specified a word size, use that to determine the
# architecture. Otherwise, let the architecture specify the word size.
if (WORD_SIZE EQUAL 32)
#message(STATUS "WORD_SIZE is 32")
set(ARCH i686)
set(AUTOBUILD_PLATFORM_NAME "linux")
elseif (WORD_SIZE EQUAL 64)
#message(STATUS "WORD_SIZE is 64")
set(ARCH x86_64)
set(AUTOBUILD_PLATFORM_NAME "linux64")
else (WORD_SIZE EQUAL 32)
if(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(ARCH i686)
set(WORD_SIZE 32)
else(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(ARCH x86_64)
#message(STATUS "WORD_SIZE is UNDEFINED")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Size of void pointer is detected as 8; ARCH is 64-bit")
set(WORD_SIZE 64)
endif(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(AUTOBUILD_PLATFORM_NAME "linux64")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
message(STATUS "Size of void pointer is detected as 4; ARCH is 32-bit")
set(WORD_SIZE 32)
set(AUTOBUILD_PLATFORM_NAME "linux")
else()
message(FATAL_ERROR "Unkown Architecture!")
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
endif (WORD_SIZE EQUAL 32)
if (NOT STANDALONE AND MULTIARCH_HACK)
@@ -98,25 +143,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
COMMAND sh -c "xcodebuild -version | grep Xcode | cut -d ' ' -f2 | cut -d'.' -f1-2"
OUTPUT_VARIABLE XCODE_VERSION )
string(REGEX REPLACE "(\r?\n)+$" "" XCODE_VERSION "${XCODE_VERSION}")
# # To support a different SDK update these Xcode settings:
# if (XCODE_VERSION GREATER 4.9) # (Which would be 5.0+)
# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
# set(CMAKE_OSX_SYSROOT macosx10.9)
# else (XCODE_VERION GREATER 4.9)
# if (XCODE_VERSION GREATER 4.5)
# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
# set(CMAKE_OSX_SYSROOT macosx10.8)
# else (XCODE_VERSION GREATER 4.5)
# if (XCODE_VERSION GREATER 4.2)
# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
# set(CMAKE_OSX_SYSROOT macosx10.7)
# else (XCODE_VERSION GREATER 4.2)
# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
# set(CMAKE_OSX_SYSROOT macosx10.7)
# endif (XCODE_VERSION GREATER 4.2)
# endif (XCODE_VERSION GREATER 4.5)
# endif (XCODE_VERSION GREATER 4.9)
# Hardcode SDK we build against until we can test and allow newer ones
# as autodetected in the code above
@@ -151,38 +177,19 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LL_ARCH_DIR universal-darwin)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LIBS_PREBUILT_DIR ${CMAKE_BINARY_DIR}/packages CACHE PATH
"Location of prebuilt libraries.")
set(LIBS_PREBUILT_LEGACY_DIR ${CMAKE_BINARY_DIR}/packages/libraries/${LL_ARCH_DIR} CACHE PATH
"Legacy location of prebuilt libraries.")
if (WINDOWS AND WORD_SIZE EQUAL 32)
set(PREBUILT_TYPE windows)
elseif (WINDOWS AND WORD_SIZE EQUAL 64)
set(PREBUILT_TYPE windows64)
elseif(DARWIN)
set(PREBUILT_TYPE darwin)
elseif(LINUX AND WORD_SIZE EQUAL 32)
set(PREBUILT_TYPE linux)
elseif(LINUX AND WORD_SIZE EQUAL 64)
set(PREBUILT_TYPE linux64)
endif(WINDOWS AND WORD_SIZE EQUAL 32)
# Default deploy grid
set(GRID agni CACHE STRING "Target Grid")
set(VIEWER_CHANNEL "Singularity" CACHE STRING "Viewer Channel Name")
set(VIEWER_LOGIN_CHANNEL "${VIEWER_CHANNEL}" CACHE STRING "Fake login channel for A/B Testing")
set(VIEWER_BRANDING_ID "singularity" CACHE STRING "Viewer branding id (currently secondlife|snowglobe)")
set(VIEWER_CHANNEL "Singularity Test" CACHE STRING "Viewer Channel Name")
# *TODO: break out proper Branding-secondlife.cmake, Branding-snowglobe.cmake, etc
string(REGEX REPLACE " +" "" VIEWER_CHANNEL_ONE_WORD "${VIEWER_CHANNEL}")
set(VIEWER_BRANDING_NAME "${VIEWER_CHANNEL_ONE_WORD}")
set(VIEWER_BRANDING_NAME_CAMELCASE "${VIEWER_CHANNEL_ONE_WORD}")
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(STANDALONE OFF CACHE BOOL "Do not use 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)

View File

@@ -2,12 +2,8 @@
include(Prebuilt)
if (NOT STANDALONE)
use_prebuilt_binary(vivox)
use_prebuilt_binary(slvoice)
if(LINUX)
use_prebuilt_binary(libuuid)
if (${ARCH} STREQUAL "x86_64")
use_prebuilt_binary(32bitcompatibilitylibs)
endif (${ARCH} STREQUAL "x86_64")
use_prebuilt_binary(fontconfig)
endif(LINUX)
else (NOT STANDALONE)

View File

@@ -1,64 +0,0 @@
# -*- cmake -*-
include(Linking)
include(Prebuilt)
include(LLQtWebkit)
include(Qt4)
if (STANDALONE)
set(WEBKITLIBPLUGIN OFF CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
else (STANDALONE)
use_prebuilt_binary(llqtwebkit)
set(WEBKITLIBPLUGIN ON CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
endif (STANDALONE)
if (WINDOWS)
set(WEBKIT_PLUGIN_LIBRARIES
debug llqtwebkitd
debug QtWebKitd4
debug QtOpenGLd4
debug QtNetworkd4
debug QtGuid4
debug QtCored4
debug qtmaind
optimized llqtwebkit
optimized QtWebKit4
optimized QtOpenGL4
optimized QtNetwork4
optimized QtGui4
optimized QtCore4
optimized qtmain
)
elseif (DARWIN)
set(WEBKIT_PLUGIN_LIBRARIES
debug libllqtwebkit.dylib
optimized libllqtwebkit.dylib
)
elseif (LINUX)
if (STANDALONE)
set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES})
else (STANDALONE)
set(WEBKIT_PLUGIN_LIBRARIES
llqtwebkit
QtWebKit
QtOpenGL
QtNetwork
QtGui
QtCore
crypto
ssl
# qgif
# qjpeg
jpeg
fontconfig
X11
Xrender
Xext
GL
)
if (CMAKE_SIZEOF_VOID_P EQUAL 4) # Singu TODO: update webkit
set(WEBKIT_PLUGIN_LIBRARIES ${WEBKIT_PLUGIN_LIBRARIES} jscore)
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
endif (STANDALONE)
endif (WINDOWS)

View File

@@ -0,0 +1,17 @@
# - Embeds a specific manifest file in a Windows binary
# Defines the following:
# EMBED_MANIFEST - embed manifest in a windows binary with mt
# Parameters - _target is the target file, type - 1 for EXE, 2 for DLL
MACRO(EMBED_MANIFEST _target type)
ADD_CUSTOM_COMMAND(
TARGET ${_target}
POST_BUILD
COMMAND "mt.exe"
ARGS
-manifest \"${CMAKE_SOURCE_DIR}\\tools\\manifests\\compatibility.manifest\"
-inputresource:\"$<TARGET_FILE:${_target}>\"\;\#${type}
-outputresource:\"$<TARGET_FILE:${_target}>\"\;\#${type}
COMMENT "Adding compatibility manifest to ${_target}"
)
ENDMACRO(EMBED_MANIFEST _target type)

View File

@@ -8,9 +8,13 @@ if (STANDALONE)
include(FindXmlRpcEpi)
else (STANDALONE)
use_prebuilt_binary(xmlrpc-epi)
set(XMLRPCEPI_LIBRARIES xmlrpc-epi)
set(XMLRPCEPI_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include
${LIBS_PREBUILT_LEGACY_DIR}/include
)
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 (STANDALONE)

View File

@@ -13,13 +13,25 @@ else (STANDALONE)
set(ZLIB_LIBRARIES
debug zlibd
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(ZLIB_PRELOAD_ARCHIVES -Wl,--whole-archive z -Wl,--no-whole-archive)
set(ZLIB_LIBRARIES z)
else (WINDOWS)
set(ZLIB_LIBRARIES z)
endif (WINDOWS)
if (WINDOWS OR LINUX)
set(ZLIB_INCLUDE_DIRS
${LIBS_PREBUILT_DIR}/include/zlib
${LIBS_PREBUILT_LEGACY_DIR}/include/zlib
)
set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib)
endif (WINDOWS OR LINUX)
endif (STANDALONE)

View File

@@ -1,30 +1,24 @@
/**
* @file cmake_dummy.cpp
*
* $LicenseInfo:firstyear=2008&license=viewergpl$
*
* Copyright (c) 2008-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/

View File

@@ -1,4 +1,28 @@
#!/usr/bin/env python
"""\
@file start-client.py
$LicenseInfo:firstyear=2010&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2010-2011, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2.1 of the License only.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
import sys, getopt
import os
import llstart

View File

@@ -1,941 +0,0 @@
#!/usr/bin/env python
#
# @file develop.py
# @authors Bryan O'Sullivan, Mark Palange, Aaron Brashears
# @brief Fire and forget script to appropriately configure cmake for SL.
#
# $LicenseInfo:firstyear=2007&license=viewergpl$
#
# Copyright (c) 2007-2009, Linden Research, Inc.
#
# Second Life Viewer Source Code
# The source code in this file ("Source Code") is provided by Linden Lab
# to you under the terms of the GNU General Public License, version 2.0
# ("GPL"), unless you have obtained a separate licensing agreement
# ("Other License"), formally executed by you and Linden Lab. Terms of
# the GPL can be found in doc/GPL-license.txt in this distribution, or
# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
#
# There are special exceptions to the terms and conditions of the GPL as
# it is applied to this Source Code. View the full text of the exception
# in the file doc/FLOSS-exception.txt in this software distribution, or
# online at
# http://secondlifegrid.net/programs/open_source/licensing/flossexception
#
# By copying, modifying or distributing this software, you acknowledge
# that you have read and understood your obligations described above,
# and agree to abide by those obligations.
#
# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
# COMPLETENESS OR PERFORMANCE.
# $/LicenseInfo$
import errno
import getopt
import os
import random
import re
import shutil
import socket
import sys
import commands
import shlex
class CommandError(Exception):
pass
def mkdir(path):
try:
os.mkdir(path)
return path
except OSError, err:
if err.errno != errno.EEXIST or not os.path.isdir(path):
raise
def prettyprint_path_for_cmake(path):
if 'a' <= path[0] <= 'z' and path[1] == ':':
# CMake wants DOS drive letters to be in uppercase. The above
# condition never asserts on platforms whose full path names
# always begin with a slash, so we don't need to test whether
# we are running on Windows.
path = path[0].upper() + path[1:]
return path
def getcwd():
return prettyprint_path_for_cmake(os.getcwd())
source_indra = prettyprint_path_for_cmake(os.path.dirname(os.path.realpath(__file__)))
def quote(opts):
return '"' + '" "'.join([ opt.replace('"', '') for opt in opts ]) + '"'
class PlatformSetup(object):
generator = None
build_types = {}
for t in ('Debug', 'Release', 'RelWithDebInfo'):
build_types[t.lower()] = t
build_type = build_types['relwithdebinfo']
standalone = 'OFF'
unattended = 'OFF'
universal = 'OFF'
project_name = 'Singularity'
distcc = True
cmake_opts = []
word_size = 32
using_express = False
def __init__(self):
self.script_dir = os.path.realpath(
os.path.dirname(__import__(__name__).__file__))
def os(self):
'''Return the name of the OS.'''
raise NotImplemented('os')
def arch(self):
'''Return the CPU architecture.'''
return None
def platform(self):
'''Return a stringified two-tuple of the OS name and CPU
architecture.'''
ret = self.os()
if self.arch():
ret += '-' + self.arch()
return ret
def build_dirs(self):
'''Return the top-level directories in which builds occur.
This can return more than one directory, e.g. if doing a
32-bit viewer and server build on Linux.'''
if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'):
prefix = '../'
else:
prefix = ''
return [prefix+'build-' + self.platform()]
def cmake_commandline(self, src_dir, build_dir, opts, simple):
'''Return the command line to run cmake with.'''
args = dict(
dir=src_dir,
generator=self.generator,
opts=quote(opts),
standalone=self.standalone,
unattended=self.unattended,
word_size=self.word_size,
type=self.build_type.upper(),
)
#if simple:
# return 'cmake %(opts)s %(dir)r' % args
return ('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s '
'-DSTANDALONE:BOOL=%(standalone)s '
'-DUNATTENDED:BOOL=%(unattended)s '
'-DWORD_SIZE:STRING=%(word_size)s '
'-G %(generator)r %(opts)s %(dir)r' % args)
def run_cmake(self, args=[]):
'''Run cmake.'''
# do a sanity check to make sure we have a generator
if not hasattr(self, 'generator'):
raise "No generator available for '%s'" % (self.__name__,)
cwd = getcwd()
created = []
try:
for d in self.build_dirs():
simple = True
if mkdir(d):
created.append(d)
simple = False
try:
os.chdir(d)
cmd = self.cmake_commandline(source_indra, d, args, simple)
print 'Running %r in %r' % (cmd, d)
self.run(cmd, 'cmake')
finally:
os.chdir(cwd)
except:
# If we created a directory in which to run cmake and
# something went wrong, the directory probably just
# contains garbage, so delete it.
os.chdir(cwd)
for d in created:
print 'Cleaning %r' % d
shutil.rmtree(d)
raise
def parse_build_opts(self, arguments):
opts, targets = getopt.getopt(arguments, 'D:o:', ['option='])
build_opts = []
for o, a in opts:
if o in ('-o', '--option'):
build_opts.append(a)
return build_opts, targets
def run_build(self, opts, targets):
'''Build the default targets for this platform.'''
raise NotImplemented('run_build')
def cleanup(self):
'''Delete all build directories.'''
cleaned = 0
for d in self.build_dirs():
if os.path.isdir(d):
print 'Cleaning %r' % d
shutil.rmtree(d)
cleaned += 1
if not cleaned:
print 'Nothing to clean up!'
def is_internal_tree(self):
'''Indicate whether we are building in an internal source tree.'''
return os.path.isdir(os.path.join(self.script_dir, 'newsim'))
def find_in_path(self, name, defval=None, basename=False):
for ext in self.exe_suffixes:
name_ext = name + ext
if os.sep in name_ext:
path = os.path.abspath(name_ext)
if os.access(path, os.X_OK):
return [basename and os.path.basename(path) or path]
for p in os.getenv('PATH', self.search_path).split(os.pathsep):
path = os.path.join(p, name_ext)
if os.access(path, os.X_OK):
return [basename and os.path.basename(path) or path]
if defval:
return [defval]
return []
class UnixSetup(PlatformSetup):
'''Generic Unixy build instructions.'''
search_path = '/usr/bin:/usr/local/bin'
exe_suffixes = ('',)
def __init__(self):
PlatformSetup.__init__(self)
super(UnixSetup, self).__init__()
self.generator = 'Unix Makefiles'
def os(self):
return 'unix'
def arch(self):
cpu = os.uname()[-1]
if cpu.endswith('386'):
cpu = 'i386'
elif cpu.endswith('86'):
cpu = 'i686'
elif cpu in ('athlon',):
cpu = 'i686'
elif cpu == 'Power Macintosh':
cpu = 'ppc'
elif cpu == 'x86_64' and self.word_size == 32:
cpu = 'i686'
return cpu
def run(self, command, name=None):
'''Run a program. If the program fails, raise an exception.'''
ret = os.system(command)
if ret:
if name is None:
name = command.split(None, 1)[0]
if os.WIFEXITED(ret):
st = os.WEXITSTATUS(ret)
if st == 127:
event = 'was not found'
else:
event = 'exited with status %d' % st
elif os.WIFSIGNALED(ret):
event = 'was killed by signal %d' % os.WTERMSIG(ret)
else:
event = 'died unexpectedly (!?) with 16-bit status %d' % ret
raise CommandError('the command %r %s' %
(name, event))
class LinuxSetup(UnixSetup):
def __init__(self):
UnixSetup.__init__(self)
super(LinuxSetup, self).__init__()
try:
self.debian_sarge = open('/etc/debian_version').read().strip() == '3.1'
except:
self.debian_sarge = False
def os(self):
return 'linux'
def build_dirs(self):
return [PlatformSetup.build_dirs(self)[0]+'-'+self.build_type.lower()]
def cmake_commandline(self, src_dir, build_dir, opts, simple):
args = dict(
dir=src_dir,
generator=self.generator,
opts=quote(opts),
standalone=self.standalone,
unattended=self.unattended,
type=self.build_type.upper(),
project_name=self.project_name,
word_size=self.word_size,
cxx="g++"
)
cmd = (('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s '
'-G %(generator)r -DSTANDALONE:BOOL=%(standalone)s '
'-DWORD_SIZE:STRING=%(word_size)s '
'-DROOT_PROJECT_NAME:STRING=%(project_name)s '
'%(opts)s %(dir)r')
% args)
if 'CXX' not in os.environ:
args.update({'cmd':cmd})
cmd = ('CXX=%(cxx)r %(cmd)s' % args)
return cmd
def run_build(self, opts, targets):
job_count = None
for i in range(len(opts)):
if opts[i].startswith('-j'):
try:
job_count = int(opts[i][2:])
except ValueError:
try:
job_count = int(opts[i+1])
except ValueError:
job_count = True
def get_cpu_count():
count = 0
for line in open('/proc/cpuinfo'):
if re.match(r'processor\s*:', line):
count += 1
return count
def localhost():
count = get_cpu_count()
return 'localhost/' + str(count), count
def get_distcc_hosts():
try:
hosts = []
name = os.getenv('DISTCC_DIR', '/etc/distcc') + '/hosts'
for l in open(name):
l = l[l.find('#')+1:].strip()
if l: hosts.append(l)
return hosts
except IOError:
return (os.getenv('DISTCC_HOSTS', '').split() or
[localhost()[0]])
def count_distcc_hosts():
cpus = 0
hosts = 0
for host in get_distcc_hosts():
m = re.match(r'.*/(\d+)', host)
hosts += 1
cpus += m and int(m.group(1)) or 1
return hosts, cpus
def mk_distcc_hosts(basename, range, num_cpus):
'''Generate a list of LL-internal machines to build on.'''
loc_entry, cpus = localhost()
hosts = [loc_entry]
dead = []
stations = [s for s in xrange(range) if s not in dead]
random.shuffle(stations)
hosts += ['%s%d.lindenlab.com/%d,lzo' % (basename, s, num_cpus) for s in stations]
cpus += 2 * len(stations)
return ' '.join(hosts), cpus
if job_count is None:
hosts, job_count = count_distcc_hosts()
if hosts == 1:
hostname = socket.gethostname()
if hostname.startswith('station'):
hosts, job_count = mk_distcc_hosts('station', 36, 2)
os.environ['DISTCC_HOSTS'] = hosts
if hostname.startswith('eniac'):
hosts, job_count = mk_distcc_hosts('eniac', 71, 2)
os.environ['DISTCC_HOSTS'] = hosts
if job_count > 4:
job_count = 4;
opts.extend(['-j', str(job_count)])
if targets:
targets = ' '.join(targets)
else:
targets = 'all'
for d in self.build_dirs():
cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets)
print 'Running %r' % cmd
self.run(cmd)
class DarwinSetup(UnixSetup):
def __init__(self):
UnixSetup.__init__(self)
super(DarwinSetup, self).__init__()
self.generator = 'Xcode'
def os(self):
return 'darwin'
def arch(self):
if self.universal == 'ON':
return 'universal'
else:
return UnixSetup.arch(self)
def build_dirs(self):
if(self.generator == 'Xcode'):
return PlatformSetup.build_dirs(self)
else:
return [PlatformSetup.build_dirs(self)[0]+'-'+self.build_type.lower()]
def cmake_commandline(self, src_dir, build_dir, opts, simple):
args = dict(
dir=src_dir,
generator=self.generator,
opts=quote(opts),
standalone=self.standalone,
word_size=self.word_size,
unattended=self.unattended,
project_name=self.project_name,
universal='',
type='',
)
if(self.generator != 'Xcode'):
args['type'] = '-DCMAKE_BUILD_TYPE=%s' % self.build_type.upper()
if self.universal == 'ON':
args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\''
#if simple:
# return 'cmake %(opts)s %(dir)r' % args
return ('cmake -G %(generator)r '
'%(type)s '
'-DSTANDALONE:BOOL=%(standalone)s '
'-DUNATTENDED:BOOL=%(unattended)s '
'-DWORD_SIZE:STRING=%(word_size)s '
'-DROOT_PROJECT_NAME:STRING=%(project_name)s '
'%(universal)s '
'%(opts)s %(dir)r' % args)
def run_build(self, opts, targets):
if(self.generator != 'Xcode'):
if targets:
targets = ' '.join(targets)
else:
targets = 'all'
for d in self.build_dirs():
cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets)
print 'Running %r' % cmd
self.run(cmd)
return
cwd = getcwd()
if targets:
targets = ' '.join(['-target ' + repr(t) for t in targets])
else:
targets = ''
cmd = ('xcodebuild -configuration %s %s %s' %
(self.build_type, ' '.join(opts), targets))
for d in self.build_dirs():
try:
os.chdir(d)
print 'Running %r in %r' % (cmd, d)
self.run(cmd)
finally:
os.chdir(cwd)
class WindowsSetup(PlatformSetup):
gens = {
'vc100' : {
'gen' : r'Visual Studio 10',
'ver' : r'10.0'
},
'vc120' : {
'gen' : r'Visual Studio 12',
'ver' : r'12.0'
}
}
gens['vs2010'] = gens['vc100']
gens['vs2013'] = gens['vc120']
search_path = r'C:\windows'
exe_suffixes = ('.exe', '.bat', '.com')
def __init__(self):
PlatformSetup.__init__(self)
super(WindowsSetup, self).__init__()
self._generator = None
self.incredibuild = False
def _get_generator(self):
if self._generator is None:
for version in 'vc100'.split():
if self.find_visual_studio(version):
self._generator = version
print 'Building with ', self.gens[version]['gen']
break
else:
print >> sys.stderr, 'Cannot find a Visual Studio installation, testing for express editions'
for version in 'vc100'.split():
if self.find_visual_studio_express(version):
self._generator = version
self.using_express = True
print 'Building with ', self.gens[version]['gen'] , "Express edition"
break
else:
for version in 'vc100'.split():
if self.find_visual_studio_express_single(version):
self._generator = version
self.using_express = True
print 'Building with ', self.gens[version]['gen'] , "Express edition"
break
else:
print >> sys.stderr, 'Cannot find any Visual Studio installation'
sys.exit(1)
return self._generator
def _set_generator(self, gen):
self._generator = gen
generator = property(_get_generator, _set_generator)
def get_gen_str(self, gen):
if gen is None:
gen = self._generator
return self.gens[gen.lower()]['ver']
def os(self):
return 'win32'
def build_dirs(self):
if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'):
prefix = '../'
else:
prefix = ''
if self.word_size == 64:
return [prefix+'build-' + self.generator + '-Win64']
else:
return [prefix+'build-' + self.generator]
def cmake_commandline(self, src_dir, build_dir, opts, simple):
args = dict(
dir=src_dir,
generator=self.gens[self.generator.lower()]['gen'],
opts=quote(opts),
standalone=self.standalone,
unattended=self.unattended,
project_name=self.project_name,
word_size=self.word_size,
)
if self.word_size == 64:
args["generator"] += r' Win64'
#if simple:
# return 'cmake %(opts)s "%(dir)s"' % args
return ('cmake -G "%(generator)s" '
'-DSTANDALONE:BOOL=%(standalone)s '
'-DUNATTENDED:BOOL=%(unattended)s '
'-DWORD_SIZE:STRING=%(word_size)s '
'-DROOT_PROJECT_NAME:STRING=\"%(project_name)s\" '
'%(opts)s "%(dir)s"' % args)
def get_HKLM_registry_value(self, key_str, value_str):
import _winreg
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = _winreg.OpenKey(reg, key_str)
value = _winreg.QueryValueEx(key, value_str)[0]
print 'Found: %s' % value
return value
def find_visual_studio(self, gen=None):
gen = self.get_gen_str(gen)
value_str = (r'EnvironmentDirectory')
key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' %
gen)
print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' %
(key_str, value_str))
try:
return self.get_HKLM_registry_value(key_str, value_str)
except WindowsError, err:
key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' %
gen)
try:
return self.get_HKLM_registry_value(key_str, value_str)
except:
print >> sys.stderr, "Didn't find ", self.gens[gen]['gen']
return ''
def find_msbuild(self, gen=None):
gen = self.get_gen_str(gen)
key_str = (r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0')
print ('Checking MSBuild support for vs ver = %s' % gen)
if not self.get_HKLM_registry_value(key_str+'\\'+gen, "VCTargetsPath"):
return (None, None)
print ('Reading MSBuild location from HKEY_LOCAL_MACHINE\%s\MSBuildToolsPath' %
key_str)
print key_str
try:
return (self.get_HKLM_registry_value(key_str, 'MSBuildToolsPath'), gen)
except WindowsError, err:
key_str = (r'SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\%s' %
gen)
try:
return (self.get_HKLM_registry_value(key_str, 'MSBuildToolsPath'), gen)
except WindowsError, err:
print 'Didn\'t find msbuild'
return (None, None)
def find_visual_studio_express(self, gen=None):
gen = self.get_gen_str(gen)
try:
import _winreg
key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s\Setup\VC' %
gen)
value_str = (r'ProductDir')
print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' %
(key_str, value_str))
print key_str
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = _winreg.OpenKey(reg, key_str)
value = _winreg.QueryValueEx(key, value_str)[0]+"IDE"
print 'Found: %s' % value
return value
except WindowsError, err:
print >> sys.stderr, "Didn't find ", gen
return ''
def find_visual_studio_express_single(self, gen=None):
gen = self.get_gen_str(gen)
try:
import _winreg
key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s_Config\Setup\VC' %
gen)
value_str = (r'ProductDir')
print ('Reading VS environment from HKEY_CURRENT_USER\%s\%s' %
(key_str, value_str))
print key_str
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
key = _winreg.OpenKey(reg, key_str)
value = _winreg.QueryValueEx(key, value_str)[0]+"IDE"
print 'Found: %s' % value
return value
except WindowsError, err:
print >> sys.stderr, "Didn't find ", gen
return ''
def get_build_cmd(self):
if self.incredibuild:
config = self.build_type
if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
config = '\"%s|Win32\"' % config
return "buildconsole \"%s.sln\" /build %s" % (self.project_name, config), None
environment = self.find_visual_studio()
if environment == '':
environment = self.find_visual_studio_express()
if environment == '':
environment = self.find_visual_studio_express_single()
if environment == '':
print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?"
else:
build_dirs=self.build_dirs()
print >> sys.stderr, "\nSolution generation complete, it can can now be found in:", build_dirs[0]
print >> sys.stderr, "\nAs you are using an Express Visual Studio, the build step cannot be automated"
print >> sys.stderr, "\nPlease see https://wiki.secondlife.com/wiki/Microsoft_Visual_Studio#Extra_steps_for_Visual_Studio_Express_editions for Visual Studio Express specific information"
exit(0)
msbuild_dir, tool_ver = self.find_msbuild()
if msbuild_dir is not None and tool_ver is not None:
return ('\"%smsbuild.exe\" \"%s.sln\" /p:configuration=%s /p:VisualStudioVersion=%s' %
(msbuild_dir, self.project_name, self.build_type, tool_ver)), True
# devenv.com is CLI friendly, devenv.exe... not so much.
return ('"%sdevenv.com" \"%s.sln\" /build %s' %
(self.find_visual_studio(), self.project_name, self.build_type)), None
def run(self, command, name=None):
'''Run a program. If the program fails, raise an exception.'''
ret = os.system('\"'+command+'\"')
if ret:
if name is None:
name = os.path.normpath(shlex.split(command.encode('utf8'),posix=False)[0].strip('"'))
path = self.find_in_path(name)
if not path:
ret = 'was not found'
else:
ret = 'exited with status %d' % ret
raise CommandError('the command %r %s' %
(name, ret))
def run_cmake(self, args=[]):
'''Override to add the vstool.exe call after running cmake.'''
PlatformSetup.run_cmake(self, args)
if self.unattended == 'OFF':
if self.using_express == False:
self.run_vstool()
def run_vstool(self):
for build_dir in self.build_dirs():
stamp = os.path.join(build_dir, 'vstool.txt')
try:
prev_build = open(stamp).read().strip()
except IOError:
prev_build = ''
if prev_build == self.build_type:
# Only run vstool if the build type has changed.
continue
if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'):
tool_path = os.path.join('tools','vstool','VSTool.exe')
else:
tool_path = os.path.join('indra','tools','vstool','VSTool.exe')
vstool_cmd = (tool_path +
' --solution \"' +
os.path.join(build_dir,'%s.sln' % self.project_name) +
'\" --config ' + self.build_type +
' --startup secondlife-bin')
print 'Running vstool %r in %r' % (vstool_cmd, getcwd())
self.run(vstool_cmd)
print >> open(stamp, 'w'), self.build_type
def run_build(self, opts, targets):
cwd = getcwd()
build_cmd, msbuild = self.get_build_cmd()
for d in self.build_dirs():
try:
os.chdir(d)
if targets:
if msbuild:
cmd = '%s /target:%s %s' % (build_cmd, ';'.join(targets), ' '.join(opts))
print 'Running build(targets) %r in %r' % (cmd, d)
self.run(cmd)
else:
for t in targets:
cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts))
print 'Running build(targets) %r in %r' % (cmd, d)
self.run(cmd)
else:
cmd = '%s %s' % (build_cmd, ' '.join(opts))
print 'Running build %r in %r' % (cmd, d)
self.run(cmd)
finally:
os.chdir(cwd)
class CygwinSetup(WindowsSetup):
def __init__(self):
super(CygwinSetup, self).__init__()
self.generator = 'vc80'
def cmake_commandline(self, src_dir, build_dir, opts, simple):
dos_dir = commands.getoutput("cygpath -w %s" % src_dir)
args = dict(
dir=dos_dir,
generator=self.gens[self.generator.lower()]['gen'],
opts=quote(opts),
standalone=self.standalone,
unattended=self.unattended,
project_name=self.project_name,
word_size=self.word_size,
)
if self.word_size == 64:
args["generator"] += r' Win64'
#if simple:
# return 'cmake %(opts)s "%(dir)s"' % args
return ('cmake -G "%(generator)s" '
'-DUNATTENDED:BOOl=%(unattended)s '
'-DSTANDALONE:BOOL=%(standalone)s '
'-DWORD_SIZE:STRING=%(word_size)s '
'-DROOT_PROJECT_NAME:STRING=%(project_name)s '
'%(opts)s "%(dir)s"' % args)
def run(self, command, name=None):
'''Run a program. If the program fails, raise an exception.'''
ret = os.system(command)
if ret:
if name is None:
name = os.path.normpath(shlex.split(command.encode('utf8'),posix=False)[0].strip('"'))
path = self.find_in_path(name)
if not path:
ret = 'was not found'
else:
ret = 'exited with status %d' % ret
raise CommandError('the command %r %s' %
(name, ret))
setup_platform = {
'darwin': DarwinSetup,
'linux2': LinuxSetup,
'linux3': LinuxSetup,
'win32' : WindowsSetup,
'cygwin' : CygwinSetup
}
usage_msg = '''
Usage: develop.py [options] [command [command-options]]
Options:
-h | --help print this help message
--standalone build standalone, without Linden prebuild libraries
--unattended build unattended, do not invoke any tools requiring
a human response
--universal build a universal binary on Mac OS X (unsupported)
-t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo")
-m32 | -m64 build architecture (32-bit or 64-bit)
-N | --no-distcc disable use of distcc
-G | --generator=NAME generator name
Windows: VC100 (VS2010) (default)
Mac OS X: Xcode (default), Unix Makefiles
Linux: Unix Makefiles (default), KDevelop3
-p | --project=NAME set the root project name. (Doesn't effect makefiles)
Commands:
build configure and build default target
clean delete all build directories, does not affect sources
configure configure project by running cmake (default if none given)
printbuilddirs print the build directory that will be used
Command-options for "configure":
We use cmake variables to change the build configuration.
-DPACKAGE:BOOL=ON Create "package" target to make installers
-DLL_TESTS:BOOL=OFF Don't generate unit test projects
-DEXAMPLEPLUGIN:BOOL=OFF Don't generate example plugin project
-DDISABLE_TCMALLOC:BOOL=ON Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)
-DRELEASE_CRASH_REPORTING:BOOL=ON Enable Google Breakpad crash reporting
-DFMODSTUDIO:BOOL=ON Use FMOD Studio audio libraries
-DFMODEX:BOOL=ON Use FMOD Ex audio libraries
Examples:
Set up a Visual Studio 2010 project with "package" target:
develop.py -G vc100 configure -DPACKAGE:BOOL=ON
'''
def main(arguments):
setup = setup_platform[sys.platform]()
try:
opts, args = getopt.getopt(
arguments,
'?hNt:p:G:m:',
['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=', 'project='])
except getopt.GetoptError, err:
print >> sys.stderr, 'Error:', err
print >> sys.stderr, """
Note: You must pass -D options to cmake after the "configure" command
For example: develop.py configure -DSERVER:BOOL=OFF"""
print >> sys.stderr, usage_msg.strip()
sys.exit(1)
for o, a in opts:
if o in ('-?', '-h', '--help'):
print usage_msg.strip()
sys.exit(0)
elif o in ('--standalone',):
setup.standalone = 'ON'
elif o in ('--unattended',):
setup.unattended = 'ON'
elif o in ('-m',):
if a in ('32', '64'):
setup.word_size = int(a)
else:
print >> sys.stderr, 'Error: unknown word size', repr(a)
print >> sys.stderr, 'Supported word sizes: 32, 64'
sys.exit(1)
elif o in ('-t', '--type'):
try:
setup.build_type = setup.build_types[a.lower()]
except KeyError:
print >> sys.stderr, 'Error: unknown build type', repr(a)
print >> sys.stderr, 'Supported build types:'
types = setup.build_types.values()
types.sort()
for t in types:
print ' ', t
sys.exit(1)
elif o in ('-G', '--generator'):
setup.generator = a
elif o in ('-N', '--no-distcc'):
setup.distcc = False
elif o in ('-p', '--project'):
setup.project_name = a
elif o in ('--incredibuild'):
setup.incredibuild = True
else:
print >> sys.stderr, 'INTERNAL ERROR: unhandled option', repr(o)
sys.exit(1)
if not args:
setup.run_cmake()
return
try:
cmd = args.pop(0)
if cmd in ('cmake', 'configure'):
setup.run_cmake(args)
elif cmd == 'build':
if os.getenv('DISTCC_DIR') is None:
distcc_dir = os.path.join(getcwd(), '.distcc')
if not os.path.exists(distcc_dir):
os.mkdir(distcc_dir)
print "setting DISTCC_DIR to %s" % distcc_dir
os.environ['DISTCC_DIR'] = distcc_dir
else:
print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR')
for d in setup.build_dirs():
if not os.path.exists(d):
raise CommandError('run "develop.py cmake" first')
setup.run_cmake()
opts, targets = setup.parse_build_opts(args)
setup.run_build(opts, targets)
elif cmd == 'clean':
if args:
raise CommandError('clean takes no arguments')
setup.cleanup()
elif cmd == 'printbuilddirs':
for d in setup.build_dirs():
print >> sys.stdout, d
else:
print >> sys.stderr, 'Error: unknown subcommand', repr(cmd)
print >> sys.stderr, "(run 'develop.py --help' for help)"
sys.exit(1)
except getopt.GetoptError, err:
print >> sys.stderr, 'Error with %r subcommand: %s' % (cmd, err)
sys.exit(1)
if __name__ == '__main__':
try:
main(sys.argv[1:])
except CommandError, err:
print >> sys.stderr, 'Error:', err
sys.exit(1)

View File

@@ -1,3 +1,24 @@
#!/usr/bin/python
## $LicenseInfo:firstyear=2011&license=viewerlgpl$
## Second Life Viewer Source Code
## Copyright (C) 2011, Linden Research, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## version 2.1 of the License only.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
##
## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
## $/LicenseInfo$
import warnings

View File

@@ -1,3 +1,24 @@
#!/usr/bin/python
## $LicenseInfo:firstyear=2011&license=viewerlgpl$
## Second Life Viewer Source Code
## Copyright (C) 2011, Linden Research, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## version 2.1 of the License only.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
##
## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
## $/LicenseInfo$
from indra.base import llsd, lluuid
from indra.ipc import siesta
import datetime, math, unittest

View File

@@ -36,7 +36,6 @@ $/LicenseInfo$
# Using cElementTree might cause some unforeseen problems, so here's a
# convenient off switch.
use_celementree = True
try:

View File

@@ -41,6 +41,14 @@ import tarfile
import errno
import subprocess
class ManifestError(RuntimeError):
"""Use an exception more specific than generic Python RuntimeError"""
pass
class MissingError(ManifestError):
"""You specified a file that doesn't exist"""
pass
def path_ancestors(path):
drive, path = os.path.splitdrive(os.path.normpath(path))
result = []
@@ -76,31 +84,9 @@ def get_default_platform(dummy):
'darwin':'darwin'
}[sys.platform]
def get_default_version(srctree):
# look up llversion.h and parse out the version info
paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']]
for p in paths:
if os.path.exists(p):
contents = open(p, 'r').read()
major = re.search("LL_VERSION_MAJOR\s=\s([0-9]+)", contents).group(1)
minor = re.search("LL_VERSION_MINOR\s=\s([0-9]+)", contents).group(1)
patch = re.search("LL_VERSION_PATCH\s=\s([0-9]+)", contents).group(1)
build = re.search("LL_VERSION_BUILD\s=\s([0-9]+)", contents).group(1)
return major, minor, patch, build
def get_channel(srctree):
# look up llversionserver.h and parse out the version info
paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']]
for p in paths:
if os.path.exists(p):
contents = open(p, 'r').read()
channel = re.search("LL_CHANNEL\s=\s\"(.+)\";\s*$", contents, flags = re.M).group(1)
return channel
DEFAULT_SRCTREE = os.path.dirname(sys.argv[0])
DEFAULT_CHANNEL = 'Second Life Release'
DEFAULT_CHANNEL_SNOWGLOBE = 'Snowglobe Release'
CHANNEL_VENDOR_BASE = 'Singularity'
RELEASE_CHANNEL = CHANNEL_VENDOR_BASE + ' Release'
ARGUMENTS=[
dict(name='actions',
@@ -121,27 +107,19 @@ ARGUMENTS=[
On Linux this would try to use Linux_i686Manifest.""",
default=""),
dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE),
dict(name='buildtype', description="""The build type used. ('Debug', 'Release', or 'RelWithDebInfo')
Default is Release """,
default="Release"),
dict(name='branding_id', description="""Identifier for the branding set to
use. Currently, 'secondlife' or 'snowglobe')""",
default='secondlife'),
dict(name='buildtype', description='Build type (i.e. Debug, Release, RelWithDebInfo).', default=None),
dict(name='configuration',
description="""The build configuration used. Only used on OS X for
now, but it could be used for other platforms as well.""",
default="Universal"),
description="""The build configuration used.""",
default="Release"),
dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE),
dict(name='grid',
description="""Which grid the client will try to connect to. Even
though it's not strictly a grid, 'firstlook' is also an acceptable
value for this parameter.""",
default=""),
description="""Which grid the client will try to connect to.""",
default=None),
dict(name='channel',
description="""The channel to use for updates, packaging, settings name, etc.""",
default=get_channel),
dict(name='login_channel',
description="""The channel to use for login handshake/updates only.""",
default='CHANNEL UNSET'),
dict(name='channel_suffix',
description="""Addition to the channel for packaging and channel value, but not application name (used internally)""",
default=None),
dict(name='installer_name',
description=""" The name of the file that the installer should be
@@ -166,12 +144,12 @@ ARGUMENTS=[
contain the name of the final package in a form suitable
for use by a .bat file.""",
default=None),
dict(name='version',
description="""This specifies the version of Second Life that is
being packaged up.""",
default=get_default_version),
dict(name='extra_libraries',
description="""List of extra libraries to include in package""",
dict(name='versionfile',
description="""The name of a file containing the full version number."""),
dict(name='signature',
description="""This specifies an identity to sign the viewer with, if any.
If no value is supplied, the default signature will be used, if any. Currently
only used on Mac OS X.""",
default=None)
]
@@ -193,8 +171,9 @@ def usage(srctree=""):
arg['description'] % nd)
def main():
print "cwd:", os.getcwd()
print " ".join(sys.argv)
## import itertools
## print ' '.join((("'%s'" % item) if ' ' in item else item)
## for item in itertools.chain([sys.executable], sys.argv))
option_names = [arg['name'] + '=' for arg in ARGUMENTS]
option_names.append('help')
options, remainder = getopt.getopt(sys.argv[1:], "", option_names)
@@ -231,12 +210,17 @@ def main():
args[arg['name']] = default
# fix up version
if isinstance(args.get('version'), str):
args['version'] = args['version'].split('.')
# default and agni are default
if args['grid'] in ['default', 'agni']:
args['grid'] = ''
if isinstance(args.get('versionfile'), str):
try: # read in the version string
vf = open(args['versionfile'], 'r')
args['version'] = vf.read().strip().split('.')
except:
print "Unable to read versionfile '%s'" % args['versionfile']
raise
# unspecified, default, and agni are default
if args['grid'] in ['', 'default', 'agni']:
args['grid'] = None
if 'actions' in args:
args['actions'] = args['actions'].split()
@@ -245,15 +229,101 @@ def main():
for opt in args:
print "Option:", opt, "=", args[opt]
# pass in sourceid as an argument now instead of an environment variable
try:
args['sourceid'] = os.environ["sourceid"]
except KeyError:
args['sourceid'] = ""
# Build base package.
touch = args.get('touch')
if touch:
print 'Creating base package'
args['package_id'] = "" # base package has no package ID
wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args)
wm.do(*args['actions'])
# Store package file for later if making touched file.
base_package_file = ""
if touch:
print 'Created base package ', wm.package_file
base_package_file = "" + wm.package_file
# handle multiple packages if set
try:
additional_packages = os.environ["additional_packages"]
except KeyError:
additional_packages = ""
if additional_packages:
# Determine destination prefix / suffix for additional packages.
base_dest_postfix = args['dest']
base_dest_prefix = ""
base_dest_parts = args['dest'].split(os.sep)
if len(base_dest_parts) > 1:
base_dest_postfix = base_dest_parts[len(base_dest_parts) - 1]
base_dest_prefix = base_dest_parts[0]
i = 1
while i < len(base_dest_parts) - 1:
base_dest_prefix = base_dest_prefix + os.sep + base_dest_parts[i]
i = i + 1
# Determine touched prefix / suffix for additional packages.
base_touch_postfix = ""
base_touch_prefix = ""
if touch:
base_touch_postfix = touch
base_touch_parts = touch.split('/')
if "arwin" in args['platform']:
if len(base_touch_parts) > 1:
base_touch_postfix = base_touch_parts[len(base_touch_parts) - 1]
base_touch_prefix = base_touch_parts[0]
i = 1
while i < len(base_touch_parts) - 1:
base_touch_prefix = base_touch_prefix + '/' + base_touch_parts[i]
i = i + 1
else:
if len(base_touch_parts) > 2:
base_touch_postfix = base_touch_parts[len(base_touch_parts) - 2] + '/' + base_touch_parts[len(base_touch_parts) - 1]
base_touch_prefix = base_touch_parts[0]
i = 1
while i < len(base_touch_parts) - 2:
base_touch_prefix = base_touch_prefix + '/' + base_touch_parts[i]
i = i + 1
# Store base channel name.
base_channel_name = args['channel']
# Build each additional package.
package_id_list = additional_packages.split(" ")
args['channel'] = base_channel_name
for package_id in package_id_list:
try:
if package_id + "_viewer_channel_suffix" in os.environ:
args['channel_suffix'] = os.environ[package_id + "_viewer_channel_suffix"]
else:
args['channel_suffix'] = None
if package_id + "_sourceid" in os.environ:
args['sourceid'] = os.environ[package_id + "_sourceid"]
else:
args['sourceid'] = None
args['dest'] = base_dest_prefix + os.sep + package_id + os.sep + base_dest_postfix
except KeyError:
sys.stderr.write("Failed to create package for package_id: %s" % package_id)
sys.stderr.flush()
continue
if touch:
print 'Creating additional package for "', package_id, '" in ', args['dest']
wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args)
wm.do(*args['actions'])
if touch:
print 'Created additional package ', wm.package_file, ' for ', package_id
faketouch = base_touch_prefix + '/' + package_id + '/' + base_touch_postfix
fp = open(faketouch, 'w')
fp.write('set package_file=%s\n' % wm.package_file)
fp.close()
# Write out the package file in this format, so that it can easily be called
# and used in a .bat file - yeah, it sucks, but this is the simplest...
touch = args.get('touch')
if touch:
fp = open(touch, 'w')
fp.write('set package_file=%s\n' % wm.package_file)
fp.write('set package_file=%s\n' % base_package_file)
fp.close()
print 'touched', touch
return 0
@@ -269,8 +339,8 @@ class LLManifest(object):
__metaclass__ = LLManifestRegistry
manifests = {}
def for_platform(self, platform, arch = None):
if arch and platform != "windows":
platform = platform + '_' + arch
if arch:
platform = platform + '_' + arch + '_'
return self.manifests[platform.lower()]
for_platform = classmethod(for_platform)
@@ -280,26 +350,15 @@ class LLManifest(object):
self.file_list = []
self.excludes = []
self.actions = []
self.src_prefix = list([args['source']])
self.artwork_prefix = list([args['artwork']])
self.build_prefix = list([args['build']])
self.alt_build_prefix = list([args['build']])
self.dst_prefix = list([args['dest']])
self.src_prefix = [args['source']]
self.artwork_prefix = [args['artwork']]
self.build_prefix = [args['build']]
self.dst_prefix = [args['dest']]
self.created_paths = []
self.package_name = "Unknown"
def default_grid(self):
return self.args.get('grid', None) == ''
def default_channel(self):
return self.args.get('channel', None) == DEFAULT_CHANNEL
def default_channel_for_brand(self):
if self.viewer_branding_id()=='secondlife':
return self.args.get('channel', None) == DEFAULT_CHANNEL
elif self.viewer_branding_id()=="snowglobe":
return self.args.get('channel', None) == DEFAULT_CHANNEL_SNOWGLOBE
else:
return True
return self.args.get('channel', None) == RELEASE_CHANNEL
def construct(self):
""" Meant to be overriden by LLManifest implementors with code that
@@ -311,7 +370,7 @@ class LLManifest(object):
in the file list by path()."""
self.excludes.append(glob)
def prefix(self, src='', build=None, dst=None, alt_build=None):
def prefix(self, src='', build=None, dst=None):
""" Pushes a prefix onto the stack. Until end_prefix is
called, all relevant method calls (esp. to path()) will prefix
paths with the entire prefix stack. Source and destination
@@ -322,15 +381,10 @@ class LLManifest(object):
dst = src
if build is None:
build = src
if alt_build is None:
alt_build = build
self.src_prefix.append(src)
self.artwork_prefix.append(src)
self.build_prefix.append(build)
self.dst_prefix.append(dst)
self.alt_build_prefix.append(alt_build)
return True # so that you can wrap it in an if to get indentation
def end_prefix(self, descr=None):
@@ -343,30 +397,25 @@ class LLManifest(object):
src = self.src_prefix.pop()
artwork = self.artwork_prefix.pop()
build = self.build_prefix.pop()
alt_build_prefix = self.alt_build_prefix.pop()
dst = self.dst_prefix.pop()
if descr and not(src == descr or build == descr or dst == descr):
raise ValueError, "End prefix '" + descr + "' didn't match '" +src+ "' or '" +dst + "'"
def get_src_prefix(self):
""" Returns the current source prefix."""
return os.path.relpath(os.path.normpath(os.path.join(*self.src_prefix)))
return os.path.join(*self.src_prefix)
def get_artwork_prefix(self):
""" Returns the current artwork prefix."""
return os.path.relpath(os.path.normpath(os.path.join(*self.artwork_prefix)))
return os.path.join(*self.artwork_prefix)
def get_build_prefix(self):
""" Returns the current build prefix."""
return os.path.relpath(os.path.normpath(os.path.join(*self.build_prefix)))
def get_alt_build_prefix(self):
""" Returns the current alternate source prefix."""
return os.path.relpath(os.path.normpath(os.path.join(*self.alt_build_prefix)))
return os.path.join(*self.build_prefix)
def get_dst_prefix(self):
""" Returns the current destination prefix."""
return os.path.relpath(os.path.normpath(os.path.join(*self.dst_prefix)))
return os.path.join(*self.dst_prefix)
def src_path_of(self, relpath):
"""Returns the full path to a file or directory specified
@@ -383,25 +432,45 @@ class LLManifest(object):
relative to the destination directory."""
return os.path.join(self.get_dst_prefix(), relpath)
def ensure_src_dir(self, reldir):
"""Construct the path for a directory relative to the
source path, and ensures that it exists. Returns the
full path."""
path = os.path.join(self.get_src_prefix(), reldir)
self.cmakedirs(path)
return path
def ensure_dst_dir(self, reldir):
"""Construct the path for a directory relative to the
destination path, and ensures that it exists. Returns the
full path."""
path = os.path.join(self.get_dst_prefix(), reldir)
self.cmakedirs(path)
return path
def run_command(self, command):
""" Runs an external command, and returns the output. Raises
an exception if the command reurns a nonzero status code. For
debugging/informational purpoases, prints out the command's
an exception if the command returns a nonzero status code. For
debugging/informational purposes, prints out the command's
output as it is received."""
print "Running command:", command
fd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
sys.stdout.flush()
child = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
shell=True)
lines = []
while True:
lines.append(fd.stdout.readline())
lines.append(child.stdout.readline())
if lines[-1] == '':
break
else:
print lines[-1].rstrip('\n'),
print lines[-1],
output = ''.join(lines)
if fd.returncode:
raise RuntimeError(
child.stdout.close()
status = child.wait()
if status:
raise ManifestError(
"Command %s returned non-zero status (%s) \noutput:\n%s"
% (command, fd.returncode, output) )
% (command, status, output) )
return output
def created_path(self, path):
@@ -409,14 +478,24 @@ class LLManifest(object):
a) verify that you really have created it
b) schedule it for cleanup"""
if not os.path.exists(path):
raise RuntimeError, "Should be something at path " + path
raise ManifestError, "Should be something at path " + path
self.created_paths.append(path)
def put_in_file(self, contents, dst):
def put_in_file(self, contents, dst, src=None):
# write contents as dst
f = open(self.dst_path_of(dst), "wb")
f.write(contents)
f.close()
dst_path = self.dst_path_of(dst)
f = open(dst_path, "wb")
try:
f.write(contents)
finally:
f.close()
# Why would we create a file in the destination tree if not to include
# it in the installer? The default src=None (plus the fact that the
# src param is last) is to preserve backwards compatibility.
if src:
self.file_list.append([src, dst_path])
return dst_path
def replace_in(self, src, dst=None, searchdict={}):
if dst == None:
@@ -436,11 +515,7 @@ class LLManifest(object):
# ensure that destination path exists
self.cmakedirs(os.path.dirname(dst))
self.created_paths.append(dst)
if not os.path.isdir(src):
self.ccopy(src,dst)
else:
# src is a dir
self.ccopytree(src,dst)
self.ccopymumble(src, dst)
else:
print "Doesn't exist:", src
@@ -479,30 +554,29 @@ class LLManifest(object):
if method is not None:
method(src, dst)
self.file_list.append([src, dst])
return [dst]
return 1
else:
sys.stdout.write(" (excluding %r, %r)" % (src, dst))
sys.stdout.flush()
return []
return 0
def process_directory(self, src, dst):
if not self.includes(src, dst):
sys.stdout.write(" (excluding %r, %r)" % (src, dst))
sys.stdout.flush()
return []
return 0
names = os.listdir(src)
self.cmakedirs(dst)
errors = []
found_files = []
count = 0
for name in names:
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
if os.path.isdir(srcname):
found_files.extend(self.process_directory(srcname, dstname))
count += self.process_directory(srcname, dstname)
else:
found_files.extend(self.process_file(srcname, dstname))
return found_files
count += self.process_file(srcname, dstname)
return count
def includes(self, src, dst):
if src:
@@ -520,28 +594,38 @@ class LLManifest(object):
else:
os.remove(path)
def ccopy(self, src, dst):
""" Copy a single file or symlink. Uses filecmp to skip copying for existing files."""
def ccopymumble(self, src, dst):
"""Copy a single symlink, file or directory."""
if os.path.islink(src):
linkto = os.readlink(src)
if os.path.islink(dst) or os.path.exists(dst):
if os.path.islink(dst) or os.path.isfile(dst):
os.remove(dst) # because symlinking over an existing link fails
elif os.path.isdir(dst):
shutil.rmtree(dst)
os.symlink(linkto, dst)
elif os.path.isdir(src):
self.ccopytree(src, dst)
else:
# Don't recopy file if it's up-to-date.
# If we seem to be not not overwriting files that have been
# updated, set the last arg to False, but it will take longer.
if os.path.exists(dst) and filecmp.cmp(src, dst, True):
return
# only copy if it's not excluded
if self.includes(src, dst):
try:
os.unlink(dst)
except OSError, err:
if err.errno != errno.ENOENT:
raise
self.ccopyfile(src, dst)
# XXX What about devices, sockets etc.?
# YYY would we put such things into a viewer package?!
shutil.copy2(src, dst)
def ccopyfile(self, src, dst):
""" Copy a single file. Uses filecmp to skip copying for existing files."""
# Don't recopy file if it's up-to-date.
# If we seem to be not not overwriting files that have been
# updated, set the last arg to False, but it will take longer.
if os.path.exists(dst) and filecmp.cmp(src, dst, True):
return
# only copy if it's not excluded
if self.includes(src, dst):
try:
os.unlink(dst)
except OSError, err:
if err.errno != errno.ENOENT:
raise
shutil.copy2(src, dst)
def ccopytree(self, src, dst):
"""Direct copy of shutil.copytree with the additional
@@ -557,15 +641,11 @@ class LLManifest(object):
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
try:
if os.path.isdir(srcname):
self.ccopytree(srcname, dstname)
else:
self.ccopy(srcname, dstname)
# XXX What about devices, sockets etc.?
self.ccopymumble(srcname, dstname)
except (IOError, os.error), why:
errors.append((srcname, dstname, why))
if errors:
raise RuntimeError, errors
raise ManifestError, errors
def cmakedirs(self, path):
@@ -582,11 +662,25 @@ class LLManifest(object):
if os.path.exists(f):
return f
# didn't find it, return last item in list
if list:
if len(list) > 0:
return list[-1]
else:
return None
def contents_of_tar(self, src_tar, dst_dir):
""" Extracts the contents of the tarfile (specified
relative to the source prefix) into the directory
specified relative to the destination directory."""
self.check_file_exists(src_tar)
tf = tarfile.open(self.src_path_of(src_tar), 'r')
for member in tf.getmembers():
tf.extract(member, self.ensure_dst_dir(dst_dir))
# TODO get actions working on these dudes, perhaps we should extract to a temporary directory and then process_directory on it?
self.file_list.append([src_tar,
self.dst_path_of(os.path.join(dst_dir,member.name))])
tf.close()
def wildcard_regex(self, src_glob, dst_glob):
src_re = re.escape(src_glob)
src_re = src_re.replace('\*', '([-a-zA-Z0-9._ ]*)')
@@ -597,7 +691,12 @@ class LLManifest(object):
i = i+1
return re.compile(src_re), dst_temp
wildcard_pattern = re.compile('\*')
def check_file_exists(self, path):
if not os.path.exists(path) and not os.path.islink(path):
raise MissingError("Path %s doesn't exist" % (os.path.abspath(path),))
wildcard_pattern = re.compile(r'\*')
def expand_globs(self, src, dst):
src_list = glob.glob(src)
src_re, d_template = self.wildcard_regex(src.replace('\\', '/'),
@@ -624,43 +723,53 @@ class LLManifest(object):
return self.path(os.path.join(path, file), file)
def path(self, src, dst=None):
sys.stdout.write("Processing %s => %s ... " % (src, dst))
sys.stdout.flush()
if src == None:
raise RuntimeError("No source file, dst is " + dst)
raise ManifestError("No source file, dst is " + dst)
if dst == None:
dst = src
dst = os.path.join(self.get_dst_prefix(), dst)
sys.stdout.write("Processing %s => %s ... " % (src, dst))
count = 0
is_glob = False
found_files = []
# look under each prefix for matching paths. Paths are normalized so './../blah' will match '../blah/../blah/'
paths = set([os.path.normpath(os.path.join(self.get_src_prefix(), src)),
os.path.normpath(os.path.join(self.get_artwork_prefix(), src)),
os.path.normpath(os.path.join(self.get_build_prefix(), src)),
os.path.normpath(os.path.join(self.get_alt_build_prefix(), src))]
)
for path in paths:
if self.wildcard_pattern.search(path):
is_glob = True
for s,d in self.expand_globs(path, dst):
def try_path(src):
# expand globs
count = 0
if self.wildcard_pattern.search(src):
for s,d in self.expand_globs(src, dst):
assert(s != d)
found_files.extend(self.process_file(s, d))
count += self.process_file(s, d)
else:
# if we're specifying a single path (not a glob),
# we should error out if it doesn't exist
self.check_file_exists(src)
# if it's a directory, recurse through it
if os.path.isdir(path):
found_files.extend(self.process_directory(path, dst))
elif os.path.exists(path):
found_files.extend(self.process_file(path, dst))
if os.path.isdir(src):
count += self.process_directory(src, dst)
else:
count += self.process_file(src, dst)
return count
# if we're specifying a single path (not a glob),
# we should error out if it doesn't exist
if not found_files and not is_glob:
raise RuntimeError("No files match %s\n" % str(paths))
for pfx in self.get_src_prefix(), self.get_artwork_prefix(), self.get_build_prefix():
try:
count = try_path(os.path.join(pfx, src))
except MissingError:
# If src isn't a wildcard, and if that file doesn't exist in
# this pfx, try next pfx.
count = 0
continue
print "%d files" % len(found_files)
return found_files
# Here try_path() didn't raise MissingError. Did it process any files?
if count:
break
# Even though try_path() didn't raise MissingError, it returned 0
# files. src is probably a wildcard meant for some other pfx. Loop
# back to try the next.
print "%d files" % count
# Let caller check whether we processed as many files as expected. In
# particular, let caller notice 0.
return count
def do(self, *actions):
self.actions = actions

View File

@@ -1,3 +1,24 @@
#!/usr/bin/python
## $LicenseInfo:firstyear=2011&license=viewerlgpl$
## Second Life Viewer Source Code
## Copyright (C) 2011, Linden Research, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## version 2.1 of the License only.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
##
## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
## $/LicenseInfo$
r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions

View File

@@ -30,5 +30,3 @@ set_source_files_properties(${libpathing_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
add_library(nd_Pathing STATIC ${libpathing_SOURCE_FILES} ${libpathing_HEADER_FILES} )
add_dependencies(nd_Pathing prepare)

View File

@@ -1,4 +1,3 @@
#include "sys.h"
#include "llpathinglib.h"
void LLPathingLib::initSystem()

View File

@@ -86,10 +86,10 @@ LLAssetType::EType LLWearable::getAssetType() const
return LLWearableType::getAssetType(mType);
}
BOOL LLWearable::exportFile(LLFILE* fp) const
BOOL LLWearable::exportFile(const std::string& filename) const
{
llofstream ofs(fp);
return exportStream(ofs);
llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
return ofs.is_open() && exportStream(ofs);
}
// virtual
@@ -105,13 +105,13 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
output_stream << mDescription << "\n";
// permissions
if( !mPermissions.exportStream( output_stream ) )
if( !mPermissions.exportLegacyStream( output_stream ) )
{
return FALSE;
}
// sale info
if( !mSaleInfo.exportStream( output_stream ) )
if( !mSaleInfo.exportLegacyStream( output_stream ) )
{
return FALSE;
}
@@ -193,7 +193,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
if (layer_set)
{
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
}
else
{
@@ -201,10 +201,11 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
}
}
LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp )
LLWearable::EImportResult LLWearable::importFile(const std::string& filename,
LLAvatarAppearance* avatarp )
{
llifstream ifs(fp);
return importStream(ifs, avatarp);
llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp);
}
// virtual
@@ -287,7 +288,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream,
LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL;
return LLWearable::FAILURE;
}
if( !mPermissions.importStream( input_stream ) )
if( !mPermissions.importLegacyStream( input_stream ) )
{
return LLWearable::FAILURE;
}
@@ -312,7 +313,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream,
// up the vast majority of the tasks.
BOOL has_perm_mask = FALSE;
U32 perm_mask = 0;
if( !mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask) )
if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) )
{
return LLWearable::FAILURE;
}

View File

@@ -82,8 +82,8 @@ public:
SUCCESS,
BAD_HEADER
};
BOOL exportFile(LLFILE* file) const;
EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp );
BOOL exportFile(const std::string& filename) const;
EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp );
virtual BOOL exportStream( std::ostream& output_stream ) const;
virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );

View File

@@ -5,12 +5,7 @@ project(llaudio)
include(00-Common)
include(Audio)
include(LLAudio)
if (FMODSTUDIO)
include(FMODSTUDIO)
endif (FMODSTUDIO)
if (FMODEX)
include(FMODEX)
endif (FMODEX)
include(FMODSTUDIO)
include(OPENAL)
include(LLCommon)
include(LLMath)
@@ -68,20 +63,6 @@ if (FMODSTUDIO)
)
endif (FMODSTUDIO)
if (FMODEX)
list(APPEND llaudio_SOURCE_FILES
llaudioengine_fmodex.cpp
lllistener_fmodex.cpp
llstreamingaudio_fmodex.cpp
)
list(APPEND llaudio_HEADER_FILES
llaudioengine_fmodex.h
lllistener_fmodex.h
llstreamingaudio_fmodex.h
)
endif (FMODEX)
if (OPENAL)
list(APPEND llaudio_SOURCE_FILES
llaudioengine_openal.cpp
@@ -100,5 +81,3 @@ set_source_files_properties(${llaudio_HEADER_FILES}
list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES})
add_library (llaudio ${llaudio_SOURCE_FILES})
add_dependencies(llaudio prepare)

File diff suppressed because it is too large Load Diff

View File

@@ -1,139 +0,0 @@
/**
* @file audioengine_FMODEX.h
* @brief Definition of LLAudioEngine class abstracting the audio
* support as a FMOD 3D implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_AUDIOENGINE_FMODEX_H
#define LL_AUDIOENGINE_FMODEX_H
#include "llaudioengine.h"
#include "lllistener_fmodex.h"
#include "llwindgen.h"
//Stubs
class LLAudioStreamManagerFMODEX;
namespace FMOD
{
class System;
class Channel;
class ChannelGroup;
class Sound;
class DSP;
}
//Interfaces
class LLAudioEngine_FMODEX : public LLAudioEngine
{
public:
LLAudioEngine_FMODEX(bool enable_profiler, bool verbose_debugging);
virtual ~LLAudioEngine_FMODEX();
// initialization/startup/shutdown
virtual bool init(const S32 num_channels, void *user_data);
virtual std::string getDriverName(bool verbose);
virtual void allocateListener();
virtual void shutdown();
/*virtual*/ bool initWind();
/*virtual*/ void cleanupWind();
/*virtual*/void updateWind(LLVector3 direction, F32 camera_height_above_water);
typedef F32 MIXBUFFERFORMAT;
FMOD::System *getSystem() const {return mSystem;}
protected:
/*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to.
/*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel.
/*virtual*/ void setInternalGain(F32 gain);
bool mInited;
LLWindGen<MIXBUFFERFORMAT> *mWindGen;
FMOD::DSP *mWindDSP;
FMOD::System *mSystem;
bool mEnableProfiler;
public:
static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT];
};
class LLAudioChannelFMODEX : public LLAudioChannel
{
public:
LLAudioChannelFMODEX(FMOD::System *audioengine);
virtual ~LLAudioChannelFMODEX();
void onRelease();
protected:
/*virtual*/ void play();
/*virtual*/ void playSynced(LLAudioChannel *channelp);
/*virtual*/ void cleanup();
/*virtual*/ bool isPlaying();
/*virtual*/ bool updateBuffer();
/*virtual*/ void update3DPosition();
/*virtual*/ void updateLoop();
void set3DMode(bool use3d);
protected:
FMOD::System *getSystem() const {return mSystemp;}
FMOD::System *mSystemp;
FMOD::Channel *mChannelp;
S32 mLastSamplePos;
friend class CFMODSoundChecks;
};
class LLAudioBufferFMODEX : public LLAudioBuffer
{
public:
LLAudioBufferFMODEX(FMOD::System *audioengine);
virtual ~LLAudioBufferFMODEX();
/*virtual*/ bool loadWAV(const std::string& filename);
/*virtual*/ U32 getLength();
friend class LLAudioChannelFMODEX;
protected:
FMOD::System *getSystem() const {return mSystemp;}
FMOD::System *mSystemp;
FMOD::Sound *getSound() const{ return mSoundp; }
FMOD::Sound *mSoundp;
friend class CFMODSoundChecks;
};
#endif // LL_AUDIOENGINE_FMODEX_H

View File

@@ -1,5 +1,5 @@
/**
* @file audioengine_FMODSTUDIO.cpp
* @file audioengine_fmodstudio.cpp
* @brief Implementation of LLAudioEngine class abstracting the audio support as a FMOD 3D implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
@@ -79,7 +79,7 @@ bool attemptDelayLoad()
static bool sVerboseDebugging = false;
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels);
FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels);
FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0};
@@ -248,7 +248,6 @@ LLAudioEngine_FMODSTUDIO::~LLAudioEngine_FMODSTUDIO()
{
}
inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
{
if(result == FMOD_OK)
@@ -257,45 +256,20 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
return true;
}
void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
{
if(type & FMOD_MEMORY_STREAM_DECODE)
{
LL_INFOS("AudioImpl") << "Decode buffer size: " << size << LL_ENDL;
}
else if(type & FMOD_MEMORY_STREAM_FILE)
{
LL_INFOS("AudioImpl") << "Stream buffer size: " << size << LL_ENDL;
}
return new char[size];
}
void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
{
memset(ptr,0,size);
return ptr;
}
void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr)
{
delete[] (char*)ptr;
}
bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata)
{
#if LL_WINDOWS
LL_WARNS("AudioImpl") << "BARKBARKBARK" << LL_ENDL;
#if 0 //LL_WINDOWS
if(!attemptDelayLoad())
return false;
#endif
U32 version = 0;
FMOD_RESULT result;
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() initializing FMOD" << LL_ENDL;
//result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
//if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
// return false;
result = FMOD::System_Create(&mSystem);
if(Check_FMOD_Error(result, "FMOD::System_Create"))
return false;
@@ -477,7 +451,7 @@ std::string LLAudioEngine_FMODSTUDIO::getDriverName(bool verbose)
return llformat("FMOD Studio %1x.%02x.%02x", version >> 16, version >> 8 & 0x000000FF, version & 0x000000FF);
}
}
return "FMODEx";
return "FMOD Studio";
}
@@ -533,15 +507,16 @@ bool LLAudioEngine_FMODSTUDIO::initWind()
dspdesc.pluginsdkversion = FMOD_PLUGIN_SDK_VERSION;
strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit"
dspdesc.numoutputbuffers = 1;
dspdesc.read = &windCallback; //Assign callback.
dspdesc.read = &windDSPCallback; //Assign callback.
if (Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP") || !mWindDSP)
return false;
int frequency = 44100;
if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, NULL, NULL), "FMOD::System::getSoftwareFormat"))
FMOD_SPEAKERMODE mode;
if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, &mode, NULL), "FMOD::System::getSoftwareFormat"))
{
mWindGen = new LLWindGen<MIXBUFFERFORMAT>((U32)frequency);
FMOD_SPEAKERMODE mode;
if (!Check_FMOD_Error(mWindDSP->setUserData((void*)mWindGen), "FMOD::DSP::setUserData") &&
!Check_FMOD_Error(mSystem->playDSP(mWindDSP, NULL, false, 0), "FMOD::System::playDSP") &&
!Check_FMOD_Error(mSystem->getSoftwareFormat(NULL, &mode, NULL), "FMOD::System::getSoftwareFormat") &&
@@ -686,6 +661,7 @@ bool LLAudioChannelFMODSTUDIO::updateBuffer()
return false;
}
// Actually play the sound. Start it off paused so we can do all the necessary
// setup.
if(!mChannelp)
@@ -924,8 +900,7 @@ bool LLAudioBufferFMODSTUDIO::loadWAV(const std::string& filename)
}
FMOD_MODE base_mode = FMOD_LOOP_NORMAL;
FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo,0,sizeof(exinfo));
FMOD_CREATESOUNDEXINFO exinfo = {0};
exinfo.cbsize = sizeof(exinfo);
exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading.
// Load up the wav file into an fmod sample
@@ -983,7 +958,7 @@ void LLAudioChannelFMODSTUDIO::set3DMode(bool use3d)
}
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels)
FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels)
{
// inbuffer = incomming data.
// newbuffer = outgoing data. AKA this DSP's output.

View File

@@ -1,141 +0,0 @@
/**
* @file listener_fmod.cpp
* @brief implementation of LISTENER class abstracting the audio
* support as a FMOD 3D implementation (windows only)
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llaudioengine.h"
#include "lllistener_fmodex.h"
#include "fmod.hpp"
//-----------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------
LLListener_FMODEX::LLListener_FMODEX(FMOD::System *system)
{
mSystem = system;
init();
}
//-----------------------------------------------------------------------
LLListener_FMODEX::~LLListener_FMODEX()
{
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::init(void)
{
// do inherited
LLListener::init();
mDopplerFactor = 1.0f;
mRolloffFactor = 1.0f;
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::translate(LLVector3 offset)
{
LLListener::translate(offset);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV);
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::setPosition(LLVector3 pos)
{
LLListener::setPosition(pos);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV);
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::setVelocity(LLVector3 vel)
{
LLListener::setVelocity(vel);
mSystem->set3DListenerAttributes(0, NULL, (FMOD_VECTOR*)mVelocity.mV, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV);
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::orient(LLVector3 up, LLVector3 at)
{
LLListener::orient(up, at);
// Welcome to the transition between right and left
// (coordinate systems, that is)
// Leaving the at vector alone results in a L/R reversal
// since DX is left-handed and we (LL, OpenGL, OpenAL) are right-handed
at = -at;
mSystem->set3DListenerAttributes(0, NULL, NULL, (FMOD_VECTOR*)at.mV, (FMOD_VECTOR*)up.mV);
}
//-----------------------------------------------------------------------
void LLListener_FMODEX::commitDeferredChanges()
{
mSystem->update();
}
void LLListener_FMODEX::setRolloffFactor(F32 factor)
{
//An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment.
//Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well.
//In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call.
if(mRolloffFactor != factor)
{
LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL);
}
mRolloffFactor = factor;
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
}
F32 LLListener_FMODEX::getRolloffFactor()
{
return mRolloffFactor;
}
void LLListener_FMODEX::setDopplerFactor(F32 factor)
{
mDopplerFactor = factor;
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
}
F32 LLListener_FMODEX::getDopplerFactor()
{
return mDopplerFactor;
}

View File

@@ -1,71 +0,0 @@
/**
* @file listener_fmod.h
* @brief Description of LISTENER class abstracting the audio support
* as an FMOD 3D implementation (windows and Linux)
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LISTENER_FMODEX_H
#define LL_LISTENER_FMODEX_H
#include "lllistener.h"
//Stubs
namespace FMOD
{
class System;
}
//Interfaces
class LLListener_FMODEX : public LLListener
{
public:
LLListener_FMODEX(FMOD::System *system);
virtual ~LLListener_FMODEX();
virtual void init();
virtual void translate(LLVector3 offset);
virtual void setPosition(LLVector3 pos);
virtual void setVelocity(LLVector3 vel);
virtual void orient(LLVector3 up, LLVector3 at);
virtual void commitDeferredChanges();
virtual void setDopplerFactor(F32 factor);
virtual F32 getDopplerFactor();
virtual void setRolloffFactor(F32 factor);
virtual F32 getRolloffFactor();
protected:
FMOD::System *mSystem;
F32 mDopplerFactor;
F32 mRolloffFactor;
};
#endif

View File

@@ -1,596 +0,0 @@
/**
* @file streamingaudio_fmod.cpp
* @brief LLStreamingAudio_FMODEX implementation
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llmath.h"
#include "fmod.hpp"
#include "fmod_errors.h"
#include "llstreamingaudio_fmodex.h"
inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
{
if (result == FMOD_OK)
return false;
LL_WARNS("AudioImpl") << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL;
return true;
}
class LLAudioStreamManagerFMODEX
{
public:
LLAudioStreamManagerFMODEX(FMOD::System *system, const std::string& url);
FMOD::Channel* startStream();
bool stopStream(); // Returns true if the stream was successfully stopped.
bool ready();
const std::string& getURL() { return mInternetStreamURL; }
FMOD_RESULT getOpenState(FMOD_OPENSTATE& openstate, unsigned int* percentbuffered=NULL, bool* starving=NULL, bool* diskbusy=NULL);
protected:
FMOD::System* mSystem;
FMOD::Channel* mStreamChannel;
FMOD::Sound* mInternetStream;
bool mReady;
std::string mInternetStreamURL;
};
//---------------------------------------------------------------------------
// Internet Streaming
//---------------------------------------------------------------------------
LLStreamingAudio_FMODEX::LLStreamingAudio_FMODEX(FMOD::System *system) :
mSystem(system),
mCurrentInternetStreamp(NULL),
mFMODInternetStreamChannelp(NULL),
mGain(1.0f),
mMetaData(NULL)
{
FMOD_RESULT result;
// Number of milliseconds of audio to buffer for the audio card.
// Must be larger than the usual Second Life frame stutter time.
const U32 buffer_seconds = 10; //sec
const U32 estimated_bitrate = 128; //kbit/sec
result = mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
Check_FMOD_Error(result, "FMOD::System::setStreamBufferSize");
// Here's where we set the size of the network buffer and some buffering
// parameters. In this case we want a network buffer of 16k, we want it
// to prebuffer 40% of that when we first connect, and we want it
// to rebuffer 80% of that whenever we encounter a buffer underrun.
// Leave the net buffer properties at the default.
//FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80);
}
LLStreamingAudio_FMODEX::~LLStreamingAudio_FMODEX()
{
stop();
for (U32 i = 0; i < 100; ++i)
{
if (releaseDeadStreams())
break;
ms_sleep(10);
}
}
void LLStreamingAudio_FMODEX::start(const std::string& url)
{
//if (!mInited)
//{
// LL_WARNS() << "startInternetStream before audio initialized" << LL_ENDL;
// return;
//}
// "stop" stream but don't clear url, etc. in case url == mInternetStreamURL
stop();
if (!url.empty())
{
if(mDeadStreams.empty())
{
LL_INFOS() << "Starting internet stream: " << url << LL_ENDL;
mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url);
mURL = url;
mMetaData = new LLSD;
}
else
{
LL_INFOS() << "Deferring stream load until buffer release: " << url << LL_ENDL;
mPendingURL = url;
}
}
else
{
LL_INFOS() << "Set internet stream to null" << LL_ENDL;
mURL.clear();
}
}
enum utf_endian_type_t
{
UTF16LE,
UTF16BE,
UTF16
};
std::string utf16input_to_utf8(unsigned char* input, U32 len, utf_endian_type_t type)
{
if (type == UTF16)
{
type = UTF16BE; //Default
if (len > 2)
{
//Parse and strip BOM.
if ((input[0] == 0xFE && input[1] == 0xFF) ||
(input[0] == 0xFF && input[1] == 0xFE))
{
input += 2;
len -= 2;
type = input[0] == 0xFE ? UTF16BE : UTF16LE;
}
}
}
llutf16string out_16((U16*)input, len / 2);
if (len % 2)
{
out_16.push_back((input)[len - 1] << 8);
}
if (type == UTF16BE)
{
for (llutf16string::iterator i = out_16.begin(); i < out_16.end(); ++i)
{
llutf16string::value_type v = *i;
*i = ((v & 0x00FF) << 8) | ((v & 0xFF00) >> 8);
}
}
return utf16str_to_utf8str(out_16);
}
void LLStreamingAudio_FMODEX::update()
{
if (!releaseDeadStreams())
{
llassert_always(mCurrentInternetStreamp == NULL);
return;
}
if(!mPendingURL.empty())
{
llassert_always(mCurrentInternetStreamp == NULL);
LL_INFOS() << "Starting internet stream: " << mPendingURL << LL_ENDL;
mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,mPendingURL);
mURL = mPendingURL;
mMetaData = new LLSD;
mPendingURL.clear();
}
// Don't do anything if there are no streams playing
if (!mCurrentInternetStreamp)
{
return;
}
unsigned int progress;
bool starving;
bool diskbusy;
FMOD_OPENSTATE open_state;
FMOD_RESULT res = mCurrentInternetStreamp->getOpenState(open_state, &progress, &starving, &diskbusy);
if (res != FMOD_OK || open_state == FMOD_OPENSTATE_ERROR)
{
stop();
return;
}
else if (open_state == FMOD_OPENSTATE_READY)
{
// Stream is live
// start the stream if it's ready
if (!mFMODInternetStreamChannelp &&
(mFMODInternetStreamChannelp = mCurrentInternetStreamp->startStream()))
{
// Reset volume to previously set volume
setGain(getGain());
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused");
}
}
if(mFMODInternetStreamChannelp)
{
if(!mMetaData)
mMetaData = new LLSD;
FMOD::Sound *sound = NULL;
if(mFMODInternetStreamChannelp->getCurrentSound(&sound) == FMOD_OK && sound)
{
FMOD_TAG tag;
S32 tagcount, dirtytagcount;
if(sound->getNumTags(&tagcount, &dirtytagcount) == FMOD_OK && dirtytagcount)
{
mMetaData->clear();
for(S32 i = 0; i < tagcount; ++i)
{
if(sound->getTag(NULL, i, &tag)!=FMOD_OK)
continue;
std::string name = tag.name;
switch(tag.type) //Crappy tag translate table.
{
case(FMOD_TAGTYPE_ID3V2):
if (!LLStringUtil::compareInsensitive(name, "TIT2")) name = "TITLE";
else if(name == "TPE1") name = "ARTIST";
break;
case(FMOD_TAGTYPE_ASF):
if (!LLStringUtil::compareInsensitive(name, "Title")) name = "TITLE";
else if (!LLStringUtil::compareInsensitive(name, "WM/AlbumArtist")) name = "ARTIST";
break;
case(FMOD_TAGTYPE_FMOD):
if (!LLStringUtil::compareInsensitive(name, "Sample Rate Change"))
{
LL_INFOS() << "Stream forced changing sample rate to " << *((float *)tag.data) << LL_ENDL;
Check_FMOD_Error(mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data)), "FMOD::Channel::setFrequency");
}
continue;
default:
if (!LLStringUtil::compareInsensitive(name, "TITLE") ||
!LLStringUtil::compareInsensitive(name, "ARTIST"))
LLStringUtil::toUpper(name);
break;
}
switch(tag.datatype)
{
case(FMOD_TAGDATATYPE_INT):
(*mMetaData)[name]=*(LLSD::Integer*)(tag.data);
LL_INFOS() << tag.name << ": " << *(int*)(tag.data) << LL_ENDL;
break;
case(FMOD_TAGDATATYPE_FLOAT):
(*mMetaData)[name]=*(LLSD::Float*)(tag.data);
LL_INFOS() << tag.name << ": " << *(float*)(tag.data) << LL_ENDL;
break;
case(FMOD_TAGDATATYPE_STRING):
{
std::string out = rawstr_to_utf8(std::string((char*)tag.data,tag.datalen));
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name]=out;
LL_INFOS() << tag.name << "(RAW): " << out << LL_ENDL;
}
break;
case(FMOD_TAGDATATYPE_STRING_UTF8) :
{
U8 offs = 0;
if (tag.datalen > 3 && ((unsigned char*)tag.data)[0] == 0xEF && ((char*)tag.data)[1] == 0xBB && ((char*)tag.data)[2] == 0xBF)
offs = 3;
std::string out((char*)tag.data + offs, tag.datalen - offs);
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name] = out;
LL_INFOS() << tag.name << "(UTF8): " << out << LL_ENDL;
}
break;
case(FMOD_TAGDATATYPE_STRING_UTF16):
{
std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16);
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name] = out;
LL_INFOS() << tag.name << "(UTF16): " << out << LL_ENDL;
}
break;
case(FMOD_TAGDATATYPE_STRING_UTF16BE):
{
std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16BE);
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name] = out;
LL_INFOS() << tag.name << "(UTF16BE): " << out << LL_ENDL;
}
default:
break;
}
}
}
if(starving)
{
bool paused = false;
if (mFMODInternetStreamChannelp->getPaused(&paused) == FMOD_OK && !paused)
{
LL_INFOS() << "Stream starvation detected! Pausing stream until buffer nearly full." << LL_ENDL;
LL_INFOS() << " (diskbusy="<<diskbusy<<")" << LL_ENDL;
LL_INFOS() << " (progress="<<progress<<")" << LL_ENDL;
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(true), "FMOD::Channel::setPaused");
}
}
else if(progress > 80)
{
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused");
}
}
}
}
void LLStreamingAudio_FMODEX::stop()
{
mPendingURL.clear();
if(mMetaData)
{
delete mMetaData;
mMetaData = NULL;
}
if (mFMODInternetStreamChannelp)
{
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(true), "FMOD::Channel::setPaused");
Check_FMOD_Error(mFMODInternetStreamChannelp->setPriority(0), "FMOD::Channel::setPriority");
mFMODInternetStreamChannelp = NULL;
}
if (mCurrentInternetStreamp)
{
LL_INFOS() << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << LL_ENDL;
if (mCurrentInternetStreamp->stopStream())
{
delete mCurrentInternetStreamp;
}
else
{
LL_WARNS() << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << LL_ENDL;
mDeadStreams.push_back(mCurrentInternetStreamp);
}
mCurrentInternetStreamp = NULL;
//mURL.clear();
}
}
void LLStreamingAudio_FMODEX::pause(int pauseopt)
{
if (pauseopt < 0)
{
pauseopt = mCurrentInternetStreamp ? 1 : 0;
}
if (pauseopt)
{
if (mCurrentInternetStreamp)
{
stop();
}
}
else
{
start(getURL());
}
}
// A stream is "playing" if it has been requested to start. That
// doesn't necessarily mean audio is coming out of the speakers.
int LLStreamingAudio_FMODEX::isPlaying()
{
if (mCurrentInternetStreamp)
{
return 1; // Active and playing
}
else if (!mURL.empty() || !mPendingURL.empty())
{
return 2; // "Paused"
}
else
{
return 0;
}
}
F32 LLStreamingAudio_FMODEX::getGain()
{
return mGain;
}
std::string LLStreamingAudio_FMODEX::getURL()
{
return mURL;
}
void LLStreamingAudio_FMODEX::setGain(F32 vol)
{
mGain = vol;
if (mFMODInternetStreamChannelp)
{
vol = llclamp(vol * vol, 0.f, 1.f); //should vol be squared here?
Check_FMOD_Error(mFMODInternetStreamChannelp->setVolume(vol), "FMOD::Channel::setVolume");
}
}
/*virtual*/ bool LLStreamingAudio_FMODEX::getWaveData(float* arr, S32 count, S32 stride/*=1*/)
{
if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp)
return false;
bool muted=false;
FMOD_RESULT res = mFMODInternetStreamChannelp->getMute(&muted);
if(res != FMOD_OK || muted)
return false;
static std::vector<float> local_array(count); //Have to have an extra buffer to mix channels. Bleh.
if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink.
local_array.resize(count);
if( mFMODInternetStreamChannelp->getWaveData(&local_array[0],count,0) == FMOD_OK &&
mFMODInternetStreamChannelp->getWaveData(&arr[0],count,1) == FMOD_OK )
{
for(S32 i = count-1;i>=0;i-=stride)
{
arr[i] += local_array[i];
arr[i] *= .5f;
}
return true;
}
return false;
}
///////////////////////////////////////////////////////
// manager of possibly-multiple internet audio streams
LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, const std::string& url) :
mSystem(system),
mStreamChannel(NULL),
mInternetStream(NULL),
mReady(false)
{
mInternetStreamURL = url;
/*FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo,0,sizeof(exinfo));
exinfo.cbsize = sizeof(exinfo);
exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_OGGVORBIS; //Hint to speed up loading.*/
FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream);
if (result!= FMOD_OK)
{
LL_WARNS() << "Couldn't open fmod stream, error "
<< FMOD_ErrorString(result)
<< LL_ENDL;
mReady = false;
return;
}
mReady = true;
}
FMOD::Channel *LLAudioStreamManagerFMODEX::startStream()
{
// We need a live and opened stream before we try and play it.
FMOD_OPENSTATE open_state;
if (getOpenState(open_state) != FMOD_OK || open_state != FMOD_OPENSTATE_READY)
{
LL_WARNS() << "No internet stream to start playing!" << LL_ENDL;
return NULL;
}
if(mStreamChannel)
return mStreamChannel; //Already have a channel for this stream.
Check_FMOD_Error(mSystem->playSound(FMOD_CHANNEL_FREE, mInternetStream, true, &mStreamChannel), "FMOD::System::playSound");
return mStreamChannel;
}
bool LLAudioStreamManagerFMODEX::stopStream()
{
if (mInternetStream)
{
bool close = true;
FMOD_OPENSTATE open_state;
if (getOpenState(open_state) == FMOD_OK)
{
switch (open_state)
{
case FMOD_OPENSTATE_CONNECTING:
close = false;
break;
default:
close = true;
}
}
if (close && mInternetStream->release() == FMOD_OK)
{
mStreamChannel = NULL;
mInternetStream = NULL;
return true;
}
else
{
return false;
}
}
else
{
return true;
}
}
FMOD_RESULT LLAudioStreamManagerFMODEX::getOpenState(FMOD_OPENSTATE& state, unsigned int* percentbuffered, bool* starving, bool* diskbusy)
{
if (!mInternetStream)
return FMOD_ERR_INVALID_HANDLE;
FMOD_RESULT result = mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy);
Check_FMOD_Error(result, "FMOD::Sound::getOpenState");
return result;
}
void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)
{
Check_FMOD_Error(mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES), "FMOD::System::setStreamBufferSize");
FMOD_ADVANCEDSETTINGS settings;
memset(&settings,0,sizeof(settings));
settings.cbsize=sizeof(settings);
settings.defaultDecodeBufferSize = decodebuffertime;//ms
Check_FMOD_Error(mSystem->setAdvancedSettings(&settings), "FMOD::System::setAdvancedSettings");
}
bool LLStreamingAudio_FMODEX::releaseDeadStreams()
{
// Kill dead internet streams, if possible
std::list<LLAudioStreamManagerFMODEX *>::iterator iter;
for (iter = mDeadStreams.begin(); iter != mDeadStreams.end();)
{
LLAudioStreamManagerFMODEX *streamp = *iter;
if (streamp->stopStream())
{
LL_INFOS() << "Closed dead stream" << LL_ENDL;
delete streamp;
mDeadStreams.erase(iter++);
}
else
{
iter++;
}
}
return mDeadStreams.empty();
}

View File

@@ -1,89 +0,0 @@
/**
* @file streamingaudio_fmod.h
* @author Tofu Linden
* @brief Definition of LLStreamingAudio_FMOD implementation
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_STREAMINGAUDIO_FMOD_H
#define LL_STREAMINGAUDIO_FMOD_H
#include "stdtypes.h" // from llcommon
#include "llstreamingaudio.h"
#include "lltimer.h"
//Stubs
class LLAudioStreamManagerFMODEX;
namespace FMOD
{
class System;
class Channel;
}
//Interfaces
class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
{
public:
LLStreamingAudio_FMODEX(FMOD::System *system);
/*virtual*/ ~LLStreamingAudio_FMODEX();
/*virtual*/ void start(const std::string& url);
/*virtual*/ void stop();
/*virtual*/ void pause(int pause);
/*virtual*/ void update();
/*virtual*/ int isPlaying();
/*virtual*/ void setGain(F32 vol);
/*virtual*/ F32 getGain();
/*virtual*/ std::string getURL();
/*virtual*/ bool supportsMetaData(){return true;}
/*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing.
/*virtual*/ bool supportsWaveData(){return true;}
/*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1);
/*virtual*/ bool supportsAdjustableBufferSizes(){return true;}
/*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime);
private:
bool releaseDeadStreams();
FMOD::System *mSystem;
LLAudioStreamManagerFMODEX *mCurrentInternetStreamp;
FMOD::Channel *mFMODInternetStreamChannelp;
std::list<LLAudioStreamManagerFMODEX *> mDeadStreams;
std::string mURL;
std::string mPendingURL;
F32 mGain;
LLSD *mMetaData;
};
#endif // LL_STREAMINGAUDIO_FMOD_H

View File

@@ -31,6 +31,7 @@
*/
#include "linden_common.h"
#include "llstreamingaudio_fmodstudio.h"
#include "llmath.h"
#include "llthread.h"
@@ -38,8 +39,6 @@
#include "fmod.hpp"
#include "fmod_errors.h"
#include "llstreamingaudio_fmodstudio.h"
inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
{
if (result == FMOD_OK)
@@ -61,9 +60,9 @@ public:
FMOD_RESULT getOpenState(FMOD_OPENSTATE& openstate, unsigned int* percentbuffered = NULL, bool* starving = NULL, bool* diskbusy = NULL);
protected:
FMOD::System* mSystem;
FMOD::ChannelGroup* mChannelGroup;
FMOD::Channel* mStreamChannel;
FMOD::Sound* mInternetStream;
FMOD::ChannelGroup* mChannelGroup;
bool mReady;
std::string mInternetStreamURL;
@@ -119,11 +118,11 @@ FMOD_RESULT F_CALLBACK waveDataCallback(FMOD_DSP_STATE *dsp_state, float *inbuff
LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) :
mSystem(system),
mCurrentInternetStreamp(NULL),
mStreamDSP(NULL),
mStreamGroup(NULL),
mFMODInternetStreamChannelp(NULL),
mGain(1.0f),
mMetaData(NULL),
mStreamGroup(NULL),
mStreamDSP(NULL)
mMetaData(NULL)
{
FMOD_RESULT result;
@@ -142,10 +141,9 @@ LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) :
// Leave the net buffer properties at the default.
//FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80);
Check_FMOD_Error(mSystem->createChannelGroup("stream", &mStreamGroup), "FMOD::System::createChannelGroup");
Check_FMOD_Error(system->createChannelGroup("stream", &mStreamGroup), "FMOD::System::createChannelGroup");
FMOD_DSP_DESCRIPTION dspdesc;
memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); //Zero out everything
FMOD_DSP_DESCRIPTION dspdesc = {0};
dspdesc.pluginsdkversion = FMOD_PLUGIN_SDK_VERSION;
strncpy(dspdesc.name, "Waveform", sizeof(dspdesc.name));
dspdesc.numoutputbuffers = 1;
@@ -154,7 +152,6 @@ LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) :
Check_FMOD_Error(system->createDSP(&dspdesc, &mStreamDSP), "FMOD::System::createDSP");
}
LLStreamingAudio_FMODSTUDIO::~LLStreamingAudio_FMODSTUDIO()
{
stop();
@@ -168,7 +165,6 @@ LLStreamingAudio_FMODSTUDIO::~LLStreamingAudio_FMODSTUDIO()
cleanupWaveData();
}
void LLStreamingAudio_FMODSTUDIO::start(const std::string& url)
{
//if (!mInited)
@@ -209,7 +205,7 @@ enum utf_endian_type_t
UTF16
};
std::string utf16input_to_utf8(char* input, U32 len, utf_endian_type_t type)
std::string utf16input_to_utf8(unsigned char* input, U32 len, utf_endian_type_t type)
{
if (type == UTF16)
{
@@ -226,7 +222,7 @@ std::string utf16input_to_utf8(char* input, U32 len, utf_endian_type_t type)
}
}
}
llutf16string out_16((U16*)input, len / 2);
llutf16string out_16((llutf16string::value_type*)input, len / 2);
if (len % 2)
{
out_16.push_back((input)[len - 1] << 8);
@@ -254,7 +250,7 @@ void LLStreamingAudio_FMODSTUDIO::update()
{
llassert_always(mCurrentInternetStreamp == NULL);
LL_INFOS() << "Starting internet stream: " << mPendingURL << LL_ENDL;
mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem,mStreamGroup, mPendingURL);
mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem, mStreamGroup, mPendingURL);
mURL = mPendingURL;
mMetaData = new LLSD;
mPendingURL.clear();
@@ -315,6 +311,7 @@ void LLStreamingAudio_FMODSTUDIO::update()
{
if(sound->getTag(NULL, i, &tag)!=FMOD_OK)
continue;
std::string name = tag.name;
switch(tag.type) //Crappy tag translate table.
{
@@ -373,7 +370,7 @@ void LLStreamingAudio_FMODSTUDIO::update()
break;
case(FMOD_TAGDATATYPE_STRING_UTF16):
{
std::string out = utf16input_to_utf8((char*)tag.data, tag.datalen, UTF16);
std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16);
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name] = out;
@@ -382,7 +379,7 @@ void LLStreamingAudio_FMODSTUDIO::update()
break;
case(FMOD_TAGDATATYPE_STRING_UTF16BE):
{
std::string out = utf16input_to_utf8((char*)tag.data, tag.datalen, UTF16BE);
std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16BE);
if (out.length() && out[out.size() - 1] == 0)
out.erase(out.size() - 1);
(*mMetaData)[name] = out;
@@ -393,6 +390,7 @@ void LLStreamingAudio_FMODSTUDIO::update()
}
}
}
static bool was_starved = false;
if(starving)
{
bool paused = false;
@@ -403,9 +401,11 @@ void LLStreamingAudio_FMODSTUDIO::update()
LL_INFOS() << " (progress="<<progress<<")" << LL_ENDL;
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(true), "FMOD::Channel::setPaused");
}
was_starved = true;
}
else if(progress > 80)
else if(progress > 80 && was_starved)
{
was_starved = false;
Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused");
}
}
@@ -446,7 +446,6 @@ void LLStreamingAudio_FMODSTUDIO::stop()
mDeadStreams.push_back(mCurrentInternetStreamp);
}
mCurrentInternetStreamp = NULL;
//mURL.clear();
}
}
@@ -514,7 +513,8 @@ void LLStreamingAudio_FMODSTUDIO::setGain(F32 vol)
}
}
/*virtual*/ bool LLStreamingAudio_FMODSTUDIO::getWaveData(float* arr, S32 count, S32 stride/*=1*/)
/* virtual */
bool LLStreamingAudio_FMODSTUDIO::getWaveData(float* arr, S32 count, S32 stride/*=1*/)
{
if (count > (WAVE_BUFFER_SIZE / 2))
LL_ERRS("AudioImpl") << "Count=" << count << " exceeds WAVE_BUFFER_SIZE/2=" << WAVE_BUFFER_SIZE << LL_ENDL;
@@ -547,9 +547,9 @@ void LLStreamingAudio_FMODSTUDIO::setGain(F32 vol)
LLAudioStreamManagerFMODSTUDIO::LLAudioStreamManagerFMODSTUDIO(FMOD::System *system, FMOD::ChannelGroup *group, const std::string& url) :
mSystem(system),
mChannelGroup(group),
mStreamChannel(NULL),
mInternetStream(NULL),
mChannelGroup(group),
mReady(false)
{
mInternetStreamURL = url;
@@ -632,8 +632,7 @@ FMOD_RESULT LLAudioStreamManagerFMODSTUDIO::getOpenState(FMOD_OPENSTATE& state,
void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)
{
Check_FMOD_Error(mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES), "FMOD::System::setStreamBufferSize");
FMOD_ADVANCEDSETTINGS settings;
memset(&settings,0,sizeof(settings));
FMOD_ADVANCEDSETTINGS settings = {0};
settings.cbSize=sizeof(settings);
settings.defaultDecodeBufferSize = decodebuffertime;//ms
Check_FMOD_Error(mSystem->setAdvancedSettings(&settings), "FMOD::System::setAdvancedSettings");
@@ -672,4 +671,4 @@ void LLStreamingAudio_FMODSTUDIO::cleanupWaveData()
if(mStreamDSP)
Check_FMOD_Error(mStreamDSP->release(), "FMOD::DSP::release");
mStreamDSP = NULL;
}
}

View File

@@ -73,4 +73,3 @@ set_source_files_properties(${llcharacter_HEADER_FILES}
list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES})
add_library (llcharacter ${llcharacter_SOURCE_FILES})
add_dependencies(llcharacter prepare)

View File

@@ -1382,7 +1382,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
}
if (mJointMotionList->mDuration > MAX_ANIM_DURATION ||
!llfinite(mJointMotionList->mDuration))
!std::isfinite(mJointMotionList->mDuration))
{
LL_WARNS() << "invalid animation duration" << LL_ENDL;
return FALSE;
@@ -1407,14 +1407,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// get loop
//-------------------------------------------------------------------------
if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") ||
!llfinite(mJointMotionList->mLoopInPoint))
!std::isfinite(mJointMotionList->mLoopInPoint))
{
LL_WARNS() << "can't read loop point" << LL_ENDL;
return FALSE;
}
if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") ||
!llfinite(mJointMotionList->mLoopOutPoint))
!std::isfinite(mJointMotionList->mLoopOutPoint))
{
LL_WARNS() << "can't read loop point" << LL_ENDL;
return FALSE;
@@ -1430,14 +1430,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// get easeIn and easeOut
//-------------------------------------------------------------------------
if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") ||
!llfinite(mJointMotionList->mEaseInDuration))
!std::isfinite(mJointMotionList->mEaseInDuration))
{
LL_WARNS() << "can't read easeIn" << LL_ENDL;
return FALSE;
}
if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") ||
!llfinite(mJointMotionList->mEaseOutDuration))
!std::isfinite(mJointMotionList->mEaseOutDuration))
{
LL_WARNS() << "can't read easeOut" << LL_ENDL;
return FALSE;
@@ -1608,7 +1608,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (old_version)
{
if (!dp.unpackF32(time, "time") ||
!llfinite(time))
!std::isfinite(time))
{
LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL;
return FALSE;
@@ -1702,7 +1702,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (old_version)
{
if (!dp.unpackF32(pos_key.mTime, "time") ||
!llfinite(pos_key.mTime))
!std::isfinite(pos_key.mTime))
{
LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL;
return FALSE;
@@ -1907,28 +1907,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// constraintp->mTargetConstraintDir *= constraintp->mSourceConstraintOffset.magVec();
}
if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime))
if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !std::isfinite(constraintp->mEaseInStartTime))
{
LL_WARNS() << "can't read constraint ease in start time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime))
if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !std::isfinite(constraintp->mEaseInStopTime))
{
LL_WARNS() << "can't read constraint ease in stop time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime))
if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !std::isfinite(constraintp->mEaseOutStartTime))
{
LL_WARNS() << "can't read constraint ease out start time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime))
if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !std::isfinite(constraintp->mEaseOutStopTime))
{
LL_WARNS() << "can't read constraint ease out stop time" << LL_ENDL;
delete constraintp;

View File

@@ -30,7 +30,10 @@
#include "v3math.h"
#include "llstring.h"
#include "llxmltree.h"
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
class LLPolyMesh;
class LLXmlTreeNode;

View File

@@ -7,7 +7,11 @@ include(00-Common)
include(LLCommon)
include(APR)
include(Linking)
include(Boost)
include(LLSharedLibs)
include(GoogleBreakpad)
include(Copy3rdPartyLibs)
include(ZLIB)
include_directories(
${EXPAT_INCLUDE_DIRS}
@@ -229,7 +233,6 @@ set(llcommon_HEADER_FILES
lltypeinfolookup.h
lluri.h
lluuid.h
llversionviewer.h.in
llworkerthread.h
metaclass.h
metaclasst.h
@@ -249,13 +252,26 @@ set_source_files_properties(${llcommon_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND llcommon_SOURCE_FILES ${cwdebug_SOURCE_FILES})
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(WINDOWS)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
endif(WINDOWS)
add_dependencies(llcommon prepare)
if(NOT WORD_SIZE EQUAL 32)
if(NOT WINDOWS)
add_definitions(-fPIC)
endif(NOT WINDOWS)
endif(NOT WORD_SIZE EQUAL 32)
if(LLCOMMON_LINK_SHARED)
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(WINDOWS)
# always generate llcommon.pdb, even for "Release" builds
set_target_properties(llcommon PROPERTIES LINK_FLAGS "/DEBUG")
endif(WINDOWS)
ll_stage_sharedlib(llcommon)
else(LLCOMMON_LINK_SHARED)
add_library (llcommon ${llcommon_SOURCE_FILES})
endif(LLCOMMON_LINK_SHARED)
target_link_libraries(
llcommon
${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES}
@@ -280,3 +296,5 @@ if (DARWIN)
INSTALL_NAME_DIR "@executable_path/../Resources"
)
endif (DARWIN)
add_dependencies(llcommon stage_third_party_libs)

View File

@@ -96,16 +96,6 @@
#include "llthread.h"
#include "llerror.h"
// g++ 4.2.x (and before?) have the bug that when you try to pass a temporary
// to a function taking a const reference, it still calls the copy constructor.
// Define this to hack around that.
// Note that the chosen solution ONLY works for copying an AI*Access object that
// is passed to a function: the lifetime of the copied object must not be longer
// than the original (or at least, it shouldn't be used anymore after the
// original is destructed). This will be guaranteed if the code also compiles
// on a compiler that doesn't need this hack.
#define AI_NEED_ACCESS_CC (defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || (__GNUC__ < 4)))
template<typename T, typename RWLOCK> struct AIReadAccessConst;
template<typename T, typename RWLOCK> struct AIReadAccess;
template<typename T, typename RWLOCK> struct AIWriteAccess;
@@ -339,9 +329,6 @@ struct AIReadAccessConst
AIReadAccessConst(AIThreadSafe<T, RWLOCK> const& wrapper, bool high_priority = false)
: mWrapper(const_cast<AIThreadSafe<T, RWLOCK>&>(wrapper)),
mState(readlocked)
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{
mWrapper.mRWLock.rdlock(high_priority);
}
@@ -350,9 +337,6 @@ struct AIReadAccessConst
// These should never be dynamically allocated, so there is no need to make this virtual.
~AIReadAccessConst()
{
#if AI_NEED_ACCESS_CC
if (mIsCopyConstructed) return;
#endif
if (mState == readlocked)
mWrapper.mRWLock.rdunlock();
else if (mState == writelocked)
@@ -371,23 +355,14 @@ protected:
//! Constructor used by AIReadAccess.
AIReadAccessConst(AIThreadSafe<T, RWLOCK>& wrapper, state_type state)
: mWrapper(wrapper), mState(state)
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{ }
AIThreadSafe<T, RWLOCK>& mWrapper; //!< Reference to the object that we provide access to.
state_type const mState; //!< The lock state that mWrapper is in.
#if AI_NEED_ACCESS_CC
bool mIsCopyConstructed;
public:
AIReadAccessConst(AIReadAccessConst const& orig) : mWrapper(orig.mWrapper), mState(orig.mState), mIsCopyConstructed(true) { }
#else
private:
// Disallow copy constructing directly.
AIReadAccessConst(AIReadAccessConst const&);
#endif
};
/**
@@ -596,9 +571,6 @@ struct AIAccessConst
{
//! Construct a AIAccessConst from a constant AIThreadSafeSimple.
AIAccessConst(AIThreadSafeSimple<T, MUTEX> const& wrapper) : mWrapper(const_cast<AIThreadSafeSimple<T, MUTEX>&>(wrapper))
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{
this->mWrapper.mMutex.lock();
}
@@ -611,9 +583,6 @@ struct AIAccessConst
~AIAccessConst()
{
#if AI_NEED_ACCESS_CC
if (mIsCopyConstructed) return;
#endif
this->mWrapper.mMutex.unlock();
}
@@ -625,15 +594,9 @@ struct AIAccessConst
protected:
AIThreadSafeSimple<T, MUTEX>& mWrapper; //!< Reference to the object that we provide access to.
#if AI_NEED_ACCESS_CC
bool mIsCopyConstructed;
public:
AIAccessConst(AIAccessConst const& orig) : mWrapper(orig.mWrapper), mIsCopyConstructed(true) { }
#else
private:
// Disallow copy constructing directly.
AIAccessConst(AIAccessConst const&);
#endif
};
/**
@@ -817,14 +780,9 @@ struct AISTAccessConst
protected:
AIThreadSafeSingleThread<T>& mWrapper; //!< Reference to the object that we provide access to.
#if AI_NEED_ACCESS_CC
public:
AISTAccessConst(AISTAccessConst const& orig) : mWrapper(orig.mWrapper) { }
#else
private:
// Disallow copy constructing directly.
AISTAccessConst(AISTAccessConst const&);
#endif
};
/**

View File

@@ -50,7 +50,7 @@
#include "boost/atomic.hpp"
template<typename T>
struct impl_atomic_type { typedef boost::atomic<T> type; };
#elif defined(USE_STD_ATOMIC) && defined(LL_CPP11)
#elif defined(USE_STD_ATOMIC)
#include <atomic>
template<typename T>
struct impl_atomic_type { typedef std::atomic<T> type; };

View File

@@ -44,14 +44,6 @@ const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisa
// Maximum number of avatar picks
const S32 MAX_AVATAR_PICKS = 10;
// For Flags in AvatarPropertiesReply
const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified
char const* const VISIBILITY_DEFAULT = "default";
char const* const VISIBILITY_HIDDEN = "hidden";
char const* const VISIBILITY_VISIBLE = "visible";

View File

@@ -4,69 +4,60 @@
* @date 2006-02-05
* @brief Implementation of the date class
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
* Copyright (c) 2006-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "lldate.h"
#include "apr_time.h"
#include <time.h>
#include <locale.h>
#include <string>
#include <iomanip>
#include <iostream>
#include <sstream>
#include "llfasttimer.h"
#include "lltimer.h"
#include "llstring.h"
#include "llfasttimer.h"
#if defined(LL_WINDOWS) && !defined(timegm)
# define timegm _mkgmtime
#endif
#define EPOCH_STR "1970-01-01T00:00:00Z"
static const F64 DATE_EPOCH = 0.0;
static const F64 LL_APR_USEC_PER_SEC = 1000000.0;
// should be APR_USEC_PER_SEC, but that relies on INT64_C which
// isn't defined in glib under our build set up for some reason
static std::string sPrevLocale = "";
LLDate::LLDate() : mSecondsSinceEpoch(DATE_EPOCH)
{
}
{}
LLDate::LLDate(const LLDate& date) :
mSecondsSinceEpoch(date.mSecondsSinceEpoch)
{
}
{}
LLDate::LLDate(F64 seconds_since_epoch) :
mSecondsSinceEpoch(seconds_since_epoch)
{
}
{}
LLDate::LLDate(const std::string& iso8601_date)
{
@@ -92,37 +83,43 @@ std::string LLDate::asString() const
// is one of the standards used and the prefered format
std::string LLDate::asRFC1123() const
{
return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT"));
return toHTTPDateString(LLStringExplicit("%A, %d %b %Y %H:%M:%S GMT"));
}
LLFastTimer::DeclareTimer FT_DATE_FORMAT("Date Format");
std::string LLDate::toHTTPDateString (std::string fmt) const
std::string LLDate::toHTTPDateString(std::string fmt) const
{
LLFastTimer ft1(FT_DATE_FORMAT);
time_t locSeconds = (time_t) mSecondsSinceEpoch;
struct tm * gmt = gmtime (&locSeconds);
std::time_t locSeconds = (std::time_t) mSecondsSinceEpoch;
std::tm * gmt = gmtime (&locSeconds);
if (!gmt)
{
LL_WARNS() << "The impossible has happened!" << LL_ENDL;
return LLStringExplicit(EPOCH_STR);
}
return toHTTPDateString(gmt, fmt);
}
std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt)
std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt)
{
LLFastTimer ft1(FT_DATE_FORMAT);
// avoid calling setlocale() unnecessarily - it's expensive.
static std::string prev_locale = "";
std::string this_locale = LLStringUtil::getLocale();
if (this_locale != prev_locale)
if (this_locale != sPrevLocale)
{
setlocale(LC_TIME, this_locale.c_str());
prev_locale = this_locale;
sPrevLocale = this_locale;
}
// use strftime() as it appears to be faster than std::time_put
char buffer[128];
strftime(buffer, 128, fmt.c_str(), gmt);
if (std::strftime(buffer, 128, fmt.c_str(), gmt) == 0)
return LLStringExplicit(EPOCH_STR);
std::string res(buffer);
#if LL_WINDOWS
// Convert from locale-dependant charset to UTF-8 (EXT-8524).
res = ll_convert_string_to_utf8_string(res);
@@ -132,12 +129,18 @@ std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt)
void LLDate::toStream(std::ostream& s) const
{
apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC);
std::ios::fmtflags f( s.flags() );
apr_time_exp_t exp_time;
if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS)
std::tm exp_time = {0};
std::time_t time = static_cast<std::time_t>(mSecondsSinceEpoch);
#if LL_WINDOWS
if (gmtime_s(&exp_time, &time) != 0)
#else
if (!gmtime_r(&time, &exp_time))
#endif
{
s << "1970-01-01T00:00:00Z";
s << EPOCH_STR;
return;
}
@@ -153,22 +156,29 @@ void LLDate::toStream(std::ostream& s) const
<< 'T' << std::setw(2) << (exp_time.tm_hour)
<< ':' << std::setw(2) << (exp_time.tm_min)
<< ':' << std::setw(2) << (exp_time.tm_sec);
if (exp_time.tm_usec > 0)
{
s << '.' << std::setw(2)
<< (int)(exp_time.tm_usec / (LL_APR_USEC_PER_SEC / 100));
}
s << 'Z'
<< std::setfill(' ');
s.flags( f );
}
bool LLDate::split(S32 *year, S32 *month, S32 *day, S32 *hour, S32 *min, S32 *sec) const
{
apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC);
std::tm exp_time = {0};
std::time_t time = static_cast<std::time_t>(mSecondsSinceEpoch);
apr_time_exp_t exp_time;
if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS)
#if LL_WINDOWS
if (gmtime_s(&exp_time, &time) != 0)
#else
if (!gmtime_r(&time, &exp_time))
#endif
{
*year = 1970;
*month = 01;
*day = 01;
*hour = 00;
*min = 00;
*sec = 00;
return false;
}
@@ -201,60 +211,63 @@ bool LLDate::fromString(const std::string& iso8601_date)
bool LLDate::fromStream(std::istream& s)
{
struct apr_time_exp_t exp_time;
apr_int32_t tm_part;
std::tm time = {0};
int c;
#if LL_WINDOWS || LL_LINUX // GCC 4.8 lacks this Windows has broken std::get_time() Time for things to get ugly!
int32_t tm_part;
s >> tm_part;
exp_time.tm_year = tm_part - 1900;
time.tm_year = tm_part - 1900;
c = s.get(); // skip the hypen
if (c != '-') { return false; }
s >> tm_part;
exp_time.tm_mon = tm_part - 1;
time.tm_mon = tm_part - 1;
c = s.get(); // skip the hypen
if (c != '-') { return false; }
s >> tm_part;
exp_time.tm_mday = tm_part;
time.tm_mday = tm_part;
c = s.get(); // skip the T
if (c != 'T') { return false; }
s >> tm_part;
exp_time.tm_hour = tm_part;
time.tm_hour = tm_part;
c = s.get(); // skip the :
if (c != ':') { return false; }
s >> tm_part;
exp_time.tm_min = tm_part;
time.tm_min = tm_part;
c = s.get(); // skip the :
if (c != ':') { return false; }
s >> tm_part;
exp_time.tm_sec = tm_part;
time.tm_sec = tm_part;
// zero out the unused fields
exp_time.tm_usec = 0;
exp_time.tm_wday = 0;
exp_time.tm_yday = 0;
exp_time.tm_isdst = 0;
exp_time.tm_gmtoff = 0;
// generate a time_t from that
apr_time_t time;
if (apr_time_exp_gmt_get(&time, &exp_time) != APR_SUCCESS)
{
return false;
}
F64 seconds_since_epoch = time / LL_APR_USEC_PER_SEC;
// check for fractional
c = s.peek();
if(c == '.')
{
F64 fractional = 0.0;
s >> fractional;
seconds_since_epoch += fractional;
}
#else
std::string this_locale = LLStringUtil::getLocale();
if (this_locale != sPrevLocale)
{
setlocale(LC_TIME, this_locale.c_str());
sPrevLocale = this_locale;
}
// Isn't stdlib nice?
s.imbue(std::locale(sPrevLocale.c_str()));
s >> std::get_time(&time, "%Y-%m-%dT%H:%M:%S");
if (s.fail())
{
return false;
}
#endif
std::time_t tm = timegm(&time);
if (tm == -1)
return false;
F64 seconds_since_epoch = static_cast<F64>(tm);
c = s.peek(); // check for offset
if (c == '+' || c == '-')
{
@@ -270,7 +283,6 @@ bool LLDate::fromStream(std::istream& s)
{
s >> offset_minutes;
}
offset_in_seconds = (offset_hours * 60 + offset_sign * offset_minutes) * 60;
seconds_since_epoch -= offset_in_seconds;
}
@@ -282,7 +294,7 @@ bool LLDate::fromStream(std::istream& s)
bool LLDate::fromYMDHMS(S32 year, S32 month, S32 day, S32 hour, S32 min, S32 sec)
{
struct apr_time_exp_t exp_time;
std::tm exp_time = {0};
exp_time.tm_year = year - 1900;
exp_time.tm_mon = month - 1;
@@ -291,21 +303,11 @@ bool LLDate::fromYMDHMS(S32 year, S32 month, S32 day, S32 hour, S32 min, S32 sec
exp_time.tm_min = min;
exp_time.tm_sec = sec;
// zero out the unused fields
exp_time.tm_usec = 0;
exp_time.tm_wday = 0;
exp_time.tm_yday = 0;
exp_time.tm_isdst = 0;
exp_time.tm_gmtoff = 0;
// generate a time_t from that
apr_time_t time;
if (apr_time_exp_gmt_get(&time, &exp_time) != APR_SUCCESS)
{
std::time_t tm = timegm(&exp_time);
if (tm == -1)
return false;
}
mSecondsSinceEpoch = time / LL_APR_USEC_PER_SEC;
mSecondsSinceEpoch = static_cast<F64>(tm);
return true;
}

View File

@@ -39,7 +39,10 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
#include <boost/range/iterator_range.hpp>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/bind.hpp>
/*****************************************************************************

View File

@@ -58,7 +58,10 @@ static const int& nil(nil_);
#include <string>
#include <boost/shared_ptr.hpp>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/bind.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/utility/enable_if.hpp>

View File

@@ -32,7 +32,10 @@
#include "llevents.h"
#include "stdtypes.h"
#include "lltimer.h"
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
/**
* Generic base class

View File

@@ -56,7 +56,10 @@
#include <boost/visit_each.hpp>
#include <boost/ref.hpp> // reference_wrapper
#include <boost/type_traits/is_pointer.hpp>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/static_assert.hpp>
#include "llsd.h"
#include "llsingleton.h"

View File

@@ -157,6 +157,7 @@
#if LL_WINDOWS
#include "lltimer.h"
#include <intrin.h>
#elif LL_LINUX || LL_SOLARIS
#include <sys/time.h>
#include <sched.h>
@@ -184,7 +185,7 @@ LLMutex* LLFastTimer::sLogLock = NULL;
std::queue<LLSD> LLFastTimer::sLogQueue;
const int LLFastTimer::NamedTimer::HISTORY_NUM = 300;
#if defined(LL_WINDOWS) && !defined(_WIN64)
#if defined(LL_WINDOWS)
#define USE_RDTSC 1
#endif
@@ -952,34 +953,15 @@ LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state)
#if USE_RDTSC
U32 LLFastTimer::getCPUClockCount32()
{
U32 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
shr eax,8
shl edx,24
or eax, edx
mov dword ptr [ret_val], eax
}
return ret_val;
return (U32)(__rdtsc()>>8);
}
// return full timer value, *not* shifted by 8 bits
U64 LLFastTimer::getCPUClockCount64()
{
U64 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
mov eax,eax
mov edx,edx
mov dword ptr [ret_val+4], edx
mov dword ptr [ret_val], eax
}
return ret_val;
return (U64)__rdtsc();
}
#else
//LL_COMMON_API U64 get_clock_count(); // in lltimer.cpp
// These use QueryPerformanceCounter, which is arguably fine and also works on AMD architectures.

Some files were not shown because too many files have changed in this diff Show More