Download and Installation of wxArt2D

General Approach

The general approach to get the wxArt2D library and its demos running is:

Due to things being a little complex, it's not unusual to have some problem in between. You might want to take a look at the common issues.

In this documentation there might be a certain bias towards MS Windows (MSW) systems with Visual Studio. However, wxArt2D is known to work with Cygwin and natively on Linux as well. See Working platform and tool sets for more.

Download Tools and Sources

Being able to be built on different platforms, wxArt2D requires more than just its own sources.

Now you have the tools and sources needed to build wxArt2D.

Configure and build wxWidgets

wxWidgets and wxArt2D need to be made with matching configurations. Especially, wxArt2D requires OpenGL support and the contributed scintilla library from wxWidgets.

Now you have a functional wxWidgets library, including some contribs. Ideally you have verified on some wxWidgets demo, that everything is running well.

Configure and build wxArt2D

The building process of wxArt2D relies on CMake generated makefiles resp. project files. See CMake for a more detailed explanation.

Once your project files or else makefiles are generated, wxArt2D should build without trouble.

Generating wxArt2D Documentation

WxArt2D uses doxygen to generate API documentation straight from the source code. Doxygen again itself uses graphviz to generate graphs of classes.

Next to that Docbook is used to generate the general documentation. You will need to download the Docbookk XSL style sheets from here http://docbook.sourceforge.net/projects/xsl/ The dtd of docbook is in CVS itself. And the STSL processor you might use is located here http://saxon.sourceforge.net/, I use Instant Saxon 6.5.3

For the doxygen documentation there is the option BUILD_DOCUMENTATION in CMakeSetup.

Make sure doxygen and the graphviz its dot tool is in your path variable. You can also set DOT_PATH in doxygen.doxy.

For docbook, search for gendocbook.bat, hack its paths until it works ;-)

Focus on your own Application

Exploring wxArt2D

An overview of samples and the hierarchy of the modules can be found in readme.html.

Build your own wxArt2d-based project using CMake. After you have build wxArt2D as explained above, you will find that the samples and all are included in its make and project files.

For your own project there are several options. The easiest is to use the myproject template which is automatically generated in your build directory. This template generates a CMakeLists.txt, which you should use to generate the project files. So use CMakeSetup on windows and ccmake or cmake on Unix to generate the makefile and project files for your own project. In our case the input to CMakeSetup is something like this: "Where is the source installed" c:/libraries/buildwxart2dhere "Where to build binaries" c:/whereEver

You can place this CmakeLists.txt and /bin/FindwxArt2D.cmake wherever you want, FindwxArt2D itself searches for wxart2dconfig.cmake in your build directory. The line SET( WXART2D D:/notebook/wxartcvs/vcp ) can be edited later if you want to try different wxArt2D builds. Down here the file you will find in your build_wxart2d/myproject.

    PROJECT( myapp )

    #modify this!!
    SET( WXART2D D:/notebook/wxartcvs/vcp )

    INCLUDE (${myapp_SOURCE_DIR}/bin/FindwxArt2D.cmake)

    INCLUDE_DIRECTORIES( ${myapp_SOURCE_DIR}/include )

    ADD_EXECUTABLE( myappname  WIN32
        src/myfile1.cpp include/myfile1.h
        d:/notebook/wxwin/wx251vc/include/wx/msw/wx.rc
    )

One other option is to use wxart2dconfig Unix script in some way in your own makefiles.

Common Issues

Static CRT

The CMake scripts do not fully support the use of static C run time libraries. They always use the compiler switches /MDd resp. /MD, instead of the then needed /MTd resp. /MT. To get around this, you need to manually modify the CMake lines for the C++-flags and C-flags before you generate the makefiles. These lines are usually hidden, activate "show advanced values". The names you look for start with CMAKE_CXX_FLAGS_ and CMAKE_C_FLAGS_.

Typical error codes show up at link time or at run time, e.g.

LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

or

STATUS_DLL_NOT_FOUND exception

Remember, these /MTd, /MT, /MDd, /MD flags must be the same throghout wxWidgets, wxArt2D and the rest of your application.

Manifest

Starting with VS2005 manifests are auto generated. Before manual generation was neccessary, so wxWidgets offers a default manifest. Using the auto generated is strongly preferred, unless you know what you do.

In case you get something like

CVTRES : fatal error CVT1100: duplicate resource.  type:MANIFEST, name:1, language:0x0409
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

chances are good, your include files have a wrong order, therefore the wrong rcdef.h gets loaded. The order of includes in your makefile should look like /I.\..\..\lib\vc_lib\mswd /I.\..\..\include. Then the right lib\vc_lib\mswd\wx\msw\rcdef.h gets included, instead of include\wx\msw\rcdefs.h. They differ by (not) defining WX_MSC_FULL_VER, which is used by wx.rc to decide on inclusion of wx's own manifest or not (to rely on the auto generated one).


wxArt2D with wxLua and wxStEdit

As scripting language within wxArt2D is currently available. wxLua itself needs , so you need to get wxLua and wxStEdit compiled for your system. On windows make sure you have the floowing environment variables set, before starting CmakeSetup.exe to generate your project files. First you build wxStEdit and Next wxLua, both in all flavors you need.

I assume the following are set:

SET WXSTEDIT=c:\soft\art2d\wxstedit
SET WXLUA=c:\soft\art2d\wxLua
SET WXWIN=c:\soft\wxWidgest-2.8.8

Just check on your MDOS command line with:

echo %WXLUA% 
echo %WXSTEDIT% 
echo %WXWIN%

cd %WXSTEDIT%\build 
#for debug
nmake -f makefile.vc WX_DEBUG=1
#for release
nmake -f makefile.vc WX_DEBUG=0

cd %WXLUA%\build 
#for debug
nmake -f makefile.vc BUILD=debug
#for release
nmake -f makefile.vc BUILD=release

This should give you all the libraries for wxLua and wxStEdit in debug and release mode. Now you start CmakeSetup.exe and enable the option WXART2D_USE_LUA to be ON. The project files wxArt2D.sln, now gets extra targets and samples using wxlua.

P.S. for the moment gdiplus.lib is not used by wxLua, and so WXART2d_USE_GDIPLUSDRAWER is only possible if you add by hand gdiplus.lib to the wxLua makefile.vc files. That is in %WXLUA%\apps\build\msw\makefile.vc, just add it where you see *.lib files.

On Unix you need to set the same variable on your shell command line.

I assume:

export WXSTEDIT=/home/myhome/art2d/wxstedit
export WXLUA=/home/myhome/art2d/wxLua
export WXWIN=/home/myhome/art2d/wxWidgest-2.8.8

Use: this to compile and install for wxstedit and wxlua.

./configure (right option see ./configure --help)
make
make install 

Next configure wxArt2D and compile:

export WXART2D=/home/myhome/art2d/wxArt2D
cd $WXART2D
cd ..
mkdir buildArt2dWithWxLua
cd buildArt2dWithWxLua
ccmake ../wxArt2D
make