diff options
| author | Aleric Inglewood <Aleric.Inglewood@gmail.com> | 2010-12-15 20:12:17 +0100 | 
|---|---|---|
| committer | Aleric Inglewood <Aleric.Inglewood@gmail.com> | 2010-12-15 20:12:17 +0100 | 
| commit | d0a25a41848142e469f5d64f4e4cef3852d3b2ab (patch) | |
| tree | 5e7c5e0e6b7ad37534aab5758f932c4b3073956b /indra/cmake | |
| parent | 0de05499eddd2afbd69b5f247d4cffdee448db19 (diff) | |
VWR-24252: On standalone, find Qt4 with find_package, and find llqtwebkit.
If Qt and/or llqtwebkit is found in a non-standard place, you still
have to set LD_LIBRARY_PATH yourself (to $QTDIR/lib) before running
the viewer of course (or the webkit plugin will silently fail).
Diffstat (limited to 'indra/cmake')
| -rw-r--r-- | indra/cmake/FindLLQtWebkit.cmake | 62 | ||||
| -rw-r--r-- | indra/cmake/WebKitLibPlugin.cmake | 25 | 
2 files changed, 86 insertions, 1 deletions
| diff --git a/indra/cmake/FindLLQtWebkit.cmake b/indra/cmake/FindLLQtWebkit.cmake new file mode 100644 index 0000000000..c747ec32a2 --- /dev/null +++ b/indra/cmake/FindLLQtWebkit.cmake @@ -0,0 +1,62 @@ +# -*- cmake -*- + +# - Find llqtwebkit +# Find the llqtwebkit includes and library +# This module defines +#  LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc. +#  LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path. +#  LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit. +# also defined, but not for general use are +#  LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit. +#  LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library. +#  LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS}) +#      before compiling code that includes llqtwebkit library files. + +# Try to use pkg-config first. +# This allows to have two different libllqtwebkit packages installed: +# one for viewer 2.x and one for viewer 1.x. +include(FindPkgConfig) +if (PKG_CONFIG_FOUND) +    if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) +        set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED) +    else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) +        set(_PACKAGE_ARGS libllqtwebkit) +    endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) +    if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8") +      # As virtually nobody will have a pkg-config file for this, do this check always quiet. +      # Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'. +      set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET) +    endif () +    pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS}) +endif (PKG_CONFIG_FOUND) +set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER}) + +find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS}) + +find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS}) + +if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)	# If pkg-config couldn't find it, pretend we don't have pkg-config. +   set(LLQTWEBKIT_LIBRARIES llqtwebkit) +   get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH) +endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) + +# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND +# to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( +  LLQTWEBKIT +  DEFAULT_MSG +  LLQTWEBKIT_LIBRARY +  LLQTWEBKIT_INCLUDE_DIR +  LLQTWEBKIT_LIBRARIES +  LLQTWEBKIT_LIBRARY_DIRS +  ) + +mark_as_advanced( +  LLQTWEBKIT_LIBRARY +  LLQTWEBKIT_INCLUDE_DIR +  LLQTWEBKIT_LIBRARIES +  LLQTWEBKIT_LIBRARY_DIRS +  LLQTWEBKIT_DEFINITIONS +  ) + diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake index 12ba1b1b35..1f5b0f5d84 100644 --- a/indra/cmake/WebKitLibPlugin.cmake +++ b/indra/cmake/WebKitLibPlugin.cmake @@ -3,6 +3,29 @@ include(Linking)  include(Prebuilt)  if (STANDALONE) +  # The minimal version, 4.4.3, is rather arbitrary: it's the version in Debian/Lenny. +  find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED) +  include(${QT_USE_FILE}) +  set(QTDIR $ENV{QTDIR}) +  if (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin") +	message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; " +	  "Qt is found by looking for qmake in your PATH. " +	  "Please set your PATH such that 'qmake' is found in \$QTDIR/bin, " +	  "or unset QTDIR if the found Qt is correct.") +	endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin") +  find_package(LLQtWebkit REQUIRED QUIET) +  # Add the plugins. +  set(QT_PLUGIN_LIBRARIES) +  foreach(qlibname qgif qjpeg) +	find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH) +	if (QT_PLUGIN_${qlibname}) +	  list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}}) +	else (QT_PLUGIN_${qtlibname}) +	  message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!") +	endif (QT_PLUGIN_${qlibname}) +  endforeach(qlibname) +  # qjpeg depends on libjpeg +  list(APPEND QT_PLUGIN_LIBRARIES jpeg)    set(WEBKITLIBPLUGIN OFF CACHE BOOL        "WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")  else (STANDALONE) @@ -35,7 +58,7 @@ elseif (DARWIN)        )  elseif (LINUX)    if (STANDALONE)  -    set(WEBKIT_PLUGIN_LIBRARIES llqtwebkit) +    set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES})    else (STANDALONE)      set(WEBKIT_PLUGIN_LIBRARIES          llqtwebkit | 
