2018-10-03 12:11:54 -04:00
|
|
|
Installing wxWidgets for Windows {#plat_msw_install}
|
|
|
|
--------------------------------
|
1999-07-25 13:11:17 -04:00
|
|
|
|
2015-08-04 07:06:02 -04:00
|
|
|
This is wxWidgets for Microsoft Windows (XP, Vista, 7, 8, 10, etc)
|
|
|
|
including both 32 bit and 64 bit versions.
|
2002-08-20 10:11:55 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
[TOC]
|
1999-02-09 11:00:23 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Installation {#msw_install}
|
2011-11-28 09:16:03 -05:00
|
|
|
============
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2018-10-03 16:13:31 -04:00
|
|
|
If you are using one of the supported compilers, you can use
|
|
|
|
[pre-built binaries](@ref plat_msw_binaries).
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
In this case, just uncompress the binaries archive under any directory
|
2018-10-03 12:11:54 -04:00
|
|
|
and skip to [Building Applications Using wxWidgets](#msw_build_apps) part.
|
1999-02-09 11:00:23 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Otherwise, or if you want to build a configuration of the library
|
|
|
|
different from the default one, you need to build the library from
|
|
|
|
sources before using it.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
If you use CMake, please see @ref overview_cmake for
|
|
|
|
building wxWidgets using it.
|
2018-07-29 16:39:12 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
The first step, which you may have already performed, unless you are
|
|
|
|
reading this file online, is to download the source archive and
|
|
|
|
uncompress it in any directory. It is strongly advised to avoid using
|
|
|
|
spaces in the name of this directory, i.e. notably do *not* choose a
|
|
|
|
location under "C:\Program Files", as this risks creating problems
|
|
|
|
with makefiles and other command-line tools.
|
|
|
|
|
|
|
|
After choosing the directory location, please define WXWIN environment
|
|
|
|
variable containing the full path to this directory. While this is not
|
|
|
|
actually required, this makes using the library more convenient and
|
|
|
|
this environment variable is used in the examples below.
|
|
|
|
|
|
|
|
NB: If you checked your sources from version control repository and
|
2018-10-03 12:11:54 -04:00
|
|
|
didn't obtain them from a release file, you also need to copy
|
|
|
|
`include/wx/msw/setup0.h` to `include/wx/msw/setup.h` and to remember
|
|
|
|
to update the latter whenever the former changes, otherwise you
|
|
|
|
will get compilation errors if any new symbols are added to
|
|
|
|
setup0.h file in the repository.
|
2014-10-12 16:48:46 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
If you have no intention of modifying setup.h, you may avoid this
|
|
|
|
problem by creating a symbolic link to setup0.h instead of making
|
|
|
|
a copy of it using mklink, from an admin command prompt:
|
2014-10-12 16:48:46 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
cd %WXWIN%\include\wx\msw\
|
|
|
|
mklink setup.h setup0.h
|
2014-10-12 16:48:46 -04:00
|
|
|
|
1999-02-09 11:00:23 -05:00
|
|
|
|
2011-11-28 09:16:03 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Building wxWidgets {#msw_build}
|
2011-11-28 09:16:03 -05:00
|
|
|
==================
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
The following sections explain how to compile wxWidgets with each supported
|
2011-11-28 09:16:03 -05:00
|
|
|
compiler, see the "Building Applications" section about the instructions for
|
|
|
|
building your application using wxWidgets.
|
|
|
|
|
2003-08-06 18:44:22 -04:00
|
|
|
All makefiles and project are located in build\msw directory.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Microsoft Visual C++ Compilation {#msw_build_msvs}
|
2005-04-17 06:34:19 -04:00
|
|
|
----------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
* From command line using the provided makefiles:
|
|
|
|
|
|
|
|
0. Open a "Visual Studio Command Prompt" window shortcut to which
|
|
|
|
must have been installed to the "Start" menu or the "Start" screen
|
|
|
|
by MSVS installation.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
1. Change directory to \%WXWIN\%\build\msw and type
|
2013-11-12 13:06:37 -05:00
|
|
|
|
|
|
|
> nmake /f makefile.vc
|
|
|
|
|
|
|
|
to build wxWidgets in the default debug configuration as a static
|
|
|
|
library. You can also do
|
|
|
|
|
|
|
|
> nmake /f makefile.vc BUILD=release
|
|
|
|
|
|
|
|
to build a release version or
|
|
|
|
|
|
|
|
> nmake /f makefile.vc BUILD=release SHARED=1
|
|
|
|
|
|
|
|
to build a release DLL version. Finally, you can also add
|
|
|
|
"TARGET_CPU=X64" to nmake command line to build Win64 versions
|
|
|
|
(this only works if you are using a 64 bit compiler, of course).
|
|
|
|
|
|
|
|
See "Configuring the Build" for more information about the
|
|
|
|
additional parameters that can be specified on the command line.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
2. To verify your build, change the directory to \%WXWIN\%\samples\minimal and
|
2013-11-12 13:06:37 -05:00
|
|
|
run the same nmake command (with the same parameters there), this
|
|
|
|
should create a working minimal wxWidgets sample.
|
|
|
|
|
|
|
|
3. If you need to rebuild, use "clean" target first or "nmake /a".
|
|
|
|
|
|
|
|
|
|
|
|
* From the IDE using the provided project files:
|
|
|
|
|
2014-05-15 18:32:17 -04:00
|
|
|
Ready to use project files are provided for VC++ versions 7, 8, 9,
|
2017-01-16 16:28:40 -05:00
|
|
|
10, 11, 12, 14 and 15 (also known as MSVS 2003, 2005, 2008, 2010, 2012, 2013,
|
|
|
|
2015 and 2017 respectively).
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2017-01-16 16:28:40 -05:00
|
|
|
Simply open wx_vcN.sln (for N=7, 8, 9, 10, 11, 12, 14, or 15) file,
|
2013-11-12 13:06:37 -05:00
|
|
|
select the appropriate configuration (Debug or Release, static or DLL)
|
|
|
|
and build the solution. Notice that when building a DLL configuration,
|
|
|
|
you may need to perform the build several times because the projects
|
|
|
|
are not always built in the correct order, and this may result in link
|
|
|
|
errors. Simply do the build again, up to 3 times, to fix this.
|
|
|
|
|
2014-10-12 16:48:46 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
### Special notes for Visual Studio 2010+
|
2014-10-12 16:48:46 -04:00
|
|
|
|
|
|
|
For Visual Studio 2010+ solutions it is possible to customize the build by
|
|
|
|
creating a wx_local.props file in the build\msw directory which is used, if it
|
|
|
|
exists, by the projects. The settings in that file override the default values
|
|
|
|
for the properties such as wxCfg (corresponding to the CFG makefile variable
|
|
|
|
described below) or wxVendor (corresponding to VENDOR). The typical way to
|
|
|
|
make the file is to copy wx_setup.props to wx_local.props and then edit local.
|
|
|
|
|
|
|
|
For example, if you are building wxWidgets libraries using multiple versions
|
|
|
|
of Visual Studio you could change wxCompilerPrefix to include the toolset:
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
- <wxCompilerPrefix>vc</wxCompilerPrefix>
|
|
|
|
+ <wxCompilerPrefix>vc$(PlatformToolsetVersion)</wxCompilerPrefix>
|
2014-10-12 16:48:46 -04:00
|
|
|
|
|
|
|
Following that example if you are using Visual Studio 2013 and open
|
|
|
|
wx_vc12.sln it will build using the "vc120" prefix for the build directories
|
|
|
|
so to allow its build files to coexist with the files produced by the other
|
|
|
|
MSVC versions.
|
|
|
|
|
|
|
|
Keep in mind that by using a separate local props file you ensure that your
|
|
|
|
changes won't be lost when updating to a future wxWidgets version. But if
|
|
|
|
wx_setup.props is updated in some later commit your wx_local.props is not
|
|
|
|
updated with it. For example the version information in wx_setup.props could
|
|
|
|
change and the information in your wx_local.props would be outdated. It is
|
|
|
|
your responsibility to monitor for such situations.
|
2014-02-22 14:45:49 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
### Improve debugging for Visual Studio 2012+
|
2016-02-04 11:18:30 -05:00
|
|
|
|
|
|
|
Debug visualizers for Visual Studio 2012+ are provided which makes inspecting
|
|
|
|
various wxWidgets classes easier to view while debugging. To use them:
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
1. Open the folder \%WXWIN\%\misc\msvc
|
|
|
|
2. Open the folder \%USERPROFILE\%\My Documents\Visual Studio 2012\Visualizers\
|
2016-02-04 11:18:30 -05:00
|
|
|
(or the corresponding location for newer versions, e.g. ...2013\Visualizers)
|
|
|
|
3. Copy wxWidgets.natvis and autoexp.inc
|
|
|
|
4. For Visual Studio 2013+ additionally copy wxWidgets.2013.natvis
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Cygwin/MinGW Compilation {#msw_build_cygwin}
|
2005-11-02 21:25:01 -05:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
wxWidgets supports Cygwin, MinGW, MinGW-w64 and TDM-GCC tool chains under
|
|
|
|
Windows. They can be downloaded from:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
http://www.cygwin.com/
|
|
|
|
|
|
|
|
http://www.mingw.org/
|
|
|
|
|
|
|
|
http://mingw-w64.sourceforge.net/
|
|
|
|
|
|
|
|
http://tdm-gcc.tdragon.net/
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
respectively. Please retrieve and install the latest version of your preferred
|
|
|
|
tool chain by following the instructions provided by these packages. Notice
|
|
|
|
that Cygwin includes both native Cygwin compiler, which produces binaries that
|
|
|
|
require Cygwin during run-time, and MinGW[-w64] cross-compilers which can still
|
|
|
|
be used in Cygwin environment themselves but produce plain Windows binaries
|
|
|
|
without any special run-time requirements. You will probably want to use the
|
|
|
|
latter for developing your applications.
|
|
|
|
|
|
|
|
If using MinGW, you can download the add-on MSYS package to provide Unix-like
|
|
|
|
tools that you'll need to build wxWidgets using configure.
|
|
|
|
|
|
|
|
C++11 note: If you want to compile wxWidgets in C++11 mode, you currently have
|
|
|
|
to use -std=gnu++11 switch as -std=c++11 disables some extensions
|
|
|
|
that wxWidgets relies on. I.e. please use CXXFLAGS="-std=gnu++11".
|
|
|
|
|
|
|
|
All of these tool chains can be used either with Unix-like configure+make build
|
|
|
|
process (preferred) or with the provided makefile.gcc makefiles without using
|
|
|
|
configure:
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
### Using configure
|
2013-11-12 13:06:37 -05:00
|
|
|
|
|
|
|
This method works in exactly the same way as under Unix systems,
|
|
|
|
including OS X, and requires a Unix-like environment to work, i.e.
|
|
|
|
either MSYS or Cygwin.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
0. Open MSYS or Cygwin shell prompt.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
1. Create a build directory: it is is strongly recommended to not
|
|
|
|
build the library in the directory containing the sources ($WXWIN)
|
|
|
|
but to create a separate build directory instead. The build
|
|
|
|
directory can be placed anywhere (using the fastest available disk
|
|
|
|
may be a good idea), but in this example we create it as a
|
|
|
|
subdirectory of the source one:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
$ cd $WXWIN
|
|
|
|
$ mkdir build-debug
|
2018-01-30 12:03:36 -05:00
|
|
|
$ cd build-debug
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
2. Run configure passing it any of the options shown by "configure
|
|
|
|
--help". Notice that configure builds shared libraries by default,
|
|
|
|
use --disable-shared to build static ones. For example:
|
2005-11-09 09:17:31 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
$ ../configure --enable-debug
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
3. Build the library:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
$ make
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
4. Test the library build by building the minimal sample:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
$ cd samples/minimal
|
|
|
|
$ make
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
5. Optionally install the library in a global location
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
$ make install
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Notice that there is not much benefice to installing under Windows
|
|
|
|
so this step can usually be omitted.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
### Using plain makefiles:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
NOTE: The makefile.gcc makefiles are for compilation under MinGW using
|
|
|
|
Windows command interpreter (command.com/cmd.exe), they won't work
|
|
|
|
if you use Unix shell, as is the case with MSYS. Follow the instructions
|
|
|
|
for using configure above instead if you prefer to use Unix shell.
|
|
|
|
|
|
|
|
0. Open DOS command line window (cmd.exe, *not* Bash sh.exe).
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
1. Change directory to \%WXWIN\%\build\msw and type
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
> mingw32-make -f makefile.gcc
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
to build wxWidgets in the default debug configuration as a static
|
|
|
|
library. Add "BUILD=release" and/or "SHARED=1" to build the library
|
|
|
|
in release configuration and/or as a shared library instead of the
|
|
|
|
default static one.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2017-05-06 18:16:55 -04:00
|
|
|
NOTE: For parallel builds, i.e. using -jN make option, please run
|
|
|
|
"mingw32-make -jN ... setup_h" first and then rerun the full
|
|
|
|
make command without "setup_h" at the end to work around a bug
|
|
|
|
in the current makefiles.
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
2. To verify your build, change the directory to samples\minimal and
|
|
|
|
run the same mingw32-make command (with the same parameters there),
|
|
|
|
this should create a working minimal wxWidgets sample.
|
|
|
|
|
|
|
|
3. If you need to rebuild, use "clean" target first.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Borland C++ Compilation {#msw_build_borland}
|
2005-04-17 06:34:19 -04:00
|
|
|
----------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
WARNING: Borland instructions are out of date, please send us your
|
|
|
|
corrections if you are using it with wxWidgets 3.0.
|
|
|
|
|
2006-10-24 20:18:10 -04:00
|
|
|
The minimum version required is 5.5 (last version supported by BC++ 5.0 was
|
|
|
|
2.4.2), which can be downloaded for free from:
|
2006-11-27 10:01:24 -05:00
|
|
|
http://www.borland.com/products/downloads/download_cbuilder.html
|
|
|
|
|
2008-09-04 19:02:44 -04:00
|
|
|
We have found that the free Turbo Explorer and commercial BDS work fine; the
|
|
|
|
debugger is very good. To avoid linker errors you will need to add
|
2007-10-25 06:48:50 -04:00
|
|
|
-DSHARED=1 to the makefile line for the library
|
|
|
|
|
2006-11-27 10:01:24 -05:00
|
|
|
The version 5.6 included in Borland C++ Builder 2006 works as well after the
|
2018-10-03 12:11:54 -04:00
|
|
|
following small change: please remove the test for `__WINDOWS__` from line 88
|
2018-11-08 19:50:44 -05:00
|
|
|
of the file `BCCDIR\include\stl\_threads.h`.
|
2006-01-23 04:40:05 -05:00
|
|
|
|
|
|
|
Compiling using the makefiles:
|
1999-02-17 12:18:22 -05:00
|
|
|
|
2003-08-06 18:44:22 -04:00
|
|
|
1. Change directory to build\msw. Type 'make -f makefile.bcc' to
|
2004-05-04 04:27:20 -04:00
|
|
|
make the wxWidgets core library. Ignore the compiler warnings.
|
2003-08-26 04:28:41 -04:00
|
|
|
This produces a couple of libraries in the lib\bcc_lib directory.
|
2003-08-06 18:44:22 -04:00
|
|
|
|
|
|
|
2. Change directory to a sample or demo such as samples\minimal, and type
|
2008-09-04 19:02:44 -04:00
|
|
|
'make -f makefile.bcc'. This produces a windows exe file - by default
|
2003-08-26 04:28:41 -04:00
|
|
|
in the bcc_mswd subdirectory.
|
2003-08-06 18:44:22 -04:00
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
Note (1): the wxWidgets makefiles assume dword structure alignment. Please
|
1999-10-22 08:03:54 -04:00
|
|
|
make sure that your own project or makefile settings use the
|
|
|
|
same alignment, or you could experience mysterious crashes. To
|
2003-08-06 18:44:22 -04:00
|
|
|
change the alignment, change CPPFLAGS in build\msw\config.bcc.
|
1999-10-22 08:03:54 -04:00
|
|
|
|
2010-07-23 19:44:00 -04:00
|
|
|
Note (2): If you wish debug messages to be sent to the console in
|
2003-08-06 18:44:22 -04:00
|
|
|
debug mode, edit makefile.bcc and change /aa to /Tpe in link commands.
|
2000-03-19 09:47:13 -05:00
|
|
|
|
2007-04-26 10:03:29 -04:00
|
|
|
Using the Debugger and IDE in BDS or Turbo Explorer
|
|
|
|
---------------------------------------------------
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Doubleclick / open \%WXWIN\%\samples\minimal\borland.bdsproj. The current version
|
2007-04-26 10:03:29 -04:00
|
|
|
is to be used with a dynamic build of wxWidgets-made by running
|
|
|
|
make -f Makefile.bcc -DBUILD=debug -DSHARED=1
|
|
|
|
in wxWidgets\build\msw. You also need the wxWidgets\lib\bcc_dll
|
2007-10-25 06:48:50 -04:00
|
|
|
directory in your PATH. The debugger tracks your source and also
|
|
|
|
traces into the wxWidgets sources.
|
2007-04-26 10:03:29 -04:00
|
|
|
|
|
|
|
To use this to debug other samples, copy the borland_ide.cpp
|
2009-01-12 09:50:52 -05:00
|
|
|
and borland.bdsproj files, then replace all occurrences of
|
2007-04-26 10:03:29 -04:00
|
|
|
"minimal" with the name of the new project files
|
|
|
|
|
2008-09-04 19:02:44 -04:00
|
|
|
Compilation succeeds with CBuilderX personal edition and CBuilder6, but
|
2006-01-23 04:40:05 -05:00
|
|
|
you may have to copy make.exe from the 5.5 download to the new bin directory.
|
2007-04-26 10:03:29 -04:00
|
|
|
|
2008-09-04 19:02:44 -04:00
|
|
|
Compiling using the IDE files for Borland C++ 5.0 and using CBuilder IDE
|
|
|
|
(v1-v6): not supported
|
1999-02-17 12:18:22 -05:00
|
|
|
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
** REMEMBER **
|
2004-05-04 04:27:20 -04:00
|
|
|
In all of your wxWidgets applications, your source code should include
|
2000-07-15 15:51:35 -04:00
|
|
|
the following preprocessor directive:
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2003-01-22 12:31:04 -05:00
|
|
|
(check the samples -- e.g., \wx2\samples\minimal\minimal.cpp -- for
|
|
|
|
more details)
|
|
|
|
|
2003-11-30 15:46:20 -05:00
|
|
|
|
2002-09-13 05:29:46 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Configuring the Build {#msw_build_config}
|
2005-04-17 06:34:19 -04:00
|
|
|
================================================================
|
1999-01-19 13:23:02 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
NOTE: If you use configure to build the library with Cygwin/MinGW, the
|
|
|
|
contents of this section does not apply, just pass the arguments
|
|
|
|
to configure directly in this case.
|
2012-09-26 08:20:30 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Library configuration
|
2005-04-17 06:34:19 -04:00
|
|
|
----------------------------------------------------------------
|
1999-01-19 13:23:02 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
While it is never necessary to do it, you may want to change some of
|
2018-10-03 12:11:54 -04:00
|
|
|
the options in the \%WXWIN\%\\include\\wx\\msw\\setup.h file before building
|
2016-06-06 16:59:51 -04:00
|
|
|
wxWidgets. This file is heavily commented, please read it and enable or disable
|
2013-11-12 13:06:37 -05:00
|
|
|
the features you would like to compile wxWidgets with[out].
|
2003-01-22 12:31:04 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Notice that this file is later copied into a directory under lib for
|
|
|
|
each of the build configurations which allows to have different
|
|
|
|
build options for different configurations too if you edit any
|
|
|
|
configuration-specific file.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Makefile parameters
|
|
|
|
----------------------------------------------------------------
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
When building using makefiles, you can specify many build settings
|
|
|
|
(unlike when using the project files where you are limited to choosing
|
|
|
|
just the configuration and platform). This can be done either by
|
|
|
|
passing the values as arguments when invoking make or by editing
|
|
|
|
build\msw\config.$(compiler) file where $(compiler) is same extension
|
|
|
|
as the makefile you use has (see below). The latter is good for
|
|
|
|
setting options that never change in your development process (e.g.
|
|
|
|
GCC_VERSION or VENDOR). If you want to build several versions of
|
|
|
|
wxWidgets and use them side by side, the former method is better.
|
|
|
|
Settings in config.* files are shared by all makefiles (including the
|
|
|
|
samples), but if you pass the options as arguments, you must use same
|
|
|
|
arguments you used for the library when building samples!
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
For example, to build the library in release mode you can either
|
|
|
|
change the "BUILD" variable definition in build\msw\config.$(compiler)
|
|
|
|
or use
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
> nmake -f makefile.vc BUILD=debug
|
|
|
|
> mingw32-make -f makefile.gcc BUILD=debug
|
2005-10-18 14:54:13 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
depending on the compiler used.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
The full list of the build settings follows:
|
1998-11-29 16:20:12 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* BUILD=release
|
|
|
|
|
2010-07-23 19:44:05 -04:00
|
|
|
Builds release version of the library. It differs from default 'debug' in
|
|
|
|
lack of appended 'd' in name of library and uses the release CRT libraries
|
|
|
|
instead of debug ones. Notice that even release builds do include debug
|
|
|
|
information by default, see DEBUG_FLAG for more information about it.
|
2004-10-27 15:27:14 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* SHARED=1
|
|
|
|
|
2004-10-27 15:27:14 -04:00
|
|
|
Build shared libraries (DLLs). By default, DLLs are not built
|
|
|
|
(SHARED=0).
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* UNICODE=0
|
|
|
|
|
2012-09-26 08:20:30 -04:00
|
|
|
To completely disable Unicode support (default is UNICODE=1). It should not
|
2014-05-15 22:33:40 -04:00
|
|
|
be necessary to do this.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2012-09-26 08:20:30 -04:00
|
|
|
This option affect name of the library ('u' is appended in the default
|
2013-11-12 13:06:37 -05:00
|
|
|
Unicode build) and the directory where the library and setup.h are stored
|
2012-09-26 08:20:30 -04:00
|
|
|
(ditto).
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* WXUNIV=1
|
|
|
|
|
2015-10-30 22:06:09 -04:00
|
|
|
Build wxUniversal instead of native wxMSW
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* MONOLITHIC=1
|
|
|
|
|
2008-09-04 19:02:44 -04:00
|
|
|
Starting with version 2.5.1, wxWidgets has the ability to be built as
|
2003-08-07 03:58:21 -04:00
|
|
|
several smaller libraries instead of single big one as used to be the case
|
|
|
|
in 2.4 and older versions. This is called "multilib build" and is the
|
|
|
|
default behaviour of makefiles. You can still build single library
|
|
|
|
("monolithic build") by setting MONOLITHIC variable to 1.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* USE_GUI=0
|
|
|
|
|
2003-08-07 03:58:21 -04:00
|
|
|
Disable building GUI parts of the library, build only wxBase components used
|
|
|
|
by console applications. Note that if you leave USE_GUI=1 then both wxBase
|
2013-11-12 13:06:37 -05:00
|
|
|
and GUI libraries are built.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* USE_$(LIBRARY)=0
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Do not build the corresponding library (all libraries are built by
|
|
|
|
default). Library which can be disabled in this way are: AUI, HTML,
|
|
|
|
MEDIA, GL (the option name is USE_OPENGL for this one), PROPGRID,
|
|
|
|
QA, RIBBON, RICHTEXT, STC, WEBVIEW, XRC.
|
2004-09-20 15:30:20 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* RUNTIME_LIBS=static
|
|
|
|
|
2003-08-07 03:58:21 -04:00
|
|
|
Links static version of C and C++ runtime libraries into the executable, so
|
|
|
|
that the program does not depend on DLLs provided with the compiler (e.g.
|
|
|
|
Visual C++'s msvcrt.dll or Borland's cc3250mt.dll).
|
|
|
|
Caution: Do not use static runtime libraries when building DLL (SHARED=1)!
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* DEBUG_FLAG=0
|
|
|
|
* DEBUG_FLAG=1
|
|
|
|
* DEBUG_FLAG=2
|
|
|
|
|
2010-07-23 19:44:05 -04:00
|
|
|
Specifies the level of debug support in wxWidgets. Notice that
|
|
|
|
this is independent from both BUILD and DEBUG_INFO options. By default
|
|
|
|
always set to 1 meaning that debug support is enabled: asserts are compiled
|
|
|
|
into the code (they are inactive by default in release builds of the
|
|
|
|
application but can be enabled), wxLogDebug() and wxLogTrace() are available
|
2018-10-03 12:11:54 -04:00
|
|
|
and `__WXDEBUG__` is defined. Setting it to 0 completely disables all
|
2010-07-23 19:44:05 -04:00
|
|
|
debugging code in wxWidgets while setting it to 2 enables even the time
|
|
|
|
consuming assertions and checks which are deemed to be unsuitable for
|
|
|
|
production environment.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* DEBUG_INFO=0
|
|
|
|
* DEBUG_INFO=1
|
|
|
|
|
2010-07-23 19:44:05 -04:00
|
|
|
This option affects whether debugging information is generated. If
|
|
|
|
omitted or set to 'default' its value is determined the value of
|
|
|
|
the BUILD option.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* DEBUG_RUNTIME_LIBS=0
|
|
|
|
* DEBUG_RUNTIME_LIBS=1
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
(VC++ only.) If set to 1, msvcrtd.dll is used, if to 0, msvcrt.dll
|
|
|
|
is used. By default msvcrtd.dll is used only if the executable
|
|
|
|
contains debug info and msvcrt.dll if it doesn't. It is sometimes
|
|
|
|
desirable to build with debug info and still link against msvcrt.dll
|
|
|
|
(e.g. when you want to ship the app to customers and still have
|
|
|
|
usable .pdb files with debug information) and this setting makes it
|
|
|
|
possible.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* TARGET_CPU=X64|ARM64|IA64
|
|
|
|
|
2007-05-15 08:48:26 -04:00
|
|
|
(VC++ only.) Set this variable to build for x86_64 systems. If unset, x86
|
|
|
|
build is performed.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* VENDOR=\<your company name\>
|
|
|
|
|
2003-08-07 03:58:21 -04:00
|
|
|
Set this to a short string identifying your company if you are planning to
|
2004-05-04 04:27:20 -04:00
|
|
|
distribute wxWidgets DLLs with your application. Default value is 'custom'.
|
|
|
|
This string is included as part of DLL name. wxWidgets DLLs contain compiler
|
2003-08-07 03:58:21 -04:00
|
|
|
name, version information and vendor name in them. For example
|
2017-11-23 12:15:04 -05:00
|
|
|
wxmsw311u_core_vc_custom.dll is one of DLLs build using Visual C++ with
|
2003-08-07 03:58:21 -04:00
|
|
|
default settings. If you set VENDOR=mycorp, the name will change to
|
2017-11-23 12:15:04 -05:00
|
|
|
wxmsw311u_core_vc_mycorp.dll.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* CFG=\<configuration name\>
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
Sets configuration name so that you can have multiple wxWidgets builds with
|
2013-11-12 13:06:37 -05:00
|
|
|
different setup.h settings coexisting in same tree. The value of
|
|
|
|
this option is appended to the build directories names. This is
|
|
|
|
useful for building the library in some non-default configuration,
|
2018-10-03 12:11:54 -04:00
|
|
|
e.g. you could change wxUSE_STL to 1 in \%WXWIN\%\include\wx\msw\setup.h and
|
2013-11-12 13:06:37 -05:00
|
|
|
then build with "CFG=-stl". Alternatively, you could build with e.g.
|
|
|
|
"RUNTIME_LIBS=static CFG=-mt" when using MSVC.
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* COMPILER_PREFIX=\<string\>
|
|
|
|
|
2007-05-15 08:48:26 -04:00
|
|
|
If you build with multiple versions of the same compiler, you can put
|
|
|
|
their outputs into directories like "vc6_lib", "vc8_lib" etc. instead of
|
|
|
|
"vc_lib" by setting this variable to e.g. "vc6". This is merely a
|
2015-10-30 22:06:09 -04:00
|
|
|
convenience variable, you can achieve the same effect (but different
|
2009-01-12 09:50:52 -05:00
|
|
|
directory names) with the CFG option.
|
2007-05-15 08:48:26 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* CFLAGS
|
|
|
|
* CXXFLAGS
|
|
|
|
* CPPFLAGS
|
|
|
|
* LDFLAGS
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
Additional flags to be used with C compiler, C++ compiler, C
|
|
|
|
preprocessor (used for both C and C++ compilation) and linker,
|
|
|
|
respectively.
|
2007-05-15 08:48:26 -04:00
|
|
|
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2003-08-25 20:23:34 -04:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
Building Applications Using wxWidgets {#msw_build_apps}
|
2011-11-28 09:16:03 -05:00
|
|
|
=====================================
|
|
|
|
|
2018-11-08 20:00:16 -05:00
|
|
|
If you use MSVS 2010 or later IDE for building your project, simply add
|
|
|
|
`wxwidgets.props` property sheet to (all) your project(s) using wxWidgets.
|
|
|
|
You don't need to do anything else.
|
|
|
|
|
2018-07-29 16:39:12 -04:00
|
|
|
If you want to use CMake for building your project, please see
|
2018-10-03 12:11:54 -04:00
|
|
|
@ref overview_cmake.
|
2018-07-29 16:39:12 -04:00
|
|
|
|
|
|
|
Otherwise follow the instructions below for "manual" setup of your project.
|
2011-11-28 09:16:03 -05:00
|
|
|
|
2018-07-29 16:39:12 -04:00
|
|
|
We suppose that wxWidgets sources are under the directory $WXWIN (notice that
|
2014-08-10 12:11:54 -04:00
|
|
|
different tool chains refer to environment variables such as WXWIN in
|
2018-07-29 16:39:12 -04:00
|
|
|
different ways, e.g. MSVC users should use $(WXWIN) instead of just
|
2018-10-03 12:11:54 -04:00
|
|
|
$WXWIN). And we will use \<wx-lib-dir\> as a shortcut for the subdirectory of
|
2018-07-29 16:39:12 -04:00
|
|
|
$WXWIN\lib which is composed from several parts separated by underscore:
|
|
|
|
first, a compiler-specific prefix (e.g. "vc" for MSVC, "gcc" for g++ or the
|
|
|
|
value of COMPILER_PREFIX if you set it explicitly), then optional "x64" if
|
|
|
|
building in 64 bits and finally either "lib" or "dll" depending on whether
|
|
|
|
static or dynamic wx libraries are being used.
|
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
For example, WXWIN could be "c:\wxWidgets\3.4.5" and \<wx-lib-dir\> could be
|
2018-07-29 16:39:12 -04:00
|
|
|
"c:\wxWidgets\3.4.5\lib\vc_x64_lib" for 64-bit static libraries built with
|
|
|
|
MSVC.
|
|
|
|
|
|
|
|
Here is what you need to do:
|
2011-11-28 09:16:03 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
* Add $WXWIN\\include to the
|
2011-11-28 09:16:03 -05:00
|
|
|
- compiler
|
|
|
|
- resource compiler
|
|
|
|
include paths.
|
2018-07-29 16:39:12 -04:00
|
|
|
* If using MSVC, prepend $WXWIN\include\msvc to the include paths too.
|
2018-10-03 12:11:54 -04:00
|
|
|
Otherwise, append \<wx-lib-dir\>\mswu[d] to the include paths, where "d" should
|
2018-07-29 16:39:12 -04:00
|
|
|
be used for debug builds only.
|
2011-11-28 09:16:03 -05:00
|
|
|
* Define the following symbols for the preprocessor:
|
2018-10-03 12:11:54 -04:00
|
|
|
- `__WXMSW__` to ensure you use the correct wxWidgets port.
|
2018-11-08 19:50:44 -05:00
|
|
|
- `_UNICODE` unless you want to use deprecated ANSI build of wxWidgets.
|
|
|
|
- `NDEBUG` if you want to build in release mode, i.e. disable asserts.
|
|
|
|
- `WXUSINGDLL` if you are using DLL build of wxWidgets.
|
2014-05-15 18:32:17 -04:00
|
|
|
* If using MSVC 7 only (i.e. not for later versions), also define
|
2018-11-08 19:50:44 -05:00
|
|
|
`wxUSE_RC_MANIFEST=1` and `WX_CPU_X86`.
|
2018-10-03 12:11:54 -04:00
|
|
|
* Add \<wx-lib-dir\> directory described above to the libraries path.
|
2018-07-29 16:39:12 -04:00
|
|
|
|
|
|
|
When using MSVC, the libraries are linked automatically using "#pragma
|
|
|
|
comment(lib)" feature of this compiler. With all the other compilers you also
|
|
|
|
need to:
|
|
|
|
|
2011-11-28 09:16:03 -05:00
|
|
|
* Add the list of libraries to link with to the linker input. The exact list
|
|
|
|
depends on which libraries you use and whether you built wxWidgets in
|
|
|
|
monolithic or default multlib mode and basically should include all the
|
2017-11-23 12:15:04 -05:00
|
|
|
relevant libraries from the directory above, e.g. "wxmsw31ud_core.lib
|
|
|
|
wxbase31ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib
|
2011-11-28 09:16:03 -05:00
|
|
|
wxexpatd.lib" for a debug build of an application using the core library only
|
|
|
|
(all wxWidgets applications use the base library).
|
|
|
|
|
|
|
|
|
2018-07-29 16:39:12 -04:00
|
|
|
Finally, please notice that the makefiles and project files provided with
|
|
|
|
wxWidgets samples show which flags should be used when building applications
|
|
|
|
using wxWidgets and always work, so in case of a problem, e.g. if the
|
|
|
|
instructions here are out of date, you can always simply copy a makefile or
|
|
|
|
project file from $WXWIN\samples\minimal or some other sample and adapt it to
|
|
|
|
your application.
|
2018-10-03 12:11:54 -04:00
|
|
|
|
|
|
|
If you are not using Visual Studio 2010 or newer please see
|
|
|
|
@subpage plat_msw_winxp "Windows XP Support" to enable visual styles in your
|
|
|
|
application.
|
|
|
|
|
|
|
|
Advanced Library Configurations {#msw_advanced}
|
|
|
|
===============================
|
|
|
|
Build instructions to less common library configuartions using different UI
|
|
|
|
backends are avaiable here.
|
|
|
|
|
|
|
|
@subpage plat_msw_msys2 "Building with Win32 MSys2 backend"
|
|
|
|
|
|
|
|
@subpage plat_msw_msys2_gtk "Building with Win32 MSys2 GDK backend"
|
|
|
|
|
|
|
|
@subpage plat_msw_gtk "Building wxGTK port with Win32 GDK backend"
|