[CMake] Problem with QtTest Bundle Utility Example?

Michael Jackson mike.jackson at bluequartz.net
Fri Mar 12 15:43:18 EST 2010


I had to over-load the gp_item_default_embedded_path_override CMake  
function with the following:

# gp_item_default_embedded_path item default_embedded_path_var
#
# Return the path that others should refer to the item by when the item
# is embedded inside a bundle.
#
# Override on a per-project basis by providing a project-specific
# gp_item_default_embedded_path_override function.
#
function(gp_item_default_embedded_path_override item  
default_embedded_path_var)
   #
   # The assumption here is that all executables in the bundle will be
   # in same-level-directories inside the bundle. The parent directory
   # of an executable inside the bundle should be MacOS or a sibling of
   # MacOS and all embedded paths returned from here will begin with
   # "@executable_path/../" and will work from all executables in all
   # such same-level-directories inside the bundle.
   #

   # By default, embed things right next to the main bundle executable:
   #
   set(path "@executable_path/../../Contents/MacOS")

   set(overridden 0)
   # For Qt Based Plugins for the image formats, the plugins MUST  
reside in
   # the "PlugIns/imageformats" directory. Since THIS particular  
project ONLY has
   # the Qt Frameworks AND the plugins the below regex will suffice to  
separate
   # them from each other. On other projects we could use better logic  
to
   # put things where they go. Maybe using some "configured" CMake  
List of libraries
   # then looking through each list for the currect library being  
fixed up.
   # Embed .dylibs right next to the main bundle executable:
   #
   if(item MATCHES "\\.dylib$")
     set(path "@executable_path/../PlugIns/imageformats")
     set(overridden 1)
   endif(item MATCHES "\\.dylib$")

   # Embed .so right next to the main bundle executable:
   #
   if(item MATCHES "\\.so$")
     set(path "@executable_path/../Plugins/imageformats")
     set(overridden 1)
   endif(item MATCHES "\\.so$")

   # Embed frameworks in the embedded "Frameworks" directory (sibling  
of MacOS):
   #
   if(NOT overridden)
     if(item MATCHES "[^/]+\\.framework/")
       set(path "@executable_path/../Frameworks")
       set(overridden 1)
     endif(item MATCHES "[^/]+\\.framework/")
   endif(NOT overridden)

   set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
endfunction(gp_item_default_embedded_path_override)

Which is a complete hack (as it does not take into account other types  
of plugins) but worked for my limited Application bundle.
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio


On Mar 12, 2010, at 3:20 PM, Bradley Lowekamp wrote:

> Hello,
>
> I am trying run the QtTest-Package-Example from: http://www.vtk.org/Wiki/BundleUtilitiesExample 
>  and I am getting some errors on install.
>
> I am running CMake 2.8, with Qt 4.6.2 Cocoa universal, on OSX 10.6.2.
>
> During the fixup_bundle phase I am getting some error message and  
> some undesired behavior. It appears the qt plugin libraries are  
> problematic. Here is snipits of the output:
>
> - Install configuration: ""
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents/ 
> Info.plist
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents/ 
> MacOS
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents/ 
> MacOS/QtTest
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents/ 
> Resources
> -- Installing: ~/Downloads/QtTest/./install/./QtTest.app/Contents/ 
> Resources/QtTest.icns
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqgif.dylib
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqico.dylib
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqjpeg.dylib
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqmng.dylib
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqsvg.dylib
> -- Installing: ~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqtiff.dylib
> -- fixup_bundle
> --   app='./install/QtTest.app'
> --   libs='~/Downloads/QtTest/./install/QtTest.app/Contents/MacOS/ 
> plugins/imageformats/libqgif.dylib;~/Downloads/QtTest/./install/ 
> QtTest.app/Contents/MacOS/plugins/imageformats/libqico.dylib;~/ 
> Downloads/QtTest/./install/QtTest.app/Contents/MacOS/plugins/ 
> imageformats/libqjpeg.dylib;~/Downloads/QtTest/./install/QtTest.app/ 
> Contents/MacOS/plugins/imageformats/libqmng.dylib;~/Downloads/ 
> QtTest/./install/QtTest.app/Contents/MacOS/plugins/imageformats/ 
> libqsvg.dylib;~/Downloads/QtTest/./install/QtTest.app/Contents/MacOS/ 
> plugins/imageformats/libqtiff.dylib'
> --   dirs=''
> -- fixup_bundle: preparing...
> -- 
> warning: cannot resolve item 'libqgif.dylib'
>
>   possible problems:
>     need more directories?
>     need to use InstallRequiredSystemLibraries?
>     run in install tree instead of build tree?
>
> -- warning: gp_resolved_file_type non-absolute file 'libqgif.dylib'  
> returning type 'other' -- possibly incorrect
> -- 
> warning: cannot resolve item 'libqgif.dylib'
>
>   possible problems:
>     need more directories?
>     need to use InstallRequiredSystemLibraries?
>     run in install tree instead of build tree?
>
> warning: target 'libqgif.dylib' is not absolute...
> warning: target 'libqgif.dylib' does not exist...
> /usr/bin/otool: can't open file: libqgif.dylib (No such file or  
> directory)
> -- 
>
> (repeated for each other plugin)
>
> Then it copies things again:
>
> - fixup_bundle: copying...
> -- 1/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqgif.dylib'
> -- 2/22: copying '/Library/Frameworks/QtCore.framework/Versions/4/ 
> QtCore'
> -- 3/22: copying '/Library/Frameworks/QtGui.framework/Versions/4/ 
> QtGui'
> -- 4/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqico.dylib'
> -- 5/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqjpeg.dylib'
> -- 6/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqmng.dylib'
> -- 7/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqsvg.dylib'
> -- 8/22: copying '/Library/Frameworks/QtSvg.framework/Versions/4/ 
> QtSvg'
> -- 9/22: copying '/Library/Frameworks/QtXml.framework/Versions/4/ 
> QtXml'
> -- 10/22: copying '~/Downloads/QtTest/./install/QtTest.app/Contents/ 
> MacOS/plugins/imageformats/libqtiff.dylib'
> -- 11/22: *NO~T* copying '~/Downloads/QtTest/./install/QtTest.app/ 
> Contents/MacOS/QtTest'
> -- fixup_bundle: fixing...
> -- 12/22: fixing up '~/Downloads/QtTest/install/QtTest.app/Contents/ 
> MacOS/libqgif.dylib'
> -- 13/22: fixing up '~/Downloads/QtTest/install/QtTest.app/Contents/ 
> Frameworks/QtCore.framework/Versions/4/QtCore'
> -- 14/22: fixing up '~/Downloads/QtTest/install/QtTest.app/Contents/ 
> Frameworks/QtGui.framework/Versions/4/QtGui'
> -- 15/22: fixing up '~/Downloads/QtTest/install/QtTest.app/Contents/ 
> MacOS/libqico.dylib'
> -- 16/22: fixing up '~/Downloads/QtTest/install/QtTest.app/Contents/ 
> MacOS/libqjpeg.dylib'
>
>
> And this may be useful too:
> $ otool -L /Developer/Applications/Qt/plugins/imageformats/ 
> libqgif.dylib
> /Developer/Applications/Qt/plugins/imageformats/libqgif.dylib:
> 	libqgif.dylib (compatibility version 0.0.0, current version 0.0.0)
> 	QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0,  
> current version 4.6.2)
> 	QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0,  
> current version 4.6.2)
> 	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current  
> version 7.9.0)
> 	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
> version 103.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 125.0.0)
>
>
> Any thoughts or suggestions, before I dive too deep into  
> GetPrerequisites.cmake?
>
> Thanks,
> Brad
>
> ========================================================
> Bradley Lowekamp
> Lockheed Martin Contractor for
> Office of High Performance Computing and Communications
> National Library of Medicine
> blowekamp at mail.nih.gov
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list