[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3435: Add a CMake script for finding libmarblewidget, Marble heade (in vidalia/branches/marble: . cmake src/vidalia)



Author: edmanm
Date: 2009-01-15 20:08:33 -0500 (Thu, 15 Jan 2009)
New Revision: 3435

Added:
   vidalia/branches/marble/cmake/FindMarble.cmake
Modified:
   vidalia/branches/marble/CMakeLists.txt
   vidalia/branches/marble/src/vidalia/CMakeLists.txt
Log:
Add a CMake script for finding libmarblewidget, Marble header files, and
Marble data. Also add CMake fu for including Marble in the Vidalia build, and
post-build actions for moving the Marble data into place. (Probably only works
on OS X at this point.)


Modified: vidalia/branches/marble/CMakeLists.txt
===================================================================
--- vidalia/branches/marble/CMakeLists.txt	2009-01-16 00:58:39 UTC (rev 3434)
+++ vidalia/branches/marble/CMakeLists.txt	2009-01-16 01:08:33 UTC (rev 3435)
@@ -33,12 +33,12 @@
 find_package(Qt4 REQUIRED)
 set(QT_USE_QTNETWORK  true)
 set(QT_USE_QTXML      true)
+set(QT_USE_QTSVG      true)
 include(${QT_USE_FILE})
 include(${CMAKE_SOURCE_DIR}/cmake/VidaliaMacros.cmake)
 include(CheckIncludeFile)
 include(CheckIncludeFileCXX)
 include(CheckTypeSize)
-include(CPack)
 if (WIN32)
   include(${CMAKE_SOURCE_DIR}/cmake/FindWiX.cmake)
 endif(WIN32)
@@ -83,6 +83,9 @@
   option(USE_AUTOUPDATE "Enable automatic software update support." OFF)
 endif(WIN32)
 
+## Use the KDE Marble library
+include(${CMAKE_SOURCE_DIR}/cmake/FindMarble.cmake)
+
 ## Check for system header files
 check_include_file("limits.h" HAVE_LIMITS_H)
 check_include_file("sys/limits.h" HAVE_SYS_LIMITS_H)

Added: vidalia/branches/marble/cmake/FindMarble.cmake
===================================================================
--- vidalia/branches/marble/cmake/FindMarble.cmake	                        (rev 0)
+++ vidalia/branches/marble/cmake/FindMarble.cmake	2009-01-16 01:08:33 UTC (rev 3435)
@@ -0,0 +1,70 @@
+##
+##  $Id$
+## 
+##  This file is part of Vidalia, and is subject to the license terms in the
+##  LICENSE file, found in the top level directory of this distribution. If 
+##  you did not receive the LICENSE file with this file, you may obtain it
+##  from the Vidalia source package distributed by the Vidalia Project at
+##  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+##  may be copied, modified, propagated, or distributed except according to
+##  the terms described in the LICENSE file.
+##
+##  This file incorporates work from the KDE Marble project, and is covered by 
+##  the following copyright and permission notice:
+##
+##  Redistribution and use in source and binary forms, with or without
+##  modification, are permitted provided that the following conditions are
+##  met:
+##
+##   * Redistributions of source code must retain the above copyright notice,
+##     this list of conditions and the following disclaimer.
+##
+##   * Redistributions in binary form must reproduce the above copyright 
+##     notice, this list of conditions and the following disclaimer in the 
+##     documentation and/or other materials provided with the distribution.
+##
+##   * Neither the names of the copyright owners nor the names of its
+##     contributors may be used to endorse or promote products derived from 
+##     this software without specific prior written permission.
+##
+##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
+##  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+##  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+##  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+##  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+##  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+##  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+##  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+##  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+##  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+
+if (MARBLE_INCLUDE_DIR AND MARBLE_DATA_DIR AND MARBLE_LIBRARIES)
+  set(MARBLE_FIND_QUIETLY TRUE)
+endif(MARBLE_INCLUDE_DIR AND MARBLE_DATA_DIR AND MARBLE_LIBRARIES)
+
+find_path(MARBLE_INCLUDE_DIR
+  NAMES MarbleMap.h
+  PATH_SUFFIXES marble
+)
+
+find_path(MARBLE_DATA_DIR
+  NAMES srtm.dgml
+  PATH_SUFFIXES maps/earth/srtm
+)
+if (MARBLE_DATA_DIR)
+  message(STATUS "Using Marble data from ${MARBLE_DATA_DIR}")
+endif(MARBLE_DATA_DIR)
+
+find_library(MARBLE_LIBRARIES
+  NAMES marblewidget
+  PATHS ${MARBLE_LIBRARY_DIR}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(marble DEFAULT_MSG 
+  MARBLE_INCLUDE_DIR
+  MARBLE_LIBRARIES
+)


Property changes on: vidalia/branches/marble/cmake/FindMarble.cmake
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: vidalia/branches/marble/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/branches/marble/src/vidalia/CMakeLists.txt	2009-01-16 00:58:39 UTC (rev 3434)
+++ vidalia/branches/marble/src/vidalia/CMakeLists.txt	2009-01-16 01:08:33 UTC (rev 3435)
@@ -16,7 +16,25 @@
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/config
   ${CMAKE_CURRENT_SOURCE_DIR}/help/browser
+  ${MARBLE_INCLUDE_DIR}
 )
+if (APPLE)
+##
+## XXX: The Marble build system on OS X currently doesn't actually install the
+## required include files to /usr/local/include or similar. Instead, we have
+## to pluck them directly from the source tree. Ick.
+##
+  include_directories(
+    ${MARBLE_INCLUDE_DIR}/AbstractLayer
+    ${MARBLE_INCLUDE_DIR}/geodata
+    ${MARBLE_INCLUDE_DIR}/geodata/data
+    ${MARBLE_INCLUDE_DIR}/geodata/handlers
+    ${MARBLE_INCLUDE_DIR}/geodata/parser
+    ${MARBLE_INCLUDE_DIR}/geodata/scene
+    ${MARBLE_INCLUDE_DIR}/Projections
+  )
+endif(APPLE)
+
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc.in
   ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc
@@ -245,6 +263,33 @@
   ${CMAKE_CURRENT_BINARY_DIR}/i18n/vidalia_i18n.qrc
 )
 
+## Specify the map data Marble will need
+set(marble_DATA
+  landcolors.leg
+  seacolors.leg
+  maps/earth/bluemarble/bluemarble.dgml
+  maps/earth/citylights/citylights.dgml
+  maps/earth/srtm/srtm.dgml
+  maps/earth/srtm/srtm.jpg
+  mwdbii/DATELINE.PNT
+  mwdbii/PAUST.PNT
+  mwdbii/PBORDER.PNT
+  mwdbii/PCANPROV.PNT
+  mwdbii/PCOAST.PNT
+  mwdbii/PDIFFBORDER.PNT
+  mwdbii/PGLACIER.PNT
+  mwdbii/PISLAND.PNT
+  mwdbii/PLAKE.PNT
+  mwdbii/PLAKEISLAND.PNT
+  mwdbii/PMEXICO.PNT
+  mwdbii/PUSA48.DIFF.PNT
+  mwdbii/PUSA48.PNT
+  mwdbii/RIVER.PNT
+  placemarks/baseplacemarks.cache
+  placemarks/boundaryplacemarks.cache
+  placemarks/elevplacemarks.cache
+)
+
 ## Set the appropriate executable target for the current platform
 if (APPLE)
   ## Set the output file name (make it uppercase on OS X)
@@ -271,10 +316,41 @@
       ARGS ${CMAKE_CURRENT_SOURCE_DIR}/res/icons/*.icns 
            ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/
   )
+
+  ## Copy the Marble data into the bundle
+  foreach(it ${marble_DATA})
+    get_filename_component(outdir  ${it} PATH)
+    get_filename_component(outfile ${it} NAME)
+    set(outdir Vidalia.app/Contents/Resources/data/${outdir})
+
+    add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+      COMMAND ${CMAKE_COMMAND}
+        ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir}
+      COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy_if_different 
+              ${MARBLE_DATA_DIR}/${it} 
+              ${CMAKE_CURRENT_BINARY_DIR}/${outdir}/${outfile}
+    )
+  endforeach(it)
+
+  ## Create the Marble plugins directory and copy in any wanted plugins
+  add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+    COMMAND ${CMAKE_COMMAND}
+      ARGS -E make_directory 
+            ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins
+  )
+  foreach(it ${MARBLE_PLUGINS})
+    add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+      COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy_if_different ${it}
+          ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins/
+    )
+  endforeach(it)
+
 else(APPLE)
   ## Set the output file name
   set(vidalia_BIN vidalia)
-  
+
   if (WIN32)
     ## Create a Windows binary
     win32_wrap_rc(vidalia_SRCS res/vidalia_win.rc)
@@ -283,6 +359,20 @@
     ## Non-Windows, non-Mac
     add_executable(${vidalia_BIN} ${vidalia_SRCS})
   endif(WIN32)
+
+  ## Copy the Marble data into the data/ directory under the binary
+  foreach(it ${marble_DATA})
+    get_filename_component(outdir  ${it} PATH)
+    get_filename_component(outfile ${it} NAME)
+  
+    add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+      COMMAND ${CMAKE_COMMAND}
+        ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir}
+      COMMAND ${CMAKE_COMMAND}
+        ARGS -E copy_if_different ${MARBLE_DATA_DIR}/${it} 
+                                  ${CMAKE_CURRENT_BINARY_DIR}/data/${it}
+    )
+  endforeach(it)
 endif(APPLE)
 add_dependencies(${vidalia_BIN} i18n)
 
@@ -290,6 +380,7 @@
 ## Link to the Qt libraries and other libraries built as a part of Vidalia
 target_link_libraries(${vidalia_BIN}
   ${QT_LIBRARIES}
+  ${MARBLE_LIBRARIES}
   common
   torcontrol
 )
@@ -320,4 +411,3 @@
           DESTINATION share/icons/hicolor/22x22/apps)
 endif(NOT WIN32 AND NOT APPLE)
 
-