Include instructions for specifying the location of libjpeg-turbo


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4578 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/BUILDING.txt b/BUILDING.txt
index 7c4ea1d..c2611b5 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -24,6 +24,7 @@
 -- libjpeg-turbo SDK
    * If your system does not include libjpeg-turbo, then you can download the
      SDK from http://sourceforge.net/projects/libjpeg-turbo/files/
+   * See "Building High-Performance JPEG Support" below.
 
 
 =========================
@@ -145,7 +146,7 @@
 of TigerVNC on 64-bit systems.
 
   cd {build_directory}
-  cmake -G "Unix Makefiles" {source_directory} [additional CMake flags]
+  cmake -G "Unix Makefiles" [additional CMake flags] {source_directory}
   make
 
 Building the TigerVNC Server (Xvnc) is a bit trickier.  On newer systems
@@ -195,7 +196,7 @@
 -------------------------
 
   cd {build_directory}
-  cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
+  cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}
   nmake
 
 This will build either a 32-bit or a 64-bit version of TigerVNC, depending
@@ -210,7 +211,7 @@
 instance:
 
   cd {build_directory}
-  cmake -G "Visual Studio 9 2008" {source_directory}
+  cmake -G "Visual Studio 9 2008" [additional CMake flags] {source_directory}
 
 You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
 configurations in that project ("Debug", "Release", etc.) to generate a full
@@ -221,7 +222,7 @@
 -----
 
   cd {build_directory}
-  cmake -G "MSYS Makefiles" {source_directory}
+  cmake -G "MSYS Makefiles" [additional CMake flags] {source_directory}
   make
 
 This will generate only vncviewer.  Currently, Visual C++ must be used to build
@@ -248,6 +249,61 @@
 
 
 ======================================
+Building High-Performance JPEG Support
+======================================
+
+In order to achieve its high levels of performance, TigerVNC relies on
+libjpeg-turbo (http://www.libjpeg-turbo.org), a derivative of libjpeg which
+uses SIMD instructions to accelerate baseline JPEG compression and
+decompression.  If you are building TigerVNC on an operating system that
+includes libjpeg-turbo as a system library (for instance, Fedora 14 and later),
+then the TigerVNC build system should detect the system version of
+libjpeg-turbo automatically and link against it.  However, this produces a
+version of TigerVNC that depends on the libjpeg-turbo dynamic libraries, and
+thus the TigerVNC binaries are not portable.
+
+To build a fully portable, cross-compatible version of TigerVNC with
+high-performance JPEG support, it is necessary to link against the
+libjpeg-turbo static library.  This is also necessary when building TigerVNC on
+Windows or OS X.  To link against the libjpeg-turbo static library, first
+install the libjpeg-turbo SDK, which is available from
+https://sourceforge.net/projects/libjpeg-turbo/files/.  Next, use the
+JPEG_INCLUDE_DIR and JPEG_LIBRARY CMake variables to specify the location of
+libjpeg-turbo.  For example, adding
+
+  -DJPEG_INCLUDE_DIR=/opt/libjpeg-turbo/include \
+    -DJPEG_LIBRARY=/opt/libjpeg-turbo/lib/libjpeg.a
+
+to the CMake command line will link TigerVNC against a static version of
+libjpeg-turbo installed under /opt/TigerVNC (which is the normal install
+location for the libjpeg-turbo SDK on Unix and Linux platforms.)  Replace "lib"
+with "lib32" or "lib64" to use the 32-bit or 64-bit version of the library on
+64-bit Linux platforms.
+
+Adding
+
+  -DJPEG_INCLUDE_DIR=c:\libjpeg-turbo[64]\include \
+    -DJPEG_LIBRARY=c:\libjpeg-turbo[64]\lib\jpeg-static.lib
+
+to the CMake command line will link TigerVNC against the static version of
+libjpeg-turbo provided by the libjpeg-turbo SDK for Visual C++.
+
+Adding
+
+  -DJPEG_INCLUDE_DIR=/c/libjpeg-turbo-gcc[64]/include \
+    -DJPEG_LIBRARY=/c/libjpeg-turbo-gcc[64]/lib/libjpeg.a
+
+to the CMake command line will link TigerVNC against the static version of
+libjpeg-turbo provided by the libjpeg-turbo SDK for GCC (MinGW.)
+
+CMake will report:
+
+  Performing Test FOUND_LIBJPEG_TURBO - Success
+
+if it successfully finds libjpeg-turbo.
+
+
+======================================
 Building Native Language Support (NLS)
 ======================================