Linux, Unix, and Mac OS XGCC

team bbl


GCC is the de facto standard compiler on Linux and many Unix platforms, including Darwin, the BSD foundation for Mac OS X. Building wxWidgets with GCC simply requires following the typical configure and make routine common on Unix and Unix-like environments.

It is recommended that you create a subdirectory within the wxWidgets directory for each different configuration that you want to build. Most developers create directories using the same naming conventions as wxWidgets; if you want to compile the library in Unicode debug mode, you might create a directory named buildud, build26ud, or even buildGTK26ud depending on how many different configurations you want to have.

After you have created your build directory, change into the build directory. The configure script, now located one directory up, takes many different parameters, the most important ones being those that control the main build options. For example, you could run

 ../configure --enable-unicode --disable-debug --disable-shared \     --disable-monolithic 

(The backslash is only there to denote that the command should be typed all on one line.)

The configure script will analyze the build environment and then generate the makefiles for use with GCC. When configure has finished, it will display a summary of the library build configuration. The previous configure options would produce the following summary on Linux:

 Configured wxWidgets 2.6.0 for `i686-pc-linux-gnu'   Which GUI toolkit should wxWidgets use?                GTK+ 2   Should wxWidgets be compiled into single library?      no   Should wxWidgets be compiled in debug mode?            no   Should wxWidgets be linked as a shared library?        no   Should wxWidgets be compiled in Unicode mode?          yes   What level of wxWidgets compatibility should be enabled?                                        wxWidgets 2.2      no                                        wxWidgets 2.4      yes   Which libraries should wxWidgets use?                                        jpeg               sys                                        png                sys                                        regex              builtin                                        tiff               sys                                        zlib               sys                                        odbc               no                                        expat              sys                                        libmspack          no                                        sdl                no 

Many other individual features can be enabled or disabled using the configure script, a list of which can be found in the wxWidgets documentation or by passing --help to the configure script. Most significantly, you can also choose to override the default GUI toolkit (GTK+ 2) with GTK+, Motif, or X11.

After configure has generated the makefiles, build the library by running make in the same directory as you ran configure. The compiled library files are placed in the lib subdirectory of the directory used for the build, not the lib directory at the root of the wxWidgets tree. You may optionally use make install as root after the make has completed to copy the library and the necessary headers into /usr/local so that all users may have access to compile, build, and run wxWidgets programs.

Compiling a wxWidgets Sample Program

The configure script creates a samples directory in your build directory, with further subdirectories for each sample. If you change into one of the sample program directories, you will see a makefile, which has been generated for your build directory and build configuration. Run make to build the sample. For example:

 cd ~/wx/buildGTK26ud/samples/minimal make ./minimal 

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net