[CMake] CMake 2.8.1 + Qt/Cocoa + OS X Problem -- qt_menu.nib not getting copied
Mike Jackson
mike.jackson at bluequartz.net
Thu Apr 15 22:07:18 EDT 2010
I do not see any where in your code commands to actually copy the nib
file from the qtgui framework into your app bundle. I know thatbthe
way I set up my installation code I explicitly put a command to copy
the nib file. I believe there is a qt example on the cmake wiki that
shows how to do that.
-----
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson at bluequartz.net
BlueQuartz Software Dayton, Ohio
On Apr 15, 2010, at 17:06, kent williams <nkwmailinglists at gmail.com>
wrote:
> I'll include my CMakeLists.txt at the end of this message, but the
> long and the short of it is this: My ApplicationBundle crashes when I
> try and open it with this classic error message:
>
> Qt internal error: qt_menu.nib could not be loaded. The .nib file
> should be placed in QtGui.framework/Versions/Current/Resources/ or in
> the resources directory of your application bundle.
>
> This is supposed to be fixed, as documented in this bug:
>
> http://public.kitware.com/Bug/view.php?id=10000
>
> I checked out the latest GIT CMake and verified that the file in
> question is the same in 2.8.1 and current GIT trunk.
>
> So is there some magical extra step I need to get my bundle properly
> fixed up?
>
> project( BRAINSTracerQT )
> cmake_minimum_required(VERSION 2.8)
> cmake_policy(VERSION 2.8)
>
> find_package( VTK REQUIRED )
> include(${VTK_USE_FILE})
>
> find_package( ITK REQUIRED )
> include(${ITK_USE_FILE})
>
> find_package( Qt4 REQUIRED )
> if(QT_USE_FILE)
> include(${QT_USE_FILE})
> set(QT_USE_QTXML 1)
> else(QT_USE_FILE)
> set( QT_LIBRARIES ${QT_QT_LIBRARY})
> endif(QT_USE_FILE)
>
> find_package(ModuledescriptionParser REQUIRED)
> include(${ModuleDescriptionParser_USE_FILE})
>
> find_package(TCL REQUIRED)
>
> find_package( VTK REQUIRED )
> include(${VTK_USE_FILE})
>
> find_package( ITK REQUIRED )
> include(${ITK_USE_FILE})
> include_directories(
> ${BRAINSTracerQT_SOURCE_DIR}
> ${BRAINSTracerQT_BINARY_DIR}
> )
>
> configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ExecutablePath.h.in
> ${CMAKE_BINARY_DIR}/ExecutablePath.h IMMEDIATE @ONLY)
>
> add_subdirectory(vtkRenderingAddOn)
> include_directories(${BRAINSTracerQT_SOURCE_DIR}/vtkRenderingAddOn)
>
> set(BRAINSTracerQT_SRCS
> main.cxx
> BTMainWindow.cxx
> vtkKWImage.cxx
> vtkKWImage2D.cxx
> QVtkImageViewer.cxx
> vtkMultiWidgetBase.cxx
> vtkMultiContourWidget.cxx
> vtkBTPointSetWidget.cxx
> vtkBTPointWidget.cxx
> PolyDataUtils.cxx
> BTContour.cxx
> BTPolygon.cxx
> DiscreteParticleFilter.cxx
> PolygonFill.cxx
> LoadMaskImage.cxx
> qtcolorpicker.cxx
> QVtkPropertyDialog.cxx
> QModuleParameterWidget.cxx
> QImageParameterWidget.cxx
> QFileBrowserParameterWidget.cxx
> )
>
> set(BRAINSTracerQT_HDRS
> BTMainWindow.h
> QVtkImageViewer.h
> qtcolorpicker.h
> QVtkPropertyDialog.h
> QModuleParameterWidget.h
> QImageParameterWidget.h
> QFileBrowserParameterWidget.h
> )
>
> set(BRAINSTracerQT_RCCS
> BRAINSTracerQT.qrc)
>
> set(BRAINSTracerQT_UIS
> qvtkpropertydialog.ui)
>
> QT4_WRAP_CPP( MOCSrcs ${BRAINSTracerQT_HDRS} )
>
> QT4_ADD_RESOURCES(RCC_SRCS ${BRAINSTracerQT_RCCS})
>
> QT4_WRAP_UI(UIHeaders ${BRAINSTracerQT_UIS} )
>
> set_source_files_properties(${BRAINSTracerQT_SRCS}
> PROPERTIES OBJECT_DEPENDS ${UIHeaders})
>
> add_definitions(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
>
> #set_source_files_properties(${BRAINSTracerQT_SRCS} PROPERTIES
> # OBJECT_DEPENDS "${UIHeaders}")
>
> add_executable( BRAINSTracerQT
> MACOSX_BUNDLE
> WIN32
> ${BRAINSTracerQT_SRCS}
> ${MOCSrcs}
> ${RCC_SRCS}
> )
> target_link_libraries( BRAINSTracerQT
> QVTK
> ${QT_LIBRARIES}
> ${ITK_LIBRARIES}
> vtkRenderingAddOn
> vtkRendering
> vtkFiltering
> vtkVolumeRendering
> ${TCL_LIBRARY}
> ModuleDescriptionParser
> )
>
> GET_TARget_property(TARGET_EXEC_DIR BRAINSTracerQT
> RUNTIME_OUTPUT_DIRECTORY)
> set(TARGET_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
>
> set(DEFAULT_MODULE_SEARCH_PATH
> "${TARGET_EXEC_DIR}/Modules")
>
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> # Now the installation stuff below
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> SET(plugin_dest_dir bin)
> SET(qtconf_dest_dir bin)
> SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/BRAINSTracerQT")
> IF(APPLE)
> SET(plugin_dest_dir BRAINSTracerQT.app/Contents/MacOS)
> SET(qtconf_dest_dir BRAINSTracerQT.app/Contents/Resources)
> SET(APPS "\${CMAKE_INSTALL_PREFIX}/BRAINSTracerQT.app")
> ENDIF(APPLE)
> IF(WIN32)
> SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/BRAINSTracerQT.exe")
> ENDIF(WIN32)
>
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> # Install the BRAINSTracerQT application, on Apple, the bundle is at
> the root of the
> # install tree, and on other platforms it'll go into the bin
> directory.
> INSTALL(TARGETS BRAINSTracerQT
> BUNDLE DESTINATION . COMPONENT Runtime
> RUNTIME DESTINATION bin COMPONENT Runtime
> )
>
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> # Install needed Qt plugins by copying directories from the qt
> installation
> # One can cull what gets copied by using 'REGEX "..." EXCLUDE'
> INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION
> ${plugin_dest_dir}/plugins COMPONENT Runtime)
>
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> # install a qt.conf file
> # this inserts some cmake code into the install script to write the
> file
> INSTALL(CODE "
> file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf
> \" \"\")
> " COMPONENT Runtime)
>
>
> #--
> ---
> ---
> ---
> ---------------------------------------------------------------------
> # Use BundleUtilities to get all other dependencies for the
> application to work.
> # It takes a bundle or executable along with possible plugins and
> inspects it
> # for dependencies. If they are not system dependencies, they are
> copied.
>
> # directories to look for dependencies
> SET(DIRS
> ${QT_LIBRARY_DIRS}
> ${ITK_DIR}
> ${VTK_DIR}
> ${CMAKE_INSTALL_PREFIX}/lib
> ${ModuledescriptionParser_DIR}
> ${BRAINSTracerQT_BINARY_DIR}/lib
> )
> MESSAGE(status QT_LIBRARY_DIRS ${QT_LIBRARY_DIRS} ${QT_PLUGINS_DIR})
> # Now the work of copying dependencies into the bundle/package
> # The quotes are escaped and variables to use at install time have
> their $ escaped
> # An alternative is the do a configure_file() on a script and use
> install(SCRIPT ...).
> # Note that the image plugins depend on QtSvg and QtXml, and it got
> those copied
> # over.
> INSTALL(CODE "
> file(GLOB_RECURSE QTPLUGINS
> \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*$
> {CMAKE_SHARED_LIBRARY_SUFFIX}\")
> include(BundleUtilities)
> fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
> " COMPONENT Runtime)
>
>
> # To Create a package, one can run "cpack -G DragNDrop
> CPackConfig.cmake" on Mac OS X
> # where CPackConfig.cmake is created by including CPack
> # And then there's ways to customize this as well
> set(CPACK_BINARY_DRAGNDROP ON)
> include(CPack)
> _______________________________________________
> 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