wx-config windows port
wx-config-win is a tiny implementation of wx-config for Windows compilers.
Home | Issue tracker | Source | Download
What is wx-config?
wx-config is a helper tool used when compiling applications that makes use of the wxWidgets library.
It helps you insert the correct compiler options on the command line so an application can use
g++ -o test.exe test.cpp `wx-config --libs --cflags` for instance, rather than hard-coding
values on where to find wxWidgets and it's configurations (monolithic, debug, unicode, wxuniversal, etc).
Note that backticks is a property of the shell or the build system used.
Fortunately the Code::Blocks IDE supports backticks natively on windows.
For other Windows IDEs and build systems there are workarounds, commonly using response files.
Purpose
The purpose of this wx-config port is to make everything more easy in these situations:
- When compiling wxWidgets apps between Linux and Windows (the Code::Blocks projects are almost the same between Linux and Windows, so it's less maintenance).
- When compiling wxWidgets apps in Windows but wanting to use any configuration and any compiler supported (in Code::Blocks only MinGW MONOLITHIC builds are supported by the wizard). This port gives support for MinGW, VC, and DMars, and for every possible wxWidgets configuration (NON-MONOLITHIC, DEBUG, UNICODE, UNIVERSAL, etc).
- Linux developers can feel at home.
- Hopefully everything will be easier in any case :)
Download
Download the wx-config port from here: http://wx-config-win.googlecode.com/svn/binary/wx-config.exe
Installation
The usage is as following:
- Copy wx-config.exe to anywhere in your path.
-
Set an environmental variable, called WXWIN. You can do so in two ways:
As a System setting
Go to Start menu->Control Panel->System->Advanced->Environment Variables and there click New, setting Variable name to WXWIN and Variable value to where you have wxWidgets installed (ie. C:\wxWidgets2.6.3).
As a Code::Blocks setting
Launch Code::Blocks. Go to Settings->Environment->Environment variables and there click Add, setting Key to WXWIN and Value to where you have wxWidgets installed (ie. C:\wxWidgets2.6.3).
- That's all.
Note:
- If you have only one configuration, it will be autodetected (including the compiler used).
- If you have more than one, you can use wx-config --wxcfg=gcc_dll\mswu for example, or set an env. var. like WXCFG=gcc_dll\mswu for choosing the configuration you want.
Sample Code::Blocks project
This is a wxWidgets sample project that compiles as-is, on GCC on Linux and Windows (if you're using other compiler you'll only have to select it from within C::B, without any further touching the project):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="5" />
<Project>
<Option title="wxSample" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="wxSample.exe" extension_auto="1" />
<Option type="0" />
<Option compiler="gcc" />
</Target>
</Build>
<Compiler>
<Add option="`wx-config --cflags`" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP" />
<Option target="default" />
</Unit>
</Project>
</CodeBlocks_project_file>
Command line options
Usage: wx-config [options]
--prefix[=DIR]
Path of the wxWidgets installation (ie. C:\wxWidgets2.6.3).
--wxcfg[=DIR] (not present in original wx-config)
Relative path of the build.cfg file (ie. gcc_dll\mswud).
--cflags
Outputs all pre-processor and compiler flags.
--cxxflags
Same as --cflags but for C++.
--rcflags
Outputs all resource compiler flags. [UNTESTED]
--libs
Outputs all linker flags.
--debug[=yes|no]
Uses a debug configuration if found.
--unicode[=yes|no]
Uses an unicode configuration if found.
--static[=yes|no]
Uses a static configuration if found.
--universal[=yes|no]
Uses an universal configuration if found.
--compiler[=gcc,dmc,vc] (not present in original wx-config)
Selects the compiler.
--release
Outputs the wxWidgets release number.
--cc
Outputs the name of the C compiler.
--cxx
Outputs the name of the C++ compiler.
--ld
Outputs the linker command.
-v (not present in original wx-config)
Outputs the revision of wx-config.