Creating my Own application

There are some ways to your own application, depending on your system. Mainly based on CMake or else DialogBlocks.

CMake

As you know from wxArt2D installation, the make files resp. project files for wxArt2D 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 c:/soft/wxArt2D cd c:/soft/MyArt2dBuildDebug        

You will find a simple example in ${wxart2d_BINARY_DIR}/myapp (c:/soft/MyArt2dBuildDebug). This example was generated from ${wxart2d_SOURCE_DIR}/myapp taking into account where youre 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 outcomment #SET( WXART2D_DIR c:/soft/MyArt2dBuildDebug ), this will set the location where the wxArt2D build will be searched for. If not set other methods will be used, like when wxArt2D was distributed as a package.

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

Additional infos

You can place CmakeLists.txt and /bin/FindwxArt2D.cmake wherever you want. FindwxArt2D itself searches for wxArt2DConfig.cmake in your build directory.

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

The CMake approach additionally offers you to pack your application for distribution, on Windows and Unix. See Packaging.

DialogBlocks

This is for those people who like to design their wxWidgets app's GUI by Julian Smart's DialogBlocks (http://www.DialogBlocks.com/). Though this description is based on using Visual Studio and its project files, the general approach for Unix like makefiles should be similar.

CMake and DialogBlocks ("DB") generate solutions including project files for the application. However, these two approaches cannot be combined. So wxArt2D has to be included into DB's project configuration generation manually. Like you would do with any other third party library.

You have your App in DB. Take a wxArt2D example which is similar to what you want to do. Load both solutions into two Visual Studio instances. Choose matching configurations (e.g. Unicode Debug). Then you compare manually the properties of both. Identify what wxArt2D needs, but your app does not have yet, that you need to add in DB.

Do for both projects: In Visual Studio, under Project, Properties you get the Property Pages of the projects. Configuration Properties, C/C++, Command Line gives you all options the compiler gets called with. Same with Linker, get the Command Line for both projects. With these two by two lines, you can compare step by step inside some text editor, e.g. by deleting which is same for both.

Options should be similar, interesting are include paths, library paths, libraries and preprocessor flags. You need to adjust (and maybe clean up) the wxArt2D include and library paths, so everything gets found from within your app project.

With the results you go to DB's Configuration settings and add what you need. Example, based on some system, where wxArt2D resides in D:\wxArt2D, and the unicode debug build in D:\wxArt2D\buildud. Only the four modified lines are shown. For your environment the content will probably differ much.

Compiler include path

%AUTO%, %WXWIN%\src\expat\lib, D:\wxArt2D\buildud\include, D:\wxArt2D\include, D:\wxArt2D\modules, D:\wxArt2D\thirdparty\kbool\include, D:\wxArt2D\thirdparty\agg2\include, D:\wxArt2D\thirdparty\freetype\include

Preprocessor flags

%AUTO% /DwxUSE_UNICODE

Libraries

%AUTO% wxart2d_msw28ud_aggdrawer.lib wxart2d_msw28ud_curves.lib wxart2d_msw28ud_editor.lib wxart2d_msw28ud_canextobj.lib wxart2d_msw28ud_canvas.lib wxart2d_msw28ud_artbase.lib wxart2d_msw28ud_docview.lib wxart2d_msw28ud_svgio.lib wxart2d_msw28ud_gdsio.lib wxart2d_msw28ud_general.lib wxart2d_msw28ud_xmlparse.lib kboold.lib aggd.lib freetyped.lib wxmsw28ud_stc.lib wxmsw28ud_qa.lib glu32.lib

Library path

%AUTO%,D:\wxArt2D\buildud\lib\Debug

Of course there might be more paths and libs needed, which were not in that specific wxArt2D example. The errors from compiler and linker will guide you. Do not forget to do both (all) configurations, Debug and Release, separately. Simple copy and paste will not work.

CodeBlocks with MinGW

For your application to build, you need to add libraries and include files to the search path. Furthermore, the libraries must be in a specific order. To keep the project path independent, define CodeBlocks global variables for wxWidgets and wxArt2D.

$(#wxart2d) = <path>\wxArt2D
$(#wx) = <path>\wxWidgets-2.8.11

Now add include paths

All Targets

$(#wxart2d)\packages\wxart2d\include
$(#wxart2d)\packages\wxdocview\include
$(#wxart2d)\thirdparty\freetype-2.4.2\include
$(#wx)\src\expat\lib

Debug

$(#wxart2d)\<debug_path>\packages\wxdocview\include
$(#wxart2d)\<debug_path>\packages\wxart2d\include

Release

$(#wxart2d)\<release_path>\packages\wxdocview\include
$(#wxart2d)\<release_path>\packages\wxart2d\include

and library paths.

All Targets

$(#wxart2d)\thirdparty\freetype-2.4.2\objs

Debug

$(#wxart2d)\<debug_path>\packages\wxart2d\lib
$(#wxart2d)\<debug_path>\packages\wxdocview\lib
$(#wxart2d)\<debug_path>\thirdparty\kbool\lib
$(#wxart2d)\<debug_path>\thirdparty\agg-2.4\lib

Release

$(#wxart2d)\<release_path>\packages\wxart2d\lib
$(#wxart2d)\<release_path>\packages\wxdocview\lib
$(#wxart2d)\<release_path>\thirdparty\kbool\lib
$(#wxart2d)\<release_path>\thirdparty\agg-2.4\lib

For the libraries to be found when the path is searched, they must begin with "lib". By default, the freetype library is named freetype.a. Make a copy of the file in the same directory and name it libfreetype.a.

Finally, add libraries to the list of libraries to be linked. These must be added such that they link before the wxWidgets libraries and they must be added in the order listed.

Debug

libwxart2d_msw28ud_curves.a
libwxart2d_msw28ud_editor.a
libwxart2d_msw28ud_canextobj.a
libwxart2d_msw28ud_canvas.a
libwxart2d_msw28ud_svgio.a
libwxart2d_msw28ud_gdsio.a
libwxart2d_msw28ud_artbase.a
libwxart2d_msw28ud_aggdrawer.a
libwxart2d_msw28ud_genart.a
libfreetype.a
libaggctrl.a
libaggplatform.a
libagg.a
libkbool.a
libwxdocview_msw28ud_docview.a
libwxdocview_msw28ud_general.a
libwxdocview_msw28ud_xmlparse.a
libwxexpatd.a

Release

libwxart2d_msw28u_curves.a
libwxart2d_msw28u_editor.a
libwxart2d_msw28u_canextobj.a
libwxart2d_msw28u_canvas.a
libwxart2d_msw28u_svgio.a
libwxart2d_msw28u_gdsio.a
libwxart2d_msw28u_artbase.a
libwxart2d_msw28u_aggdrawer.a
libwxart2d_msw28u_genart.a
libfreetype.a
libaggctrl.a
libaggplatform.a
libagg.a
libkbool.a
libwxdocview_msw28u_docview.a
libwxdocview_msw28u_general.a
libwxdocview_msw28u_xmlparse.a
libwxexpat.a

MyOwnApp (last edited 2011-07-03 17:02:33 by c-98-220-62-183)