http://www.rasmsys.com/page6/page13/page13.html

 

Erik Rasmussen

2 Feb 2010

 

I just spent a very hard month of trial, error, experimentation, and googling to figure out how to build a redistributable Paraview application containing my custom plugins.

 

The process was beyond frustrating because I was learning a new, complicated software build system called CMake. And there were many, many bugs in this whole process that were only decipherable via vague comments in internet archives of mail group exchanges.

 

As the process evolved, I had no success building for the older Mac framework called Carbon. So I decided as long as I was having such a good time, I might as well build for the next-generation framework called Cocoa.

 

I must comment that I built this application on Ubuntu Linux in about a day, and it worked as the manuals described it should. I.e., the main Paraview app compiled and ran, and my custom plugins could be placed in any of the standard locations in the filesystem, and Paraview found them and they ran.

 

The overwhelming issue with Mac is the location relationships between compiled components. In all my fiddling, I never was able to build plugins that could be put in the standard places and recognized by ParaView. I eventually had to compile and install my plugins with the main application and have them be installed in the paraview.app bundle-folder. There are probably easy, elegant ways to do what I did, but AFAIK they have not been documented. So if I can save just one person the agony and lost time that I just went through, I'll be happy. Here's how I got a viable ParaView app, with plugins, on Mac OS X 10.6.

 

First download Qt 4.5.3 from Trolltech/Nokia. I have had issues with graphics system slowdowns in 4.6, so I haven't tried it yet. Get the Paraview 3.6.2 source code, and the latest release version of CMake.

 

And don't ask me for additional advice! I would rather not have to endure this process again.

 

1. Downoad and install new ParaView3 source distribution

 

2. Add folder build_XC to the ParaView3 folder

2.1 Add RS plugin source* folders to ParaView3/Plugins

2.2 Go to CMakeFiles.txt in Plugins, and add the RS plugins to the list

 

3. Modified the file CreateBundle.sh.in to get rid of insufficiencies for building the .app bundle

3.1 Follow modifications noted in the CreateBundle.sh.in that is preserved in ParaViewMac (note lines below comments # Custom line added by ENR 6Jan10)

 

4. Went to CMakeLists.txt in ParaView3, and fixed USE_COCOA USE_CARBON bug.

4.1 Change the on/off status of VTK_USE_CARBON and VTK_USE_COCOA

4.2 If you don't do this, CMake configure will always switch them back to the settings you don't want for Cocoa.

 

5. cd to build_XC folder in shell and "cmake -G Xcode"

 

6. In shell, type cmake-gui; set the values of the properties shown below. Make sure that VTK_USE_RPATH becomes available and set. Did not generate. configure until configuration succeeded, run generate. A successful compile probably won't happen unless all of these are set appropriately

 

BUILD

only check BUILD_SHARED_LIBS

CMAKE

CMAKE_BUILD_TYPE Release

CMAKE_INSTALL_PREFIX /build_XC

CMAKE_OSX_ARCHITECTURES x86_64

CMAKE_USE_PTHREADS is checked

CMAKE_USE_RELATIVE_PATHS is NOT checked

CPACK

check bundle and packagemaker

add variable CPACK_BUNDLE_NAME; e.g. ParaViewRS

add variable CPACK_BUNDLE_ICON (MacIcon.icns; save this somewhere else and point to it here)

add variable CPACK_BUNDLE_PLIST (Info.plist save this somewhere else and point to it here)

VTK

VTK_USE_COCOA is checked (but it won't stay checked if you ignored step 4 above!)

VTK_USE_RPATH is checked

 

8. In ParaView3/Qt/Widgets/pqProgressBar.cxx, comment out three lines referring to HI classes in method setProgress(int)

8.1 There is a patch floating around the internet for this, but I decided I would just forego seeing a progress bar. Paraview will not compile with these three lines present.

 

9. Invoke XCode for building by double-clicking ParaView.xcodeproj

 

10. Do target BUILD_ALL, Release or Debug. Choose this build by using the drop-down list.

 

11. Go to build_XC folder and select everything in Release (or Debug, whichever the case may be) and move it up one folder to bin. This really needs a better approach, but XCode puts things in folders called bin/Release or bin/Debug, and the paraview installation scripts expect to see them in bin.

 

12. Go to XCode and select target "package" from the dropdown. Build.

 

 

 

Here is the CMakeLists.txt for one of my plugins. Note esp. that you will need to use the INCLUDE_DIRECTORIES command.

 

#cmake_minimum_required(VERSION 2.6)

 

#--------------------------------------------------

# Find and Use ParaView

#--------------------------------------------------

#FIND_PACKAGE(ParaView REQUIRED)

#INCLUDE(${PARAVIEW_USE_FILE})

 

 

INCLUDE(${QT_USE_FILE})

 

INCLUDE_DIRECTORIES(

${VTK_INCLUDE_DIR}

${PARAVIEW_INCLUDE_DIRS}

${ParaView_SOURCE_DIR}/VTK/GUISupport/Qt

${pqCore_SOURCE_DIR}

${pqCore_BINARY_DIR}

${pqComponents_SOURCE_DIR}

${pqComponents_BINARY_DIR}

${QtWidgets_SOURCE_DIR}

${QtWidgets_BINARY_DIR}

)

 

#define the server-side portion of the reader plugin

ADD_PARAVIEW_PLUGIN(SAMReaderPlugin "0.0"

SERVER_MANAGER_XML SAMReader.xml

SERVER_MANAGER_SOURCES vtkSAMReader.cxx)

 

#define the client-side portion of the reader plugin

 

ADD_PARAVIEW_PLUGIN(SAMReaderGUIPlugin "0.0"

GUI_RESOURCES SAMReader.qrc)

用户登录