Setup.H

From WxWiki

Jump to: navigation, search

In wxWidgets, setup.h refers to the header file which defines all of the configurable settings that will be, or were already used to build wxWidgets.

Contents

[edit] Usage

[edit] setup.h and building wxWidgets

Sometimes, you might wish to edit setup.h before building the wxWidgets library. This is done in order to enable or disable certain features (or classes); these features, classes and their dependencies are well documented in the setup.h file itself. For example, you might wish to build the library with wxUSE_EXTENDED_RTTI (to ebable XTI), but without wxUSE_TIMER (since your application is not making use of it).

If you do want to or need to edit the settings in setup.h, you will need to download wxWidgets from the official website, and build it by hand.

The master setup.h 
There is one master setup.h which is located in "include/wx/<your build platform>" (this is the file you might want to edit before building wxWidgets).
Post-build configuration setup.h files 
When you build your project, this setup file is copied into a directory which is unique to your build configuration (for example "wxWidgets Debug" builds on MSW will copy the file to "lib\mswd\wx\setup.h"). When you make any changes to your master setup.h, the next build will copy it over your current per-configuration setup.h automatically.

[edit] Pre-built packages

If you are building your application against a pre-built package of wxWidgets such as the ones that come with Ubuntu, or Mac OS X, they have already picked appropriate settings for that platform, and you will not be able to change these settings. However, most distributions should already come with multiple builds of wxWidgets under different configurations, most commonly, debug and release as well as unicode and ascii configurations. These alternate configurations can be selected by using the appropriate options for wx-config. If you are having trouble locating the include directory for the setup.h header used to build that package, you can simply run "wx-config --cppflags" (adding any additional configuration options as well). Many linux distributions and Mac OS X install this file in different locations, but wx-config will always know where to find it.

[edit] FAQ

[edit] Why is it setup this way?

It's really very simple however. You have one master setup.h in wx/msw which is copied to the configuration-dependent directory by the build process initially. This allows you to have different setup.h's for different configurations.

Now if you ask me if it was a good idea to do it like this, I can definitely answer "no" by now. No other issue has resulted in such tremendous amount of confusion as this and I'm sure no amount of docs are going to solve it (although they will definitely help). At the time it looked like a good idea to mirror the Unix build process but it turned out to be a very bad one.

But if you ask me if we're going to revert this back to a single setup.h again I'm going to answer "no" as well because, as usual, this will double the amount of confusion instead of solving the problem. So by now we can only try to explain to people (those who want to listen, anyhow) how the current system works.

[edit] Do I have to change all 8 setup.h files?

No, you only need to change include/wx/<your build platform>/setup.h.

[edit] Can I just change one and copy it over the other 7?

You can but shouldn't, there is no need for this.

[edit] Why do I need a different setup.h for each build configuration? Shouldn't they all be the same anyway?

Sometimes it is convenient to have them different. For example you may want to enable ODBC for ANSI build but not for Unicode (as it doesn't work with Unicode). To do this, edit the master file first, then modify the ones which you want to differ from it.

Personal tools