Skip to content
This repository
tree: b6262a5c12
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 61 lines (51 sloc) 2.483 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
#
# This is evil! I don't know why it works this way.
# But it works.
#
# First - collect all Qt and App plugins. Then call that bloody
# cmake FIXUP_BUNDLE macro which copis all files into MacOS directory.
# So it's moved back to plugins tree where its expected by a) Qt b) application
#
# I hate it.
#

# Dunno what id this var for...
SET(DIRS @QT_LIBRARY_DIRS@;@QT_PLUGINS_DIR@;@CMAKE_INSTALL_PREFIX@/Contents/plugins/)

# qt_menu.nib is mandatory for mac
if (@QT_USE_FRAMEWORKS@)
    file(COPY @QT_LIBRARY_DIR@/QtGui.framework/Resources/qt_menu.nib
         DESTINATION @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/Resources)
else ()
    file(COPY @QT_LIBRARY_DIR@/Resources/qt_menu.nib
         DESTINATION @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/Resources)
endif ()

# the qt.conf is mandatory too
file(WRITE @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/Resources/qt.conf "[Paths]
Plugins = plugins")

# copy all (required) Qt plugs into bundle
message(STATUS "Searching for Qt plugs in: @QT_PLUGINS_DIR@/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
file(COPY @QT_PLUGINS_DIR@/
        DESTINATION @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/plugins/
        REGEX "(designer|script|debug|mysql|psql|sqlite|odbc|phonon)" EXCLUDE)
        #REGEX "(.*)" EXCLUDE)

# try to FIXUP_BUNDLE - to change otool -L paths
# currently it creates lots of false warnings when plugins are compiled as dylibs
# warning: cannot resolve item 'libfoobar.dylib'
# etc. Ignore it.
message(STATUS "Searching for plugs in bundle: @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/plugins/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
file(GLOB_RECURSE inplugs
        @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/plugins/*@CMAKE_SHARED_LIBRARY_SUFFIX@)

#message(STATUS "Dylibs: ${inplugs}")
#message(STATUS "DIR: ${DIRS}")

include(BundleUtilities)
fixup_bundle(@CMAKE_INSTALL_PREFIX@/@JUFFED@.app "${inplugs}" @CMAKE_INSTALL_PREFIX@/Contents/plugins/)#${DIRS} )

# FIXUP_BUNDLE copies it into MacOS dir. But we need it in plugins *tree*,
# not a flat dir.
#foreach (item IN LISTS inplugs)
    #message(STATUS "IN: ${item}")
# get_filename_component(fname ${item} NAME)
# message(STATUS "Moving ${fname} back to plugins tree: ${item}")
    #message(STATUS " ${fname}")
    #message(STATUS " src: @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/MacOS/${fname}")
    #message(STATUS " tgt: ${item}")
# execute_process(COMMAND mv @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/MacOS/${fname} ${item})
#endforeach()
   
Something went wrong with that request. Please try again.