segunda-feira, 9 de julho de 2007

Preparing wxWidgets workspace

After a good "first sight" impression about wxWidgets I decide to take a "deep look" into the product. With some hardware issues in the middle it took me about one week to get stable Linux distros running, but the integration of Windows and Linux development was easy. Windows was already set up so I used a Linux-only package [GTK] to build, with a structure analogous to Windows with debug and release under build/gtk (with sudo as needed):
mkdir /devel
cd /devel
tar -xof /download path/wxGTK-x.x.x.tar.gz
cd wxGTK-x.x.x/build
mkdir gtk
cd gtk
mkdir debug
cd debug
../../../configure --with-gtk --enable-debug
make (play some games)
cd ..
mkdir release
cd release
../../../configure --with-gtk [ --disable-shared ?]
make (to do, need to learn about the shared option)

Default configuration creates make files for wxWidgets samples. To make the "minimal sample" debug version:
cd /devel/wxGTK-x.x.x/build/gtk/debug/samples/minimal
make

Errors found [u] is Ubuntu, [p] is PCLinuxOS

C compiler cannot create executables [u]
Install build-essential package with Synaptic or apt-get

some error about compiler [p]
Install gcc-c++ package

The development files for GTK+ were not found [u] [p]
Install standard C and GTK libraries:
libstdc++6-devel, libgtk+2.0-0-devel [p]
libstdc++6-4.1-dev, libgtk2.0-dev [u]

other errors when making wxWidgets [u] [p]
After messing around with configurations and invalid makes you may need to "make clean" before "make" again

cannot find -lwx_gtk2d_core-x.x when making a sample [u] [p]
Did you make wxWidgets after configure?


Workspace options

Source share between Windows and Linux may not be an out of the box option: some Linux distros dont have NTFS write, and Windows dont have Ext3 access. On the Linux side install ntfs-3g, in STABLE status since February 2007 after twelve years of development; on the Windows side install Ext2 File System For Windows, it deals well with ext3 without journal imple­mentation (just as older Linux Kernels which do not know the Ext3 file system).

I've made exe files in the Ext3 partition (running Windows) and bin files in the NTFS partition (running Linux) without problems. The trick part was to pull the projects from wxWidgets folders, with all these includes and flags the safest way is to copy the project files and change paths with a text editor.

This is my workspace scheme:
project (folder)
common sources (h, cpp)
gtk (folder)
platform sources (xpm)
debug (folder)
Makefile
release (folder)
Makefile
msw (folder)
platform sources, project (ico, rc, dsw, dsp)
vc_mswud (make folder)
vc_mswu (make folder)

The "minimal" project can be transposed outside wx folders with Makefile copies from build/gtk/xxx/samples/minimal for Linux, and .dsw;.dsp copies from samples/minimal for Windows MSVS. Makefile and .dsw;.dsp need path changes, just a replacement for the first and find/replace for the last. There is a catch, however: resources are taken from the samples folder (minimal.rc is not used) and that needs special care.

On the Windows side I've make a share of the wxWidgets folder and use \\host\share as wx dir, this gives me greater flexibility. After tests with multiple configurations, in Windows and Linux, I've clean and compact the extracted "minimal" project as a start for wxWidgets projects. It is highly portable, I used it with two Windows installations with different drive letters and two Linux distros, in NTFS and Ext3, without changes. Now its time for my wxWidgets learning project.

Etiquetas:

0 Comentários:

Enviar um comentário

Subscrever Enviar feedback [Atom]

<< Página inicial