r13962 by herm - Fixed GraphicsMagick build system.

scribus-commit scribus-commit at lists.scribus.net
Sat Sep 5 15:20:18 CEST 2009


Revision: 13962
Author: herm
Date: 2009-09-05T13:19:22.059197Z
Commit message: Fixed GraphicsMagick build system.


Changeset: 
M  /trunk/Scribus/scribus/CMakeLists.txt
A  /trunk/Scribus/cmake/modules/FindGMAGICK.cmake
M  /trunk/Scribus/CMakeLists.txt
D  /trunk/Scribus/cmake/modules/GMAGICKConfig.cmake

Diffs:
Index: cmake/modules/GMAGICKConfig.cmake
===================================================================
--- cmake/modules/GMAGICKConfig.cmake	(revision 13961)
+++ cmake/modules/GMAGICKConfig.cmake	(revision 13962)
@@ -1,55 +0,0 @@
-#
-# Find the native GraphicksMagick++ includes and library
-#
-
-# This module defines
-# GMAGICK_INCLUDE_DIR, where to find Magick++.h
-# GMAGICK_LIBRARY, the libraries to link against to use GraphicksMagick++.
-# GMAGICK_FOUND, If false, do not try to use GraphicksMagick++.
-# GMAGICK_LIBS, link information
-# GMAGICK_CFLAGS, cflags for include information
-
-
-find_program(GMAGICK_CONFIG_EXECUTABLE NAMES GraphicsMagick++-config PATH ${PREFIX_GMAGICK} DOC "GraphicsMagick++-config executable")
-mark_as_advanced(GMAGICK_CONFIG_EXECUTABLE)
-
-MESSAGE(STATUS "Gmconf ${GMAGICK_CONFIG_EXECUTABLE}")
-
-macro(_gmagickconfig_invoke _type _varname _regexp)
-  set(_gmagickconfig_invoke_result)
-
-  execute_process(
-    COMMAND ${GMAGICK_CONFIG_EXECUTABLE} ${_type}
-    OUTPUT_VARIABLE _gmagickconfig_invoke_result
-    RESULT_VARIABLE _gmagickconfig_failed)
-
-  if (NOT _gmagickconfig_failed)
-    set(GMAGICK_FOUND "YES")
-    string(REGEX REPLACE "[\r\n]"  " " _gmagickconfig_invoke_result "${_gmagickconfig_invoke_result}")
-    string(REGEX REPLACE " +$"     ""  _gmagickconfig_invoke_result "${_gmagickconfig_invoke_result}")
-
-    if (NOT ${_regexp} STREQUAL "")
-      string(REGEX REPLACE "${_regexp}" " " _gmagickconfig_invoke_result "${_gmagickconfig_invoke_result}")
-    endif(NOT ${_regexp} STREQUAL "")
-
-    separate_arguments(_gmagickconfig_invoke_result)
-    
-    MESSAGE(STATUS "GMAGICK result for ${_type}: ${_gmagickconfig_invoke_result}")
-
-    #message(STATUS "  ${_varname} ... ${_pkgconfig_invoke_result}")
-     set(${_varname} ${_gmagickconfig_invoke_result})
-#     _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
-    endif(NOT _gmagickconfig_failed)
-endmacro(_gmagickconfig_invoke)
-
-_gmagickconfig_invoke("--cppflags" GMAGICK_INCLUDES "(^| )-I")
-_gmagickconfig_invoke("--ldflags" GMAGICK_LDFLAGS "(^| )-L")
-_gmagickconfig_invoke("--libs" GMAGICK_LIBRARIES "(^| )-l")
-
-if(GMAGICK_INCLUDES)
-	SET(GMAGICK_FOUND "YES")
-else(GMAGICK_INCLUDES)
-	SET(GMAGICK_INCLUDES)
-	SET(GMAGICK_LIBRARIES)
-	SET(GMAGICK_LDFLAGS)
-endif(GMAGICK_INCLUDES)
Index: cmake/modules/FindGMAGICK.cmake
===================================================================
--- cmake/modules/FindGMAGICK.cmake	(revision 0)
+++ cmake/modules/FindGMAGICK.cmake	(revision 13962)
@@ -0,0 +1,33 @@
+# - Try to find GraphicsMagick++
+# Once done, this will define
+#
+#  GMAGICK_FOUND - system has zziplib
+#  GMAGICK_INCLUDE_DIRS - the zziplib include directories
+#  GMAGICK_LIBRARIES - link these to use zziplib
+
+include(FindPkgConfig)
+
+# Use pkg-config to get hints about paths
+pkg_check_modules(GMAGICK_PKGCONF GraphicsMagick++)
+
+# Include dir
+find_path(GMAGICK_INCLUDE_DIR
+  NAMES Magick++.h
+  PATHS ${GMAGICK_PKGCONF_INCLUDE_DIRS}
+)
+
+# Finally the library itself
+find_library(GMAGICK_LIBRARY
+  NAMES GraphicsMagick++
+  PATHS ${GMAGICK_PKGCONF_LIBRARY_DIRS}
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMAGICK DEFAULT_MSG GMAGICK_LIBRARY GMAGICK_INCLUDE_DIR)
+IF(GMAGICK_FOUND)
+    set(GMAGICK_INCLUDES ${GMAGICK_INCLUDE_DIR})
+    set(GMAGICK_LIBRARIES ${GMAGICK_LIBRARY})
+ELSE()
+    set(GMAGICK_INCLUDES)
+    set(GMAGICK_LIBRARIES)
+ENDIF()
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt	(revision 13961)
+++ scribus/CMakeLists.txt	(revision 13962)
@@ -37,6 +37,13 @@
   pageitem_osgframe.cpp
   )
 ENDIF (HAVE_OSG)
+
+IF (GMAGICK_FOUND)
+    SET(SCRIBUS_GMAGICK_SRC scimgdataloader_gmagick.cpp)
+ELSE(GMAGICK_FOUND)
+    SET(SCRIBUS_GMAGICK_SRC)
+ENDIF(GMAGICK_FOUND)
+
 # We setup something like a group to gather setter related stuff
 # because it could expand into a huge amount of file at some point.
 SET(SCRIBUS_ITEMSETTERS_UI_SRC
@@ -631,7 +638,6 @@
   scimagestructs.cpp
   scimgdataloader.cpp
   scimgdataloader_gimp.cpp
-  scimgdataloader_gmagick.cpp
   scimgdataloader_jpeg.cpp
   scimgdataloader_pdf.cpp
   scimgdataloader_ps.cpp
@@ -765,6 +771,7 @@
   ui/vruler.cpp
   ${SCRIBUS_ITEMSETTERS_SRC}
   ${SCRIBUS_OSG_SRC}
+  ${SCRIBUS_GMAGICK_SRC}
 )
 
 IF(WIN32)
@@ -811,14 +818,17 @@
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${FREETYPE_INCLUDE_DIRS}
 )
-INCLUDE_DIRECTORIES(
-  BEFORE ${GMAGICK_INCLUDES}
-)
-MESSAGE(STATUS "${GMAGICK_LIBRARIES}, ${GMAGICK_INCLUDES}, ${GMAGICK_LDFLAGS}")
-LINK_DIRECTORIES(
-    ${GMAGICK_LDFLAGS}
-)
 
+IF (GMAGICK_FOUND)
+    MESSAGE(STATUS "GMAGICK: Libs: ${GMAGICK_LIBRARIES}, Inc: ${GMAGICK_INCLUDES}, Ldflags: ${GMAGICK_LDFLAGS}")
+    INCLUDE_DIRECTORIES(
+        BEFORE ${GMAGICK_INCLUDES}
+    )
+    LINK_DIRECTORIES(
+        ${GMAGICK_LDFLAGS} #TODO
+    )
+ENDIF(GMAGICK_FOUND)
+
 IF(HAVE_PODOFO)
   INCLUDE_DIRECTORIES(
     ${LIBPODOFO_INCLUDE_DIR}
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 13961)
+++ CMakeLists.txt	(revision 13962)
@@ -653,13 +653,15 @@
 ENDIF(LIBPODOFO_FOUND)
 #>>PoDoFo for AI PDF import
 
+#<<GraphicksMagick++ for image import
 SET(GMAGICK_DIR ${CMAKE_MODULE_PATH})
 FIND_PACKAGE(GMAGICK)
 IF(GMAGICK_FOUND)
-  MESSAGE("GraphicksMagick++ Library Found OK")
+  MESSAGE("GraphicksMagick++ Found OK")
 ELSE(GMAGICK_FOUND)
-  MESSAGE("GraphicksMagick++ Library NOT found! Building without additional image format support!")
+  MESSAGE("GraphicksMagick++ NOT found! Building without additional image format support!")
 ENDIF(GMAGICK_FOUND)
+#>>GraphicksMagick++ for image import
 
 ##############################################################################################################
 ########## Include Setup                                                                            ##########




More information about the scribus-commit mailing list