All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

VWR-24252: Find Qt4 with find_package on STANDALONE.

Review Request #46 - Created Dec. 19, 2010 and submitted

Aleric Inglewood Reviewers
viewer
VWR-24252
None viewer-development
This patch has only effect on standalone.
It searches for the Qt libs using the cmake provided FindQt4.cmake
and search for llqtwekbit using the new FindLLQtWebkit.cmake
and then uses the resulting LLQTWEBKIT_LIBRARY
and LLQTWEBKIT_INCLUDE_DIR in the right places.

I added an explicit test to check if QTDIR is set, it is set to
the correct value (even LL got this wrong on their wiki, so it's
apparently not obvious): As of Qt 4, Qt is found by calling qmake,
NOT by looking at QTDIR. So, if you set QTDIR then it better be
set to whatever qmake was "found" (using PATH as usual).

Finally, we also need to explicitly pass the Qt plugin libraries
in order to link with them, so part of this patch adds the rules
to do that (the foreach).

Note that if you installed your libs in a non-standard place, then
of course you still have to set LD_LIBRARY_PATH yourself before
running the viewer ;)
I used this while working on adding plugin support to Imprudence, needing to debug into the Qt libs and llqtwebkit. I added support for multiple versions of llqtwebkit to imprudence (not just the one needed, but also newer versions of llqtwebkit). Needless to say that I needed this patch to work to find my (several) installations of Qt and llqtwebkit.

Diff revision 2 (Latest)

1 2
1 2

  1. indra/cmake/FindLLQtWebkit.cmake: Loading...
  2. indra/cmake/WebKitLibPlugin.cmake: Loading...
  3. indra/llplugin/CMakeLists.txt: Loading...
  4. indra/media_plugins/webkit/CMakeLists.txt: Loading...
indra/cmake/FindLLQtWebkit.cmake
New File

   
1
# -*- cmake -*-

   
2

   

   
3
# - Find llqtwebkit

   
4
# Find the llqtwebkit includes and library

   
5
# This module defines

   
6
#  LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc.

   
7
#  LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path.

   
8
#  LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit.

   
9
# also defined, but not for general use are

   
10
#  LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit.

   
11
#  LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library.

   
12
#  LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS})

   
13
#      before compiling code that includes llqtwebkit library files.

   
14

   

   
15
# Try to use pkg-config first.

   
16
# This allows to have two different libllqtwebkit packages installed:

   
17
# one for viewer 2.x and one for viewer 1.x.

   
18
include(FindPkgConfig)

   
19
if (PKG_CONFIG_FOUND)

   
20
    if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)

   
21
        set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED)

   
22
    else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)

   
23
        set(_PACKAGE_ARGS libllqtwebkit)

   
24
    endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)

   
25
    if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")

   
26
      # As virtually nobody will have a pkg-config file for this, do this check always quiet.

   
27
      # Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'.

   
28
      set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET)

   
29
    endif ()

   
30
    pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS})

   
31
endif (PKG_CONFIG_FOUND)

   
32
set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER})

   
33

   

   
34
find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS})

   
35

   

   
36
find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS})

   
37

   

   
38
if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)	# If pkg-config couldn't find it, pretend we don't have pkg-config.

   
39
   set(LLQTWEBKIT_LIBRARIES llqtwebkit)

   
40
   get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH)

   
41
endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)

   
42

   

   
43
# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND

   
44
# to TRUE if all listed variables are TRUE.

   
45
include(FindPackageHandleStandardArgs)

   
46
find_package_handle_standard_args(

   
47
  LLQTWEBKIT

   
48
  DEFAULT_MSG

   
49
  LLQTWEBKIT_LIBRARY

   
50
  LLQTWEBKIT_INCLUDE_DIR

   
51
  LLQTWEBKIT_LIBRARIES

   
52
  LLQTWEBKIT_LIBRARY_DIRS

   
53
  )

   
54

   

   
55
mark_as_advanced(

   
56
  LLQTWEBKIT_LIBRARY

   
57
  LLQTWEBKIT_INCLUDE_DIR

   
58
  LLQTWEBKIT_LIBRARIES

   
59
  LLQTWEBKIT_LIBRARY_DIRS

   
60
  LLQTWEBKIT_DEFINITIONS

   
61
  )

   
62

   
indra/cmake/WebKitLibPlugin.cmake
Revision b0689af42a71 New Change
 
indra/llplugin/CMakeLists.txt
Revision b0689af42a71 New Change
 
indra/media_plugins/webkit/CMakeLists.txt
Revision b0689af42a71 New Change
 
  1. indra/cmake/FindLLQtWebkit.cmake: Loading...
  2. indra/cmake/WebKitLibPlugin.cmake: Loading...
  3. indra/llplugin/CMakeLists.txt: Loading...
  4. indra/media_plugins/webkit/CMakeLists.txt: Loading...