summaryrefslogtreecommitdiff
path: root/indra/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'indra/cmake')
-rw-r--r--indra/cmake/00-Common.cmake249
-rw-r--r--indra/cmake/APR.cmake63
-rw-r--r--indra/cmake/Audio.cmake42
-rw-r--r--indra/cmake/BerkeleyDB.cmake11
-rw-r--r--indra/cmake/Boost.cmake49
-rw-r--r--indra/cmake/BuildVersion.cmake18
-rw-r--r--indra/cmake/CARes.cmake24
-rw-r--r--indra/cmake/CMakeCopyIfDifferent.cmake41
-rw-r--r--indra/cmake/CMakeLists.txt103
-rw-r--r--indra/cmake/CSharpMacros.cmake142
-rw-r--r--indra/cmake/CURL.cmake19
-rw-r--r--indra/cmake/Copy3rdPartyLibs.cmake377
-rw-r--r--indra/cmake/CopyBackToSource.cmake16
-rw-r--r--indra/cmake/DBusGlib.cmake29
-rw-r--r--indra/cmake/DeploySharedLibs.cmake73
-rw-r--r--indra/cmake/DirectX.cmake44
-rw-r--r--indra/cmake/DragDrop.cmake23
-rw-r--r--indra/cmake/ELFIO.cmake19
-rw-r--r--indra/cmake/EXPAT.cmake17
-rw-r--r--indra/cmake/ExamplePlugin.cmake16
-rw-r--r--indra/cmake/Externals.cmake34
-rw-r--r--indra/cmake/FMOD.cmake24
-rw-r--r--indra/cmake/FindAPR.cmake94
-rw-r--r--indra/cmake/FindBerkeleyDB.cmake50
-rw-r--r--indra/cmake/FindCARes.cmake48
-rw-r--r--indra/cmake/FindELFIO.cmake48
-rw-r--r--indra/cmake/FindFMOD.cmake44
-rw-r--r--indra/cmake/FindGoogleBreakpad.cmake40
-rw-r--r--indra/cmake/FindGooglePerfTools.cmake66
-rw-r--r--indra/cmake/FindJsonCpp.cmake55
-rw-r--r--indra/cmake/FindMT.cmake15
-rw-r--r--indra/cmake/FindMono.cmake68
-rw-r--r--indra/cmake/FindMySQL.cmake48
-rw-r--r--indra/cmake/FindOpenJPEG.cmake50
-rw-r--r--indra/cmake/FindSCP.cmake40
-rw-r--r--indra/cmake/FindSVN.cmake34
-rw-r--r--indra/cmake/FindTut.cmake31
-rw-r--r--indra/cmake/FindXmlRpcEpi.cmake48
-rw-r--r--indra/cmake/FreeType.cmake20
-rw-r--r--indra/cmake/GStreamer010Plugin.cmake38
-rw-r--r--indra/cmake/GetPrerequisites_2_8.cmake786
-rw-r--r--indra/cmake/Glui.cmake28
-rw-r--r--indra/cmake/Glut.cmake19
-rw-r--r--indra/cmake/GoogleBreakpad.cmake19
-rw-r--r--indra/cmake/GoogleMock.cmake27
-rw-r--r--indra/cmake/GooglePerfTools.cmake42
-rw-r--r--indra/cmake/JPEG.cmake23
-rw-r--r--indra/cmake/JsonCpp.cmake22
-rw-r--r--indra/cmake/LLAddBuildTest.cmake265
-rw-r--r--indra/cmake/LLAudio.cmake10
-rw-r--r--indra/cmake/LLCharacter.cmake7
-rw-r--r--indra/cmake/LLCommon.cmake23
-rw-r--r--indra/cmake/LLCrashLogger.cmake7
-rw-r--r--indra/cmake/LLDatabase.cmake10
-rw-r--r--indra/cmake/LLImage.cmake11
-rw-r--r--indra/cmake/LLImageJ2COJ.cmake5
-rw-r--r--indra/cmake/LLInventory.cmake7
-rw-r--r--indra/cmake/LLKDU.cmake7
-rw-r--r--indra/cmake/LLLogin.cmake7
-rw-r--r--indra/cmake/LLMath.cmake7
-rw-r--r--indra/cmake/LLMessage.cmake15
-rw-r--r--indra/cmake/LLPlugin.cmake8
-rw-r--r--indra/cmake/LLPrimitive.cmake7
-rw-r--r--indra/cmake/LLRender.cmake32
-rw-r--r--indra/cmake/LLScene.cmake7
-rw-r--r--indra/cmake/LLSharedLibs.cmake75
-rw-r--r--indra/cmake/LLTestCommand.cmake16
-rw-r--r--indra/cmake/LLUI.cmake7
-rw-r--r--indra/cmake/LLVFS.cmake7
-rw-r--r--indra/cmake/LLWindow.cmake43
-rw-r--r--indra/cmake/LLXML.cmake12
-rw-r--r--indra/cmake/LLXUIXML.cmake7
-rw-r--r--indra/cmake/LScript.cmake16
-rw-r--r--indra/cmake/Linking.cmake57
-rw-r--r--indra/cmake/MediaPluginBase.cmake8
-rw-r--r--indra/cmake/MonoDeps.cmake48
-rw-r--r--indra/cmake/MonoEmbed.cmake57
-rw-r--r--indra/cmake/MySQL.cmake26
-rw-r--r--indra/cmake/NDOF.cmake14
-rw-r--r--indra/cmake/OPENAL.cmake28
-rw-r--r--indra/cmake/OpenGL.cmake9
-rw-r--r--indra/cmake/OpenJPEG.cmake22
-rw-r--r--indra/cmake/OpenSSL.cmake23
-rw-r--r--indra/cmake/PNG.cmake13
-rw-r--r--indra/cmake/PluginAPI.cmake16
-rw-r--r--indra/cmake/Prebuilt.cmake44
-rw-r--r--indra/cmake/Pth.cmake21
-rw-r--r--indra/cmake/PulseAudio.cmake28
-rw-r--r--indra/cmake/Python.cmake54
-rw-r--r--indra/cmake/QuickTimePlugin.cmake46
-rw-r--r--indra/cmake/TemplateCheck.cmake14
-rw-r--r--indra/cmake/Tut.cmake12
-rw-r--r--indra/cmake/UI.cmake64
-rw-r--r--indra/cmake/UnixInstall.cmake31
-rw-r--r--indra/cmake/Variables.cmake146
-rw-r--r--indra/cmake/ViewerMiscLibs.cmake16
-rw-r--r--indra/cmake/WebKitLibPlugin.cmake59
-rw-r--r--indra/cmake/XmlRpcEpi.cmake17
-rw-r--r--indra/cmake/ZLIB.cmake22
-rw-r--r--indra/cmake/cmake_dummy.cpp24
-rw-r--r--indra/cmake/run_build_test.py142
101 files changed, 4915 insertions, 0 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
new file mode 100644
index 0000000000..a114d6e778
--- /dev/null
+++ b/indra/cmake/00-Common.cmake
@@ -0,0 +1,249 @@
+# -*- cmake -*-
+#
+# Compilation options shared by all Second Life components.
+
+include(Variables)
+
+
+# Portable compilation flags.
+
+if (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
+ # The release build should only offer to send crash reports if we're
+ # building from a Linden internal source tree.
+ set(release_crash_reports 1)
+else (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
+ set(release_crash_reports 0)
+endif (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
+
+set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
+set(CMAKE_CXX_FLAGS_RELEASE
+ "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=${release_crash_reports} -DNDEBUG")
+
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ "-DLL_RELEASE=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
+
+
+# Don't bother with a MinSizeRel build.
+
+set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING
+ "Supported build types." FORCE)
+
+
+# Platform-specific compilation flags.
+
+if (WINDOWS)
+ # Don't build DLLs.
+ set(BUILD_SHARED_LIBS OFF)
+
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP"
+ CACHE STRING "C++ compiler debug options" FORCE)
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ "${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"
+ CACHE STRING "C++ compiler release options" FORCE)
+
+ set(CMAKE_CXX_STANDARD_LIBRARIES "")
+ set(CMAKE_C_STANDARD_LIBRARIES "")
+
+ add_definitions(
+ /DLL_WINDOWS=1
+ /DUNICODE
+ /D_UNICODE
+ /GS
+ /TP
+ /W3
+ /c
+ /Zc:forScope
+ /nologo
+ /Oy-
+ )
+
+ if(MSVC80 OR MSVC90)
+ set(CMAKE_CXX_FLAGS_RELEASE
+ "${CMAKE_CXX_FLAGS_RELEASE} -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
+ CACHE STRING "C++ compiler release options" FORCE)
+
+ add_definitions(
+ /Zc:wchar_t-
+ )
+ endif (MSVC80 OR MSVC90)
+
+ # Are we using the crummy Visual Studio KDU build workaround?
+ if (NOT VS_DISABLE_FATAL_WARNINGS)
+ add_definitions(/WX)
+ endif (NOT VS_DISABLE_FATAL_WARNINGS)
+
+ # 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}")
+endif (WINDOWS)
+
+
+if (LINUX)
+ set(CMAKE_SKIP_RPATH TRUE)
+
+ # Here's a giant hack for Fedora 8, where we can't use
+ # _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1.
+
+ find_program(GXX g++)
+ mark_as_advanced(GXX)
+
+ if (GXX)
+ execute_process(
+ COMMAND ${GXX} --version
+ COMMAND sed "s/^[gc+ ]*//"
+ COMMAND head -1
+ OUTPUT_VARIABLE GXX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ else (GXX)
+ set(GXX_VERSION x)
+ endif (GXX)
+
+ # The quoting hack here is necessary in case we're using distcc or
+ # ccache as our compiler. CMake doesn't pass the command line
+ # through the shell by default, so we end up trying to run "distcc"
+ # " g++" - notice the leading space. Ugh.
+
+ execute_process(
+ COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version"
+ COMMAND sed "s/^[gc+ ]*//"
+ COMMAND head -1
+ OUTPUT_VARIABLE CXX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (${GXX_VERSION} STREQUAL ${CXX_VERSION})
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ else (${GXX_VERSION} STREQUAL ${CXX_VERSION})
+ if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
+ endif (${GXX_VERSION} STREQUAL ${CXX_VERSION})
+
+ # Let's actually get a numerical version of gxx's version
+ STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION_NUMBER ${CXX_VERSION})
+
+ # gcc 4.3 and above don't like the LL boost and also
+ # cause warnings due to our use of deprecated headers
+ if(${CXX_VERSION_NUMBER} GREATER 429)
+ add_definitions(-Wno-parentheses)
+ set(CMAKE_CXX_FLAGS "-Wno-deprecated ${CMAKE_CXX_FLAGS}")
+ endif (${CXX_VERSION_NUMBER} GREATER 429)
+
+ # End of hacks.
+
+ add_definitions(
+ -DLL_LINUX=1
+ -D_REENTRANT
+ -fexceptions
+ -fno-math-errno
+ -fno-strict-aliasing
+ -fsigned-char
+ -g
+ -pthread
+ )
+
+ if (SERVER)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60")
+ if (EXISTS /etc/debian_version)
+ FILE(READ /etc/debian_version DEBIAN_VERSION)
+ else (EXISTS /etc/debian_version)
+ set(DEBIAN_VERSION "")
+ endif (EXISTS /etc/debian_version)
+
+ if (NOT DEBIAN_VERSION STREQUAL "3.1")
+ add_definitions(-DCTYPE_WORKAROUND)
+ endif (NOT DEBIAN_VERSION STREQUAL "3.1")
+
+ if (EXISTS /usr/lib/mysql4/mysql)
+ link_directories(/usr/lib/mysql4/mysql)
+ endif (EXISTS /usr/lib/mysql4/mysql)
+
+ add_definitions(
+ -msse2
+ -mfpmath=sse
+ )
+ endif (SERVER)
+
+ if (VIEWER)
+ add_definitions(-DAPPID=secondlife)
+ add_definitions(-fvisibility=hidden)
+ # don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
+ add_definitions(-DLL_IGNORE_SIGCHLD)
+ if (NOT STANDALONE)
+ # this stops us requiring a really recent glibc at runtime
+ add_definitions(-fno-stack-protector)
+ # linking can be very memory-hungry, especially the final viewer link
+ set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
+ endif (NOT STANDALONE)
+ endif (VIEWER)
+
+ set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
+endif (LINUX)
+
+
+if (DARWIN)
+ # NOTE (per http://lists.apple.com/archives/darwin-dev/2008/Jan/msg00232.html):
+ # > Why the bus error? What am I doing wrong?
+ # This is a known issue where getcontext(3) is writing past the end of the
+ # ucontext_t struct when _XOPEN_SOURCE is not defined (rdar://problem/5578699 ).
+ # As a workaround, define _XOPEN_SOURCE before including ucontext.h.
+ add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
+ set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(DARWIN_extra_cstar_flags "-mlong-branch")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}")
+ # NOTE: it's critical that the optimization flag is put in front.
+ # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+endif (DARWIN)
+
+
+if (LINUX OR DARWIN)
+ set(GCC_WARNINGS "-Wall -Wno-sign-compare -Wno-trigraphs")
+
+ if (NOT GCC_DISABLE_FATAL_WARNINGS)
+ set(GCC_WARNINGS "${GCC_WARNINGS} -Werror")
+ endif (NOT GCC_DISABLE_FATAL_WARNINGS)
+
+ set(GCC_CXX_WARNINGS "${GCC_WARNINGS} -Wno-reorder -Wno-non-virtual-dtor -Woverloaded-virtual")
+
+ set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
+
+ if (WORD_SIZE EQUAL 32)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+ elseif (WORD_SIZE EQUAL 64)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+ endif (WORD_SIZE EQUAL 32)
+endif (LINUX OR DARWIN)
+
+
+if (STANDALONE)
+ add_definitions(-DLL_STANDALONE=1)
+
+ if (LINUX AND ${ARCH} STREQUAL "i686")
+ add_definitions(-march=pentiumpro)
+ endif (LINUX AND ${ARCH} STREQUAL "i686")
+
+else (STANDALONE)
+ set(${ARCH}_linux_INCLUDES
+ ELFIO
+ atk-1.0
+ glib-2.0
+ gstreamer-0.10
+ gtk-2.0
+ pango-1.0
+ )
+endif (STANDALONE)
+
+if(SERVER)
+ include_directories(${LIBS_PREBUILT_DIR}/include/havok)
+endif(SERVER)
diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake
new file mode 100644
index 0000000000..180504d286
--- /dev/null
+++ b/indra/cmake/APR.cmake
@@ -0,0 +1,63 @@
+include(BerkeleyDB)
+include(Linking)
+include(Prebuilt)
+
+set(APR_FIND_QUIETLY ON)
+set(APR_FIND_REQUIRED ON)
+
+set(APRUTIL_FIND_QUIETLY ON)
+set(APRUTIL_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindAPR)
+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 ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apr-1.lib
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib
+ )
+ set(APRICONV_LIBRARIES
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apriconv-1.lib
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apriconv-1.lib
+ )
+ set(APRUTIL_LIBRARIES
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES}
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES}
+ )
+ elseif (DARWIN)
+ if (LLCOMMON_LINK_SHARED)
+ set(APR_selector "0.3.7.dylib")
+ set(APRUTIL_selector "0.3.8.dylib")
+ else (LLCOMMON_LINK_SHARED)
+ set(APR_selector "a")
+ set(APRUTIL_selector "a")
+ endif (LLCOMMON_LINK_SHARED)
+ set(APR_LIBRARIES
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.${APR_selector}
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.${APR_selector}
+ )
+ set(APRUTIL_LIBRARIES
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.${APRUTIL_selector}
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/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}/${LL_ARCH_DIR}/include/apr-1)
+
+ if (LINUX)
+ if (VIEWER)
+ list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)
+ endif (VIEWER)
+ list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} rt)
+ endif (LINUX)
+endif (STANDALONE)
diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake
new file mode 100644
index 0000000000..d23bc2f9c6
--- /dev/null
+++ b/indra/cmake/Audio.cmake
@@ -0,0 +1,42 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindPkgConfig)
+ pkg_check_modules(OGG REQUIRED ogg)
+ pkg_check_modules(VORBIS REQUIRED vorbis)
+ pkg_check_modules(VORBISENC REQUIRED vorbisenc)
+ pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
+else (STANDALONE)
+ 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})
+
+ if (WINDOWS)
+ set(OGG_LIBRARIES
+ optimized ogg_static
+ debug ogg_static_d)
+ set(VORBIS_LIBRARIES
+ optimized vorbis_static
+ debug vorbis_static_d)
+ set(VORBISENC_LIBRARIES
+ optimized vorbisenc_static
+ debug vorbisenc_static_d)
+ set(VORBISFILE_LIBRARIES
+ optimized vorbisfile_static
+ debug vorbisfile_static_d)
+ else (WINDOWS)
+ set(OGG_LIBRARIES ogg)
+ set(VORBIS_LIBRARIES vorbis)
+ set(VORBISENC_LIBRARIES vorbisenc)
+ set(VORBISFILE_LIBRARIES vorbisfile)
+ endif (WINDOWS)
+endif (STANDALONE)
+
+link_directories(
+ ${VORBIS_LIBRARY_DIRS}
+ ${VORBISENC_LIBRARY_DIRS}
+ ${VORBISFILE_LIBRARY_DIRS}
+ ${OGG_LIBRARY_DIRS}
+ )
diff --git a/indra/cmake/BerkeleyDB.cmake b/indra/cmake/BerkeleyDB.cmake
new file mode 100644
index 0000000000..d98e79179d
--- /dev/null
+++ b/indra/cmake/BerkeleyDB.cmake
@@ -0,0 +1,11 @@
+# -*- cmake -*-
+
+set(DB_FIND_QUIETLY ON)
+set(DB_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindBerkeleyDB)
+else (STANDALONE)
+ set(DB_LIBRARIES db-4.2)
+ set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+endif (STANDALONE)
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
new file mode 100644
index 0000000000..7ce57a5572
--- /dev/null
+++ b/indra/cmake/Boost.cmake
@@ -0,0 +1,49 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(Boost_FIND_QUIETLY ON)
+set(Boost_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindBoost)
+
+ set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
+ set(BOOST_REGEX_LIBRARY boost_regex-mt)
+ set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
+else (STANDALONE)
+ use_prebuilt_binary(boost)
+ set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+
+ if (WINDOWS)
+ set(BOOST_VERSION 1_39)
+ if (MSVC71)
+ set(BOOST_PROGRAM_OPTIONS_LIBRARY
+ optimized libboost_program_options-vc71-mt-s-${BOOST_VERSION}
+ debug libboost_program_options-vc71-mt-sgd-${BOOST_VERSION})
+ set(BOOST_REGEX_LIBRARY
+ optimized libboost_regex-vc71-mt-s-${BOOST_VERSION}
+ debug libboost_regex-vc71-mt-sgd-${BOOST_VERSION})
+ set(BOOST_SIGNALS_LIBRARY
+ optimized libboost_signals-vc71-mt-s-${BOOST_VERSION}
+ debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION})
+ else (MSVC71)
+ set(BOOST_PROGRAM_OPTIONS_LIBRARY
+ optimized libboost_program_options-vc80-mt-${BOOST_VERSION}
+ debug libboost_program_options-vc80-mt-gd-${BOOST_VERSION})
+ set(BOOST_REGEX_LIBRARY
+ optimized libboost_regex-vc80-mt-${BOOST_VERSION}
+ debug libboost_regex-vc80-mt-gd-${BOOST_VERSION})
+ set(BOOST_SIGNALS_LIBRARY
+ optimized libboost_signals-vc80-mt-${BOOST_VERSION}
+ debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
+ endif (MSVC71)
+ elseif (DARWIN)
+ set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-xgcc40-mt)
+ set(BOOST_REGEX_LIBRARY boost_regex-xgcc40-mt)
+ set(BOOST_SIGNALS_LIBRARY boost_signals-xgcc40-mt)
+ elseif (LINUX)
+ set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-gcc41-mt)
+ set(BOOST_REGEX_LIBRARY boost_regex-gcc41-mt)
+ set(BOOST_SIGNALS_LIBRARY boost_signals-gcc41-mt)
+ endif (WINDOWS)
+endif (STANDALONE)
diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake
new file mode 100644
index 0000000000..60a519c9af
--- /dev/null
+++ b/indra/cmake/BuildVersion.cmake
@@ -0,0 +1,18 @@
+# -*- cmake -*-
+
+include(Python)
+
+macro (build_version _target)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/build_version.py
+ llversion${_target}.h ${LLCOMMON_INCLUDE_DIRS}
+ OUTPUT_VARIABLE ${_target}_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ if (${_target}_VERSION)
+ message(STATUS "Version of ${_target} is ${${_target}_VERSION}")
+ else (${_target}_VERSION)
+ message(SEND_ERROR "Could not determine ${_target} version")
+ endif (${_target}_VERSION)
+endmacro (build_version)
diff --git a/indra/cmake/CARes.cmake b/indra/cmake/CARes.cmake
new file mode 100644
index 0000000000..1850b706ac
--- /dev/null
+++ b/indra/cmake/CARes.cmake
@@ -0,0 +1,24 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+set(CARES_FIND_QUIETLY ON)
+set(CARES_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindCARes)
+else (STANDALONE)
+ use_prebuilt_binary(ares)
+ add_definitions("-DCARES_STATICLIB")
+ if (WINDOWS)
+ set(CARES_LIBRARIES areslib)
+ elseif (DARWIN)
+ set(CARES_LIBRARIES
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libcares.a
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/libcares.a
+ )
+ else (WINDOWS)
+ set(CARES_LIBRARIES cares)
+ endif (WINDOWS)
+ set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares)
+endif (STANDALONE)
diff --git a/indra/cmake/CMakeCopyIfDifferent.cmake b/indra/cmake/CMakeCopyIfDifferent.cmake
new file mode 100644
index 0000000000..55e71ff153
--- /dev/null
+++ b/indra/cmake/CMakeCopyIfDifferent.cmake
@@ -0,0 +1,41 @@
+# -*- cmake -*-
+# Taken from http://www.cmake.org/Wiki/CMakeCopyIfDifferent
+# Generates a rule to copy each source file from source directory to destination directory.
+#
+# Typical use -
+#
+# SET(SRC_FILES head1.h head2.h head3.h)
+# COPY_IF_DIFFERENT( /from_dir /to_dir IncludeTargets ${SRC_FILES})
+# ADD_TARGET(CopyIncludes ALL DEPENDS ${IncludeTargets})
+
+MACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS)
+# Macro to implement copy_if_different for a list of files
+# Arguments -
+# FROM_DIR - this is the source directory
+# TO_DIR - this is the destination directory
+# TARGETS - A variable to receive a list of targets
+# FILES - names of the files to copy
+# TODO: add globing.
+SET(AddTargets "")
+FOREACH(SRC ${ARGN})
+ GET_FILENAME_COMPONENT(SRCFILE ${SRC} NAME)
+ IF("${FROM_DIR}" STREQUAL "")
+ SET(FROM ${SRC})
+ ELSE("${FROM_DIR}" STREQUAL "")
+ SET(FROM ${FROM_DIR}/${SRC})
+ ENDIF("${FROM_DIR}" STREQUAL "")
+ IF("${TO_DIR}" STREQUAL "")
+ SET(TO ${SRCFILE})
+ ELSE("${TO_DIR}" STREQUAL "")
+ SET(TO ${TO_DIR}/${SRCFILE})
+ ENDIF("${TO_DIR}" STREQUAL "")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${TO}"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO}
+ DEPENDS ${FROM}
+ COMMENT "Copying ${SRCFILE} ${TO_DIR}"
+ )
+ SET(AddTargets ${AddTargets} ${TO})
+ENDFOREACH(SRC ${ARGN})
+SET(${TARGETS} ${AddTargets})
+ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS)
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
new file mode 100644
index 0000000000..6470836286
--- /dev/null
+++ b/indra/cmake/CMakeLists.txt
@@ -0,0 +1,103 @@
+# -*- cmake -*-
+
+include(00-Common)
+
+project(cmake)
+
+set(cmake_SOURCE_FILES
+ CMakeLists.txt
+
+ 00-Common.cmake
+ APR.cmake
+ Audio.cmake
+ BerkeleyDB.cmake
+ Boost.cmake
+ BuildVersion.cmake
+ CARes.cmake
+ CURL.cmake
+ CMakeCopyIfDifferent.cmake
+ Copy3rdPartyLibs.cmake
+ CSharpMacros.cmake
+ DBusGlib.cmake
+ DirectX.cmake
+ ELFIO.cmake
+ EXPAT.cmake
+ FindAPR.cmake
+ FindBerkeleyDB.cmake
+ FindCARes.cmake
+ FindELFIO.cmake
+ FindFMOD.cmake
+ FindGooglePerfTools.cmake
+ FindMono.cmake
+ FindMT.cmake
+ FindMySQL.cmake
+ FindOpenJPEG.cmake
+ FindXmlRpcEpi.cmake
+ FMOD.cmake
+ FreeType.cmake
+ GStreamer010Plugin.cmake
+ GooglePerfTools.cmake
+ JPEG.cmake
+ LLAddBuildTest.cmake
+ LLAudio.cmake
+ LLCharacter.cmake
+ LLCommon.cmake
+ LLCrashLogger.cmake
+ LLDatabase.cmake
+ LLImage.cmake
+ LLImageJ2COJ.cmake
+ LLInventory.cmake
+ LLKDU.cmake
+ LLMath.cmake
+ LLMessage.cmake
+ LLPlugin.cmake
+ LLPrimitive.cmake
+ LLRender.cmake
+ LLScene.cmake
+ LLTestCommand.cmake
+ LLUI.cmake
+ LLVFS.cmake
+ LLWindow.cmake
+ LLXML.cmake
+ LScript.cmake
+ Linking.cmake
+ MonoEmbed.cmake
+ MySQL.cmake
+ NDOF.cmake
+ OPENAL.cmake
+ OpenGL.cmake
+ OpenJPEG.cmake
+ OpenSSL.cmake
+ PNG.cmake
+ Python.cmake
+ Prebuilt.cmake
+ TemplateCheck.cmake
+ Tut.cmake
+ UI.cmake
+ UnixInstall.cmake
+ Variables.cmake
+ XmlRpcEpi.cmake
+ ZLIB.cmake
+ )
+
+source_group("Shared Rules" FILES ${cmake_SOURCE_FILES})
+
+set(master_SOURCE_FILES
+ ../CMakeLists.txt
+ ../develop.py
+ )
+
+if (SERVER)
+ list(APPEND master_SOURCE_FILES ../Server.cmake)
+endif (SERVER)
+
+source_group("Master Rules" FILES ${master_SOURCE_FILES})
+
+set_source_files_properties(${cmake_SOURCE_FILES} ${master_SOURCE_FILES}
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+
+add_library(cmake
+ cmake_dummy.cpp
+ ${cmake_SOURCE_FILES}
+ ${master_SOURCE_FILES}
+ )
diff --git a/indra/cmake/CSharpMacros.cmake b/indra/cmake/CSharpMacros.cmake
new file mode 100644
index 0000000000..a4dd815043
--- /dev/null
+++ b/indra/cmake/CSharpMacros.cmake
@@ -0,0 +1,142 @@
+# - This is a support module for easy Mono/C# handling with CMake
+# It defines the following macros:
+#
+# ADD_CS_LIBRARY (<target> <source>)
+# ADD_CS_EXECUTABLE (<target> <source>)
+# INSTALL_GAC (<target>)
+#
+# Note that the order of the arguments is important.
+#
+# You can optionally set the variable CS_FLAGS to tell the macros whether
+# to pass additional flags to the compiler. This is particularly useful to
+# set assembly references, unsafe code, etc... These flags are always reset
+# after the target was added so you don't have to care about that.
+#
+# copyright (c) 2007 Arno Rehn arno@arnorehn.de
+#
+# Redistribution and use is allowed according to the terms of the GPL license.
+
+
+# ----- support macros -----
+MACRO(GET_CS_LIBRARY_TARGET_DIR)
+ IF (NOT LIBRARY_OUTPUT_PATH)
+ SET(CS_LIBRARY_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ ELSE (NOT LIBRARY_OUTPUT_PATH)
+ SET(CS_LIBRARY_TARGET_DIR ${LIBRARY_OUTPUT_PATH})
+ ENDIF (NOT LIBRARY_OUTPUT_PATH)
+ENDMACRO(GET_CS_LIBRARY_TARGET_DIR)
+
+MACRO(GET_CS_EXECUTABLE_TARGET_DIR)
+ IF (NOT EXECUTABLE_OUTPUT_PATH)
+ SET(CS_EXECUTABLE_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ ELSE (NOT EXECUTABLE_OUTPUT_PATH)
+ SET(CS_EXECUTABLE_TARGET_DIR ${EXECUTABLE_OUTPUT_PATH})
+ ENDIF (NOT EXECUTABLE_OUTPUT_PATH)
+ENDMACRO(GET_CS_EXECUTABLE_TARGET_DIR)
+
+MACRO(MAKE_PROPER_FILE_LIST)
+ FOREACH(file ${ARGN})
+ # first assume it's a relative path
+ FILE(GLOB globbed ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+ IF(globbed)
+ FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file} native)
+ ELSE(globbed)
+ FILE(TO_NATIVE_PATH ${file} native)
+ ENDIF(globbed)
+ SET(proper_file_list ${proper_file_list} ${native})
+ SET(native "")
+ ENDFOREACH(file)
+ENDMACRO(MAKE_PROPER_FILE_LIST)
+# ----- end support macros -----
+
+MACRO(ADD_CS_LIBRARY target)
+ GET_CS_LIBRARY_TARGET_DIR()
+
+ SET(target_DLL "${CS_LIBRARY_TARGET_DIR}/${target}.dll")
+ MAKE_PROPER_FILE_LIST(${ARGN})
+ FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_DLL})
+
+ SET(target_KEY "${CMAKE_CURRENT_SOURCE_DIR}/${target}.key")
+ SET(target_CS_FLAGS "${CS_FLAGS}")
+ IF(${target}_CS_FLAGS)
+ LIST(APPEND target_CS_FLAGS ${${target}_CS_FLAGS})
+ ENDIF(${target}_CS_FLAGS)
+ IF(EXISTS ${target_KEY})
+ LIST(APPEND target_CS_FLAGS -keyfile:${target_KEY})
+ ENDIF(EXISTS ${target_KEY})
+
+ FOREACH(ref ${${target}_REFS})
+ SET(ref_DLL ${CMAKE_CURRENT_BINARY_DIR}/${ref}.dll)
+ IF(EXISTS ${ref_DLL})
+ LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
+ ELSE(EXISTS ${ref_DLL})
+ LIST(APPEND target_CS_FLAGS -r:${ref})
+ ENDIF(EXISTS ${ref_DLL})
+ ENDFOREACH(ref ${${target}_REFS})
+
+ ADD_CUSTOM_COMMAND (OUTPUT ${target_DLL}
+ COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_DLL} -target:library ${proper_file_list}
+ MAIN_DEPENDENCY ${proper_file_list}
+ DEPENDS ${ARGN}
+ COMMENT "Building ${relative_path}")
+ ADD_CUSTOM_TARGET (${target} ALL DEPENDS ${target_DLL})
+
+ FOREACH(ref ${${target}_REFS})
+ GET_TARGET_PROPERTY(is_target ${ref} TYPE)
+ IF(is_target)
+ ADD_DEPENDENCIES(${target} ${ref})
+ ENDIF(is_target)
+ ENDFOREACH(ref ${${target}_REFS})
+
+ SET(relative_path "")
+ SET(proper_file_list "")
+ENDMACRO(ADD_CS_LIBRARY)
+
+MACRO(ADD_CS_EXECUTABLE target)
+ GET_CS_EXECUTABLE_TARGET_DIR()
+
+ # Seems like cmake doesn't like the ".exe" ending for custom commands.
+ # If we call it ${target}.exe, 'make' will later complain about a missing rule.
+ # Create a fake target instead.
+ SET(target_EXE "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe")
+ SET(target_TOUCH "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe-built")
+ GET_DIRECTORY_PROPERTY(clean ADDITIONAL_MAKE_CLEAN_FILES)
+ LIST(APPEND clean ${target}.exe)
+ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}")
+ MAKE_PROPER_FILE_LIST(${ARGN})
+ FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_EXE})
+ SET(target_CS_FLAGS "${CS_FLAGS}")
+
+ FOREACH(ref ${${target}_REFS})
+ SET(ref_DLL ${CMAKE_CURRENT_SOURCE_DIR}/${ref}.dll)
+ IF(EXISTS ${ref_DLL})
+ LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
+ ELSE(EXISTS ${ref_DLL})
+ LIST(APPEND target_CS_FLAGS -r:${ref})
+ ENDIF(EXISTS ${ref_DLL})
+ ENDFOREACH(ref ${${target}_REFS})
+
+ ADD_CUSTOM_COMMAND (OUTPUT "${target_TOUCH}"
+ COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_EXE} ${proper_file_list}
+ COMMAND ${CMAKE_COMMAND} -E touch ${target_TOUCH}
+ MAIN_DEPENDENCY ${ARGN}
+ DEPENDS ${ARGN}
+ COMMENT "Building ${relative_path}")
+ ADD_CUSTOM_TARGET ("${target}" ALL DEPENDS "${target_TOUCH}")
+
+ FOREACH(ref ${${target}_REFS})
+ GET_TARGET_PROPERTY(is_target ${ref} TYPE)
+ IF(is_target)
+ ADD_DEPENDENCIES(${target} ${ref})
+ ENDIF(is_target)
+ ENDFOREACH(ref ${${target}_REFS})
+
+ SET(relative_path "")
+ SET(proper_file_list "")
+ENDMACRO(ADD_CS_EXECUTABLE)
+
+MACRO(INSTALL_GAC target)
+ GET_CS_LIBRARY_TARGET_DIR()
+
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GACUTIL_EXECUTABLE} -i ${CS_LIBRARY_TARGET_DIR}/${target}.dll -package 2.0)")
+ENDMACRO(INSTALL_GAC target)
diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake
new file mode 100644
index 0000000000..6e5fed4d52
--- /dev/null
+++ b/indra/cmake/CURL.cmake
@@ -0,0 +1,19 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(CURL_FIND_QUIETLY ON)
+set(CURL_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindCURL)
+else (STANDALONE)
+ use_prebuilt_binary(curl)
+ if (WINDOWS)
+ set(CURL_LIBRARIES
+ debug libcurld
+ optimized libcurl)
+ else (WINDOWS)
+ set(CURL_LIBRARIES curl)
+ endif (WINDOWS)
+ set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+endif (STANDALONE)
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
new file mode 100644
index 0000000000..e852cf463c
--- /dev/null
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -0,0 +1,377 @@
+# -*- 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)
+
+###################################################################
+# 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 "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
+ set(vivox_files
+ SLVoice.exe
+ libsndfile-1.dll
+ vivoxplatform.dll
+ vivoxsdk.dll
+ ortp.dll
+ zlib1.dll
+ vivoxoal.dll
+ )
+
+ #*******************************
+ # Misc shared libs
+
+ # *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-win32/lib/debug")
+ set(debug_files
+ openjpegd.dll
+ libapr-1.dll
+ libaprutil-1.dll
+ libapriconv-1.dll
+ )
+
+ # *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-win32/lib/release")
+ set(release_files
+ openjpeg.dll
+ libapr-1.dll
+ libaprutil-1.dll
+ libapriconv-1.dll
+ )
+
+ if(USE_GOOGLE_PERFTOOLS)
+ set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll)
+ set(release_files ${release_files} libtcmalloc_minimal.dll)
+ endif(USE_GOOGLE_PERFTOOLS)
+
+ if (FMOD)
+ set(debug_files ${debug_files} fmod.dll)
+ set(release_files ${release_files} fmod.dll)
+ endif (FMOD)
+
+ #*******************************
+ # LLKDU
+ set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+ if(NOT EXISTS ${internal_llkdu_path})
+ if (EXISTS "${debug_src_dir}/llkdu.dll")
+ set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
+ set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/llkdu.dll")
+ endif (EXISTS "${debug_src_dir}/llkdu.dll")
+
+ if (EXISTS "${release_src_dir}/llkdu.dll")
+ set(release_llkdu_src "${release_src_dir}/llkdu.dll")
+ set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/llkdu.dll")
+ set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/llkdu.dll")
+ endif (EXISTS "${release_src_dir}/llkdu.dll")
+ endif (NOT EXISTS ${internal_llkdu_path})
+
+#*******************************
+# Copy MS C runtime dlls, required for packaging.
+# *TODO - Adapt this to support VC9
+if (MSVC80)
+ FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
+ NO_DEFAULT_PATH
+ NO_DEFAULT_PATH
+ )
+
+ if(EXISTS ${debug_msvc8_redist_path})
+ set(debug_msvc8_files
+ msvcr80d.dll
+ msvcp80d.dll
+ Microsoft.VC80.DebugCRT.manifest
+ )
+
+ copy_if_different(
+ ${debug_msvc8_redist_path}
+ "${SHARED_LIB_STAGING_DIR_DEBUG}"
+ out_targets
+ ${debug_msvc8_files}
+ )
+ set(third_party_targets ${third_party_targets} ${out_targets})
+
+ endif (EXISTS ${debug_msvc8_redist_path})
+
+ FIND_PATH(release_msvc8_redist_path msvcr80.dll
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
+ NO_DEFAULT_PATH
+ NO_DEFAULT_PATH
+ )
+
+ if(EXISTS ${release_msvc8_redist_path})
+ set(release_msvc8_files
+ msvcr80.dll
+ msvcp80.dll
+ Microsoft.VC80.CRT.manifest
+ )
+
+ copy_if_different(
+ ${release_msvc8_redist_path}
+ "${SHARED_LIB_STAGING_DIR_RELEASE}"
+ out_targets
+ ${release_msvc8_files}
+ )
+ set(third_party_targets ${third_party_targets} ${out_targets})
+
+ copy_if_different(
+ ${release_msvc8_redist_path}
+ "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+ out_targets
+ ${release_msvc8_files}
+ )
+ set(third_party_targets ${third_party_targets} ${out_targets})
+
+ endif (EXISTS ${release_msvc8_redist_path})
+endif (MSVC80)
+
+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 "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/universal-darwin")
+ set(vivox_files
+ SLVoice
+ libsndfile.dylib
+ libvivoxoal.dylib
+ libortp.dylib
+ libvivoxplatform.dylib
+ libvivoxsdk.dylib
+ )
+ # *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/universal-darwin/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/universal-darwin/lib_release")
+ set(release_files
+ libapr-1.0.3.7.dylib
+ libapr-1.dylib
+ libaprutil-1.0.3.8.dylib
+ libaprutil-1.dylib
+ libexpat.0.5.0.dylib
+ libexpat.dylib
+ libllqtwebkit.dylib
+ libndofdev.dylib
+ libexception_handler.dylib
+ )
+
+ # fmod is statically linked on darwin
+ set(fmod_files "")
+
+ #*******************************
+ # LLKDU
+ set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+ if(NOT EXISTS ${internal_llkdu_path})
+ if (EXISTS "${debug_src_dir}/libllkdu.dylib")
+ set(debug_llkdu_src "${debug_src_dir}/libllkdu.dylib")
+ set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.dylib")
+ endif (EXISTS "${debug_src_dir}/libllkdu.dylib")
+
+ if (EXISTS "${release_src_dir}/libllkdu.dylib")
+ set(release_llkdu_src "${release_src_dir}/libllkdu.dylib")
+ set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.dylib")
+ set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.dylib")
+ endif (EXISTS "${release_src_dir}/libllkdu.dylib")
+ endif (NOT EXISTS ${internal_llkdu_path})
+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 "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
+ set(vivox_files
+ libsndfile.so.1
+ libortp.so
+ libvivoxoal.so.1
+ libvivoxplatform.so
+ libvivoxsdk.so
+ SLVoice
+ )
+ # *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_client")
+ # *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
+ libbreakpad_client.so.0
+ libcrypto.so.0.9.7
+ libdb-4.2.so
+ libexpat.so
+ libexpat.so.1
+ libgmock_main.so
+ libgmock.so.0
+ libgmodule-2.0.so
+ libgobject-2.0.so
+ libgtest_main.so
+ libgtest.so.0
+ libopenal.so
+ libopenjpeg.so
+ libssl.so
+ libstacktrace.so
+ libtcmalloc.so
+ libuuid.so.1
+ libssl.so.0.9.7
+ )
+
+ if (FMOD)
+ set(release_files ${release_files} "libfmod-3.75.so")
+ endif (FMOD)
+
+ #*******************************
+ # LLKDU
+ set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+ if(NOT EXISTS ${internal_llkdu_path})
+ if (EXISTS "${debug_src_dir}/libllkdu.so")
+ set(debug_llkdu_src "${debug_src_dir}/libllkdu.so")
+ set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.so")
+ endif (EXISTS "${debug_src_dir}/libllkdu.so")
+
+ if (EXISTS "${release_src_dir}/libllkdu.so")
+ set(release_llkdu_src "${release_src_dir}/libllkdu.so")
+ set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.so")
+ set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.so")
+ endif (EXISTS "${release_src_dir}/libllkdu.so")
+ endif(NOT EXISTS ${internal_llkdu_path})
+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(fmod_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})
+
+#*******************************
+# LLKDU
+set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+if(NOT EXISTS ${internal_llkdu_path})
+ if (EXISTS "${debug_llkdu_src}")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${debug_llkdu_dst}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
+ DEPENDS ${debug_llkdu_src}
+ COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_DEBUG}"
+ )
+ set(third_party_targets ${third_party_targets} $} ${debug_llkdu_dst})
+ endif (EXISTS "${debug_llkdu_src}")
+
+ if (EXISTS "${release_llkdu_src}")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${release_llkdu_dst}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
+ DEPENDS ${release_llkdu_src}
+ COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELEASE}"
+ )
+ set(third_party_targets ${third_party_targets} ${release_llkdu_dst})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${relwithdebinfo_llkdu_dst}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
+ DEPENDS ${release_llkdu_src}
+ COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+ )
+ set(third_party_targets ${third_party_targets} ${relwithdebinfo_llkdu_dst})
+ endif (EXISTS "${release_llkdu_src}")
+
+endif (NOT EXISTS ${internal_llkdu_path})
+
+
+if(NOT STANDALONE)
+ add_custom_target(
+ stage_third_party_libs ALL
+ DEPENDS ${third_party_targets}
+ )
+endif(NOT STANDALONE)
diff --git a/indra/cmake/CopyBackToSource.cmake b/indra/cmake/CopyBackToSource.cmake
new file mode 100644
index 0000000000..d217df9aec
--- /dev/null
+++ b/indra/cmake/CopyBackToSource.cmake
@@ -0,0 +1,16 @@
+# -*- cmake -*-
+# Copies a binary back to the source directory
+
+MACRO(COPY_BACK_TO_SOURCE target)
+ GET_TARGET_PROPERTY(FROM ${target} LOCATION)
+ 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)
+
+
diff --git a/indra/cmake/DBusGlib.cmake b/indra/cmake/DBusGlib.cmake
new file mode 100644
index 0000000000..cfc4ccd404
--- /dev/null
+++ b/indra/cmake/DBusGlib.cmake
@@ -0,0 +1,29 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindPkgConfig)
+
+ pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1)
+
+elseif (LINUX)
+ use_prebuilt_binary(dbusglib)
+ set(DBUSGLIB_FOUND ON FORCE BOOL)
+ set(DBUSGLIB_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0
+ )
+ # We don't need to explicitly link against dbus-glib itself, because
+ # the viewer probes for the system's copy at runtime.
+ set(DBUSGLIB_LIBRARIES
+ gobject-2.0
+ glib-2.0
+ )
+endif (STANDALONE)
+
+if (DBUSGLIB_FOUND)
+ set(DBUSGLIB ON CACHE BOOL "Build with dbus-glib message bus support.")
+endif (DBUSGLIB_FOUND)
+
+if (DBUSGLIB)
+ add_definitions(-DLL_DBUS_ENABLED=1)
+endif (DBUSGLIB)
diff --git a/indra/cmake/DeploySharedLibs.cmake b/indra/cmake/DeploySharedLibs.cmake
new file mode 100644
index 0000000000..663c272e50
--- /dev/null
+++ b/indra/cmake/DeploySharedLibs.cmake
@@ -0,0 +1,73 @@
+# 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.
+
+# *FIX:Mani - I pulled in the CMake 2.8 GetPrerequisites.cmake script here, because it works on windows where 2.6 did not.
+# Once we have officially upgraded to 2.8 we can just use that version of GetPrerequisites.cmake.
+get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
+include(${current_dir}/GetPrerequisites_2_8.cmake)
+
+message("Getting recursive dependencies for file: ${BIN_NAME}")
+
+set(EXCLUDE_SYSTEM 1)
+set(RECURSE 1)
+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!")
diff --git a/indra/cmake/DirectX.cmake b/indra/cmake/DirectX.cmake
new file mode 100644
index 0000000000..29724ee2fc
--- /dev/null
+++ b/indra/cmake/DirectX.cmake
@@ -0,0 +1,44 @@
+# -*- cmake -*-
+
+if (VIEWER AND WINDOWS)
+ find_path(DIRECTX_INCLUDE_DIR dxdiag.h
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2008)/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2008)/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (November 2007)/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2007)/Include"
+ "C:/DX90SDK/Include"
+ "$ENV{PROGRAMFILES}/DX90SDK/Include"
+ )
+ 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)
+
+
+ find_path(DIRECTX_LIBRARY_DIR dxguid.lib
+ "$ENV{DXSDK_DIR}/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2008)/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2008)/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (November 2007)/Lib/x86"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2007)/Lib/x86"
+ "C:/DX90SDK/Lib"
+ "$ENV{PROGRAMFILES}/DX90SDK/Lib"
+ )
+ 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 (VIEWER AND WINDOWS)
diff --git a/indra/cmake/DragDrop.cmake b/indra/cmake/DragDrop.cmake
new file mode 100644
index 0000000000..c0424396e5
--- /dev/null
+++ b/indra/cmake/DragDrop.cmake
@@ -0,0 +1,23 @@
+# -*- cmake -*-
+
+if (VIEWER)
+
+ set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off")
+
+ if (OS_DRAG_DROP)
+
+ if (WINDOWS)
+ add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
+ endif (WINDOWS)
+
+ if (DARWIN)
+ add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
+ endif (DARWIN)
+
+ if (LINUX)
+ add_definitions(-DLL_OS_DRAGDROP_ENABLED=0)
+ endif (LINUX)
+
+ endif (OS_DRAG_DROP)
+
+endif (VIEWER)
diff --git a/indra/cmake/ELFIO.cmake b/indra/cmake/ELFIO.cmake
new file mode 100644
index 0000000000..e51993b0f7
--- /dev/null
+++ b/indra/cmake/ELFIO.cmake
@@ -0,0 +1,19 @@
+# -*- 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)
+ set(ELFIO_FOUND "YES")
+endif (STANDALONE)
+
+if (ELFIO_FOUND)
+ add_definitions(-DLL_ELFBIN=1)
+else (ELFIO_FOUND)
+ set(ELFIO_INCLUDE_DIR "")
+endif (ELFIO_FOUND)
diff --git a/indra/cmake/EXPAT.cmake b/indra/cmake/EXPAT.cmake
new file mode 100644
index 0000000000..acb15dc623
--- /dev/null
+++ b/indra/cmake/EXPAT.cmake
@@ -0,0 +1,17 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(EXPAT_FIND_QUIETLY ON)
+set(EXPAT_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindEXPAT)
+else (STANDALONE)
+ use_prebuilt_binary(expat)
+ if (WINDOWS)
+ set(EXPAT_LIBRARIES libexpatMT)
+ else (WINDOWS)
+ set(EXPAT_LIBRARIES expat)
+ endif (WINDOWS)
+ set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+endif (STANDALONE)
diff --git a/indra/cmake/ExamplePlugin.cmake b/indra/cmake/ExamplePlugin.cmake
new file mode 100644
index 0000000000..599787ad21
--- /dev/null
+++ b/indra/cmake/ExamplePlugin.cmake
@@ -0,0 +1,16 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+if (STANDALONE)
+ set(EXAMPLEPLUGIN OFF CACHE BOOL
+ "EXAMPLEPLUGIN support for the llplugin/llmedia test apps.")
+else (STANDALONE)
+ set(EXAMPLEPLUGIN ON CACHE BOOL
+ "EXAMPLEPLUGIN support for the llplugin/llmedia test apps.")
+endif (STANDALONE)
+
+if (WINDOWS)
+elseif (DARWIN)
+elseif (LINUX)
+endif (WINDOWS)
diff --git a/indra/cmake/Externals.cmake b/indra/cmake/Externals.cmake
new file mode 100644
index 0000000000..26f3b56049
--- /dev/null
+++ b/indra/cmake/Externals.cmake
@@ -0,0 +1,34 @@
+# -*- cmake -*-
+
+include(Python)
+include(FindSVN)
+
+macro (use_svn_external _binary _path _url _rev)
+ if (NOT STANDALONE)
+ if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ if(SVN_FOUND)
+ if(DEBUG_EXTERNALS)
+ message("cd ${_path} && ${SVN_EXECUTABLE} checkout -r ${_rev} ${_url} ${_binary}")
+ endif(DEBUG_EXTERNALS)
+ execute_process(COMMAND ${SVN_EXECUTABLE}
+ checkout
+ -r ${_rev}
+ ${_url}
+ ${_binary}
+ WORKING_DIRECTORY ${_path}
+ RESULT_VARIABLE ${_binary}_installed
+ )
+ else(SVN_FOUND)
+ message(FATAL_ERROR "Failed to find SVN_EXECUTABLE")
+ endif(SVN_FOUND)
+ file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
+ else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ set(${_binary}_installed 0)
+ endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ 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 STANDALONE)
+endmacro (use_svn_external _binary _path _url _rev)
diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake
new file mode 100644
index 0000000000..96434e38fa
--- /dev/null
+++ b/indra/cmake/FMOD.cmake
@@ -0,0 +1,24 @@
+# -*- cmake -*-
+
+set(FMOD ON CACHE BOOL "Use FMOD sound library.")
+
+if (FMOD)
+ if (STANDALONE)
+ set(FMOD_FIND_REQUIRED ON)
+ include(FindFMOD)
+ else (STANDALONE)
+ include(Prebuilt)
+ use_prebuilt_binary(fmod)
+
+ if (WINDOWS)
+ set(FMOD_LIBRARY fmod)
+ elseif (DARWIN)
+ set(FMOD_LIBRARY fmod)
+ elseif (LINUX)
+ set(FMOD_LIBRARY fmod-3.75)
+ endif (WINDOWS)
+
+ SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
+ set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
+ endif (STANDALONE)
+endif (FMOD)
diff --git a/indra/cmake/FindAPR.cmake b/indra/cmake/FindAPR.cmake
new file mode 100644
index 0000000000..906b6c9452
--- /dev/null
+++ b/indra/cmake/FindAPR.cmake
@@ -0,0 +1,94 @@
+# -*- cmake -*-
+
+# - Find Apache Portable Runtime
+# Find the APR includes and libraries
+# This module defines
+# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
+# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
+# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
+# also defined, but not for general use are
+# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
+
+# APR first.
+
+FIND_PATH(APR_INCLUDE_DIR apr.h
+/usr/local/include/apr-1
+/usr/local/include/apr-1.0
+/usr/include/apr-1
+/usr/include/apr-1.0
+)
+
+SET(APR_NAMES ${APR_NAMES} apr-1)
+FIND_LIBRARY(APR_LIBRARY
+ NAMES ${APR_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (APR_LIBRARY AND APR_INCLUDE_DIR)
+ SET(APR_LIBRARIES ${APR_LIBRARY})
+ SET(APR_FOUND "YES")
+ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
+ SET(APR_FOUND "NO")
+ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
+
+
+IF (APR_FOUND)
+ IF (NOT APR_FIND_QUIETLY)
+ MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}")
+ ENDIF (NOT APR_FIND_QUIETLY)
+ELSE (APR_FOUND)
+ IF (APR_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find APR library")
+ ENDIF (APR_FIND_REQUIRED)
+ENDIF (APR_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ APR_LIBRARY
+ APR_INCLUDE_DIR
+ )
+
+# Next, APRUTIL.
+
+FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
+/usr/local/include/apr-1
+/usr/local/include/apr-1.0
+/usr/include/apr-1
+/usr/include/apr-1.0
+)
+
+SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1)
+FIND_LIBRARY(APRUTIL_LIBRARY
+ NAMES ${APRUTIL_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+ SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
+ SET(APRUTIL_FOUND "YES")
+ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+ SET(APRUTIL_FOUND "NO")
+ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+
+
+IF (APRUTIL_FOUND)
+ IF (NOT APRUTIL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}")
+ ENDIF (NOT APRUTIL_FIND_QUIETLY)
+ELSE (APRUTIL_FOUND)
+ IF (APRUTIL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find APRUTIL library")
+ ENDIF (APRUTIL_FIND_REQUIRED)
+ENDIF (APRUTIL_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ APRUTIL_LIBRARY
+ APRUTIL_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindBerkeleyDB.cmake b/indra/cmake/FindBerkeleyDB.cmake
new file mode 100644
index 0000000000..2d633c74ec
--- /dev/null
+++ b/indra/cmake/FindBerkeleyDB.cmake
@@ -0,0 +1,50 @@
+# -*- 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
+ )
diff --git a/indra/cmake/FindCARes.cmake b/indra/cmake/FindCARes.cmake
new file mode 100644
index 0000000000..1ed5b32913
--- /dev/null
+++ b/indra/cmake/FindCARes.cmake
@@ -0,0 +1,48 @@
+# -*- cmake -*-
+
+# - Find c-ares
+# Find the c-ares includes and library
+# This module defines
+# CARES_INCLUDE_DIR, where to find ares.h, etc.
+# CARES_LIBRARIES, the libraries needed to use c-ares.
+# CARES_FOUND, If false, do not try to use c-ares.
+# also defined, but not for general use are
+# CARES_LIBRARY, where to find the c-ares library.
+
+FIND_PATH(CARES_INCLUDE_DIR ares.h
+/usr/local/include
+/usr/include
+)
+
+SET(CARES_NAMES ${CARES_NAMES} cares)
+FIND_LIBRARY(CARES_LIBRARY
+ NAMES ${CARES_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (CARES_LIBRARY AND CARES_INCLUDE_DIR)
+ SET(CARES_LIBRARIES ${CARES_LIBRARY})
+ SET(CARES_FOUND "YES")
+ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR)
+ SET(CARES_FOUND "NO")
+ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR)
+
+
+IF (CARES_FOUND)
+ IF (NOT CARES_FIND_QUIETLY)
+ MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}")
+ ENDIF (NOT CARES_FIND_QUIETLY)
+ELSE (CARES_FOUND)
+ IF (CARES_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find c-ares library")
+ ENDIF (CARES_FIND_REQUIRED)
+ENDIF (CARES_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_CARES_INCLUDE_PATH ${CARES_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_CARES_LIB_PATH ${CARES_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ CARES_LIBRARY
+ CARES_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindELFIO.cmake b/indra/cmake/FindELFIO.cmake
new file mode 100644
index 0000000000..8a5421ab9c
--- /dev/null
+++ b/indra/cmake/FindELFIO.cmake
@@ -0,0 +1,48 @@
+# -*- 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
+ )
diff --git a/indra/cmake/FindFMOD.cmake b/indra/cmake/FindFMOD.cmake
new file mode 100644
index 0000000000..e60b386027
--- /dev/null
+++ b/indra/cmake/FindFMOD.cmake
@@ -0,0 +1,44 @@
+# -*- cmake -*-
+
+# - Find FMOD
+# Find the FMOD includes and library
+# This module defines
+# FMOD_INCLUDE_DIR, where to find fmod.h and fmod_errors.h
+# FMOD_LIBRARIES, the libraries needed to use FMOD.
+# FMOD, If false, do not try to use FMOD.
+# also defined, but not for general use are
+# FMOD_LIBRARY, where to find the FMOD library.
+
+FIND_PATH(FMOD_INCLUDE_DIR fmod.h PATH_SUFFIXES fmod)
+
+SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmod-3.75)
+FIND_LIBRARY(FMOD_LIBRARY
+ NAMES ${FMOD_NAMES}
+ PATH_SUFFIXES fmod
+ )
+
+IF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
+ SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
+ SET(FMOD_FOUND "YES")
+ELSE (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
+ SET(FMOD_FOUND "NO")
+ENDIF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
+
+IF (FMOD_FOUND)
+ IF (NOT FMOD_FIND_QUIETLY)
+ MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARIES}")
+ ENDIF (NOT FMOD_FIND_QUIETLY)
+ELSE (FMOD_FOUND)
+ IF (FMOD_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find FMOD library")
+ ENDIF (FMOD_FIND_REQUIRED)
+ENDIF (FMOD_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_FMOD_INCLUDE_PATH ${FMOD_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_FMOD_LIB_PATH ${FMOD_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ FMOD_LIBRARY
+ FMOD_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindGoogleBreakpad.cmake b/indra/cmake/FindGoogleBreakpad.cmake
new file mode 100644
index 0000000000..1a0493be5e
--- /dev/null
+++ b/indra/cmake/FindGoogleBreakpad.cmake
@@ -0,0 +1,40 @@
+# -*- cmake -*-
+
+# - Find Google BreakPad
+# Find the Google BreakPad includes and library
+# This module defines
+# BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR, where to find exception_handler.h, etc.
+# BREAKPAD_EXCEPTION_HANDLER_LIBRARIES, the libraries needed to use Google BreakPad.
+# BREAKPAD_EXCEPTION_HANDLER_FOUND, If false, do not try to use Google BreakPad.
+# also defined, but not for general use are
+# BREAKPAD_EXCEPTION_HANDLER_LIBRARY, where to find the Google BreakPad library.
+
+FIND_PATH(BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR google_breakpad/exception_handler.h)
+
+SET(BREAKPAD_EXCEPTION_HANDLER_NAMES ${BREAKPAD_EXCEPTION_HANDLER_NAMES} breakpad_client)
+FIND_LIBRARY(BREAKPAD_EXCEPTION_HANDLER_LIBRARY
+ NAMES ${BREAKPAD_EXCEPTION_HANDLER_NAMES}
+ )
+
+IF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR)
+ SET(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES ${BREAKPAD_EXCEPTION_HANDLER_LIBRARY})
+ SET(BREAKPAD_EXCEPTION_HANDLER_FOUND "YES")
+ELSE (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR)
+ SET(BREAKPAD_EXCEPTION_HANDLER_FOUND "NO")
+ENDIF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR)
+
+
+IF (BREAKPAD_EXCEPTION_HANDLER_FOUND)
+ IF (NOT BREAKPAD_EXCEPTION_HANDLER_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Google BreakPad: ${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES}")
+ ENDIF (NOT BREAKPAD_EXCEPTION_HANDLER_FIND_QUIETLY)
+ELSE (BREAKPAD_EXCEPTION_HANDLER_FOUND)
+ IF (BREAKPAD_EXCEPTION_HANDLER_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Google BreakPad library")
+ ENDIF (BREAKPAD_EXCEPTION_HANDLER_FIND_REQUIRED)
+ENDIF (BREAKPAD_EXCEPTION_HANDLER_FOUND)
+
+MARK_AS_ADVANCED(
+ BREAKPAD_EXCEPTION_HANDLER_LIBRARY
+ BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindGooglePerfTools.cmake b/indra/cmake/FindGooglePerfTools.cmake
new file mode 100644
index 0000000000..bb125d538e
--- /dev/null
+++ b/indra/cmake/FindGooglePerfTools.cmake
@@ -0,0 +1,66 @@
+# -*- cmake -*-
+
+# - Find Google perftools
+# Find the Google perftools includes and libraries
+# This module defines
+# GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc.
+# GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools.
+# also defined for general use are
+# TCMALLOC_LIBRARIES, where to find the tcmalloc library.
+# STACKTRACE_LIBRARIES, where to find the stacktrace library.
+# PROFILER_LIBRARIES, where to find the profiler library.
+
+FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h
+/usr/local/include
+/usr/include
+)
+
+SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc)
+FIND_LIBRARY(TCMALLOC_LIBRARY
+ NAMES ${TCMALLOC_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY})
+ SET(GOOGLE_PERFTOOLS_FOUND "YES")
+ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(GOOGLE_PERFTOOLS_FOUND "NO")
+ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace)
+FIND_LIBRARY(STACKTRACE_LIBRARY
+ NAMES ${STACKTRACE_LIBRARY}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY})
+ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+SET(PROFILER_NAMES ${PROFILER_NAMES} profiler)
+FIND_LIBRARY(PROFILER_LIBRARY
+ NAMES ${PROFILER_LIBRARY}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY})
+ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+IF (GOOGLE_PERFTOOLS_FOUND)
+ IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}")
+ ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
+ELSE (GOOGLE_PERFTOOLS_FOUND)
+ IF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Google perftools library")
+ ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
+ENDIF (GOOGLE_PERFTOOLS_FOUND)
+
+MARK_AS_ADVANCED(
+ TCMALLOC_LIBRARY
+ STACKTRACE_LIBRARY
+ PROFILER_LIBRARY
+ GOOGLE_PERFTOOLS_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindJsonCpp.cmake b/indra/cmake/FindJsonCpp.cmake
new file mode 100644
index 0000000000..9d16f2aaab
--- /dev/null
+++ b/indra/cmake/FindJsonCpp.cmake
@@ -0,0 +1,55 @@
+# -*- cmake -*-
+
+# - Find JSONCpp
+# Find the JSONCpp includes and library
+# This module defines
+# JSONCPP_INCLUDE_DIR, where to find json.h, etc.
+# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
+# JSONCPP_FOUND, If false, do not try to use jsoncpp.
+# also defined, but not for general use are
+# JSONCPP_LIBRARY, where to find the jsoncpp library.
+
+FIND_PATH(JSONCPP_INCLUDE_DIR jsoncpp/json.h
+/usr/local/include
+/usr/include
+)
+
+# Get the GCC compiler version
+EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
+ ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+ OUTPUT_VARIABLE _gcc_COMPILER_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
+FIND_LIBRARY(JSONCPP_LIBRARY
+ NAMES ${JSONCPP_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
+ SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
+ SET(JSONCPP_FOUND "YES")
+ELSE (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
+ SET(JSONCPP_FOUND "NO")
+ENDIF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
+
+
+IF (JSONCPP_FOUND)
+ IF (NOT JSONCPP_FIND_QUIETLY)
+ MESSAGE(STATUS "Found JSONCpp: ${JSONCPP_LIBRARIES}")
+ ENDIF (NOT JSONCPP_FIND_QUIETLY)
+ELSE (JSONCPP_FOUND)
+ IF (JSONCPP_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find JSONCpp library")
+ ENDIF (JSONCPP_FIND_REQUIRED)
+ENDIF (JSONCPP_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_JSONCPP_INCLUDE_PATH ${JSONCPP_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_JSONCPP_LIB_PATH ${JSONCPP_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ JSONCPP_LIBRARY
+ JSONCPP_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindMT.cmake b/indra/cmake/FindMT.cmake
new file mode 100644
index 0000000000..5239a4c2f5
--- /dev/null
+++ b/indra/cmake/FindMT.cmake
@@ -0,0 +1,15 @@
+#Find the windows manifest tool.
+
+FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
+ PATHS
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
+IF(HAVE_MANIFEST_TOOL)
+ MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.")
+ELSE(HAVE_MANIFEST_TOOL)
+ MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
+ENDIF(HAVE_MANIFEST_TOOL)
+
+STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
+ ${CMAKE_EXE_LINKER_FLAGS})
diff --git a/indra/cmake/FindMono.cmake b/indra/cmake/FindMono.cmake
new file mode 100644
index 0000000000..d956c48656
--- /dev/null
+++ b/indra/cmake/FindMono.cmake
@@ -0,0 +1,68 @@
+# - Try to find the mono, mcs, gmcs and gacutil
+#
+# defines
+#
+# MONO_FOUND - system has mono, mcs, gmcs and gacutil
+# MONO_PATH - where to find 'mono'
+# MCS_PATH - where to find 'mcs'
+# GMCS_PATH - where to find 'gmcs'
+# GACUTIL_PATH - where to find 'gacutil'
+#
+# copyright (c) 2007 Arno Rehn arno@arnorehn.de
+#
+# Redistribution and use is allowed according to the terms of the GPL license.
+# Removed the check for gmcs
+
+FIND_PROGRAM (MONO_EXECUTABLE mono
+ "$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
+ "$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
+ /bin
+ /usr/bin
+ /usr/local/bin
+)
+FIND_PROGRAM (MCS_EXECUTABLE mcs
+ "$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
+ "$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
+ /bin
+ /usr/bin
+ /usr/local/bin
+)
+FIND_PROGRAM (GMCS_EXECUTABLE gmcs
+ "$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
+ "$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
+ /bin
+ /usr/bin
+ /usr/local/bin
+)
+FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil
+ "$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
+ "$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
+ /bin
+ /usr/bin
+ /usr/local/bin
+)
+FIND_PROGRAM (ILASM_EXECUTABLE
+ NAMES ilasm.bat ilasm
+ NO_DEFAULT_PATH
+ PATHS "$ENV{PROGRAMFILES}/Mono-1.9.1/bin" "$ENV{PROGRAMFILES}/Mono-1.2.6/bin" /bin /usr/bin /usr/local/bin
+)
+
+SET (MONO_FOUND FALSE)
+
+IF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
+ SET (MONO_FOUND TRUE)
+ENDIF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
+
+IF (MONO_FOUND)
+ IF (NOT Mono_FIND_QUIETLY)
+ MESSAGE(STATUS "Found mono: ${MONO_EXECUTABLE}")
+ MESSAGE(STATUS "Found mcs: ${MCS_EXECUTABLE}")
+ MESSAGE(STATUS "Found gacutil: ${GACUTIL_EXECUTABLE}")
+ ENDIF (NOT Mono_FIND_QUIETLY)
+ELSE (MONO_FOUND)
+ IF (Mono_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find one or more of the following programs: mono, mcs, gacutil")
+ ENDIF (Mono_FIND_REQUIRED)
+ENDIF (MONO_FOUND)
+
+MARK_AS_ADVANCED(MONO_EXECUTABLE MCS_EXECUTABLE GACUTIL_EXECUTABLE)
diff --git a/indra/cmake/FindMySQL.cmake b/indra/cmake/FindMySQL.cmake
new file mode 100644
index 0000000000..431940328f
--- /dev/null
+++ b/indra/cmake/FindMySQL.cmake
@@ -0,0 +1,48 @@
+# -*- cmake -*-
+
+# - Find MySQL
+# Find the MySQL includes and library
+# This module defines
+# MYSQL_INCLUDE_DIR, where to find mysql.h, etc.
+# MYSQL_LIBRARIES, the libraries needed to use Mysql.
+# MYSQL_FOUND, If false, do not try to use Mysql.
+# also defined, but not for general use are
+# MYSQL_LIBRARY, where to find the Mysql library.
+
+FIND_PATH(MYSQL_INCLUDE_DIR mysql/mysql.h
+/usr/local/include
+/usr/include
+)
+
+SET(MYSQL_NAMES ${MYSQL_NAMES} mysqlclient)
+FIND_LIBRARY(MYSQL_LIBRARY
+ NAMES ${MYSQL_NAMES}
+ PATHS /usr/lib/mysql /usr/lib /usr/local/lib/mysql /usr/local/lib
+ )
+
+IF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
+ SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY})
+ SET(MYSQL_FOUND "YES")
+ELSE (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
+ SET(MYSQL_FOUND "NO")
+ENDIF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
+
+
+IF (MYSQL_FOUND)
+ IF (NOT MYSQL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARIES}")
+ ENDIF (NOT MYSQL_FIND_QUIETLY)
+ELSE (MYSQL_FOUND)
+ IF (MYSQL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find MySQL library")
+ ENDIF (MYSQL_FIND_REQUIRED)
+ENDIF (MYSQL_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_MYSQL_INCLUDE_PATH ${MYSQL_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_MYSQL_LIB_PATH ${MYSQL_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ MYSQL_LIBRARY
+ MYSQL_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindOpenJPEG.cmake b/indra/cmake/FindOpenJPEG.cmake
new file mode 100644
index 0000000000..949384eec4
--- /dev/null
+++ b/indra/cmake/FindOpenJPEG.cmake
@@ -0,0 +1,50 @@
+# -*- cmake -*-
+
+# - Find OpenJPEG
+# Find the OpenJPEG includes and library
+# This module defines
+# OPENJPEG_INCLUDE_DIR, where to find openjpeg.h, etc.
+# OPENJPEG_LIBRARIES, the libraries needed to use OpenJPEG.
+# OPENJPEG_FOUND, If false, do not try to use OpenJPEG.
+# also defined, but not for general use are
+# OPENJPEG_LIBRARY, where to find the OpenJPEG library.
+
+FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h
+/usr/local/include/openjpeg
+/usr/local/include
+/usr/include/openjpeg
+/usr/include
+)
+
+SET(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg)
+FIND_LIBRARY(OPENJPEG_LIBRARY
+ NAMES ${OPENJPEG_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR)
+ SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
+ SET(OPENJPEG_FOUND "YES")
+ELSE (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR)
+ SET(OPENJPEG_FOUND "NO")
+ENDIF (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR)
+
+
+IF (OPENJPEG_FOUND)
+ IF (NOT OPENJPEG_FIND_QUIETLY)
+ MESSAGE(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES}")
+ ENDIF (NOT OPENJPEG_FIND_QUIETLY)
+ELSE (OPENJPEG_FOUND)
+ IF (OPENJPEG_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find OpenJPEG library")
+ ENDIF (OPENJPEG_FIND_REQUIRED)
+ENDIF (OPENJPEG_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_OPENJPEG_INCLUDE_PATH ${OPENJPEG_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_OPENJPEG_LIB_PATH ${OPENJPEG_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ OPENJPEG_LIBRARY
+ OPENJPEG_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FindSCP.cmake b/indra/cmake/FindSCP.cmake
new file mode 100644
index 0000000000..ea02102908
--- /dev/null
+++ b/indra/cmake/FindSCP.cmake
@@ -0,0 +1,40 @@
+# -*- cmake -*-
+#
+# Find the OpenSSH scp ("secure copy") or Putty pscp command.
+#
+# Input variables:
+# SCP_FIND_REQUIRED - set this if configuration should fail without scp
+#
+# Output variables:
+#
+# SCP_FOUND - set if scp was found
+# SCP_EXECUTABLE - path to scp or pscp executable
+# SCP_BATCH_FLAG - how to put scp/pscp into batch mode
+
+SET(SCP_EXECUTABLE)
+IF (WINDOWS)
+ FIND_PROGRAM(SCP_EXECUTABLE NAMES pscp pscp.exe)
+ELSE (WINDOWS)
+ FIND_PROGRAM(SCP_EXECUTABLE NAMES scp scp.exe)
+ENDIF (WINDOWS)
+
+IF (SCP_EXECUTABLE)
+ SET(SCP_FOUND ON)
+ELSE (SCP_EXECUTABLE)
+ SET(SCP_FOUND OFF)
+ENDIF (SCP_EXECUTABLE)
+
+IF (SCP_FOUND)
+ GET_FILENAME_COMPONENT(_scp_name ${SCP_EXECUTABLE} NAME_WE)
+ IF (_scp_name STREQUAL scp)
+ SET(SCP_BATCH_FLAG -B)
+ ELSE (_scp_name STREQUAL scp)
+ SET(SCP_BATCH_FLAG -batch)
+ ENDIF (_scp_name STREQUAL scp)
+ELSE (SCP_FOUND)
+ IF (SCP_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find scp or pscp executable")
+ ENDIF (SCP_FIND_REQUIRED)
+ENDIF (SCP_FOUND)
+
+MARK_AS_ADVANCED(SCP_EXECUTABLE SCP_FOUND SCP_BATCH_FLAG)
diff --git a/indra/cmake/FindSVN.cmake b/indra/cmake/FindSVN.cmake
new file mode 100644
index 0000000000..3322be4ca9
--- /dev/null
+++ b/indra/cmake/FindSVN.cmake
@@ -0,0 +1,34 @@
+# -*- cmake -*-
+#
+# Find the svn executable for exporting old svn:externals.
+#
+# Input variables:
+# SVN_FIND_REQUIRED - set this if configuration should fail without scp
+#
+# Output variables:
+#
+# SVN_FOUND - set if svn was found
+# SVN_EXECUTABLE - path to svn executable
+# SVN_BATCH_FLAG - how to put svn into batch mode
+
+
+SET(SVN_EXECUTABLE)
+FIND_PROGRAM(SVN_EXECUTABLE NAMES svn svn.exe)
+
+IF (SVN_EXECUTABLE)
+ SET(SVN_FOUND ON)
+ELSE (SVN_EXECUTABLE)
+ SET(SVN_FOUND OFF)
+ENDIF (SVN_EXECUTABLE)
+
+IF (SVN_FOUND)
+ GET_FILENAME_COMPONENT(_svn_name ${SVN_EXECUTABLE} NAME_WE)
+ SET(SVN_BATCH_FLAG --non-interactive)
+ELSE (SVN_FOUND)
+ IF (SVN_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find svn executable")
+ ENDIF (SVN_FIND_REQUIRED)
+ENDIF (SVN_FOUND)
+
+MARK_AS_ADVANCED(SVN_EXECUTABLE SVN_FOUND SVN_BATCH_FLAG)
+
diff --git a/indra/cmake/FindTut.cmake b/indra/cmake/FindTut.cmake
new file mode 100644
index 0000000000..b5d58f6396
--- /dev/null
+++ b/indra/cmake/FindTut.cmake
@@ -0,0 +1,31 @@
+# -*- cmake -*-
+
+# - Find Tut
+# Find the Tut unit test framework includes and library
+# This module defines
+# TUT_INCLUDE_DIR, where to find tut.h, etc.
+# TUT_FOUND, If false, do not try to use Tut.
+
+find_path(TUT_INCLUDE_DIR tut.h
+ /usr/local/include/
+ /usr/include
+ )
+
+if (TUT_INCLUDE_DIR)
+ set(TUT_FOUND "YES")
+else (TUT_INCLUDE_DIR)
+ set(TUT_FOUND "NO")
+endif (TUT_INCLUDE_DIR)
+
+if (TUT_FOUND)
+ if (NOT TUT_FIND_QUIETLY)
+ message(STATUS "Found Tut: ${TUT_INCLUDE_DIR}")
+ set(TUT_FIND_QUIETLY TRUE) # Only alert us the first time
+ endif (NOT TUT_FIND_QUIETLY)
+else (TUT_FOUND)
+ if (TUT_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find Tut")
+ endif (TUT_FIND_REQUIRED)
+endif (TUT_FOUND)
+
+mark_as_advanced(TUT_INCLUDE_DIR)
diff --git a/indra/cmake/FindXmlRpcEpi.cmake b/indra/cmake/FindXmlRpcEpi.cmake
new file mode 100644
index 0000000000..ba217e7467
--- /dev/null
+++ b/indra/cmake/FindXmlRpcEpi.cmake
@@ -0,0 +1,48 @@
+# -*- cmake -*-
+
+# - Find XMLRPC-EPI
+# Find the XMLRPC-EPI includes and library
+# This module defines
+# XMLRPCEPI_INCLUDE_DIR, where to find jpeglib.h, etc.
+# XMLRPCEPI_LIBRARIES, the libraries needed to use XMLRPC-EPI.
+# XMLRPCEPI_FOUND, If false, do not try to use XMLRPC-EPI.
+# also defined, but not for general use are
+# XMLRPCEPI_LIBRARY, where to find the XMLRPC-EPI library.
+
+FIND_PATH(XMLRPCEPI_INCLUDE_DIR xmlrpc-epi/xmlrpc.h
+/usr/local/include
+/usr/include
+)
+
+SET(XMLRPCEPI_NAMES ${XMLRPCEPI_NAMES} xmlrpc-epi)
+FIND_LIBRARY(XMLRPCEPI_LIBRARY
+ NAMES ${XMLRPCEPI_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR)
+ SET(XMLRPCEPI_LIBRARIES ${XMLRPCEPI_LIBRARY})
+ SET(XMLRPCEPI_FOUND "YES")
+ELSE (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR)
+ SET(XMLRPCEPI_FOUND "NO")
+ENDIF (XMLRPCEPI_LIBRARY AND XMLRPCEPI_INCLUDE_DIR)
+
+
+IF (XMLRPCEPI_FOUND)
+ IF (NOT XMLRPCEPI_FIND_QUIETLY)
+ MESSAGE(STATUS "Found XMLRPC-EPI: ${XMLRPCEPI_LIBRARIES}")
+ ENDIF (NOT XMLRPCEPI_FIND_QUIETLY)
+ELSE (XMLRPCEPI_FOUND)
+ IF (XMLRPCEPI_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find XMLRPC-EPI library")
+ ENDIF (XMLRPCEPI_FIND_REQUIRED)
+ENDIF (XMLRPCEPI_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_XMLRPCEPI_INCLUDE_PATH ${XMLRPCEPI_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_XMLRPCEPI_LIB_PATH ${XMLRPCEPI_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+ XMLRPCEPI_LIBRARY
+ XMLRPCEPI_INCLUDE_DIR
+ )
diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake
new file mode 100644
index 0000000000..5f1aa26e89
--- /dev/null
+++ b/indra/cmake/FreeType.cmake
@@ -0,0 +1,20 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindPkgConfig)
+
+ pkg_check_modules(FREETYPE REQUIRED freetype2)
+else (STANDALONE)
+ use_prebuilt_binary(freetype)
+ if (LINUX)
+ set(FREETYPE_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+ else (LINUX)
+ set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+ endif (LINUX)
+
+ set(FREETYPE_LIBRARIES freetype)
+endif (STANDALONE)
+
+link_directories(${FREETYPE_LIBRARY_DIRS})
diff --git a/indra/cmake/GStreamer010Plugin.cmake b/indra/cmake/GStreamer010Plugin.cmake
new file mode 100644
index 0000000000..0ca432da18
--- /dev/null
+++ b/indra/cmake/GStreamer010Plugin.cmake
@@ -0,0 +1,38 @@
+# -*- 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)
+elseif (LINUX)
+ use_prebuilt_binary(gstreamer)
+ # possible libxml should have its own .cmake file instead
+ use_prebuilt_binary(libxml)
+ set(GSTREAMER010_FOUND ON FORCE BOOL)
+ set(GSTREAMER010_PLUGINS_BASE_FOUND ON FORCE BOOL)
+ set(GSTREAMER010_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/gstreamer-0.10
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libxml2
+ )
+ # We don't need to explicitly link against gstreamer itself, because
+ # LLMediaImplGStreamer probes for the system's copy at runtime.
+ set(GSTREAMER010_LIBRARIES
+ gobject-2.0
+ gmodule-2.0
+ dl
+ gthread-2.0
+ glib-2.0
+ )
+endif (STANDALONE)
+
+if (GSTREAMER010_FOUND AND GSTREAMER010_PLUGINS_BASE_FOUND)
+ set(GSTREAMER010 ON CACHE BOOL "Build with GStreamer-0.10 streaming media support.")
+endif (GSTREAMER010_FOUND AND GSTREAMER010_PLUGINS_BASE_FOUND)
+
+if (GSTREAMER010)
+ add_definitions(-DLL_GSTREAMER010_ENABLED=1)
+endif (GSTREAMER010)
+
diff --git a/indra/cmake/GetPrerequisites_2_8.cmake b/indra/cmake/GetPrerequisites_2_8.cmake
new file mode 100644
index 0000000000..5a24842c89
--- /dev/null
+++ b/indra/cmake/GetPrerequisites_2_8.cmake
@@ -0,0 +1,786 @@
+# GetPrerequisites.cmake
+#
+# This script provides functions to list the .dll, .dylib or .so files that an
+# executable or shared library file depends on. (Its prerequisites.)
+#
+# It uses various tools to obtain the list of required shared library files:
+# dumpbin (Windows)
+# ldd (Linux/Unix)
+# otool (Mac OSX)
+#
+# The following functions are provided by this script:
+# gp_append_unique
+# is_file_executable
+# gp_item_default_embedded_path
+# (projects can override with gp_item_default_embedded_path_override)
+# gp_resolve_item
+# (projects can override with gp_resolve_item_override)
+# gp_resolved_file_type
+# gp_file_type
+# get_prerequisites
+# list_prerequisites
+# list_prerequisites_by_glob
+#
+# Requires CMake 2.6 or greater because it uses function, break, return and
+# PARENT_SCOPE.
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# gp_append_unique list_var value
+#
+# Append value to the list variable ${list_var} only if the value is not
+# already in the list.
+#
+function(gp_append_unique list_var value)
+ set(contains 0)
+
+ foreach(item ${${list_var}})
+ if("${item}" STREQUAL "${value}")
+ set(contains 1)
+ break()
+ endif("${item}" STREQUAL "${value}")
+ endforeach(item)
+
+ if(NOT contains)
+ set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
+ endif(NOT contains)
+endfunction(gp_append_unique)
+
+
+# is_file_executable file result_var
+#
+# Return 1 in ${result_var} if ${file} is a binary executable.
+#
+# Return 0 in ${result_var} otherwise.
+#
+function(is_file_executable file result_var)
+ #
+ # A file is not executable until proven otherwise:
+ #
+ set(${result_var} 0 PARENT_SCOPE)
+
+ get_filename_component(file_full "${file}" ABSOLUTE)
+ string(TOLOWER "${file_full}" file_full_lower)
+
+ # If file name ends in .exe on Windows, *assume* executable:
+ #
+ if(WIN32)
+ if("${file_full_lower}" MATCHES "\\.exe$")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif("${file_full_lower}" MATCHES "\\.exe$")
+
+ # A clause could be added here that uses output or return value of dumpbin
+ # to determine ${result_var}. In 99%+? practical cases, the exe name
+ # match will be sufficient...
+ #
+ endif(WIN32)
+
+ # Use the information returned from the Unix shell command "file" to
+ # determine if ${file_full} should be considered an executable file...
+ #
+ # If the file command's output contains "executable" and does *not* contain
+ # "text" then it is likely an executable suitable for prerequisite analysis
+ # via the get_prerequisites macro.
+ #
+ if(UNIX)
+ if(NOT file_cmd)
+ find_program(file_cmd "file")
+ endif(NOT file_cmd)
+
+ if(file_cmd)
+ execute_process(COMMAND "${file_cmd}" "${file_full}"
+ OUTPUT_VARIABLE file_ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ # Replace the name of the file in the output with a placeholder token
+ # (the string " _file_full_ ") so that just in case the path name of
+ # the file contains the word "text" or "executable" we are not fooled
+ # into thinking "the wrong thing" because the file name matches the
+ # other 'file' command output we are looking for...
+ #
+ string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
+ string(TOLOWER "${file_ov}" file_ov)
+
+ #message(STATUS "file_ov='${file_ov}'")
+ if("${file_ov}" MATCHES "executable")
+ #message(STATUS "executable!")
+ if("${file_ov}" MATCHES "text")
+ #message(STATUS "but text, so *not* a binary executable!")
+ else("${file_ov}" MATCHES "text")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif("${file_ov}" MATCHES "text")
+ endif("${file_ov}" MATCHES "executable")
+ else(file_cmd)
+ message(STATUS "warning: No 'file' command, skipping execute_process...")
+ endif(file_cmd)
+ endif(UNIX)
+endfunction(is_file_executable)
+
+
+# gp_item_default_embedded_path item default_embedded_path_var
+#
+# Return the path that others should refer to the item by when the item
+# is embedded inside a bundle.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_item_default_embedded_path_override function.
+#
+function(gp_item_default_embedded_path item default_embedded_path_var)
+
+ # On Windows and Linux, "embed" prerequisites in the same directory
+ # as the executable by default:
+ #
+ set(path "@executable_path")
+ set(overridden 0)
+
+ # On the Mac, relative to the executable depending on the type
+ # of the thing we are embedding:
+ #
+ if(APPLE)
+ #
+ # The assumption here is that all executables in the bundle will be
+ # in same-level-directories inside the bundle. The parent directory
+ # of an executable inside the bundle should be MacOS or a sibling of
+ # MacOS and all embedded paths returned from here will begin with
+ # "@executable_path/../" and will work from all executables in all
+ # such same-level-directories inside the bundle.
+ #
+
+ # By default, embed things right next to the main bundle executable:
+ #
+ set(path "@executable_path/../../Contents/MacOS")
+
+ # Embed .dylibs right next to the main bundle executable:
+ #
+ if(item MATCHES "\\.dylib$")
+ set(path "@executable_path/../MacOS")
+ set(overridden 1)
+ endif(item MATCHES "\\.dylib$")
+
+ # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
+ #
+ if(NOT overridden)
+ if(item MATCHES "[^/]+\\.framework/")
+ set(path "@executable_path/../Frameworks")
+ set(overridden 1)
+ endif(item MATCHES "[^/]+\\.framework/")
+ endif(NOT overridden)
+ endif()
+
+ # Provide a hook so that projects can override the default embedded location
+ # of any given library by whatever logic they choose:
+ #
+ if(COMMAND gp_item_default_embedded_path_override)
+ gp_item_default_embedded_path_override("${item}" path)
+ endif(COMMAND gp_item_default_embedded_path_override)
+
+ set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
+endfunction(gp_item_default_embedded_path)
+
+
+# gp_resolve_item context item exepath dirs resolved_item_var
+#
+# Resolve an item into an existing full path file.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_resolve_item_override function.
+#
+function(gp_resolve_item context item exepath dirs resolved_item_var)
+ set(resolved 0)
+ set(resolved_item "${item}")
+
+ # Is it already resolved?
+ #
+ if(EXISTS "${resolved_item}")
+ set(resolved 1)
+ endif(EXISTS "${resolved_item}")
+
+ if(NOT resolved)
+ if(item MATCHES "@executable_path")
+ #
+ # @executable_path references are assumed relative to exepath
+ #
+ string(REPLACE "@executable_path" "${exepath}" ri "${item}")
+ get_filename_component(ri "${ri}" ABSOLUTE)
+
+ if(EXISTS "${ri}")
+ #message(STATUS "info: embedded item exists (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ else(EXISTS "${ri}")
+ message(STATUS "warning: embedded item does not exist '${ri}'")
+ endif(EXISTS "${ri}")
+ endif(item MATCHES "@executable_path")
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ if(item MATCHES "@loader_path")
+ #
+ # @loader_path references are assumed relative to the
+ # PATH of the given "context" (presumably another library)
+ #
+ get_filename_component(contextpath "${context}" PATH)
+ string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
+ get_filename_component(ri "${ri}" ABSOLUTE)
+
+ if(EXISTS "${ri}")
+ #message(STATUS "info: embedded item exists (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ else(EXISTS "${ri}")
+ message(STATUS "warning: embedded item does not exist '${ri}'")
+ endif(EXISTS "${ri}")
+ endif(item MATCHES "@loader_path")
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ set(ri "ri-NOTFOUND")
+ find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+ find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
+ if(ri)
+ #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ if(item MATCHES "[^/]+\\.framework/")
+ set(fw "fw-NOTFOUND")
+ find_file(fw "${item}"
+ "~/Library/Frameworks"
+ "/Library/Frameworks"
+ "/System/Library/Frameworks"
+ )
+ if(fw)
+ #message(STATUS "info: 'find_file' found framework (${fw})")
+ set(resolved 1)
+ set(resolved_item "${fw}")
+ set(fw "fw-NOTFOUND")
+ endif(fw)
+ endif(item MATCHES "[^/]+\\.framework/")
+ endif(NOT resolved)
+
+ # Using find_program on Windows will find dll files that are in the PATH.
+ # (Converting simple file names into full path names if found.)
+ #
+ if(WIN32)
+ if(NOT resolved)
+ set(ri "ri-NOTFOUND")
+ find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
+ find_program(ri "${item}" PATHS "${exepath};${dirs}")
+ if(ri)
+ #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+ endif(NOT resolved)
+ endif(WIN32)
+
+ # Provide a hook so that projects can override item resolution
+ # by whatever logic they choose:
+ #
+ if(COMMAND gp_resolve_item_override)
+ gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
+ endif(COMMAND gp_resolve_item_override)
+
+ if(NOT resolved)
+ message(STATUS "
+warning: cannot resolve item '${item}'
+
+ possible problems:
+ need more directories?
+ need to use InstallRequiredSystemLibraries?
+ run in install tree instead of build tree?
+")
+# message(STATUS "
+#******************************************************************************
+#warning: cannot resolve item '${item}'
+#
+# possible problems:
+# need more directories?
+# need to use InstallRequiredSystemLibraries?
+# run in install tree instead of build tree?
+#
+# context='${context}'
+# item='${item}'
+# exepath='${exepath}'
+# dirs='${dirs}'
+# resolved_item_var='${resolved_item_var}'
+#******************************************************************************
+#")
+ endif(NOT resolved)
+
+ set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
+endfunction(gp_resolve_item)
+
+
+# gp_resolved_file_type original_file file exepath dirs type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file}
+# values -- but only for non-embedded items.
+#
+# Possible types are:
+# system
+# local
+# embedded
+# other
+#
+function(gp_resolved_file_type original_file file exepath dirs type_var)
+ #message(STATUS "**")
+
+ if(NOT IS_ABSOLUTE "${original_file}")
+ message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file")
+ endif()
+
+ set(is_embedded 0)
+ set(is_local 0)
+ set(is_system 0)
+
+ set(resolved_file "${file}")
+
+ if("${file}" MATCHES "^@(executable|loader)_path")
+ set(is_embedded 1)
+ endif()
+
+ if(NOT is_embedded)
+ if(NOT IS_ABSOLUTE "${file}")
+ gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+ endif()
+
+ string(TOLOWER "${original_file}" original_lower)
+ string(TOLOWER "${resolved_file}" lower)
+
+ if(UNIX)
+ if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
+ set(is_system 1)
+ endif()
+ endif()
+
+ if(APPLE)
+ if(resolved_file MATCHES "^(/System/Library/|/usr/lib/)")
+ set(is_system 1)
+ endif()
+ endif()
+
+ if(WIN32)
+ string(TOLOWER "$ENV{SystemRoot}" sysroot)
+ string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+
+ string(TOLOWER "$ENV{windir}" windir)
+ string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+
+ if(lower MATCHES "^(${sysroot}/system|${windir}/system|${sysroot}/syswow|${windir}/syswow|(.*/)*msvc[^/]+dll)")
+ set(is_system 1)
+ endif()
+ endif()
+
+ if(NOT is_system)
+ get_filename_component(original_path "${original_lower}" PATH)
+ get_filename_component(path "${lower}" PATH)
+ if("${original_path}" STREQUAL "${path}")
+ set(is_local 1)
+ endif()
+ endif()
+ endif()
+
+ # Return type string based on computed booleans:
+ #
+ set(type "other")
+
+ if(is_system)
+ set(type "system")
+ elseif(is_embedded)
+ set(type "embedded")
+ elseif(is_local)
+ set(type "local")
+ endif()
+
+ #message(STATUS "gp_resolved_file_type: '${file}' '${resolved_file}'")
+ #message(STATUS " type: '${type}'")
+
+ if(NOT is_embedded)
+ if(NOT IS_ABSOLUTE "${resolved_file}")
+ if(lower MATCHES "^msvc[^/]+dll" AND is_system)
+ message(STATUS "info: non-absolute msvc file '${file}' returning type '${type}'")
+ else()
+ message(STATUS "warning: gp_resolved_file_type non-absolute file '${file}' returning type '${type}' -- possibly incorrect")
+ endif()
+ endif()
+ endif()
+
+ set(${type_var} "${type}" PARENT_SCOPE)
+
+ #message(STATUS "**")
+endfunction()
+
+
+# gp_file_type original_file file type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Possible types are:
+# system
+# local
+# embedded
+# other
+#
+function(gp_file_type original_file file type_var)
+ if(NOT IS_ABSOLUTE "${original_file}")
+ message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
+ endif()
+
+ get_filename_component(exepath "${original_file}" PATH)
+
+ set(type "")
+ gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
+
+ set(${type_var} "${type}" PARENT_SCOPE)
+endfunction(gp_file_type)
+
+
+# get_prerequisites target prerequisites_var exclude_system recurse dirs
+#
+# Get the list of shared library files required by ${target}. The list in
+# the variable named ${prerequisites_var} should be empty on first entry to
+# this function. On exit, ${prerequisites_var} will contain the list of
+# required shared library files.
+#
+# target is the full path to an executable file
+#
+# prerequisites_var is the name of a CMake variable to contain the results
+#
+# exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to
+# exclude them
+#
+# recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
+# recursively
+#
+# exepath is the path to the top level executable used for @executable_path
+# replacment on the Mac
+#
+# dirs is a list of paths where libraries might be found: these paths are
+# searched first when a target without any path info is given. Then standard
+# system locations are also searched: PATH, Framework locations, /usr/lib...
+#
+function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
+ set(verbose 0)
+ set(eol_char "E")
+
+ if(NOT IS_ABSOLUTE "${target}")
+ message("warning: target '${target}' is not absolute...")
+ endif(NOT IS_ABSOLUTE "${target}")
+
+ if(NOT EXISTS "${target}")
+ message("warning: target '${target}' does not exist...")
+ endif(NOT EXISTS "${target}")
+
+ # <setup-gp_tool-vars>
+ #
+ # Try to choose the right tool by default. Caller can set gp_tool prior to
+ # calling this function to force using a different tool.
+ #
+ if("${gp_tool}" STREQUAL "")
+ set(gp_tool "ldd")
+ if(APPLE)
+ set(gp_tool "otool")
+ endif(APPLE)
+ if(WIN32)
+ set(gp_tool "dumpbin")
+ endif(WIN32)
+ endif("${gp_tool}" STREQUAL "")
+
+ set(gp_tool_known 0)
+
+ if("${gp_tool}" STREQUAL "ldd")
+ set(gp_cmd_args "")
+ set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$")
+ set(gp_regex_cmp_count 1)
+ set(gp_tool_known 1)
+ endif("${gp_tool}" STREQUAL "ldd")
+
+ if("${gp_tool}" STREQUAL "otool")
+ set(gp_cmd_args "-L")
+ set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
+ set(gp_regex_cmp_count 3)
+ set(gp_tool_known 1)
+ endif("${gp_tool}" STREQUAL "otool")
+
+ if("${gp_tool}" STREQUAL "dumpbin")
+ set(gp_cmd_args "/dependents")
+ set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
+ set(gp_regex_cmp_count 1)
+ set(gp_tool_known 1)
+ set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
+ endif("${gp_tool}" STREQUAL "dumpbin")
+
+ if(NOT gp_tool_known)
+ message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
+ message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
+ message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.")
+ return()
+ endif(NOT gp_tool_known)
+
+ set(gp_cmd_paths ${gp_cmd_paths}
+ "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
+ "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+ "C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
+ "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+ "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
+ "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
+ "/usr/local/bin"
+ "/usr/bin"
+ )
+
+ find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths})
+
+ if(NOT gp_cmd)
+ message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
+ return()
+ endif(NOT gp_cmd)
+
+ if("${gp_tool}" STREQUAL "dumpbin")
+ # When running dumpbin, it also needs the "Common7/IDE" directory in the
+ # PATH. It will already be in the PATH if being run from a Visual Studio
+ # command prompt. Add it to the PATH here in case we are running from a
+ # different command prompt.
+ #
+ get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
+ get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
+ if(EXISTS "${gp_cmd_dlls_dir}")
+ # only add to the path if it is not already in the path
+ if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+ set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
+ endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+ endif(EXISTS "${gp_cmd_dlls_dir}")
+ endif("${gp_tool}" STREQUAL "dumpbin")
+ #
+ # </setup-gp_tool-vars>
+
+ if("${gp_tool}" STREQUAL "ldd")
+ set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
+ foreach(dir ${exepath} ${dirs})
+ set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
+ endforeach(dir)
+ endif("${gp_tool}" STREQUAL "ldd")
+
+
+ # Track new prerequisites at each new level of recursion. Start with an
+ # empty list at each level:
+ #
+ set(unseen_prereqs)
+
+ # Run gp_cmd on the target:
+ #
+ execute_process(
+ COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
+ OUTPUT_VARIABLE gp_cmd_ov
+ )
+
+ if("${gp_tool}" STREQUAL "ldd")
+ set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
+ endif("${gp_tool}" STREQUAL "ldd")
+
+ if(verbose)
+ message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
+ message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
+ message(STATUS "</RawOutput>")
+ endif(verbose)
+
+ get_filename_component(target_dir "${target}" PATH)
+
+ # Convert to a list of lines:
+ #
+ string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
+ string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
+
+ # Analyze each line for file names that match the regular expression:
+ #
+ foreach(candidate ${candidates})
+ if("${candidate}" MATCHES "${gp_regex}")
+ # Extract information from each candidate:
+ string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+
+ if(gp_regex_cmp_count GREATER 1)
+ string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
+ endif(gp_regex_cmp_count GREATER 1)
+
+ if(gp_regex_cmp_count GREATER 2)
+ string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
+ endif(gp_regex_cmp_count GREATER 2)
+
+ # Use the raw_item as the list entries returned by this function. Use the
+ # gp_resolve_item function to resolve it to an actual full path file if
+ # necessary.
+ #
+ set(item "${raw_item}")
+
+ # Add each item unless it is excluded:
+ #
+ set(add_item 1)
+
+ if(${exclude_system})
+ set(type "")
+ gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+ if("${type}" STREQUAL "system")
+ set(add_item 0)
+ endif("${type}" STREQUAL "system")
+ endif(${exclude_system})
+
+ if(add_item)
+ list(LENGTH ${prerequisites_var} list_length_before_append)
+ gp_append_unique(${prerequisites_var} "${item}")
+ list(LENGTH ${prerequisites_var} list_length_after_append)
+
+ if(${recurse})
+ # If item was really added, this is the first time we have seen it.
+ # Add it to unseen_prereqs so that we can recursively add *its*
+ # prerequisites...
+ #
+ # But first: resolve its name to an absolute full path name such
+ # that the analysis tools can simply accept it as input.
+ #
+ if(NOT list_length_before_append EQUAL list_length_after_append)
+ gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
+ set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+ endif(NOT list_length_before_append EQUAL list_length_after_append)
+ endif(${recurse})
+ endif(add_item)
+ else("${candidate}" MATCHES "${gp_regex}")
+ if(verbose)
+ message(STATUS "ignoring non-matching line: '${candidate}'")
+ endif(verbose)
+ endif("${candidate}" MATCHES "${gp_regex}")
+ endforeach(candidate)
+
+ list(LENGTH ${prerequisites_var} prerequisites_var_length)
+ if(prerequisites_var_length GREATER 0)
+ list(SORT ${prerequisites_var})
+ endif(prerequisites_var_length GREATER 0)
+ if(${recurse})
+ set(more_inputs ${unseen_prereqs})
+ foreach(input ${more_inputs})
+ get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+ endforeach(input)
+ endif(${recurse})
+
+ set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
+endfunction(get_prerequisites)
+
+
+# list_prerequisites target all exclude_system verbose
+#
+# ARGV0 (target) is the full path to an executable file
+#
+# optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only,
+# 1 for all prerequisites recursively
+#
+# optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system"
+# prerequisites , 1 to exclude them
+#
+# optional ARGV3 (verbose) is 0 or 1: 0 to print only full path
+# names of prerequisites, 1 to print extra information
+#
+function(list_prerequisites target)
+ if("${ARGV1}" STREQUAL "")
+ set(all 1)
+ else("${ARGV1}" STREQUAL "")
+ set(all "${ARGV1}")
+ endif("${ARGV1}" STREQUAL "")
+
+ if("${ARGV2}" STREQUAL "")
+ set(exclude_system 0)
+ else("${ARGV2}" STREQUAL "")
+ set(exclude_system "${ARGV2}")
+ endif("${ARGV2}" STREQUAL "")
+
+ if("${ARGV3}" STREQUAL "")
+ set(verbose 0)
+ else("${ARGV3}" STREQUAL "")
+ set(verbose "${ARGV3}")
+ endif("${ARGV3}" STREQUAL "")
+
+ set(count 0)
+ set(count_str "")
+ set(print_count "${verbose}")
+ set(print_prerequisite_type "${verbose}")
+ set(print_target "${verbose}")
+ set(type_str "")
+
+ get_filename_component(exepath "${target}" PATH)
+
+ set(prereqs "")
+ get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
+
+ if(print_target)
+ message(STATUS "File '${target}' depends on:")
+ endif(print_target)
+
+ foreach(d ${prereqs})
+ math(EXPR count "${count} + 1")
+
+ if(print_count)
+ set(count_str "${count}. ")
+ endif(print_count)
+
+ if(print_prerequisite_type)
+ gp_file_type("${target}" "${d}" type)
+ set(type_str " (${type})")
+ endif(print_prerequisite_type)
+
+ message(STATUS "${count_str}${d}${type_str}")
+ endforeach(d)
+endfunction(list_prerequisites)
+
+
+# list_prerequisites_by_glob glob_arg glob_exp
+#
+# glob_arg is GLOB or GLOB_RECURSE
+#
+# glob_exp is a globbing expression used with "file(GLOB" to retrieve a list
+# of matching files. If a matching file is executable, its prerequisites are
+# listed.
+#
+# Any additional (optional) arguments provided are passed along as the
+# optional arguments to the list_prerequisites calls.
+#
+function(list_prerequisites_by_glob glob_arg glob_exp)
+ message(STATUS "=============================================================================")
+ message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")
+ message(STATUS "")
+ file(${glob_arg} file_list ${glob_exp})
+ foreach(f ${file_list})
+ is_file_executable("${f}" is_f_executable)
+ if(is_f_executable)
+ message(STATUS "=============================================================================")
+ list_prerequisites("${f}" ${ARGN})
+ message(STATUS "")
+ endif(is_f_executable)
+ endforeach(f)
+endfunction(list_prerequisites_by_glob)
diff --git a/indra/cmake/Glui.cmake b/indra/cmake/Glui.cmake
new file mode 100644
index 0000000000..f62a56856c
--- /dev/null
+++ b/indra/cmake/Glui.cmake
@@ -0,0 +1,28 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+if (STANDALONE)
+ set(GLUI OFF CACHE BOOL
+ "GLUI support for the llplugin/llmedia test apps.")
+else (STANDALONE)
+ use_prebuilt_binary(glui)
+ set(GLUI ON CACHE BOOL
+ "GLUI support for the llplugin/llmedia test apps.")
+endif (STANDALONE)
+
+if (LINUX)
+ set(GLUI ON CACHE BOOL
+ "llplugin media apps HACK for Linux.")
+endif (LINUX)
+
+if (DARWIN OR LINUX)
+ set(GLUI_LIBRARY
+ glui)
+endif (DARWIN OR LINUX)
+
+if (WINDOWS)
+ set(GLUI_LIBRARY
+ debug glui32.lib
+ optimized glui32.lib)
+endif (WINDOWS)
diff --git a/indra/cmake/Glut.cmake b/indra/cmake/Glut.cmake
new file mode 100644
index 0000000000..314da30652
--- /dev/null
+++ b/indra/cmake/Glut.cmake
@@ -0,0 +1,19 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+if (WINDOWS)
+ use_prebuilt_binary(freeglut)
+ set(GLUT_LIBRARY
+ debug freeglut_static.lib
+ optimized freeglut_static.lib)
+endif (WINDOWS)
+
+if (LINUX)
+ FIND_LIBRARY(GLUT_LIBRARY glut)
+endif (LINUX)
+
+if (DARWIN)
+ include(CMakeFindFrameworks)
+ find_library(GLUT_LIBRARY GLUT)
+endif (DARWIN)
diff --git a/indra/cmake/GoogleBreakpad.cmake b/indra/cmake/GoogleBreakpad.cmake
new file mode 100644
index 0000000000..7498674042
--- /dev/null
+++ b/indra/cmake/GoogleBreakpad.cmake
@@ -0,0 +1,19 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ set(BREAKPAD_EXCEPTION_HANDLER_FIND_REQUIRED ON)
+ include(FindGoogleBreakpad)
+else (STANDALONE)
+ use_prebuilt_binary(google_breakpad)
+ if (DARWIN)
+ set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES exception_handler)
+ endif (DARWIN)
+ if (LINUX)
+ set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES breakpad_client)
+ endif (LINUX)
+ if (WINDOWS)
+ set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES exception_handler crash_generation_client common)
+ endif (WINDOWS)
+endif (STANDALONE)
+
diff --git a/indra/cmake/GoogleMock.cmake b/indra/cmake/GoogleMock.cmake
new file mode 100644
index 0000000000..ca5a8034ba
--- /dev/null
+++ b/indra/cmake/GoogleMock.cmake
@@ -0,0 +1,27 @@
+# -*- cmake -*-
+include(Prebuilt)
+include(Linking)
+
+use_prebuilt_binary(googlemock)
+
+set(GOOGLEMOCK_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/include)
+
+if (LINUX)
+ set(GOOGLEMOCK_LIBRARIES
+ gmock
+ gtest)
+elseif(WINDOWS)
+ set(GOOGLEMOCK_LIBRARIES
+ gmock)
+ set(GOOGLEMOCK_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/include
+ ${LIBS_PREBUILT_DIR}/include/gmock
+ ${LIBS_PREBUILT_DIR}/include/gmock/boost/tr1/tr1)
+elseif(DARWIN)
+ set(GOOGLEMOCK_LIBRARIES
+ gmock
+ gtest)
+endif(LINUX)
+
+
diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake
new file mode 100644
index 0000000000..946fc6b375
--- /dev/null
+++ b/indra/cmake/GooglePerfTools.cmake
@@ -0,0 +1,42 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindGooglePerfTools)
+else (STANDALONE)
+ use_prebuilt_binary(google)
+ if (WINDOWS)
+ use_prebuilt_binary(google-perftools)
+ set(TCMALLOC_LIBRARIES
+ debug libtcmalloc_minimal-debug
+ optimized libtcmalloc_minimal)
+ set(GOOGLE_PERFTOOLS_FOUND "YES")
+ endif (WINDOWS)
+ if (LINUX)
+ set(TCMALLOC_LIBRARIES tcmalloc)
+ set(STACKTRACE_LIBRARIES stacktrace)
+ set(PROFILER_LIBRARIES profiler)
+ set(GOOGLE_PERFTOOLS_INCLUDE_DIR
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+ set(GOOGLE_PERFTOOLS_FOUND "YES")
+ endif (LINUX)
+endif (STANDALONE)
+
+if (GOOGLE_PERFTOOLS_FOUND)
+ # XXX Disable temporarily, until we have compilation issues on 64-bit
+ # Etch sorted.
+ set(USE_GOOGLE_PERFTOOLS OFF CACHE BOOL "Build with Google PerfTools support.")
+endif (GOOGLE_PERFTOOLS_FOUND)
+
+if (WINDOWS)
+ # *TODO -reenable this once we get server usage sorted out
+ #set(USE_GOOGLE_PERFTOOLS ON)
+endif (WINDOWS)
+
+if (USE_GOOGLE_PERFTOOLS)
+ set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1)
+ include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
+ set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})
+else (USE_GOOGLE_PERFTOOLS)
+ set(TCMALLOC_FLAG -ULL_USE_TCMALLOC)
+endif (USE_GOOGLE_PERFTOOLS)
diff --git a/indra/cmake/JPEG.cmake b/indra/cmake/JPEG.cmake
new file mode 100644
index 0000000000..9514d59f64
--- /dev/null
+++ b/indra/cmake/JPEG.cmake
@@ -0,0 +1,23 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+include(Linking)
+set(JPEG_FIND_QUIETLY ON)
+set(JPEG_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindJPEG)
+else (STANDALONE)
+ use_prebuilt_binary(jpeglib)
+ if (LINUX)
+ set(JPEG_LIBRARIES jpeg)
+ elseif (DARWIN)
+ set(JPEG_LIBRARIES
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/liblljpeg.a
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/liblljpeg.a
+ )
+ elseif (WINDOWS)
+ set(JPEG_LIBRARIES jpeglib)
+ endif (LINUX)
+ set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+endif (STANDALONE)
diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake
new file mode 100644
index 0000000000..7dd565be7c
--- /dev/null
+++ b/indra/cmake/JsonCpp.cmake
@@ -0,0 +1,22 @@
+# -*- cmake -*-
+
+include(Prebuilt)
+
+set(JSONCPP_FIND_QUIETLY ON)
+set(JSONCPP_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindJsonCpp)
+else (STANDALONE)
+ use_prebuilt_binary(jsoncpp)
+ if (WINDOWS)
+ set(JSONCPP_LIBRARIES
+ debug json_vc80d
+ optimized json_vc80)
+ elseif (DARWIN)
+ set(JSONCPP_LIBRARIES json_mac-universal-gcc_libmt)
+ elseif (LINUX)
+ set(JSONCPP_LIBRARIES jsoncpp)
+ endif (WINDOWS)
+ set(JSONCPP_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/jsoncpp)
+endif (STANDALONE)
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
new file mode 100644
index 0000000000..79c3bb7da2
--- /dev/null
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -0,0 +1,265 @@
+# -*- cmake -*-
+include(LLTestCommand)
+include(GoogleMock)
+
+MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
+ # Given a project name and a list of sourcefiles (with optional properties on each),
+ # add targets to build and run the tests specified.
+ # ASSUMPTIONS:
+ # * this macro is being executed in the project file that is passed in
+ # * current working SOURCE dir is that project dir
+ # * there is a subfolder tests/ with test code corresponding to the filenames passed in
+ # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT)
+ #
+ # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code
+ #
+ # WARNING: do NOT modify this code without working with poppy -
+ # there is another branch that will conflict heavily with any changes here.
+INCLUDE(GoogleMock)
+
+
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
+ ENDIF(LL_TEST_VERBOSE)
+
+ # Start with the header and project-wide setup before making targets
+ #project(UNITTEST_PROJECT_${project})
+ # Setup includes, paths, etc
+ SET(alltest_SOURCE_FILES
+ ${CMAKE_SOURCE_DIR}/test/test.cpp
+ ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+ )
+ SET(alltest_DEP_TARGETS
+ # needed by the test harness itself
+ ${APRUTIL_LIBRARIES}
+ ${APR_LIBRARIES}
+ llcommon
+ )
+ IF(NOT "${project}" STREQUAL "llmath")
+ # add llmath as a dep unless the tested module *is* llmath!
+ LIST(APPEND alltest_DEP_TARGETS
+ llmath
+ )
+ ENDIF(NOT "${project}" STREQUAL "llmath")
+ SET(alltest_INCLUDE_DIRS
+ ${LLMATH_INCLUDE_DIRS}
+ ${LLCOMMON_INCLUDE_DIRS}
+ ${LIBS_OPEN_DIR}/test
+ ${GOOGLEMOCK_INCLUDE_DIRS}
+ )
+ SET(alltest_LIBRARIES
+ ${GOOGLEMOCK_LIBRARIES}
+ ${PTHREAD_LIBRARY}
+ ${WINDOWS_LIBRARIES}
+ )
+ # Headers, for convenience in targets.
+ SET(alltest_HEADER_FILES
+ ${CMAKE_SOURCE_DIR}/test/test.h
+ )
+
+ # Use the default flags
+ if (LINUX)
+ SET(CMAKE_EXE_LINKER_FLAGS "")
+ endif (LINUX)
+
+ # start the source test executable definitions
+ SET(${project}_TEST_OUTPUT "")
+ FOREACH (source ${sources})
+ STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} )
+ STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} )
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})")
+ ENDIF(LL_TEST_VERBOSE)
+
+ #
+ # Per-codefile additional / external source, header, and include dir property extraction
+ #
+ # Source
+ GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES)
+ IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
+ SET(${name}_test_additional_SOURCE_FILES "")
+ ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
+ SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} )
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}")
+ ENDIF(LL_TEST_VERBOSE)
+ # Headers
+ GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES)
+ IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
+ SET(${name}_test_additional_HEADER_FILES "")
+ ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
+ SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES})
+ set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+ LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES})
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}")
+ ENDIF(LL_TEST_VERBOSE)
+ # Include dirs
+ GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS)
+ IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
+ SET(${name}_test_additional_INCLUDE_DIRS "")
+ ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
+ INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS )
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
+ ENDIF(LL_TEST_VERBOSE)
+
+
+ # Setup target
+ ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
+ SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+
+ #
+ # Per-codefile additional / external project dep and lib dep property extraction
+ #
+ # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19
+ # Projects
+ GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS)
+ IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
+ SET(${name}_test_additional_PROJECTS "")
+ ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
+ # Libraries
+ GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES)
+ IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
+ SET(${name}_test_additional_LIBRARIES "")
+ ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
+ IF(LL_TEST_VERBOSE)
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}")
+ MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}")
+ ENDIF(LL_TEST_VERBOSE)
+ # Add to project
+ TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} )
+
+ #
+ # Setup test targets
+ #
+ GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION)
+ SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt)
+ SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
+
+ # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19
+ IF(LL_TEST_VERBOSE)
+ MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd = ${TEST_CMD}")
+ ENDIF(LL_TEST_VERBOSE)
+
+ SET_TEST_PATH(LD_LIBRARY_PATH)
+ LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD})
+ IF(LL_TEST_VERBOSE)
+ MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script = ${TEST_SCRIPT_CMD}")
+ ENDIF(LL_TEST_VERBOSE)
+ # Add test
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${TEST_OUTPUT}
+ COMMAND ${TEST_SCRIPT_CMD}
+ DEPENDS PROJECT_${project}_TEST_${name}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ # Why not add custom target and add POST_BUILD command?
+ # Slightly less uncertain behavior
+ # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19
+ # > I did not use a post build step as I could not make it notify of a
+ # > failure after the first time you build and fail a test. - daveh 2009-04-20
+ LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT})
+ ENDFOREACH (source)
+
+ # Add the test runner target per-project
+ # (replaces old _test_ok targets all over the place)
+ ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT})
+ ADD_DEPENDENCIES(${project} ${project}_tests)
+ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS)
+
+FUNCTION(LL_ADD_INTEGRATION_TEST
+ testname
+ additional_source_files
+ library_dependencies
+# variable args
+ )
+ if(TEST_DEBUG)
+ message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on")
+ endif(TEST_DEBUG)
+
+ SET(source_files
+ tests/${testname}_test.cpp
+ ${CMAKE_SOURCE_DIR}/test/test.cpp
+ ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+ ${additional_source_files}
+ )
+
+ SET(libraries
+ ${library_dependencies}
+ ${GOOGLEMOCK_LIBRARIES}
+ ${PTHREAD_LIBRARY}
+ )
+
+ # Add test executable build target
+ if(TEST_DEBUG)
+ message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})")
+ endif(TEST_DEBUG)
+ ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
+ SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+
+ # Add link deps to the executable
+ if(TEST_DEBUG)
+ message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})")
+ endif(TEST_DEBUG)
+ TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})
+
+ # Create the test running command
+ SET(test_command ${ARGN})
+ GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION)
+ LIST(FIND test_command "{}" test_exe_pos)
+ IF(test_exe_pos LESS 0)
+ # The {} marker means "the full pathname of the test executable."
+ # test_exe_pos -1 means we didn't find it -- so append the test executable
+ # name to $ARGN, the variable part of the arg list. This is convenient
+ # shorthand for both straightforward execution of the test program (empty
+ # $ARGN) and for running a "wrapper" program of some kind accepting the
+ # pathname of the test program as the last of its args. You need specify
+ # {} only if the test program's pathname isn't the last argument in the
+ # desired command line.
+ LIST(APPEND test_command "${TEST_EXE}")
+ ELSE (test_exe_pos LESS 0)
+ # Found {} marker at test_exe_pos. Remove the {}...
+ LIST(REMOVE_AT test_command test_exe_pos)
+ # ...and replace it with the actual name of the test executable.
+ LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
+ ENDIF (test_exe_pos LESS 0)
+
+ SET_TEST_PATH(LD_LIBRARY_PATH)
+ LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command})
+
+ if(TEST_DEBUG)
+ message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
+ endif(TEST_DEBUG)
+
+ ADD_CUSTOM_COMMAND(
+ TARGET INTEGRATION_TEST_${testname}
+ POST_BUILD
+ COMMAND ${TEST_SCRIPT_CMD}
+ )
+
+ # Use CTEST? Not sure how to yet...
+ # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
+
+ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
+
+MACRO(SET_TEST_PATH LISTVAR)
+ IF(WINDOWS)
+ # We typically build/package only Release variants of third-party
+ # libraries, so append the Release staging dir in case the library being
+ # sought doesn't have a debug variant.
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release)
+ ELSEIF(DARWIN)
+ # We typically build/package only Release variants of third-party
+ # libraries, so append the Release staging dir in case the library being
+ # sought doesn't have a debug variant.
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib)
+ ELSE(WINDOWS)
+ # Linux uses a single staging directory anyway.
+ IF (STANDALONE)
+ set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib)
+ ELSE (STANDALONE)
+ set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib)
+ ENDIF (STANDALONE)
+ ENDIF(WINDOWS)
+ENDMACRO(SET_TEST_PATH)
diff --git a/indra/cmake/LLAudio.cmake b/indra/cmake/LLAudio.cmake
new file mode 100644
index 0000000000..7c248dfc72
--- /dev/null
+++ b/indra/cmake/LLAudio.cmake
@@ -0,0 +1,10 @@
+# -*- cmake -*-
+
+include(Audio)
+
+set(LLAUDIO_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llaudio
+ )
+
+# be exhaustive here
+set(LLAUDIO_LIBRARIES llaudio ${VORBISFILE_LIBRARIES} ${VORBIS_LIBRARIES} ${VORBISENC_LIBRARIES} ${OGG_LIBRARIES} ${OPENAL_LIBRARIES})
diff --git a/indra/cmake/LLCharacter.cmake b/indra/cmake/LLCharacter.cmake
new file mode 100644
index 0000000000..9b2f5c4956
--- /dev/null
+++ b/indra/cmake/LLCharacter.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLCHARACTER_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llcharacter
+ )
+
+set(LLCHARACTER_LIBRARIES llcharacter)
diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
new file mode 100644
index 0000000000..d1ab264a41
--- /dev/null
+++ b/indra/cmake/LLCommon.cmake
@@ -0,0 +1,23 @@
+# -*- cmake -*-
+
+include(APR)
+include(Boost)
+include(EXPAT)
+include(ZLIB)
+include(GooglePerfTools)
+
+set(LLCOMMON_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llcommon
+ ${APRUTIL_INCLUDE_DIR}
+ ${APR_INCLUDE_DIR}
+ ${Boost_INCLUDE_DIRS}
+ )
+
+set(LLCOMMON_LIBRARIES llcommon)
+
+add_definitions(${TCMALLOC_FLAG})
+
+set(LLCOMMON_LINK_SHARED ON 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)
diff --git a/indra/cmake/LLCrashLogger.cmake b/indra/cmake/LLCrashLogger.cmake
new file mode 100644
index 0000000000..f2cb83eb8b
--- /dev/null
+++ b/indra/cmake/LLCrashLogger.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLCRASHLOGGER_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llcrashlogger
+ )
+
+set(LLCRASHLOGGER_LIBRARIES llcrashlogger)
diff --git a/indra/cmake/LLDatabase.cmake b/indra/cmake/LLDatabase.cmake
new file mode 100644
index 0000000000..6526101386
--- /dev/null
+++ b/indra/cmake/LLDatabase.cmake
@@ -0,0 +1,10 @@
+# -*- cmake -*-
+
+include(MySQL)
+
+set(LLDATABASE_INCLUDE_DIRS
+ ${LIBS_SERVER_DIR}/lldatabase
+ ${MYSQL_INCLUDE_DIR}
+ )
+
+set(LLDATABASE_LIBRARIES lldatabase)
diff --git a/indra/cmake/LLImage.cmake b/indra/cmake/LLImage.cmake
new file mode 100644
index 0000000000..ec3da89081
--- /dev/null
+++ b/indra/cmake/LLImage.cmake
@@ -0,0 +1,11 @@
+# -*- cmake -*-
+
+include(JPEG)
+include(PNG)
+
+set(LLIMAGE_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llimage
+ ${JPEG_INCLUDE_DIRS}
+ )
+
+set(LLIMAGE_LIBRARIES llimage)
diff --git a/indra/cmake/LLImageJ2COJ.cmake b/indra/cmake/LLImageJ2COJ.cmake
new file mode 100644
index 0000000000..1bcf205f2d
--- /dev/null
+++ b/indra/cmake/LLImageJ2COJ.cmake
@@ -0,0 +1,5 @@
+# -*- cmake -*-
+
+include(OpenJPEG)
+
+set(LLIMAGEJ2COJ_LIBRARIES llimagej2coj)
diff --git a/indra/cmake/LLInventory.cmake b/indra/cmake/LLInventory.cmake
new file mode 100644
index 0000000000..c3dc077a2b
--- /dev/null
+++ b/indra/cmake/LLInventory.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLINVENTORY_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llinventory
+ )
+
+set(LLINVENTORY_LIBRARIES llinventory)
diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake
new file mode 100644
index 0000000000..27c8ada686
--- /dev/null
+++ b/indra/cmake/LLKDU.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (INSTALL_PROPRIETARY AND NOT STANDALONE)
+ use_prebuilt_binary(kdu)
+ set(LLKDU_LIBRARY llkdu)
+endif (INSTALL_PROPRIETARY AND NOT STANDALONE)
diff --git a/indra/cmake/LLLogin.cmake b/indra/cmake/LLLogin.cmake
new file mode 100644
index 0000000000..47d171876a
--- /dev/null
+++ b/indra/cmake/LLLogin.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLLOGIN_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/viewer_components/login
+ )
+
+set(LLLOGIN_LIBRARIES lllogin)
diff --git a/indra/cmake/LLMath.cmake b/indra/cmake/LLMath.cmake
new file mode 100644
index 0000000000..893920ae6f
--- /dev/null
+++ b/indra/cmake/LLMath.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLMATH_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llmath
+ )
+
+set(LLMATH_LIBRARIES llmath)
diff --git a/indra/cmake/LLMessage.cmake b/indra/cmake/LLMessage.cmake
new file mode 100644
index 0000000000..0143d04fd7
--- /dev/null
+++ b/indra/cmake/LLMessage.cmake
@@ -0,0 +1,15 @@
+# -*- cmake -*-
+
+include(CARes)
+include(CURL)
+include(OpenSSL)
+include(XmlRpcEpi)
+
+set(LLMESSAGE_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llmessage
+ ${CARES_INCLUDE_DIRS}
+ ${CURL_INCLUDE_DIRS}
+ ${OPENSSL_INCLUDE_DIRS}
+ )
+
+set(LLMESSAGE_LIBRARIES llmessage)
diff --git a/indra/cmake/LLPlugin.cmake b/indra/cmake/LLPlugin.cmake
new file mode 100644
index 0000000000..9722f16c3c
--- /dev/null
+++ b/indra/cmake/LLPlugin.cmake
@@ -0,0 +1,8 @@
+# -*- cmake -*-
+
+
+set(LLPLUGIN_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llplugin
+ )
+
+set(LLPLUGIN_LIBRARIES llplugin)
diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake
new file mode 100644
index 0000000000..d397b78f1c
--- /dev/null
+++ b/indra/cmake/LLPrimitive.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLPRIMITIVE_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llprimitive
+ )
+
+set(LLPRIMITIVE_LIBRARIES llprimitive)
diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake
new file mode 100644
index 0000000000..c47e8878e9
--- /dev/null
+++ b/indra/cmake/LLRender.cmake
@@ -0,0 +1,32 @@
+# -*- cmake -*-
+
+include(FreeType)
+
+set(LLRENDER_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llrender
+ )
+
+if (SERVER AND LINUX)
+ set(LLRENDER_LIBRARIES
+ llrenderheadless
+ )
+else (SERVER AND LINUX)
+set(LLRENDER_LIBRARIES
+ llrender
+ )
+endif (SERVER AND LINUX)
+
+# mapserver requires certain files to be copied so LL_MESA_HEADLESS can be set
+# differently for different object files.
+macro (copy_server_sources )
+ foreach (PREFIX ${ARGV})
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp
+ )
+ list(APPEND server_SOURCE_FILES ${PREFIX}_server.cpp)
+ endforeach (PREFIX ${_copied_SOURCES})
+endmacro (copy_server_sources _copied_SOURCES)
diff --git a/indra/cmake/LLScene.cmake b/indra/cmake/LLScene.cmake
new file mode 100644
index 0000000000..96ad5085a2
--- /dev/null
+++ b/indra/cmake/LLScene.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLSCENE_INCLUDE_DIRS
+ ${LIBS_SERVER_DIR}/llscene
+ )
+
+set(LLSCENE_LIBRARIES llscene)
diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake
new file mode 100644
index 0000000000..e29076c738
--- /dev/null
+++ b/indra/cmake/LLSharedLibs.cmake
@@ -0,0 +1,75 @@
+# 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)
+ get_target_property(TARGET_LOCATION ${target_exe} LOCATION)
+ get_filename_component(OUTPUT_PATH ${TARGET_LOCATION} PATH)
+
+ 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.
+ get_filename_component(TARGET_FILE ${TARGET_LOCATION} NAME)
+ set(OUTPUT_PATH ${TARGET_LOCATION}.app/Contents/MacOS)
+ set(TARGET_LOCATION ${OUTPUT_PATH}/${TARGET_FILE})
+ set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources)
+ endif(IS_BUNDLE)
+ elseif(WINDOWS)
+ SET_TEST_PATH(SEARCH_DIRS)
+ LIST(APPEND SEARCH_DIRS "$ENV{SystemRoot}/system32")
+ elseif(LINUX)
+ SET_TEST_PATH(SEARCH_DIRS)
+ set(OUTPUT_PATH ${OUTPUT_PATH}/lib)
+ endif(DARWIN)
+
+ add_custom_command(
+ TARGET ${target_exe} POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS
+ "-DBIN_NAME=\"${TARGET_LOCATION}\""
+ "-DSEARCH_DIRS=\"${SEARCH_DIRS}\""
+ "-DDST_PATH=\"${OUTPUT_PATH}\""
+ "-P"
+ "${CMAKE_SOURCE_DIR}/cmake/DeploySharedLibs.cmake"
+ )
+
+endmacro(ll_deploy_sharedlibs_command)
+
+# ll_stage_sharedlib
+# Performs config and adds a copy command for a sharedlib target.
+macro(ll_stage_sharedlib DSO_TARGET)
+ if(SHARED_LIB_STAGING_DIR)
+ # target gets written to the DLL staging directory.
+ # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests.
+ set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR})
+ if(NOT WINDOWS)
+ get_target_property(DSO_PATH ${DSO_TARGET} LOCATION)
+ get_filename_component(DSO_FILE ${DSO_PATH} NAME)
+ if(DARWIN)
+ set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources)
+ else(DARWIN)
+ set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+ endif(DARWIN)
+
+ # *TODO - maybe make this a symbolic link? -brad
+ add_custom_command(
+ TARGET ${DSO_TARGET} POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS
+ -E
+ copy_if_different
+ ${DSO_PATH}
+ ${SHARED_LIB_STAGING_DIR_CONFIG}/${DSO_FILE}
+ COMMENT "Copying llcommon to the staging folder."
+ )
+ endif(NOT WINDOWS)
+ endif(SHARED_LIB_STAGING_DIR)
+
+ if (DARWIN)
+ set_target_properties(${DSO_TARGET} PROPERTIES
+ BUILD_WITH_INSTALL_RPATH 1
+ INSTALL_NAME_DIR "@executable_path/../Resources"
+ )
+ endif(DARWIN)
+
+endmacro(ll_stage_sharedlib)
diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake
new file mode 100644
index 0000000000..554559edbd
--- /dev/null
+++ b/indra/cmake/LLTestCommand.cmake
@@ -0,0 +1,16 @@
+MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH)
+ # nat wonders how Kitware can use the term 'function' for a construct that
+ # cannot return a value. And yet, variables you set inside a FUNCTION are
+ # local. Try a MACRO instead.
+ SET(value
+ ${PYTHON_EXECUTABLE}
+ "${CMAKE_SOURCE_DIR}/cmake/run_build_test.py")
+ FOREACH(dir ${LD_LIBRARY_PATH})
+ LIST(APPEND value "-l${dir}")
+ ENDFOREACH(dir)
+ LIST(APPEND value ${ARGN})
+ SET(${OUTVAR} ${value})
+##IF(LL_TEST_VERBOSE)
+## MESSAGE(STATUS "LL_TEST_COMMAND: ${value}")
+##ENDIF(LL_TEST_VERBOSE)
+ENDMACRO(LL_TEST_COMMAND)
diff --git a/indra/cmake/LLUI.cmake b/indra/cmake/LLUI.cmake
new file mode 100644
index 0000000000..34de57108b
--- /dev/null
+++ b/indra/cmake/LLUI.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLUI_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llui
+ )
+
+set(LLUI_LIBRARIES llui)
diff --git a/indra/cmake/LLVFS.cmake b/indra/cmake/LLVFS.cmake
new file mode 100644
index 0000000000..0fe87cdea6
--- /dev/null
+++ b/indra/cmake/LLVFS.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLVFS_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llvfs
+ )
+
+set(LLVFS_LIBRARIES llvfs)
diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake
new file mode 100644
index 0000000000..a5b9cf47a4
--- /dev/null
+++ b/indra/cmake/LLWindow.cmake
@@ -0,0 +1,43 @@
+# -*- cmake -*-
+
+include(OpenGL)
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindSDL)
+
+ # This should be done by FindSDL. Sigh.
+ mark_as_advanced(
+ SDLMAIN_LIBRARY
+ SDL_INCLUDE_DIR
+ SDL_LIBRARY
+ )
+else (STANDALONE)
+ use_prebuilt_binary(mesa)
+ if (LINUX AND VIEWER)
+ use_prebuilt_binary(SDL)
+ set (SDL_FOUND TRUE)
+ set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux)
+ set (SDL_LIBRARY SDL)
+ endif (LINUX AND VIEWER)
+endif (STANDALONE)
+
+if (SDL_FOUND)
+ add_definitions(-DLL_SDL=1)
+ include_directories(${SDL_INCLUDE_DIR})
+endif (SDL_FOUND)
+
+set(LLWINDOW_INCLUDE_DIRS
+ ${GLEXT_INCLUDE_DIR}
+ ${LIBS_OPEN_DIR}/llwindow
+ )
+
+if (SERVER AND LINUX)
+ set(LLWINDOW_LIBRARIES
+ llwindowheadless
+ )
+else (SERVER AND LINUX)
+ set(LLWINDOW_LIBRARIES
+ llwindow
+ )
+endif (SERVER AND LINUX)
diff --git a/indra/cmake/LLXML.cmake b/indra/cmake/LLXML.cmake
new file mode 100644
index 0000000000..64dfdb604f
--- /dev/null
+++ b/indra/cmake/LLXML.cmake
@@ -0,0 +1,12 @@
+# -*- cmake -*-
+
+include(Boost)
+include(EXPAT)
+
+set(LLXML_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llxml
+ ${Boost_INCLUDE_DIRS}
+ ${EXPAT_INCLUDE_DIRS}
+ )
+
+set(LLXML_LIBRARIES llxml)
diff --git a/indra/cmake/LLXUIXML.cmake b/indra/cmake/LLXUIXML.cmake
new file mode 100644
index 0000000000..b8bfe48c77
--- /dev/null
+++ b/indra/cmake/LLXUIXML.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLXUIXML_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llxuixml
+ )
+
+set(LLXUIXML_LIBRARIES llxuixml)
diff --git a/indra/cmake/LScript.cmake b/indra/cmake/LScript.cmake
new file mode 100644
index 0000000000..86bfcb7440
--- /dev/null
+++ b/indra/cmake/LScript.cmake
@@ -0,0 +1,16 @@
+# -*- cmake -*-
+
+set(LSCRIPT_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/lscript
+ ${LIBS_OPEN_DIR}/lscript/lscript_compile
+ ${LIBS_OPEN_DIR}/lscript/lscript_execute
+ ${LIBS_OPEN_DIR}/lscript/lscript_execute_mono
+ )
+
+set(LSCRIPT_LIBRARIES
+ lscript_compile
+ lscript_execute
+ lscript_library
+ )
+
+set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono) \ No newline at end of file
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
new file mode 100644
index 0000000000..bca99caf2a
--- /dev/null
+++ b/indra/cmake/Linking.cmake
@@ -0,0 +1,57 @@
+# -*- cmake -*-
+
+if (NOT STANDALONE)
+ if (WINDOWS)
+ set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
+ set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
+ set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
+ set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
+ set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged executables")
+ elseif (LINUX)
+ if (VIEWER)
+ set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client)
+ else (VIEWER)
+ set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release)
+ endif (VIEWER)
+ set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS})
+ set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS})
+ set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib CACHE FILEPATH "Location of staged .sos")
+ set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin CACHE FILEPATH "Location of staged executables")
+ elseif (DARWIN)
+ set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release)
+ set(ARCH_PREBUILT_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
+ set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS_RELEASE})
+ set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
+ set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)" CACHE FILEPATH "Location of staged executables")
+ endif (WINDOWS)
+endif (NOT STANDALONE)
+
+link_directories(${ARCH_PREBUILT_DIRS})
+
+if (LINUX)
+ set(DL_LIBRARY dl)
+ set(PTHREAD_LIBRARY pthread)
+else (LINUX)
+ set(DL_LIBRARY "")
+ set(PTHREAD_LIBRARY "")
+endif (LINUX)
+
+if (WINDOWS)
+ set(WINDOWS_LIBRARIES
+ advapi32
+ shell32
+ ws2_32
+ mswsock
+ psapi
+ winmm
+ netapi32
+ wldap32
+ gdi32
+ user32
+ dbghelp
+ )
+else (WINDOWS)
+ set(WINDOWS_LIBRARIES "")
+endif (WINDOWS)
+
+mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES)
diff --git a/indra/cmake/MediaPluginBase.cmake b/indra/cmake/MediaPluginBase.cmake
new file mode 100644
index 0000000000..2be035b641
--- /dev/null
+++ b/indra/cmake/MediaPluginBase.cmake
@@ -0,0 +1,8 @@
+# -*- cmake -*-
+
+
+set(MEDIA_PLUGIN_BASE_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/media_plugins/base/
+ )
+
+set(MEDIA_PLUGIN_BASE_LIBRARIES media_plugin_base)
diff --git a/indra/cmake/MonoDeps.cmake b/indra/cmake/MonoDeps.cmake
new file mode 100644
index 0000000000..52d5491563
--- /dev/null
+++ b/indra/cmake/MonoDeps.cmake
@@ -0,0 +1,48 @@
+# -*- cmake -*-
+
+set(MONO_PREBUILT_LIBRARIES_DIR ${LIBS_PREBUILT_DIR}/mono/1.0)
+
+set(MONO_PREBUILT_LIBRARIES
+ Iesi.Collections.dll
+ Iesi.Collections.pdb
+ Mono.CompilerServices.SymbolWriter.dll
+ Mono.PEToolkit.dll
+ Mono.PEToolkit.pdb
+ Mono.Security.dll
+ PEAPI.dll
+ RAIL.dll
+ RAIL.pdb
+ )
+
+ set(MONO_CORE_LIBRARIES
+ System.dll
+ System.Xml.dll
+ mscorlib.dll)
+
+if(WINDOWS)
+ set(MONO_DEPENDENCIES
+ DomainCreator
+ DomainRegister
+ LslLibrary
+ LslUserScript
+ Script
+ ScriptTypes
+ TestFormat
+ UserScript
+ UThread
+ UThreadInjector
+ )
+else(WINDOWS)
+ set(MONO_DEPENDENCIES
+ DomainCreator_POST_BUILD
+ DomainRegister_POST_BUILD
+ LslLibrary_POST_BUILD
+ LslUserScript_POST_BUILD
+ Script_POST_BUILD
+ ScriptTypes_POST_BUILD
+ TestFormat_POST_BUILD
+ UserScript_POST_BUILD
+ UThread_POST_BUILD
+ UThreadInjector_POST_BUILD
+ )
+endif(WINDOWS)
diff --git a/indra/cmake/MonoEmbed.cmake b/indra/cmake/MonoEmbed.cmake
new file mode 100644
index 0000000000..0f1f23309c
--- /dev/null
+++ b/indra/cmake/MonoEmbed.cmake
@@ -0,0 +1,57 @@
+# -*- cmake -*-
+
+include(Prebuilt)
+use_prebuilt_binary(libmono)
+
+SET(GLIB_2_0 glib-2.0)
+
+if (WINDOWS)
+ SET(MONO_LIB mono)
+else (WINDOWS)
+ SET(MONO_LIB mono)
+ SET(M_LIBRARIES m)
+ SET(GTHREAD_2_0 gthread-2.0)
+endif(WINDOWS)
+
+
+IF (DARWIN)
+
+ FIND_LIBRARY(MONO_LIBRARY NAMES Mono)
+ # Find_file doesnt work as expected. Hardcode relative to Mono.framework.
+ #FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY})
+ #FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY})
+ SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/)
+ SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/)
+ SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries)
+
+ IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
+ MESSAGE(STATUS "Found Mono for embedding")
+ INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG})
+ LINK_DIRECTORIES(${MONO_LIB_DIRECTORY})
+ ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
+ MESSAGE(FATAL_ERROR "Mono not found for embedding")
+ MESSAGE(${MONO_LIBRARY})
+ MESSAGE(${MONO_GLIB_LIBRARY})
+ MESSAGE(${GLIB_CONFIG})
+ ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
+
+ELSE (DARWIN)
+
+ SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+ SET(GLIB_2_0_PLATFORM_INCLUDE_DIR
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0)
+ SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0)
+
+ INCLUDE_DIRECTORIES(
+ ${MONO_INCLUDE_DIR}
+ ${GLIB_2_0_PLATFORM_INCLUDE_DIR}
+ ${GLIB_2_0_INCLUDE_DIR})
+
+ENDIF (DARWIN)
+
+SET(MONO_LIBRARIES
+ ${MONO_LIB}
+ ${M_LIBRARIES}
+ ${GLIB_2_0}
+ ${GTHREAD_2_0}
+)
diff --git a/indra/cmake/MySQL.cmake b/indra/cmake/MySQL.cmake
new file mode 100644
index 0000000000..e591fbc3d8
--- /dev/null
+++ b/indra/cmake/MySQL.cmake
@@ -0,0 +1,26 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+use_prebuilt_binary(mysql)
+
+if (LINUX)
+ if (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
+ set(MYSQL_LIBRARIES mysqlclient)
+ set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+ else (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
+ # Use the native MySQL library on a 64-bit system.
+ set(MYSQL_FIND_QUIETLY ON)
+ set(MYSQL_FIND_REQUIRED ON)
+ include(FindMySQL)
+ endif (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
+elseif (WINDOWS)
+ set(MYSQL_LIBRARIES mysqlclient)
+ set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+elseif (DARWIN)
+ set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+ set(MYSQL_LIBRARIES
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libmysqlclient.a
+ debug ${ARCH_PREBUILT_DIRS_DEBUG}/libmysqlclient.a
+ )
+endif (LINUX)
diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake
new file mode 100644
index 0000000000..dad74e99b1
--- /dev/null
+++ b/indra/cmake/NDOF.cmake
@@ -0,0 +1,14 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+use_prebuilt_binary(ndofdev)
+
+if (WINDOWS OR DARWIN OR LINUX)
+ add_definitions(-DLIB_NDOF=1)
+endif (WINDOWS OR DARWIN OR LINUX)
+
+if (WINDOWS)
+ set(NDOF_LIBRARY libndofdev)
+elseif (DARWIN OR LINUX)
+ set(NDOF_LIBRARY ndofdev)
+endif (WINDOWS)
diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake
new file mode 100644
index 0000000000..d01c680ed1
--- /dev/null
+++ b/indra/cmake/OPENAL.cmake
@@ -0,0 +1,28 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+if (LINUX)
+ set(OPENAL ON CACHE BOOL "Enable OpenAL")
+else (LINUX)
+ set(OPENAL OFF CACHE BOOL "Enable OpenAL")
+endif (LINUX)
+
+if (OPENAL)
+ if (STANDALONE)
+ include(FindPkgConfig)
+ include(FindOpenAL)
+ pkg_check_modules(OPENAL_LIB REQUIRED openal)
+ pkg_check_modules(FREEALUT_LIB REQUIRED freealut)
+ else (STANDALONE)
+ use_prebuilt_binary(openal-soft)
+ endif (STANDALONE)
+ set(OPENAL_LIBRARIES
+ openal
+ alut
+ )
+endif (OPENAL)
+
+if (OPENAL)
+ message(STATUS "Building with OpenAL audio support")
+endif (OPENAL)
diff --git a/indra/cmake/OpenGL.cmake b/indra/cmake/OpenGL.cmake
new file mode 100644
index 0000000000..6a2b6811af
--- /dev/null
+++ b/indra/cmake/OpenGL.cmake
@@ -0,0 +1,9 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (NOT STANDALONE)
+ use_prebuilt_binary(GL)
+ # possible glh_linear should have its own .cmake file instead
+ use_prebuilt_binary(glh_linear)
+ set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
+endif (NOT STANDALONE)
diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake
new file mode 100644
index 0000000000..fcc82c2f49
--- /dev/null
+++ b/indra/cmake/OpenJPEG.cmake
@@ -0,0 +1,22 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(OPENJPEG_FIND_QUIETLY ON)
+set(OPENJPEG_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindOpenJPEG)
+else (STANDALONE)
+ use_prebuilt_binary(openjpeg)
+
+ if(WINDOWS)
+ # Windows has differently named release and debug openjpeg(d) libs.
+ set(OPENJPEG_LIBRARIES
+ debug openjpegd
+ optimized openjpeg)
+ else(WINDOWS)
+ set(OPENJPEG_LIBRARIES openjpeg)
+ endif(WINDOWS)
+
+ set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg)
+endif (STANDALONE)
diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake
new file mode 100644
index 0000000000..81584c09ea
--- /dev/null
+++ b/indra/cmake/OpenSSL.cmake
@@ -0,0 +1,23 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(OpenSSL_FIND_QUIETLY ON)
+set(OpenSSL_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindOpenSSL)
+else (STANDALONE)
+ 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}/${LL_ARCH_DIR}/include)
+endif (STANDALONE)
+
+if (LINUX)
+ set(CRYPTO_LIBRARIES crypto)
+elseif (DARWIN)
+ set(CRYPTO_LIBRARIES llcrypto)
+endif (LINUX)
diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake
new file mode 100644
index 0000000000..f6522d9e2f
--- /dev/null
+++ b/indra/cmake/PNG.cmake
@@ -0,0 +1,13 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(PNG_FIND_QUIETLY ON)
+set(PNG_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindPNG)
+else (STANDALONE)
+ use_prebuilt_binary(libpng)
+ set(PNG_LIBRARIES png12)
+ set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng12)
+endif (STANDALONE)
diff --git a/indra/cmake/PluginAPI.cmake b/indra/cmake/PluginAPI.cmake
new file mode 100644
index 0000000000..d1649e8248
--- /dev/null
+++ b/indra/cmake/PluginAPI.cmake
@@ -0,0 +1,16 @@
+# -*- cmake -*-
+
+if (WINDOWS)
+ set(PLUGIN_API_WINDOWS_LIBRARIES
+ wsock32
+ ws2_32
+ psapi
+ netapi32
+ advapi32
+ user32
+ )
+else (WINDOWS)
+ set(PLUGIN_API_WINDOWS_LIBRARIES "")
+endif (WINDOWS)
+
+
diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake
new file mode 100644
index 0000000000..a91519278c
--- /dev/null
+++ b/indra/cmake/Prebuilt.cmake
@@ -0,0 +1,44 @@
+# -*- cmake -*-
+
+include(Python)
+include(FindSCP)
+
+macro (use_prebuilt_binary _binary)
+ if (NOT STANDALONE)
+ if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ if(INSTALL_PROPRIETARY)
+ include(FindSCP)
+ if(DEBUG_PREBUILT)
+ message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. --scp=${SCP_EXECUTABLE} ${_binary}")
+ endif(DEBUG_PREBUILT)
+ execute_process(COMMAND ${PYTHON_EXECUTABLE}
+ install.py
+ --install-dir=${CMAKE_SOURCE_DIR}/..
+ --scp=${SCP_EXECUTABLE}
+ ${_binary}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ RESULT_VARIABLE ${_binary}_installed
+ )
+ else(INSTALL_PROPRIETARY)
+ if(DEBUG_PREBUILT)
+ message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. ${_binary}")
+ endif(DEBUG_PREBUILT)
+ execute_process(COMMAND ${PYTHON_EXECUTABLE}
+ install.py
+ --install-dir=${CMAKE_SOURCE_DIR}/..
+ ${_binary}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ RESULT_VARIABLE ${_binary}_installed
+ )
+ endif(INSTALL_PROPRIETARY)
+ file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
+ else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ set(${_binary}_installed 0)
+ endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
+ 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 STANDALONE)
+endmacro (use_prebuilt_binary _binary)
diff --git a/indra/cmake/Pth.cmake b/indra/cmake/Pth.cmake
new file mode 100644
index 0000000000..a28f6ec696
--- /dev/null
+++ b/indra/cmake/Pth.cmake
@@ -0,0 +1,21 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(PTH_FIND_QUIETLY ON)
+set(PTH_FIND_REQUIRED ON)
+
+if (STANDALONE)
+# ?? How would I construct FindPTH.cmake? This file was cloned from
+# CURL.cmake, which uses include(FindCURL), but there's no FindCURL.cmake?
+# include(FindPTH)
+else (STANDALONE)
+ # This library is only needed to support Boost.Coroutine, and only on Mac.
+ if (DARWIN)
+ use_prebuilt_binary(pth)
+ set(PTH_LIBRARIES pth)
+ set(PTH_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+ else (DARWIN)
+ set(PTH_LIBRARIES)
+ set(PTH_INCLUDE_DIRS)
+ endif (DARWIN)
+endif (STANDALONE)
diff --git a/indra/cmake/PulseAudio.cmake b/indra/cmake/PulseAudio.cmake
new file mode 100644
index 0000000000..e918de0198
--- /dev/null
+++ b/indra/cmake/PulseAudio.cmake
@@ -0,0 +1,28 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(PULSEAUDIO ON CACHE BOOL "Build with PulseAudio support, if available.")
+
+if (PULSEAUDIO)
+ if (STANDALONE)
+ include(FindPkgConfig)
+
+ pkg_check_modules(PULSEAUDIO libpulse)
+
+ elseif (LINUX)
+ use_prebuilt_binary(pulseaudio)
+ set(PULSEAUDIO_FOUND ON FORCE BOOL)
+ set(PULSEAUDIO_INCLUDE_DIRS
+ ${LIBS_PREBUILT_DIR}/include
+ )
+ # We don't need to explicitly link against pulseaudio itself, because
+ # the viewer probes for the system's copy at runtime.
+ set(PULSEAUDIO_LIBRARIES
+ # none needed!
+ )
+ endif (STANDALONE)
+endif (PULSEAUDIO)
+
+if (PULSEAUDIO_FOUND)
+ add_definitions(-DLL_PULSEAUDIO_ENABLED=1)
+endif (PULSEAUDIO_FOUND)
diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake
new file mode 100644
index 0000000000..0901c1b7a2
--- /dev/null
+++ b/indra/cmake/Python.cmake
@@ -0,0 +1,54 @@
+# -*- cmake -*-
+
+set(PYTHONINTERP_FOUND)
+
+if (WINDOWS)
+ # On Windows, explicitly avoid Cygwin Python.
+
+ find_program(PYTHON_EXECUTABLE
+ NAMES python25.exe python23.exe python.exe
+ NO_DEFAULT_PATH # added so that cmake does not find cygwin python
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+ )
+elseif (EXISTS /etc/debian_version)
+ # On Debian and Ubuntu, avoid Python 2.4 if possible.
+
+ find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
+
+ if (PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND ON)
+ endif (PYTHON_EXECUTABLE)
+elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # On MAC OS X be sure to search standard locations first
+
+ string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
+ find_program(PYTHON_EXECUTABLE
+ NAMES python python25 python24 python23
+ NO_DEFAULT_PATH # Avoid searching non-standard locations first
+ PATHS
+ /bin
+ /usr/bin
+ /usr/local/bin
+ ${PATH_LIST}
+ )
+
+ if (PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND ON)
+ endif (PYTHON_EXECUTABLE)
+else (WINDOWS)
+ include(FindPythonInterp)
+endif (WINDOWS)
+
+if (NOT PYTHON_EXECUTABLE)
+ message(FATAL_ERROR "No Python interpreter found")
+endif (NOT PYTHON_EXECUTABLE)
+
+mark_as_advanced(PYTHON_EXECUTABLE)
diff --git a/indra/cmake/QuickTimePlugin.cmake b/indra/cmake/QuickTimePlugin.cmake
new file mode 100644
index 0000000000..02f432e3c1
--- /dev/null
+++ b/indra/cmake/QuickTimePlugin.cmake
@@ -0,0 +1,46 @@
+# -*- cmake -*-
+
+if(INSTALL_PROPRIETARY)
+ include(Prebuilt)
+ use_prebuilt_binary(quicktime)
+endif(INSTALL_PROPRIETARY)
+
+if (DARWIN)
+ include(CMakeFindFrameworks)
+ find_library(QUICKTIME_LIBRARY QuickTime)
+elseif (WINDOWS)
+ set(QUICKTIME_SDK_DIR "$ENV{PROGRAMFILES}/QuickTime SDK"
+ CACHE PATH "Location of the QuickTime SDK.")
+
+ find_library(DEBUG_QUICKTIME_LIBRARY qtmlclient.lib
+ PATHS
+ ${ARCH_PREBUILT_DIRS_DEBUG}
+ "${QUICKTIME_SDK_DIR}\\libraries"
+ )
+
+ find_library(RELEASE_QUICKTIME_LIBRARY qtmlclient.lib
+ PATHS
+ ${ARCH_PREBUILT_DIRS_RELEASE}
+ "${QUICKTIME_SDK_DIR}\\libraries"
+ )
+
+ if (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY)
+ set(QUICKTIME_LIBRARY
+ optimized ${RELEASE_QUICKTIME_LIBRARY}
+ debug ${DEBUG_QUICKTIME_LIBRARY}
+ )
+
+ endif (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY)
+
+ include_directories(
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/quicktime
+ "${QUICKTIME_SDK_DIR}\\CIncludes"
+ )
+endif (DARWIN)
+
+mark_as_advanced(QUICKTIME_LIBRARY)
+
+if (QUICKTIME_LIBRARY)
+ set(QUICKTIME ON CACHE BOOL "Build with QuickTime streaming media support.")
+endif (QUICKTIME_LIBRARY)
+
diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake
new file mode 100644
index 0000000000..fa4e387dd5
--- /dev/null
+++ b/indra/cmake/TemplateCheck.cmake
@@ -0,0 +1,14 @@
+# -*- cmake -*-
+
+include(Python)
+
+macro (check_message_template _target)
+ add_custom_command(
+ TARGET ${_target}
+ POST_BUILD
+ COMMAND ${PYTHON_EXECUTABLE}
+ ARGS ${SCRIPTS_DIR}/template_verifier.py
+ --mode=development --cache_master
+ COMMENT "Verifying message template"
+ )
+endmacro (check_message_template)
diff --git a/indra/cmake/Tut.cmake b/indra/cmake/Tut.cmake
new file mode 100644
index 0000000000..784560471d
--- /dev/null
+++ b/indra/cmake/Tut.cmake
@@ -0,0 +1,12 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(TUT_FIND_REQUIRED TRUE)
+set(TUT_FIND_QUIETLY TRUE)
+
+if (STANDALONE)
+ include(FindTut)
+ include_directories(${TUT_INCLUDE_DIR})
+else (STANDALONE)
+ use_prebuilt_binary(tut)
+endif (STANDALONE)
diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake
new file mode 100644
index 0000000000..f529f5b644
--- /dev/null
+++ b/indra/cmake/UI.cmake
@@ -0,0 +1,64 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindPkgConfig)
+
+ if (LINUX)
+ set(PKGCONFIG_PACKAGES
+ atk
+ cairo
+ gdk-2.0
+ gdk-pixbuf-2.0
+ glib-2.0
+ gmodule-2.0
+ gtk+-2.0
+ gthread-2.0
+ libpng
+ pango
+ pangoft2
+ pangox
+ pangoxft
+ sdl
+ )
+ endif (LINUX)
+
+ foreach(pkg ${PKGCONFIG_PACKAGES})
+ pkg_check_modules(${pkg} REQUIRED ${pkg})
+ include_directories(${${pkg}_INCLUDE_DIRS})
+ link_directories(${${pkg}_LIBRARY_DIRS})
+ list(APPEND UI_LIBRARIES ${${pkg}_LIBRARIES})
+ add_definitions(${${pkg}_CFLAGS_OTHERS})
+ endforeach(pkg)
+else (STANDALONE)
+ use_prebuilt_binary(gtk-atk-pango-glib)
+ if (LINUX)
+ set(UI_LIBRARIES
+ atk-1.0
+ gdk-x11-2.0
+ gdk_pixbuf-2.0
+ Xinerama
+ glib-2.0
+ gmodule-2.0
+ gobject-2.0
+ gthread-2.0
+ gtk-x11-2.0
+ pango-1.0
+ pangoft2-1.0
+ pangox-1.0
+ pangoxft-1.0
+ )
+ endif (LINUX)
+
+ include_directories (
+ ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include
+ ${LIBS_PREBUILT_DIR}/include
+ )
+ foreach(include ${${LL_ARCH}_INCLUDES})
+ include_directories(${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/${include})
+ endforeach(include)
+endif (STANDALONE)
+
+if (LINUX)
+ add_definitions(-DLL_GTK=1 -DLL_X11=1)
+endif (LINUX)
diff --git a/indra/cmake/UnixInstall.cmake b/indra/cmake/UnixInstall.cmake
new file mode 100644
index 0000000000..139be0a008
--- /dev/null
+++ b/indra/cmake/UnixInstall.cmake
@@ -0,0 +1,31 @@
+if (NOT ${viewer_VERSION})
+ MESSAGE(FATAL_ERROR "Viewer version not known!")
+endif (NOT ${viewer_VERSION})
+
+set(INSTALL OFF CACHE BOOL
+ "Generate install target.")
+
+if (INSTALL)
+ set(INSTALL_PREFIX /usr CACHE PATH
+ "Top-level installation directory.")
+
+ if (EXISTS /lib64)
+ set(_LIB lib64)
+ else (EXISTS /lib64)
+ set(_LIB lib)
+ endif (EXISTS /lib64)
+
+ set(INSTALL_LIBRARY_DIR ${INSTALL_PREFIX}/${_LIB} CACHE PATH
+ "Installation directory for read-only shared files.")
+
+ set(INSTALL_SHARE_DIR ${INSTALL_PREFIX}/share CACHE PATH
+ "Installation directory for read-only shared files.")
+
+ set(APP_BINARY_DIR ${INSTALL_LIBRARY_DIR}/secondlife-${viewer_VERSION}
+ CACHE PATH
+ "Installation directory for binaries.")
+
+ set(APP_SHARE_DIR ${INSTALL_SHARE_DIR}/secondlife-${viewer_VERSION}
+ CACHE PATH
+ "Installation directory for read-only data files.")
+endif (INSTALL)
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
new file mode 100644
index 0000000000..230e228c62
--- /dev/null
+++ b/indra/cmake/Variables.cmake
@@ -0,0 +1,146 @@
+# -*- cmake -*-
+#
+# Definitions of variables used throughout the Second Life build
+# process.
+#
+# Platform variables:
+#
+# DARWIN - Mac OS X
+# LINUX - Linux
+# WINDOWS - Windows
+#
+# What to build:
+#
+# VIEWER - viewer and other viewer-side components
+# SERVER - simulator and other server-side bits
+
+
+# Relative and absolute paths to subtrees.
+
+set(LIBS_CLOSED_PREFIX)
+set(LIBS_OPEN_PREFIX)
+set(LIBS_SERVER_PREFIX)
+set(SCRIPTS_PREFIX ../scripts)
+set(SERVER_PREFIX)
+set(VIEWER_PREFIX)
+set(INTEGRATION_TESTS_PREFIX)
+set(LL_TESTS ON CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation")
+
+set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX})
+set(LIBS_OPEN_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX})
+set(LIBS_SERVER_DIR ${CMAKE_SOURCE_DIR}/${LIBS_SERVER_PREFIX})
+set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX})
+set(SERVER_DIR ${CMAKE_SOURCE_DIR}/${SERVER_PREFIX})
+set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX})
+
+set(LIBS_PREBUILT_DIR ${CMAKE_SOURCE_DIR}/../libraries 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)
+
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ set(WINDOWS ON BOOL FORCE)
+ set(ARCH i686)
+ set(LL_ARCH ${ARCH}_win32)
+ set(LL_ARCH_DIR ${ARCH}-win32)
+ set(WORD_SIZE 32)
+endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(LINUX ON BOOl FORCE)
+
+ # If someone has specified a word size, use that to determine the
+ # architecture. Otherwise, let the compiler specify the word size.
+ # Using uname will break under chroots and other cross arch compiles. RC
+ if (WORD_SIZE EQUAL 32)
+ set(ARCH i686)
+ elseif (WORD_SIZE EQUAL 64)
+ set(ARCH x86_64)
+ 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)
+ set(WORD_SIZE 64)
+ endif(CMAKE_SIZEOF_VOID_P MATCHES 4)
+ endif (WORD_SIZE EQUAL 32)
+
+ set(LL_ARCH ${ARCH}_linux)
+ set(LL_ARCH_DIR ${ARCH}-linux)
+endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(DARWIN 1)
+
+ # NOTE: If specifying a different SDK with CMAKE_OSX_SYSROOT at configure
+ # time you should also specify CMAKE_OSX_DEPLOYMENT_TARGET explicitly,
+ # otherwise CMAKE_OSX_SYSROOT will be overridden here. We can't just check
+ # for it being unset, as it gets set to the system default :(
+
+ # Default to building against the 10.4 SDK if no deployment target is
+ # specified.
+ if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+ # NOTE: setting -isysroot is NOT adequate: http://lists.apple.com/archives/Xcode-users/2007/Oct/msg00696.html
+ # see http://public.kitware.com/Bug/view.php?id=9959 + poppy
+ set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.4)
+ endif (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+
+ # GCC 4.2 is incompatible with the MacOSX 10.4 SDK
+ if (${CMAKE_OSX_SYSROOT} MATCHES "10.4u")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0")
+ endif (${CMAKE_OSX_SYSROOT} MATCHES "10.4u")
+
+ # NOTE: To attempt an i386/PPC Universal build, add this on the configure line:
+ # -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc'
+ # Build only for i386 by default, system default on MacOSX 10.6 is x86_64
+ if (NOT CMAKE_OSX_ARCHITECTURES)
+ set(CMAKE_OSX_ARCHITECTURES i386)
+ endif (NOT CMAKE_OSX_ARCHITECTURES)
+
+ if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
+ set(ARCH universal)
+ else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
+ set(ARCH ppc)
+ else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
+ set(ARCH i386)
+ endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
+ endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
+
+ set(LL_ARCH ${ARCH}_darwin)
+ set(LL_ARCH_DIR universal-darwin)
+ set(WORD_SIZE 32)
+endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
+# Default deploy grid
+set(GRID agni CACHE STRING "Target Grid")
+
+set(VIEWER ON CACHE BOOL "Build Second Life viewer.")
+set(VIEWER_CHANNEL "LindenDeveloper" CACHE STRING "Viewer Channel Name")
+set(VIEWER_LOGIN_CHANNEL ${VIEWER_CHANNEL} CACHE STRING "Fake login channel for A/B Testing")
+
+set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.")
+
+if (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
+ set(SERVER ON CACHE BOOL "Build Second Life server software.")
+endif (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
+
+if (LINUX AND SERVER AND VIEWER)
+ MESSAGE(FATAL_ERROR "
+The indra source does not currently support building SERVER and VIEWER at the same time.
+Please set one of these values to OFF in your CMake cache file.
+(either by running ccmake or by editing CMakeCache.txt by hand)
+For more information, please see JIRA DEV-14943 - Cmake Linux cannot build both VIEWER and SERVER in one build environment
+ ")
+endif (LINUX AND SERVER AND VIEWER)
+
+
+set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header directives where supported.")
+
+source_group("CMake Rules" FILES CMakeLists.txt)
diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake
new file mode 100644
index 0000000000..32c4bc81df
--- /dev/null
+++ b/indra/cmake/ViewerMiscLibs.cmake
@@ -0,0 +1,16 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+if (NOT STANDALONE)
+ use_prebuilt_binary(libuuid)
+ use_prebuilt_binary(vivox)
+ use_prebuilt_binary(fontconfig)
+endif(NOT STANDALONE)
+
+if(VIEWER AND NOT STANDALONE)
+ if(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
+ message(STATUS "We seem to have an artwork bundle in the tree - brilliant.")
+ else(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
+ message(FATAL_ERROR "Didn't find an artwork bundle - this needs to be downloaded separately and unpacked into this tree. You can probably get it from the same place you got your viewer source. Thanks!")
+ endif(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
+endif(VIEWER AND NOT STANDALONE)
diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake
new file mode 100644
index 0000000000..12ba1b1b35
--- /dev/null
+++ b/indra/cmake/WebKitLibPlugin.cmake
@@ -0,0 +1,59 @@
+# -*- cmake -*-
+include(Linking)
+include(Prebuilt)
+
+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
+ optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
+ debug ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
+ )
+elseif (LINUX)
+ if (STANDALONE)
+ set(WEBKIT_PLUGIN_LIBRARIES llqtwebkit)
+ else (STANDALONE)
+ set(WEBKIT_PLUGIN_LIBRARIES
+ llqtwebkit
+
+ qgif
+ qjpeg
+
+ QtWebKit
+ QtOpenGL
+ QtNetwork
+ QtGui
+ QtCore
+
+ jpeg
+ fontconfig
+ X11
+ Xrender
+ GL
+ )
+ endif (STANDALONE)
+endif (WINDOWS)
diff --git a/indra/cmake/XmlRpcEpi.cmake b/indra/cmake/XmlRpcEpi.cmake
new file mode 100644
index 0000000000..107d1926ba
--- /dev/null
+++ b/indra/cmake/XmlRpcEpi.cmake
@@ -0,0 +1,17 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(XMLRPCEPI_FIND_QUIETLY ON)
+set(XMLRPCEPI_FIND_REQUIRED ON)
+
+if (STANDALONE)
+ include(FindXmlRpcEpi)
+else (STANDALONE)
+ use_prebuilt_binary(xmlrpc-epi)
+ if (WINDOWS)
+ set(XMLRPCEPI_LIBRARIES xmlrpcepi)
+ else (WINDOWS)
+ set(XMLRPCEPI_LIBRARIES xmlrpc-epi)
+ endif (WINDOWS)
+ set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
+endif (STANDALONE)
diff --git a/indra/cmake/ZLIB.cmake b/indra/cmake/ZLIB.cmake
new file mode 100644
index 0000000000..48e5130ad5
--- /dev/null
+++ b/indra/cmake/ZLIB.cmake
@@ -0,0 +1,22 @@
+# -*- cmake -*-
+
+set(ZLIB_FIND_QUIETLY ON)
+set(ZLIB_FIND_REQUIRED ON)
+
+include(Prebuilt)
+
+if (STANDALONE)
+ include(FindZLIB)
+else (STANDALONE)
+ use_prebuilt_binary(zlib)
+ if (WINDOWS)
+ set(ZLIB_LIBRARIES
+ debug zlibd
+ optimized zlib)
+ else (WINDOWS)
+ set(ZLIB_LIBRARIES z)
+ endif (WINDOWS)
+ if (WINDOWS OR LINUX)
+ set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib)
+ endif (WINDOWS OR LINUX)
+endif (STANDALONE)
diff --git a/indra/cmake/cmake_dummy.cpp b/indra/cmake/cmake_dummy.cpp
new file mode 100644
index 0000000000..ae4475a73e
--- /dev/null
+++ b/indra/cmake/cmake_dummy.cpp
@@ -0,0 +1,24 @@
+/**
+ * @file cmake_dummy.cpp
+ *
+ * $LicenseInfo:firstyear=2008&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py
new file mode 100644
index 0000000000..37aa75e364
--- /dev/null
+++ b/indra/cmake/run_build_test.py
@@ -0,0 +1,142 @@
+#!/usr/bin/python
+"""\
+@file run_build_test.py
+@author Nat Goodspeed
+@date 2009-09-03
+@brief Helper script to allow CMake to run some command after setting
+ environment variables.
+
+CMake has commands to run an external program. But remember that each CMake
+command must be backed by multiple build-system implementations. Unfortunately
+it seems CMake can't promise that every target build system can set specified
+environment variables before running the external program of interest.
+
+This helper script is a workaround. It simply sets the requested environment
+variables and then executes the program specified on the rest of its command
+line.
+
+Example:
+
+python run_build_test.py -DFOO=bar myprog somearg otherarg
+
+sets environment variable FOO=bar, then runs:
+myprog somearg otherarg
+
+$LicenseInfo:firstyear=2009&license=viewerlgpl$
+Second Life Viewer Source Code
+Copyright (C) 2009-2010, Linden Research, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation;
+version 2.1 of the License only.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+$/LicenseInfo$
+"""
+
+import os
+import sys
+import subprocess
+
+def main(command, libpath=[], vars={}):
+ """Pass:
+ command is a sequence (e.g. a list) of strings. The first item in the list
+ must be the command name, the rest are its arguments.
+
+ libpath is a sequence of directory pathnames. These will be appended to
+ the platform-specific dynamic library search path environment variable.
+
+ vars is a dict of arbitrary (var, value) pairs to be added to the
+ environment before running 'command'.
+
+ This function runs the specified command, waits for it to terminate and
+ returns its return code. This will be negative if the command terminated
+ with a signal, else it will be the process's specified exit code.
+ """
+ # Handle platform-dependent libpath first.
+ if sys.platform == "win32":
+ lpvars = ["PATH"]
+ elif sys.platform == "darwin":
+ lpvars = ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]
+ elif sys.platform.startswith("linux"):
+ lpvars = ["LD_LIBRARY_PATH"]
+ else:
+ # No idea what the right pathname might be! But only crump if this
+ # feature is requested.
+ if libpath:
+ raise NotImplemented("run_build_test: unknown platform %s" % sys.platform)
+ lpvars = []
+ for var in lpvars:
+ # Split the existing path. Bear in mind that the variable in question
+ # might not exist; instead of KeyError, just use an empty string.
+ dirs = os.environ.get(var, "").split(os.pathsep)
+ # Append the sequence in libpath
+ print "%s += %r" % (var, libpath)
+ for dir in libpath:
+ # append system paths at the end
+ if dir in ('/lib', '/usr/lib'):
+ dirs.append(dir)
+ # prepend non-system paths
+ else:
+ dirs.insert(0, dir)
+
+ # Filter out some useless pieces
+ clean_dirs = []
+ for dir in dirs:
+ if dir and dir not in ('', '.'):
+ clean_dirs.append(dir)
+
+ # Now rebuild the path string. This way we use a minimum of separators
+ # -- and we avoid adding a pointless separator when libpath is empty.
+ os.environ[var] = os.pathsep.join(clean_dirs)
+ print "%s = %r" % (var, os.environ[var])
+ # Now handle arbitrary environment variables. The tricky part is ensuring
+ # that all the keys and values we try to pass are actually strings.
+ if vars:
+ print "Setting:"
+ for key, value in vars.iteritems():
+ print "%s=%s" % (key, value)
+ os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
+ # Run the child process.
+ print "Running: %s" % " ".join(command)
+ return subprocess.call(command)
+
+if __name__ == "__main__":
+ from optparse import OptionParser
+ parser = OptionParser(usage="usage: %prog [options] command args...")
+ # We want optparse support for the options we ourselves handle -- but we
+ # DO NOT want it looking at options for the executable we intend to run,
+ # rejecting them as invalid because we don't define them. So configure the
+ # parser to stop looking for options as soon as it sees the first
+ # positional argument (traditional Unix syntax).
+ parser.disable_interspersed_args()
+ parser.add_option("-D", "--define", dest="vars", default=[], action="append",
+ metavar="VAR=value",
+ help="Add VAR=value to the env variables defined")
+ parser.add_option("-l", "--libpath", dest="libpath", default=[], action="append",
+ metavar="DIR",
+ help="Add DIR to the platform-dependent DLL search path")
+ opts, args = parser.parse_args()
+ # What we have in opts.vars is a list of strings of the form "VAR=value"
+ # or possibly just "VAR". What we want is a dict. We can build that dict by
+ # constructing a list of ["VAR", "value"] pairs -- so split each
+ # "VAR=value" string on the '=' sign (but only once, in case we have
+ # "VAR=some=user=string"). To handle the case of just "VAR", append "" to
+ # the list returned by split(), then slice off anything after the pair we
+ # want.
+ rc = main(command=args, libpath=opts.libpath,
+ vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars]))
+ if rc not in (None, 0):
+ print >>sys.stderr, "Failure running: %s" % " ".join(args)
+ print >>sys.stderr, "Error: %s" % rc
+ sys.exit((rc < 0) and 255 or rc)