[ wxwindows-Feature Requests-1629601 ] A better setup.h
SourceForge.net
noreply at sourceforge.net
Sat Jan 6 14:57:39 PST 2007
Feature Requests item #1629601, was opened at 2007-01-06 17:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=359863&aid=1629601&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Brian A. Vanderburg II (brianvanderburg)
Assigned to: Nobody/Anonymous (nobody)
Summary: A better setup.h
Initial Comment:
A better setup.h
----------------
This is just a suggestion that I think would help out
with 'setup.h'
The make process from the makefile should dynamically generate every time it is built a 'buildcfg.h' header file, which is included by 'setup.h'. This file should be placed in the same directory as setup.h is copied to.
'setup.h' is not overwritten if it already exists, but 'buildcfg.h' is. It just contains some information about the build, as described below. Since it can override some things in 'setup.h', and this may not be desired, some options in 'setup.h' control the override.
'buildcfg.h' contains two things: certain build configurations passed to make, and locations of internal library paths used by wxWidgets. It should be created before any compilation occurs.
Controlling buildcfg.h
----------------------
In order to control what can be done, options should appear at the bottom of 'setup.h', since it does not get rewritten each build.
#define wxOVERRIDE_USE_GUI 1
#define wxOVERRIDE_USE_GLCANVAS 1
#define wxREVEAL_LIB_HEADERS 1 // Reveal library headers used by wxWidgets
...
#include "buildcfg.h"
By default all of these should be 1
The purpose for overrides
-------------------------
In order to build wxWidgets with OpenGL support, three steps are needed:
1. 'nmake ... setup_h' to copy over the 'setup.h' file
2. Edit 'setup.h' and set wxUSE_GLCANVAS to 1
3. 'nmake ... USE_OPENGL=1' to build with OpenGL support
By dynamically generating 'buildcfg.h', only one step is needed:
1. 'nmake ... USE_OPENGL=1'
This will do the the following:
- Copy 'setup.h' to destination
- Dynamincally generate 'buildcfg.h'
- Compile files and do the rest
The 'buildcfg.h' would contain a part that looks like this:
#if wxOVERRIDE_USE_GLCANVAS
#define wxUSE_GLCANVAS 1
#endif
This makes it where only one step is needed, and the build configuration is automatically used by 'setup.h' without the need to edit 'setup.h' as long as the overrides are allowed
The purpose for internal library headers
----------------------------------------
I have posted one topic about this, but I think this method is better. I'll link in that topic to this.
There are times when I may need to access certain libraries that are used by wxWidgets, like libpng. Perhaps I want to do more detailed stuff, directly access the chunks of data, or whatever. I could copy the 'png.h' and other files to my project, but it would be better and easier to just directly access the files used by wxWidgets itself. This way, I'm always using the correct headers that are used with wxzlib.lib, wxpng.lib, etc.
The dynamically generated file would also include the paths, like this:
#if wxREVEAL_LIB_HEADERS
#define wxHEADER_ZLIB "path/to/zlib.h"
#define wxHEADER_PNG "path/to/png.h"
...
#endif
The path should be relative if possible. On Windows, something like
#define wxHEADER_ZLIB "wx/../../src/zlib/zlib.h"
By using "wx/../../src/zlib/zlib.h" instead of "../src/zlib/zlib.h", it is made certain that the wx header is being used an not some other header possibly
from another include path.
On Linux, if wxWidgets is using the libraries that comes with it, it would need to copy the headers to some destination when the library is installed. Perhaps to "wx/internals/" It may look something like this:
#define wxHEADER_ZLIB "wx/internals/zlib.h"
On the other hand, if the system libary is used, it may just look like:
#define wxHEADER_ZLIB "zlib.h"
This way, a source file that wants to direcly access the library can use the same header as used by wxWidgets since it is linking against wxlib.lib:
#include "wx/defs.h" // to get definitions
#include wxHEADER_ZLIB
...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=359863&aid=1629601&group_id=9863
More information about the wx-dev
mailing list