Differences between revisions 38 and 86 (spanning 48 versions)
Revision 38 as of 2009-05-20 19:17:05
Size: 16113
Comment:
Revision 86 as of 2016-04-30 06:23:23
Size: 20805
Editor: ip5657d226
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

After reading all down here to get the general idea of what to do, you can go to the next topics to read more on your specific situation.

[[EclipseWascana|Eclipse using Wascana and Mingw]]
After reading '''all''' down here to get the general idea of what to do, you can go to the next topics to read more on your specific situation.
Do not start there!

[[Kdevelop4| kdevelop4 Unix fashion]]

[[CodeBlocks|CodeBlocks with MinGW non unix fashion]]

[[MinGW|With Mingw non Unix fashion]]

[[MinGWMSys|With Mingw/Msys Unix fashion]]

[[EclipseWascana|With Eclipse Unix and windows]]
Line 9: Line 17:
[[OpenSuseInstall| OpenSuse install from the command line]]

[[CentosRedhat| Centos or Redhat install from the command line]]
Line 10: Line 22:
Line 14: Line 25:
Line 16: Line 26:
Line 18: Line 29:
 * Build optional external dependencies wxLua wxStedit
Line 19: Line 31:
  * Build optional dependencies ( kbool, Agg, Freetype )
  * Build wxdocview package
  * Build wxart2d package
 * At least on unix Install kbool, agg, wxdocview, wxart2d
Line 21: Line 37:
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 [[#CommonIssues|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 [[WxArt2dInstallWorking|Working platform and tool sets]] for more.
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 [[WxArt2dInstall#CommonIssues|common issues]].

In this documentation there might be a certain bias towards MS Windows (MSW) systems with Visual Studio. However, wxArt2D is working for Linux and Cygwin as well. See [[WxArt2dInstallWorking|Working platform and tool sets]] for more.
Line 26: Line 42:

Being able t
o be built on different platforms, wxArt2D requires more than just its own sources.
To be built on different platforms, wxArt2D requires more than just its own sources.
Line 30: Line 45:
  * Latest released version is 2.8.8. From here on, it is assumed you use version 2.8.8, not an older version. The development branch 2.9.0 is not yet supported (there are incompatibilities).
 * Get a CVS client, e.g. [[http://www.tortoisecvs.org/|TortoiseCVS]] [[http://www.wincvs.org/|WinCvs]]
 * Get CMake, version 2.6 or newer, [[http://www.cmake.org/|CMake]]
   * wxArt2D uses CMake as its build system. It will generate makefiles & project-files using template files present in wxArt2d folders.
 * Get wxArt2D by CVS
  * Choose a home for your wxArt2D installation, on MSW e.g. D:\
  * From console run {{{cvs -z3 -d:pserver:anonymous@wxart2d.cvs.sourceforge.net:/cvsroot/wxart2d co -P wxArt2D}}}
   * Now you should have e.g. D:\wxArt2D.
  * No, there is no zip-file or msi-installer. Though wxart2d is well maintained, there are no releases, yet.
   * To get the latest wxArt2D sources, just rerun the cvs command anytime.
  * Latest released version is 2.9.1 From here on, it is assumed you use version 2.8.10 or higher, not an older version. The development branch 2.9 is supported for the default settings. We are waiting for wxLua and wxStedit to be ready.
 * Get a SVN client, e.g. [[http://rapidsvn.tigris.org|RapidSVN]]
 * Get CMake, version 2.8 or newer, [[http://www.cmake.org/|CMake]]
  * wxArt2D uses CMake as its build system. It will generate makefiles & project-files using template files present in wxArt2d folders.
 * Get wxArt2D by SVN
  * Choose a home for your wxArt2D installation, on MSW e.g. D:\wxart2d
  * From console run {{{ svn co https://svn.code.sf.net/p/wxart2d/code/trunk trunk }}}
  * Now you should have e.g. D:\wxart2d\trunk\wxArt2D.
  * No, there is no zip-file or msi-installer. Though wxart2d is well maintained, there are no releases, yet.
  * To get the latest wxArt2D sources, just re-run the svn command anytime.
Line 41: Line 56:
  * Those dependencies are kbool and Agg. For windows Freetype is included in the thirdparty directory too. For scripting wxLua is the choice.
Line 45: Line 61:

wxWidgets and wxArt2D need to be made with matching configurations. Especially and the contributed scintilla library from wxWidgets. Therefore you need to compile in the contrib directory the stc lib.
Y
ou must also set '''USE_GDIPLUS = 1''' in '''%WXWIN%/build/msw/config.vc''', in order to use GdiPlus based drawing.
With '''nmake''' you can also specify this as extra parameter on the commandline.

 * For introduction and details on how to configure or build wxWidgets on your system at all, please refer to the extensive wxWidgets documentation (offline and online)
  * But use nmake from within a DOS box, to compile wxWidgets in order to have it generate build.cfg. Project files are not oke.
  * VC command line tools, requires running vcvars32.bat, which is found in Visual Studio installation its: VC\bin directory. There also a menu for Visual studio, which start a commandline window ready to go.
  * For the debug version: '''nmake -f makefile.vc BUILD=debug'''
   * For the release version: '''nmake -f makefile.vc BUILD=release''' 

   * On Unix debug version: ./configure --enable-debug --enable-debug-gdb --disable-shared
   * On Unix release version: ./configure --disable-shared

 * If you intend to use e.g. static CRT, unicode, or wxWidgets using STL, be prepared for additional, matching changes in wxArt2D and your application.
wxWidgets and wxArt2D need to be made with matching configurations.

Especially the contributed scintilla library from wxWidgets is needed. In wxWidgets 2.9 it is included in the standard compilation. For wxWidgets 2.8 you need to compile in the contrib directory the stc lib. Path to it looks like {{{wxWidgets-2.8.x\contrib\build\stc}}}, with "x" being your actual wxWidgets version.
To use WXART2D_USE_GRAHICS_CONTEXT in wxArt2D on Windows, you must also set '''USE_GDIPLUS = 1''' in '''%WXWIN%/build/msw/config.vc''', in order to use GdiPlus based drawing. With '''nmake''' you can also specify this as extra parameter on the commandline. On unix there is a configure argument to do that.

 * For introduction and details on how to configure or build wxWidgets on your system, please refer to the extensive wxWidgets documentation (offline and online)
  * But use nmake from within a DOS box, to compile wxWidgets in order to have it generate '''build.cfg'''. Project files are not oke. 
  * VC command line tools, requires running vcvars32.bat, which is found in Visual Studio intallation its: VC\bin directory. Or you start VC special its DOS BOX found in the menu's after installing VC. It is called something like: ''Visual Studio 200X Command Prompt''. In newer version of VC there is ''vcvarsall.bat'', which you can run in a DOS BOX.
Once you have the right DOS BOX, we are ready to compile.

* For the debug version: '''nmake -f makefile.vc BUILD=debug'''
  * For the release version: '''nmake -f makefile.vc BUILD=release'''

  * On Unix debug version: '''./configure --enable-debug --enable-debug-gdb --disable-shared'''
  * On Unix release version: '''./configure --disable-shared'''

 * If you intend to use e.g. static CRT, unicode, or wxWidgets using STL, be prepared for additional, matching changes in wxArt2D and your application. In general wxArt2d will find the latest installed wxWidgets by default. But with CMake option you can choose a different one.
Line 61: Line 79:
 * Build wxWidgets contributions, stc (scintilla library) is required, LUA is optional
   * Configure and build them identically to wxWidgets itself (repeat the steps above).
   * stc is required for wxArt2D.
  * Optional is wxLua, which is used in some modules and samples of wxArt2D. So you can configure and compile wxArt2d without it. In case you have wxLua installed and compiled, wxArt2d's CMake configure script finds wxLua by setting the environment variable WXLUA on windows. When using wxLua, also wxStEdit is required, see wxCode project. WXSTEDIT should be set to its root, in order for CMake to find it.
 * Build wxWidgets contributions ( wxWidgets < 2.9 ), stc (scintilla library) is required, wxStedit and wxLua are optional.
  * Configure and build them identically to wxWidgets itself (repeat the steps above).
  * stc (see above) is required for wxArt2D.
  * Optional is wxLua, which is used in some modules and samples of wxArt2D. So you can configure and compile wxArt2d without it. In case you have wxLua installed and compiled, wxArt2d's CMake configure script finds wxLua by setting the environment variable WXLUA on windows. When using wxLua, also wxStEdit is required, see wxCode project. WXSTEDIT should be set to its root, in order for CMake to find it.
  * For windows, Freetype you will find in the thirdparty directory, you need to compile it yourself.
Line 69: Line 88:

The building process of wxArt2D relies on CMake generated makefiles resp. project files. See [[WxArt2dInstallCmake|CMake]] for a more detailed explanation.
wxArt2D is a combination of several packages.
 * Agg ( stored as thirdparty in wxArt2D repos, so no need to download), this is used for subpixel and composite/transparent drawing. Compilation is CMake based.
 * kbool ( stored as thirdparty in wxArt2D repos ) is used for boolean operation on polygons. Compilation is CMake based.
 * Freetype ( normally installed on Unix, for window the win32 package is stored as thirdparty in wxArt2D repos ) '''YOU''' are responsible for compiling it there inside the source tree. That is the place where it will be searched for by wxart2d.
 * wxdocview package ( document view framework ) and contains 3 submodules:
  * xmlparse
  * general
  * docview
 * wxart2d package ( drawing and editing library on top of the document view framework ) contains the following submodules:
  * genart
  * aggdrawer
  * artbase
  * keyio
  * gdsio
  * svgio
  * canvas
  * canextobj
  * editor
  * luawraps
  * curves

The above packages must be build separately and installed after all is build.
The building process of wxArt2D relies on CMake to generate makefiles resp. project files. It is recommended to use the '''cmake-gui''' tool to set options, and to always do outside builds. That makes it easy to have more then one build (e.g combination of debug, release and static or shared ).

== Configure by Hand ==

Do '''first''' read and apply the [[WxArt2dInstallCmake|Configure Using CMake by Hand]].
It explains how to build by hand in the right order.

If you know how it should be done by hand, you can try to use the following scripts, to automate these steps.
But in case of errors in the by hand situation, the scripts are useless.

On Linux the top ''configure'' script can be used to configure and compile all packages in the right order. For instance the wxart2d package checks for the other packages (wxdocview, Agg etc.), and if not compiled yet, this is a problem. Also the configure script makes sure all packages are build with the same settings.
The configure script will do what can be done by hand. On windows there is a configure.lua.
Look at the script or at least its ''-help'' option.

The configure script tries to configure and compile and install all packages in the right order, still it is a good idea to know what is going on behind it.

On Unix/Linux the magic line is something like:
'''../trunk/wxArt2D/configure -g -v -prefix /home/klaas/soft/usr/local'''

On Windows the magic line is something like:
'''..\trunk\wxArt2D\bin\lua ..\trunk\wxArt2D\configure.lua -g -v'''
Line 74: Line 134:
== Running the samples ==

When you finally managed to compile it, the samples are avaialble.
But you need to set the following environment variable, in order to find cursor images and other resource relates stuff.

export WXART2D=/whateverYourPathIsToTheWxArt2DSources/wxArt2D/packages/wxart2d
Line 76: Line 143:
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 ;-)
WxArt2D uses doxygen to generate API documentation straight from the source code. Doxygen again itself uses graphviz to generate graphs of classes. The rest of the documentation is in this wiki.

For the doxygen documentation there is the option {{{BUILD_DOCUMENTATION}}} in '''cmake-gui'''.

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

The generated doxygen docs are linked to from within this wiki, like classes. So that makes it easier to read.

[[http://www.wxart2d.org/wxart2dDoxygen/html/index.html|Doxygen Docs on This Site]]
Line 92: Line 154:

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 some application are included in its make and project files. And they will be compiled directly when the libraries are compiled. They use the header files from the source, and the libraries are taken from the build directory.
Some header files are coming from the build directory, since they were configured by Cmake based on the options given.

After build, the next step would be installing wxArt2D, on Unix this is simple : '''make install'''.<<BR>>
On windows and Unix packages can be generated for installation, see [[#Packaging|Packaging]]

With or without installation the '''myapp''' directory in your build tree, contains a CMakeList.txt and '''myapp/bin/FindwxArt2D.cmake''', which can work from an installed wxArt2D, but also from the build tree.

For your own project you best base it on the project template which is automatically generated in your build directory under '''myapp'''. 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/myapp
"Where to build binaries" c:/whereEver

 The default is a simple program, the {{{CmakeLists.txt}}} (see down here) should be edited to contain your own files.
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_DIR c:/libraries/buildwxart2dhere )}}} points to where you have wxArt2D build. In case you also installed wxArt2D (after building it), this must point to the installation directory.
Just out comment it in order to build the application, using the libraries and headers from the/a build tree of wxArt2D.
The default is set right to that.

Down here the file you will find in your {{{build_wxart2d/myapp}}}.
{{{
PROJECT( myapp )

# uncomment and modify this if you need a specific installation, else last installed will be used, or environment setting
for WXART2D_DIR is set.
# SET( WXART2D_DIR C:/soft/wxartcvs/wx288deb )

# additional are modified Find routines
SET ( CMAKE_MODULE_PATH "${myapp_SOURCE_DIR}/bin" )

CMAKE_MINIMUM_REQUIRED( VERSION 2.4.8 )

FIND_PACKAGE( wxArt2D )
IF( WXART2D_FOUND )
    INCLUDE(${WXART2D_USE_FILE})
ELSE( WXART2D_FOUND )
    MESSAGE( "WXART2D library was not found" )
ENDIF( WXART2D_FOUND )

INCLUDE_DIRECTORIES( ${myapp_SOURCE_DIR}/include )

COMPILE_RC( "" wx.o )

ADD_EXECUTABLE( myappname WIN32
    src/myfile1.cpp include/myfile1.h
    
)

}}}

Another option is to use {{{wxart2dconfig}}} Unix script in some way in your own makefiles.
You might want to use CMake or !DialogBlocks to automate make file and project file generation. For details see [[MyOwnApp|How do I setup my own application]].
Line 151: Line 158:
=== 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_}}}.
=== Static Link to VC runtime (CRT) ===

What is that? When you distribute your application, users can have problems that the application does not seem to do anything. Often that is because the vcruntime libraries are not installed. You can link those libraries in static.

See http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

In '''cmake-gui''' you will find the option to set the compiler flags for that package.

 * For wxdocview package set: '''wxDocview_USE_STATIC_RUNTIME'''
 * For wxart2d package set: '''WXART2D_USE_STATIC_RUNTIME'''

If you set it for one package, also so set it for the other, and be sure to compile wxWidgest static too.

In wx Widgets see '''build/msw/config.vc'''
{{{
# Should link against debug RTL (msvcrtd.dll) or release (msvcrt.dll)?
# Acts according to BUILD by default. [0,1,default]
DEBUG_RUNTIME_LIBS = default


# Version of C runtime library to use. You can change this to
# static if SHARED=0, but it is highly recommended to not do
# it if SHARED=1 unless you know what you are doing. [dynamic,static]
RUNTIME_LIBS = dynamic
}}}

The options '''*_USE_STATIC_RUNTIME''' in wxArt2D cmake scripts, do set the compiler flags down here.
You can do it yourself if you prefer.
CMake scripts does 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_}}}.
Line 156: Line 189:
Line 160: Line 194:
Line 163: Line 198:

Remember, these {{{/MTd, /MT, /MDd, /MD}}} flags must be the same throghout wxWidgets, wxArt2D and the rest of your application.
Remember, these {{{/MTd, /MT, /MDd, /MD}}} flags must be the same throughout wxWidgets, wxArt2D and the rest of your application.
Line 167: Line 201:
Line 170: Line 203:
In case you get something like  In case you get something like
Line 175: Line 209:
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).
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).
Line 181: Line 213:
Line 183: Line 214:
Line 188: Line 218:
If not available on your system, the code of freetype is available in the wxArt2D/thirdparty/freetype. And it will be included as a target in your project/makefile automatically.
The option WXART2D_USE_FREETYPE_INTERNAL is set ON by default on windows, since this makes things easy.
Especially when building various wxArt2D flavors (debug, release, shared etc. ), the freetype compiled right in is always oke.


On Unix/Linux, freetype is installed with package: freetype-devel (e.g. on Fedora: yum install freetype-devel ).
On windows you can use the following:
* Get the library + headers from: http://gnuwin32.sourceforge.net/packages/freetype.htm
* tested with the download called: "Complete package, except sources"
* This will add a key to your registry, which is searched for by Cmake, if not oke, use next step.
* Do set FREETYPE_DIR in your environment to the location where you installed the above.
If not available on your system, the code of freetype is available in the wxArt2D/thirdparty/freetype.
You need to compile it yourself, on windows this is the thing to do.

On Unix/Linux, freetype is installed with package: freetype-devel (e.g. on Fedora: yum install freetype-devel ). On windows best use '''the thirdparty/freetype''', compile it, and use it. This comes straight away from the freetype website.
But you can also use the following: * Get the library + headers from: http://gnuwin32.sourceforge.net/packages/freetype.htm * tested with the download called: "Complete package, except sources"  * This will add a key to your registry, which is searched for by Cmake, if not oke, use next step. * Do set FREETYPE_DIR in your environment to the location where you installed the above.
Line 200: Line 225:
Line 203: Line 227:
Agg is a vector drawing library, with sub pixel drawing and alpa blending and what not.
The <<Dox{a2dAggDrawer)>> uses Agg internal to do more advanced drawing compared to wxDC drawing.

If not available on your system, Agg is available in wxArt2D/thirdparty/agg2, and it will be included as a target in your project/makefile automatically. Also headers will be installed along with wxArtd2D its headers.
So this is the easy way, but feel free to get Agg and compile and install it. 

Get it from here:<<BR>>
http://sourceforge.net/projects/agg

Using SVN that is:<<BR>>
svn co https://agg.svn.sourceforge.net/svnroot/agg agg 

You will find out that it is using Cmake, and its cmake_install.html explains how to compile and install it.
It is more or less the same approach as wxArt2d, since i wrote the cmake stuff for it ;-)
Agg is a vector drawing library, with sub pixel drawing and alpa blending and what not. The <<Dox(a2dAggDrawer)>> uses Agg internal to do more advanced drawing compared to wxDC drawing.

If not available on your system, Agg is available in wxArt2D/thirdparty/agg-2.4.
It is setup as a CMake package. You can configure it using CMake. But using the configure script
it will be included as a package to configure. Also headers will be installed along with wxArtd2D its headers. So this is the easy way, but feel free to get Agg and compile and install it.

Get it from here:<<BR>> http://sourceforge.net/projects/agg

Using SVN that is:<<BR>> svn co https://agg.svn.sourceforge.net/svnroot/agg agg

You will find out that it is using Cmake, and its cmake_install.html explains how to compile and install it. It is more or less the same approach as wxArt2d, since i wrote the cmake stuff for it ;-)
Line 220: Line 240:
Some modules are default not compiled, since they depend on third party libraries. One of them is wxLua to be used as scripting language.
As scripting language within wxArt2D, wxLua is currently available. wxLua itself needs wxStEdit, so you need to get wxLua and wxStEdit compiled for your system.
On windows make sure you have the following 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.
Some modules are default not compiled, since they depend on third party libraries. One of them is wxLua to be used as scripting language. As scripting language within wxArt2D, wxLua is currently available. wxLua itself needs wxStEdit, so you need to get wxLua and wxStEdit compiled for your system. On windows make sure you have the following 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.
Line 225: Line 243:
Line 228: Line 247:
SET WXWIN=c:\soft\wxWidgest-2.8.8 SET WXWIN=c:\soft\wxWidgest-2.8.10
Line 231: Line 250:
{{{
echo %WXLUA% 
echo %WXSTEDIT% 

{{{
echo %WXLUA%
echo %WXSTEDIT%
Line 236: Line 256:
cd %WXSTEDIT%\build  cd %WXSTEDIT%\build
Line 242: Line 262:
cd %WXLUA%\build  cd %WXLUA%\build
Line 248: Line 268:
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.
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.
Line 257: Line 275:
Line 260: Line 279:
export WXWIN=/home/myhome/art2d/wxWidgest-2.8.8 export WXWIN=/home/myhome/art2d/wxWidgest-2.8.10
Line 263: Line 282:
Line 266: Line 286:
make install 
}}}
make install
}}}
Line 270: Line 289:
{{{
export WXART2D=/home/myhome/art2d/wxArt2D

{{{
export WXART2D=/home/myhome/trunk/wxArt2D
Line 276: Line 296:
ccmake ../wxArt2D
make
}}}
../trunk/wxArt2D/configure -g -v
}}}

Or do the configure and make steps by hand, is explained before.
Line 281: Line 302:
= Install =
After building there is als install. On Unix this is just ''make install''. Files will be installed to CMAKE_INSTALL_PREFIX, which default to /usr/local. But you can set this cmake variable yourself in the cmake-gui interface. wxArt2D is using the (relative CMAKE_INSTALL_PREFIX ) directores ''bin, lib, include/wxart2d, share/wxart2d'' to install too. The ''bin '' is used to place the ''wxart2dconfig.exe'', it is meant for non Cmake situation to get information on libraries and includes paths etc. Use ''wxart2dconfig.exe --help'' The recomended way is the CMake way. Therefore you find in share/wxart2d the following files:

 * wxArt2DConfig.cmake
 * FindwxArt2D.cmake
 * UsewxArt2D.cmake

You need to use FIND_PACKAGE( wxArt2D ) in your own CMakeLists.txt files, and it will search FindwxArt2D.cmake. Which on its turn searches wxAr2tDConfig.cmake.

For details see [[MyOwnApp|How do I setup my own application]].
Line 282: Line 314:

Cmake offers ways to generate installation packages. For windows the http://nsis.sourceforge.net is used for a full automatix installer executable. But also a zip file is generated.
The first adds a register key like this: <<BR>>
[HKEY_LOCAL_MACHINE\SOFTWARE\wxArt2D\wxart2d 1.0.1]<<BR>>
This KEY is used to detect wxArt2D in FindwxArt2D.cmake, if you use the zip file, you will need to set WXART2D_DIR in your environment to reach the same.

The option to generate package scripts is: WXART2D-USE_PACK. <<BR>>
Calling the Cmake tool:<<BR>>
'''cpack.exe -C debug''' or '''cpack.exe -C release''' <<BR>>
on the command line, will result in files like:

 * wxart2d-1.0.1-win32.exe # this is the installers script for wxArt2D on windows.
 * wxart2d-1.0.1-win32.zip # contains the same, and can be installed by hand

On unix you type:
 * cpack -C debug on the command line, and this gives you files like:

  
* wxart2d-1.0.1-Linux.sh
  
* wxart2d-1.0.1-Linux.tar.gz
  
* wxart2d-1.0.1-Linux.tar.Z
   * wxart2
d-1.0.1-Linux.tar.bz2

For generating the packages you will need to install the next two program:
Cmake offers ways to generate installation packages. For windows the http://nsis.sourceforge.net is used for a full automatix installer executable. But also a zip file is generated. The first adds a register key like this: <<BR>> [HKEY_LOCAL_MACHINE\SOFTWARE\wxArt2D\wxart2d 1.0.1]<<BR>> This KEY is used to detect wxArt2D in FindwxArt2D.cmake, if you use the zip file, you will need to set WXART2D_DIR in your environment to reach the same.

The wxArt2D CMake option to generate package scripts is: WXART2D-USE_PACK. <<BR>>  Calling the Cmake tool:<<BR>> '''cpack.exe -C debug''' or '''cpack.exe -C release''' <<BR>>  on the command line, will result in files like:

 * wxart2d-d-1.0.1-win32.exe # this is the installers script for wxArt2D on windows.
 * wxart2d-d-1.0.1-win32.zip # contains the same, and can be installed by hand
 * wxart2d-dev-d-1.0.1-win32.exe # this is the installers script for wxArt2D on windows.
 * wxart2d-dev-d-1.0.1-win32.zip # contains the same, and can be installed by hand

The command: '''cpack.exe -C debug''' is to be used in a debug builds, and search for debug libraries. The command: '''cpack.exe -C release''' is to be used in a release build, and search for release libraries.

The default configuration file for CPack is CPackConfig.cmake, with the next you can choose.

 * cpack -C debug --config CPackConfig.cmake
 * cpack -C debug --config CPackSourceConfig.cmake

This last one packs the wxArt2D source directory ( SVN checkout in general ), while the default takes all installed files, and packs those.

On unix you type on the command line:

{{{
cpack -C debug
}}}
And this gives you files like:

* wxart2d-dev-d-1.0.1-Linux.sh
* wxart2d-dev-d-1.0.1-Linux.tar.gz
* wxart2d-dev-d-1.0.1-Linux.tar.Z
* wxart2d-dev-d-1.0.1-Linux.tar.bz2

To get a rpm file you type:

{{{
cpack -G RPM
}}}
And if you want to know what in it, the next command gives a listing:

{{{
rpm -qlp wxart2d-gtk2-1.1.2.rpm
}}}

To get a deb file for Debian or Ubuntu ou type:

{{{
cpack -G DEB
}}}

And list what is in it like:

{{{
dpkg --contents wxdocview-gtk2ud-1.2.0.deb
}}}

And install and list what is installed:

{{{
sudo dpkg -i wxdocview-gtk2ud-1.2.0.deb
dpkg -L wxdocview
}}}

For generating the packages on windows you will need to install the next two program:
Line 307: Line 378:

Understanding how and where things are installed on Unix/Linux is here: http://www.gnu.org/prep/standards/standards.html#Directory-Variables

Specific Toolkits/OS

After reading all down here to get the general idea of what to do, you can go to the next topics to read more on your specific situation. Do not start there!

kdevelop4 Unix fashion

CodeBlocks with MinGW non unix fashion

With Mingw non Unix fashion

With Mingw/Msys Unix fashion

With Eclipse Unix and windows

Unbuntu install from the command line

OpenSuse install from the command line

Centos or Redhat install from the command line

Download and Installation of wxArt2D

General Approach

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

  • Download tools and sources
  • Configure and build wxWidgets
  • Build optional external dependencies wxLua wxStedit
  • Configure and build wxArt2D
    • Build optional dependencies ( kbool, Agg, Freetype )
    • Build wxdocview package
    • Build wxart2d package
  • At least on unix Install kbool, agg, wxdocview, wxart2d
  • Focus on your own application

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 working for Linux and Cygwin as well. See Working platform and tool sets for more.

Download Tools and Sources

To be built on different platforms, wxArt2D requires more than just its own sources.

  • Get wxWidgets, wxWidgets

    • Latest released version is 2.9.1 From here on, it is assumed you use version 2.8.10 or higher, not an older version. The development branch 2.9 is supported for the default settings. We are waiting for wxLua and wxStedit to be ready.
  • Get a SVN client, e.g. RapidSVN

  • Get CMake, version 2.8 or newer, CMake

    • wxArt2D uses CMake as its build system. It will generate makefiles & project-files using template files present in wxArt2d folders.

  • Get wxArt2D by SVN
    • Choose a home for your wxArt2D installation, on MSW e.g. D:\wxart2d
    • From console run  svn co https://svn.code.sf.net/p/wxart2d/code/trunk trunk 

    • Now you should have e.g. D:\wxart2d\trunk\wxArt2D.
    • No, there is no zip-file or msi-installer. Though wxart2d is well maintained, there are no releases, yet.
    • To get the latest wxArt2D sources, just re-run the svn command anytime.
  • Features not provided by wxWidgets, but required by wxArt2D are embedded in wxArt2d\thirdparty folder to make the compile process easier (however you can still configure wxArt2d so that they are not used).
    • Those dependencies are kbool and Agg. For windows Freetype is included in the thirdparty directory too. For scripting wxLua is the choice.

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 the contributed scintilla library from wxWidgets is needed. In wxWidgets 2.9 it is included in the standard compilation. For wxWidgets 2.8 you need to compile in the contrib directory the stc lib. Path to it looks like wxWidgets-2.8.x\contrib\build\stc, with "x" being your actual wxWidgets version. To use WXART2D_USE_GRAHICS_CONTEXT in wxArt2D on Windows, you must also set USE_GDIPLUS = 1 in %WXWIN%/build/msw/config.vc, in order to use GdiPlus based drawing. With nmake you can also specify this as extra parameter on the commandline. On unix there is a configure argument to do that.

  • For introduction and details on how to configure or build wxWidgets on your system, please refer to the extensive wxWidgets documentation (offline and online)
    • But use nmake from within a DOS box, to compile wxWidgets in order to have it generate build.cfg. Project files are not oke.

    • VC command line tools, requires running vcvars32.bat, which is found in Visual Studio intallation its: VC\bin directory. Or you start VC special its DOS BOX found in the menu's after installing VC. It is called something like: Visual Studio 200X Command Prompt. In newer version of VC there is vcvarsall.bat, which you can run in a DOS BOX.

Once you have the right DOS BOX, we are ready to compile.

  • For the debug version: nmake -f makefile.vc BUILD=debug

  • For the release version: nmake -f makefile.vc BUILD=release

  • On Unix debug version: ./configure --enable-debug --enable-debug-gdb --disable-shared

  • On Unix release version: ./configure --disable-shared

  • If you intend to use e.g. static CRT, unicode, or wxWidgets using STL, be prepared for additional, matching changes in wxArt2D and your application. In general wxArt2d will find the latest installed wxWidgets by default. But with CMake option you can choose a different one.
  • Build wxWidgets itself.
  • Build wxWidgets contributions ( wxWidgets < 2.9 ), stc (scintilla library) is required, wxStedit and wxLua are optional.

    • Configure and build them identically to wxWidgets itself (repeat the steps above).
    • stc (see above) is required for wxArt2D.
    • Optional is wxLua, which is used in some modules and samples of wxArt2D. So you can configure and compile wxArt2d without it. In case you have wxLua installed and compiled, wxArt2d's CMake configure script finds wxLua by setting the environment variable WXLUA on windows. When using wxLua, also wxStEdit is required, see wxCode project. WXSTEDIT should be set to its root, in order for CMake to find it.
    • For windows, Freetype you will find in the thirdparty directory, you need to compile it yourself.

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

wxArt2D is a combination of several packages.

  • Agg ( stored as thirdparty in wxArt2D repos, so no need to download), this is used for subpixel and composite/transparent drawing. Compilation is CMake based.
  • kbool ( stored as thirdparty in wxArt2D repos ) is used for boolean operation on polygons. Compilation is CMake based.
  • Freetype ( normally installed on Unix, for window the win32 package is stored as thirdparty in wxArt2D repos ) YOU are responsible for compiling it there inside the source tree. That is the place where it will be searched for by wxart2d.

  • wxdocview package ( document view framework ) and contains 3 submodules:
    • xmlparse
    • general
    • docview
  • wxart2d package ( drawing and editing library on top of the document view framework ) contains the following submodules:
    • genart
    • aggdrawer
    • artbase
    • keyio
    • gdsio
    • svgio
    • canvas
    • canextobj
    • editor
    • luawraps
    • curves

The above packages must be build separately and installed after all is build. The building process of wxArt2D relies on CMake to generate makefiles resp. project files. It is recommended to use the cmake-gui tool to set options, and to always do outside builds. That makes it easy to have more then one build (e.g combination of debug, release and static or shared ).

Configure by Hand

Do first read and apply the Configure Using CMake by Hand. It explains how to build by hand in the right order.

If you know how it should be done by hand, you can try to use the following scripts, to automate these steps. But in case of errors in the by hand situation, the scripts are useless.

On Linux the top configure script can be used to configure and compile all packages in the right order. For instance the wxart2d package checks for the other packages (wxdocview, Agg etc.), and if not compiled yet, this is a problem. Also the configure script makes sure all packages are build with the same settings. The configure script will do what can be done by hand. On windows there is a configure.lua. Look at the script or at least its -help option.

The configure script tries to configure and compile and install all packages in the right order, still it is a good idea to know what is going on behind it.

On Unix/Linux the magic line is something like: ../trunk/wxArt2D/configure -g -v -prefix /home/klaas/soft/usr/local

On Windows the magic line is something like: ..\trunk\wxArt2D\bin\lua ..\trunk\wxArt2D\configure.lua -g -v

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

Running the samples

When you finally managed to compile it, the samples are avaialble. But you need to set the following environment variable, in order to find cursor images and other resource relates stuff.

export WXART2D=/whateverYourPathIsToTheWxArt2DSources/wxArt2D/packages/wxart2d

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. The rest of the documentation is in this wiki.

For the doxygen documentation there is the option BUILD_DOCUMENTATION in cmake-gui.

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

The generated doxygen docs are linked to from within this wiki, like classes. So that makes it easier to read.

Doxygen Docs on This Site

Focus on your own Application

You might want to use CMake or DialogBlocks to automate make file and project file generation. For details see How do I setup my own application.

Common Issues

What is that? When you distribute your application, users can have problems that the application does not seem to do anything. Often that is because the vcruntime libraries are not installed. You can link those libraries in static.

See http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

In cmake-gui you will find the option to set the compiler flags for that package.

  • For wxdocview package set: wxDocview_USE_STATIC_RUNTIME

  • For wxart2d package set: WXART2D_USE_STATIC_RUNTIME

If you set it for one package, also so set it for the other, and be sure to compile wxWidgest static too.

In wx Widgets see build/msw/config.vc

# Should link against debug RTL (msvcrtd.dll) or release (msvcrt.dll)?
# Acts according to BUILD by default. [0,1,default]
DEBUG_RUNTIME_LIBS = default


# Version of C runtime library to use. You can change this to
# static if SHARED=0, but it is highly recommended to not do
# it if SHARED=1 unless you know what you are doing. [dynamic,static]
RUNTIME_LIBS = dynamic

The options *_USE_STATIC_RUNTIME in wxArt2D cmake scripts, do set the compiler flags down here. You can do it yourself if you prefer. CMake scripts does 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 throughout 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).


Dependencies

Freetype

Optional enabled with WXART2D_USE_FREETYPE.

Freetype is use to make text drawing based on truetype fonts possible. These fonts are vector based and can be scaled etc. as most canvas objects available in wxArt2D.

If not available on your system, the code of freetype is available in the wxArt2D/thirdparty/freetype. You need to compile it yourself, on windows this is the thing to do.

On Unix/Linux, freetype is installed with package: freetype-devel (e.g. on Fedora: yum install freetype-devel ). On windows best use the thirdparty/freetype, compile it, and use it. This comes straight away from the freetype website. But you can also use the following: * Get the library + headers from: http://gnuwin32.sourceforge.net/packages/freetype.htm * tested with the download called: "Complete package, except sources" * This will add a key to your registry, which is searched for by Cmake, if not oke, use next step. * Do set FREETYPE_DIR in your environment to the location where you installed the above.

Agg

Optional enabled with WXART2D_USE_AGGDRAWER.

Agg is a vector drawing library, with sub pixel drawing and alpa blending and what not. The a2dAggDrawer uses Agg internal to do more advanced drawing compared to wxDC drawing.

If not available on your system, Agg is available in wxArt2D/thirdparty/agg-2.4. It is setup as a CMake package. You can configure it using CMake. But using the configure script it will be included as a package to configure. Also headers will be installed along with wxArtd2D its headers. So this is the easy way, but feel free to get Agg and compile and install it.

Get it from here:
http://sourceforge.net/projects/agg

Using SVN that is:
svn co https://agg.svn.sourceforge.net/svnroot/agg agg

You will find out that it is using Cmake, and its cmake_install.html explains how to compile and install it. It is more or less the same approach as wxArt2d, since i wrote the cmake stuff for it ;-)

wxArt2D with wxLua and wxStEdit

Some modules are default not compiled, since they depend on third party libraries. One of them is wxLua to be used as scripting language. As scripting language within wxArt2D, wxLua is currently available. wxLua itself needs wxStEdit, so you need to get wxLua and wxStEdit compiled for your system. On windows make sure you have the following 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.10

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.10

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/trunk/wxArt2D
cd $WXART2D
cd ..
mkdir buildArt2dWithWxLua
cd buildArt2dWithWxLua
../trunk/wxArt2D/configure -g -v

Or do the configure and make steps by hand, is explained before.


Install

After building there is als install. On Unix this is just make install. Files will be installed to CMAKE_INSTALL_PREFIX, which default to /usr/local. But you can set this cmake variable yourself in the cmake-gui interface. wxArt2D is using the (relative CMAKE_INSTALL_PREFIX ) directores bin, lib, include/wxart2d, share/wxart2d to install too. The bin is used to place the wxart2dconfig.exe, it is meant for non Cmake situation to get information on libraries and includes paths etc. Use wxart2dconfig.exe --help The recomended way is the CMake way. Therefore you find in share/wxart2d the following files:

  • wxArt2DConfig.cmake
  • FindwxArt2D.cmake
  • UsewxArt2D.cmake

You need to use FIND_PACKAGE( wxArt2D ) in your own CMakeLists.txt files, and it will search FindwxArt2D.cmake. Which on its turn searches wxAr2tDConfig.cmake.

For details see How do I setup my own application.

Packaging

Cmake offers ways to generate installation packages. For windows the http://nsis.sourceforge.net is used for a full automatix installer executable. But also a zip file is generated. The first adds a register key like this:
[HKEY_LOCAL_MACHINE\SOFTWARE\wxArt2D\wxart2d 1.0.1]
This KEY is used to detect wxArt2D in FindwxArt2D.cmake, if you use the zip file, you will need to set WXART2D_DIR in your environment to reach the same.

The wxArt2D CMake option to generate package scripts is: WXART2D-USE_PACK.
Calling the Cmake tool:
cpack.exe -C debug or cpack.exe -C release
on the command line, will result in files like:

  • wxart2d-d-1.0.1-win32.exe # this is the installers script for wxArt2D on windows.
  • wxart2d-d-1.0.1-win32.zip # contains the same, and can be installed by hand
  • wxart2d-dev-d-1.0.1-win32.exe # this is the installers script for wxArt2D on windows.
  • wxart2d-dev-d-1.0.1-win32.zip # contains the same, and can be installed by hand

The command: cpack.exe -C debug is to be used in a debug builds, and search for debug libraries. The command: cpack.exe -C release is to be used in a release build, and search for release libraries.

The default configuration file for CPack is CPackConfig.cmake, with the next you can choose.

  • cpack -C debug --config CPackConfig.cmake
  • cpack -C debug --config CPackSourceConfig.cmake

This last one packs the wxArt2D source directory ( SVN checkout in general ), while the default takes all installed files, and packs those.

On unix you type on the command line:

cpack -C debug

And this gives you files like:

  • wxart2d-dev-d-1.0.1-Linux.sh
  • wxart2d-dev-d-1.0.1-Linux.tar.gz
  • wxart2d-dev-d-1.0.1-Linux.tar.Z
  • wxart2d-dev-d-1.0.1-Linux.tar.bz2

To get a rpm file you type:

cpack -G RPM

And if you want to know what in it, the next command gives a listing:

rpm -qlp wxart2d-gtk2-1.1.2.rpm

To get a deb file for Debian or Ubuntu ou type:

cpack -G DEB

And list what is in it like:

dpkg --contents  wxdocview-gtk2ud-1.2.0.deb

And install and list what is installed:

sudo dpkg -i  wxdocview-gtk2ud-1.2.0.deb
dpkg -L  wxdocview

For generating the packages on windows you will need to install the next two program:

Understanding how and where things are installed on Unix/Linux is here: http://www.gnu.org/prep/standards/standards.html#Directory-Variables

wxArt2D: WxArt2dInstall (last edited 2016-04-30 06:23:23 by ip5657d226)