Docview Framework Standalone

Get it from SVN

svn co https://wxart2d.svn.sourceforge.net/svnroot/wxart2d/trunk/wxArt2D/packages/wxdocview wxdocview

dependencies

Install wxWidgets, and expat is already in wxWidgest itself. The compilation of wxWidgest is explained here:

http://www.wxart2d.org/moin/WxArt2dInstall#ConfigureandbuildwxWidgets

Be sure to use nmake on windows, else build.cfg is not generated!

configure using CMake

Assuming you checkout into /home/klaas/soft/svncheckout/wxdocview:

cd /home/klaas/soft/svncheckout/wxdocview
cd /home/klaas/soft/svncheckout
mkdir buildwxdocview
cd buildwxdocview
cmake-gui ../wxdocview

In the last cmake-gui, hit a few times configure, and next generate. All is done. You can set wxWidgets options, in order to choose a different wxWidgets version and/or debug. After a change, configure again and generate again. For wxWidgets 2.9 the output is like:

Configuration /usr/local/bin/wx-config --debug=no;--static=yes;--unicode=yes;--universal=no;--toolkit=gtk2;--version=2.9
wxWidgets_PFVERSION       : 2.9
wxWidgets_USE_DEBUG       : OFF
wxWidgets_USE_UNICODE     : ON
wxWidgets_USE_STATIC      : ON
wxWidgets_USE_UNIVERSAL   : OFF
wxWidgets_FOUND           : TRUE
wxWidgets_INCLUDE_DIRS    : /usr/local/lib/wx/include/gtk2-unicode-static-2.9;/usr/local/include/wx-2.9
wxWidgets_LIBRARY_DIRS    : /usr/local/lib
wxWidgets_CXX_FLAGS       : -Wformat=0;  
wxWidgets_DEFINITIONS     : -D_FILE_OFFSET_BITS=64;-D__WXGTK__;-pthread
wxWidgets_FIND_COMPONENTS : aui,stc,qa,xrc,html,adv,xml,net,core,base
Configuring done

Now you are ready to build. Just type:

cd /home/klaas/soft/svncheckout/buildwxdocview
make 

At this point you can already run the samples, and the myapp application.

All ready, you will have compiled examples. And next you can install.

sudo make install

For CMake lovers in /usr/local/share/wxdocview you will find what you need to setup your own application using wxWidgets and wxDocview. Includes are in /usr/local/include/wxdocview-1.2. Libraries are in /usr/local/lib/wxdocview

For an in tree build (not recommended) its just cmake or cmake-gui:

cd /home/klaas/soft/svncheckout/wxdocview
cmake-gui .
make
sudo make install

Documentation

General design and usage DocviewModule. Doxygen based documentation an be found in this wiki here: http://www.wxart2d.org/wxart2dDoxygen/html/index.html But when configuring wxDocview, you can switch on the option for documentation, and it will be generated for you.

Screen shots of the samples see http://www.wxart2d.org/moin/WxArt2dSamples.

Creating my Own application

The myapp application directory, generates in your build directory a second CMakeList.txt file, that is tuned for your own application.

CMake

As you know from wxDocview installation, the make files resp. project files for wxDocview are based on CMake. You can use CMake to generate the files for your own app.

As recommended you use outside source builds. So we have something like:

cd /home/klaas/soft/svncheckout/wxdocview
cd /home/klaas/soft/svncheckout/buildwxdocview

You will find a simple example in ${wxdocview_BINARY_DIR}/myapp (/home/klaas/soft/svncheckout/buildwxdocview). This example was generated from ${wxdocview_SOURCE_DIR}/myapp taking into account where your binary/build directory is located. In fact there is already a myapp.sln in there, which you can use in case of Visual Studio as is, but this is not really what you are after. In that directory you will also find a CMakeList.txt file, which you can use in CMake again as source directory for the example to build.

Open that file, and you will see something like:

SET( wxDocview_DIR "/home/klaas/soft/svncheckout/buildwxdocview" ) this will set the location where the wxDocview build will be searched for. If not set other methods will be used, like when wxDocview was distributed as a package.

So you start cmake-gui.exe ( or ccmake or cmake), and choose as source directory /home/klaas/soft/svncheckout/buildwxdocview/myapp and as build directory /home/klaas/soft/whatever. Configure and Generate, will give you a working example in /home/klaas/soft/whatever. Go into /home/klaas/soft/whatever, and on windows open the myapp.sln file in Visual Studio, compile and run. Or use the make files on Unix.

Additional info:

You can place CmakeLists.txt and share/wxdocview/FindwxDocview.cmake wherever you want. FindwxDocview itself searches for wxDocviewConfig.cmake in your build directory.

The CMake approach additionally offers you to pack your application for distribution, on Windows and Unix. This will easily generate rpm or deb package files, and on windows an installer. See here WxArt2dInstall#Packaging, the commands are the same for the wxdocview package.

wxArt2D: WxDocviewPackage (last edited 2010-11-15 13:11:34 by KlaasHolwerda)