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

[vidalia-svn] r4034: Update the cmake macros from trunk as well. (vidalia/branches/extension-api/cmake)



Author: tyree731
Date: 2009-08-13 16:16:01 -0400 (Thu, 13 Aug 2009)
New Revision: 4034

Added:
   vidalia/branches/extension-api/cmake/FindBreakpad.cmake
   vidalia/branches/extension-api/cmake/ParseArgumentsMacro.cmake
Modified:
   vidalia/branches/extension-api/cmake/
   vidalia/branches/extension-api/cmake/VidaliaMacros.cmake
Log:
Update the cmake macros from trunk as well.


Property changes on: vidalia/branches/extension-api/cmake
___________________________________________________________________
Added: svn:mergeinfo
   + /vidalia/branches/marble/cmake:3435-3484
/vidalia/trunk/cmake:3787-3820,3822-4033

Copied: vidalia/branches/extension-api/cmake/FindBreakpad.cmake (from rev 4033, vidalia/trunk/cmake/FindBreakpad.cmake)
===================================================================
--- vidalia/branches/extension-api/cmake/FindBreakpad.cmake	                        (rev 0)
+++ vidalia/branches/extension-api/cmake/FindBreakpad.cmake	2009-08-13 20:16:01 UTC (rev 4034)
@@ -0,0 +1,50 @@
+##
+##  $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.
+##
+
+## Tries to find the required Google Breakpad libraries. Once done this will
+## define the variable BREAKPAD_LIBRARIES.
+
+message(STATUS "Looking for Google Breakpad libraries")
+if (WIN32)
+  if (MSVC)
+    find_library(BREAKPAD_EXCEPTION_HANDLER_LIB
+      NAMES exception_handler
+      PATHS ${BREAKPAD_LIBRARY_DIR}
+    )
+    if (NOT BREAKPAD_EXCEPTION_HANDLER_LIB)
+      message(FATAL_ERROR 
+              "Could not find Breakpad exception handler library")
+    endif(NOT BREAKPAD_EXCEPTION_HANDLER_LIB)
+
+    find_library(BREAKPAD_CRASH_GENERATION_LIB
+      NAMES crash_generation
+      PATHS ${BREAKPAD_LIBRARY_DIR}
+    )
+    if (NOT BREAKPAD_CRASH_GENERATION_LIB)
+      message(FATAL_ERROR
+              "Could not find Breakpad crash generation library")
+    endif(NOT BREAKPAD_CRASH_GENERATION_LIB)
+
+    set(BREAKPAD_LIBRARIES 
+      ${BREAKPAD_EXCEPTION_HANDLER_LIB}
+      ${BREAKPAD_CRASH_GENERATION_LIB}
+    )
+    message(STATUS "Looking for Google Breakpad libraries - found")
+  else(MSVC)
+    message(FATAL_ERROR
+            "Breakpad support on Windows currently requires Visual Studio.")
+  endif(MSVC)
+else(WIN32)
+  message(FATAL_ERROR
+          "Breakpad support is not currently available on your platform.")
+endif(WIN32)
+

Copied: vidalia/branches/extension-api/cmake/ParseArgumentsMacro.cmake (from rev 4033, vidalia/trunk/cmake/ParseArgumentsMacro.cmake)
===================================================================
--- vidalia/branches/extension-api/cmake/ParseArgumentsMacro.cmake	                        (rev 0)
+++ vidalia/branches/extension-api/cmake/ParseArgumentsMacro.cmake	2009-08-13 20:16:01 UTC (rev 4034)
@@ -0,0 +1,35 @@
+##
+## From http://www.cmake.org/Wiki/CMakeMacroParseArguments
+##
+
+MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
+  SET(DEFAULT_ARGS)
+  FOREACH(arg_name ${arg_names})    
+    SET(${prefix}_${arg_name})
+  ENDFOREACH(arg_name)
+  FOREACH(option ${option_names})
+    SET(${prefix}_${option} FALSE)
+  ENDFOREACH(option)
+
+  SET(current_arg_name DEFAULT_ARGS)
+  SET(current_arg_list)
+  FOREACH(arg ${ARGN})            
+    SET(larg_names ${arg_names})    
+    LIST(FIND larg_names "${arg}" is_arg_name)                   
+    IF (is_arg_name GREATER -1)
+      SET(${prefix}_${current_arg_name} ${current_arg_list})
+      SET(current_arg_name ${arg})
+      SET(current_arg_list)
+    ELSE (is_arg_name GREATER -1)
+      SET(loption_names ${option_names})    
+      LIST(FIND loption_names "${arg}" is_option)            
+      IF (is_option GREATER -1)
+       SET(${prefix}_${arg} TRUE)
+      ELSE (is_option GREATER -1)
+       SET(current_arg_list ${current_arg_list} ${arg})
+      ENDIF (is_option GREATER -1)
+    ENDIF (is_arg_name GREATER -1)
+  ENDFOREACH(arg)
+  SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(PARSE_ARGUMENTS)
+

Modified: vidalia/branches/extension-api/cmake/VidaliaMacros.cmake
===================================================================
--- vidalia/branches/extension-api/cmake/VidaliaMacros.cmake	2009-08-13 19:59:29 UTC (rev 4033)
+++ vidalia/branches/extension-api/cmake/VidaliaMacros.cmake	2009-08-13 20:16:01 UTC (rev 4034)
@@ -147,7 +147,119 @@
   set(${OUTFILES} ${${OUTFILES}} ${wxl})
 endmacro(VIDALIA_ADD_WXL)
 
+## Queries the specified TOR_EXECUTABLE for its version string using the 
+## --version argument, parses its output and sets TOR_VERSION to the result.
+## If no version could be determined, ${TOR_VERSION} will be undefined.
+macro(VIDALIA_GET_TOR_VERSION TOR_VERSION TOR_EXECUTABLE)
+  get_filename_component(TOR_EXE_PATH ${TOR_EXECUTABLE} ABSOLUTE)
+  if (UNIX)
+    execute_process(
+      COMMAND ${TOR_EXE_PATH} --version
+      COMMAND tail -n 1
+      COMMAND awk "{print $3}"
+      COMMAND sed -e s/\\.$//
+      OUTPUT_VARIABLE ${TOR_VERSION}
+    )
+  else(UNIX)
+    message(FATAL_ERROR
+      "The vidalia_get_tor_version macro is not implemented for your platform")
+  endif(UNIX)
+  if (DEFINED ${TOR_VERSION})
+    string(STRIP ${${TOR_VERSION}} ${TOR_VERSION})
+  endif(DEFINED ${TOR_VERSION})
+endmacro(VIDALIA_GET_TOR_VERSION)
 
+if (APPLE)
+  include(${Vidalia_SOURCE_DIR}/cmake/ParseArgumentsMacro.cmake)
+
+  ## Calls the install_name_tool utility to change the dependent shared
+  ## library or framework install name to the corresponding library or
+  ## framework that was previously installed in the .app bundle using
+  ## VIDALIA_INSTALL_QT4_FRAMEWORK or VIDALIA_INSTALL_DYLIB when the given
+  ## build target is executed.
+  macro(VIDALIA_INSTALL_NAME_TOOL)
+    parse_arguments(INSTALL_NAME_TOOL "TARGET;LIBRARIES;FRAMEWORKS" "" ${ARGN})
+
+    foreach(bin ${INSTALL_NAME_TOOL_DEFAULT_ARGS})
+      foreach(it ${INSTALL_NAME_TOOL_FRAMEWORKS})
+        add_custom_command(TARGET ${INSTALL_NAME_TOOL_TARGET}
+          COMMAND install_name_tool -change
+            ${it} @executable_path/../Frameworks/${it} ${bin}
+        )
+      endforeach(it)
+      foreach(it ${INSTALL_NAME_TOOL_LIBRARIES})
+        get_filename_component(libname ${it} NAME)
+        add_custom_command(TARGET ${INSTALL_NAME_TOOL_TARGET}
+          COMMAND install_name_tool -change
+            ${it} @executable_path/lib/${libname} ${bin}
+        )
+      endforeach(it)
+    endforeach(bin)
+  endmacro(VIDALIA_INSTALL_NAME_TOOL)
+
+  ## Copies the specified Qt4 framework into the .app bundle, updates its
+  ## shared library identification name, and changes any dependent Qt4
+  ## framework or shared library names to reference a framework previously
+  ## installed in the .app bundle using VIDALIA_INSTALL_QT4_FRAMEWORK.
+  macro(VIDALIA_INSTALL_QT4_FRAMEWORK)
+    parse_arguments(INSTALL_QT4_FRAMEWORK
+      "NAME;TARGET;LIBRARY;APP_BUNDLE;DEPENDS_FRAMEWORKS;DEPENDS_LIBRARIES" ""
+      ${ARGN}
+    )
+    set(ditto_ARGS "--rsrc")
+    foreach (it ${CMAKE_OSX_ARCHITECTURES})
+      set(ditto_ARGS ${ditto_ARGS} --arch ${it})
+    endforeach(it)
+
+    set(framework "${INSTALL_QT4_FRAMEWORK_NAME}.framework/Versions/4")
+    set(outdir "${INSTALL_QT4_FRAMEWORK_APP_BUNDLE}/Contents/Frameworks/${framework}")
+    get_filename_component(libname "${INSTALL_QT4_FRAMEWORK_LIBRARY}" NAME)
+    add_custom_command(TARGET ${INSTALL_QT4_FRAMEWORK_TARGET}
+      COMMAND ${CMAKE_COMMAND} -E make_directory ${outdir}
+      COMMAND ditto ${ditto_ARGS}
+        ${INSTALL_QT4_FRAMEWORK_LIBRARY} ${outdir}/
+      COMMAND install_name_tool -id
+        @executable_path/../Frameworks/${framework}/${libname} ${outdir}/${libname}
+    )
+    vidalia_install_name_tool(${outdir}/${libname}
+      TARGET     ${INSTALL_QT4_FRAMEWORK_TARGET}
+      LIBRARIES  ${INSTALL_QT4_FRAMEWORK_DEPENDS_LIBRARIES}
+      FRAMEWORKS ${INSTALL_QT4_FRAMEWORK_DEPENDS_FRAMEWORKS}
+    )
+    set(${INSTALL_QT4_FRAMEWORK_DEFAULT_ARGS} ${framework}/${libname})
+  endmacro(VIDALIA_INSTALL_QT4_FRAMEWORK)
+
+  ## Copies the specified .dylib into the .app bundle, updates its shared
+  ## library identification name, and changes any dependent framework or
+  ## shared library names to reference a framework or shared library
+  ## previously installed in the .app bundle.
+  macro(VIDALIA_INSTALL_DYLIB)
+    parse_arguments(INSTALL_DYLIB
+      "TARGET;LIBRARY;APP_BUNDLE;DEPENDS_FRAMEWORKS;DEPENDS_LIBRARIES" ""
+      ${ARGN}
+    )
+    set(ditto_ARGS "--rsrc")
+    foreach (it ${CMAKE_OSX_ARCHITECTURES})
+      set(ditto_ARGS ${ditto_ARGS} --arch ${it})
+    endforeach(it)
+
+    set(outdir "${INSTALL_DYLIB_APP_BUNDLE}/Contents/MacOS/lib/")
+    get_filename_component(libname "${INSTALL_DYLIB_LIBRARY}" NAME)
+    add_custom_command(TARGET ${INSTALL_DYLIB_TARGET}
+      COMMAND ${CMAKE_COMMAND} -E make_directory ${outdir}
+      COMMAND ditto  ${ditto_ARGS} 
+        ${INSTALL_DYLIB_LIBRARY} ${outdir}/
+      COMMAND install_name_tool -id @executable_path/lib/${libname}
+    )
+    vidalia_install_name_tool(${outir}/${libname}
+      TARGET     ${INSTALL_DYLIB_TARGET}
+      LIBRARIES  ${INSTALL_DYLIB_DEPENDS_LIBRARIES}
+      FRAMEWORKS ${INSTALL_DYLIB_DEPENDS_FRAMEWORKS}
+    )
+   set(${INSTALL_DYLIB_DEFAULT_ARGS} "${libname}")
+  endmacro(VIDALIA_INSTALL_DYLIB)
+endif(APPLE)
+
 if (WIN32)
   ## Wraps the supplied .rc files in windres commands if we're building
   ## with MinGW. Otherwise, it just adds the .rc files directly to the