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.
|
|
|
|
|
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
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
### From the IDE
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
Ready to use project files are provided for VC++ versions 8, 9,
|
2021-08-25 18:02:51 -04:00
|
|
|
10, 11, 12, 14, 15, 16 and 17 (also known as MSVS 2005, 2008, 2010, 2012,
|
|
|
|
2013, 2015, 2017, 2019 and 2022 respectively).
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
Simply open `wx_vcN.sln` (for N=8, 9, 10, 11, 12, 14, 15 or 16) file,
|
|
|
|
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.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
### From the command line
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
wxWidgets can also be built from the command line using the provided makefiles.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
This needs to be done from the "Visual Studio Command Prompt" window, which can
|
|
|
|
be opened using a shortcut installed to the "Start" menu or the "Start" screen
|
|
|
|
by MSVS installation.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-09-05 11:44:57 -04:00
|
|
|
In this window, change directory to `%%WXWIN%\build\msw` and type
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
> nmake /f makefile.vc
|
2020-07-13 12:28:53 -04:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
to build wxWidgets in the default debug configuration as a static library. You
|
|
|
|
can also do
|
2020-07-13 12:28:53 -04:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
> nmake /f makefile.vc BUILD=release
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
to build a release version or
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
> nmake /f makefile.vc BUILD=release SHARED=1 TARGET_CPU=X86
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
to build a 32 bit release DLL version from an x86 command prompt, or
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
> nmake /f makefile.vc BUILD=release SHARED=1 TARGET_CPU=X64
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:30:54 -04:00
|
|
|
to build a 64 bit release DLL version from an x64 command prompt.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:57:12 -04:00
|
|
|
See [Make Parameters](#msw_build_make_params) for more information about the
|
|
|
|
additional parameters that can be specified on the command line.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-09-05 11:44:57 -04:00
|
|
|
To verify your build, change the directory to `%%WXWIN%\samples\minimal` and
|
2021-07-13 08:30:54 -04:00
|
|
|
run the same nmake command (with the same parameters there), this should create
|
|
|
|
a working minimal wxWidgets sample.
|
|
|
|
|
|
|
|
If you need to rebuild, use "clean" target first or "nmake /a".
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2014-10-12 16:48:46 -04:00
|
|
|
|
2021-07-13 08:55:54 -04:00
|
|
|
### Using vcpkg
|
|
|
|
|
|
|
|
You can download and install wxWidgets using the [vcpkg](https://github.com/Microsoft/vcpkg)
|
|
|
|
dependency manager:
|
|
|
|
|
|
|
|
> git clone https://github.com/Microsoft/vcpkg.git
|
|
|
|
> cd vcpkg
|
|
|
|
> bootstrap-vcpkg.bat
|
|
|
|
> vcpkg integrate install
|
|
|
|
> vcpkg install wxwidgets
|
|
|
|
|
|
|
|
The wxWidgets port in vcpkg is kept up to date by Microsoft team members and community
|
|
|
|
contributors. If the version is out of date, please [create an issue or pull request]
|
|
|
|
(https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2019-06-24 12:28:25 -04:00
|
|
|
creating a `wx_local.props` file in the build\msw directory which is used, if it
|
2014-10-12 16:48:46 -04:00
|
|
|
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
|
2019-06-24 12:28:25 -04:00
|
|
|
make the file is to copy `wx_setup.props` to `wx_local.props` and then edit local.
|
2014-10-12 16:48:46 -04:00
|
|
|
|
|
|
|
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
|
2019-06-24 12:28:25 -04:00
|
|
|
`wx_vc12.sln` it will build using the "vc120" prefix for the build directories
|
2014-10-12 16:48:46 -04:00
|
|
|
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
|
2019-06-24 12:28:25 -04:00
|
|
|
`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
|
2014-10-12 16:48:46 -04:00
|
|
|
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:
|
|
|
|
|
2021-09-05 11:44:57 -04:00
|
|
|
1. Open the folder `%%WXWIN%\misc\msvc`
|
|
|
|
2. Open the folder `%%USERPROFILE%\My Documents\Visual Studio 2012\Visualizers`
|
2021-07-13 08:54:19 -04: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`
|
2016-02-04 11:18:30 -05:00
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
MinGW Compilation {#msw_build_mingw}
|
2005-11-02 21:25:01 -05:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
wxWidgets supports several different gcc-based toolchains under Windows,
|
|
|
|
including:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
- [MinGW-w64](http://mingw-w64.sourceforge.net/)
|
|
|
|
- [TDM-GCC](http://tdm-gcc.tdragon.net/)
|
|
|
|
- Classic [MinGW](http://www.mingw.org/)
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
Please retrieve and install the latest version of your preferred
|
|
|
|
tool chain by following the instructions provided by these packages.
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
Additionally note that MinGW-w64 can be used as a cross-compiler from Unix
|
|
|
|
systems, including [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
|
2013-11-12 13:06:37 -05:00
|
|
|
|
|
|
|
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
|
2021-07-13 08:58:24 -04:00
|
|
|
configure.
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2018-10-03 12:11:54 -04:00
|
|
|
### Using configure
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
This method works in exactly the same way as under Unix systems, and requires a
|
|
|
|
Unix-like environment to work, i.e. one of MSYS, [MSYS2](https://www.msys2.org/)
|
|
|
|
or [Cygwin](https://www.cygwin.com/), so the following steps should be done
|
|
|
|
from MSYS or Cygwin shell prompt:
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2021-08-21 10:39:46 -04:00
|
|
|
1. Create a build directory: it is strongly recommended to not
|
2019-06-24 12:19:23 -04:00
|
|
|
build the library in the directory containing the sources (`$WXWIN`)
|
2013-11-12 13:06:37 -05:00
|
|
|
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
|
|
|
|
2021-07-13 08:54:19 -04: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
|
|
|
|
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
### Using makefiles from Windows command line
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
The `makefile.gcc` makefiles are for compilation using MinGW using Windows
|
|
|
|
command interpreter (`cmd.exe`), they will *not* 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. The commands shown here must be
|
|
|
|
executed from a DOS command line window (cmd.exe, *not* Bash sh.exe).
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2021-09-05 11:44:57 -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
|
2021-07-13 08:57:12 -04:00
|
|
|
default static one, see [Make Parameters](#msw_build_make_params)
|
|
|
|
for more details.
|
2005-11-02 21:25:01 -05:00
|
|
|
|
2021-07-13 08:54:19 -04:00
|
|
|
NOTE: For parallel builds, i.e. using `-jN` make option, please run
|
2019-06-24 12:28:25 -04:00
|
|
|
`mingw32-make -jN ... setup_h` first and then rerun the full
|
|
|
|
make command without `setup_h` at the end to work around a bug
|
2017-05-06 18:16:55 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-09-13 05:29:46 -04:00
|
|
|
|
2021-07-13 08:57:12 -04:00
|
|
|
Make Parameters {#msw_build_make_params}
|
2005-04-17 06:34:19 -04:00
|
|
|
================================================================
|
1999-01-19 13:23:02 -05:00
|
|
|
|
2021-07-13 08:58:24 -04:00
|
|
|
NOTE: If you use configure to build the library with MinGW, the
|
2013-11-12 13:06:37 -05:00
|
|
|
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
|
2021-09-05 11:44:57 -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
|
2019-06-24 12:19:23 -04:00
|
|
|
`build\msw\config.$compiler` file where `$compiler` is the same extension
|
2013-11-12 13:06:37 -05:00
|
|
|
as the makefile you use has (see below). The latter is good for
|
|
|
|
setting options that never change in your development process (e.g.
|
2019-06-24 12:19:23 -04:00
|
|
|
`GCC_VERSION` or `VENDOR`). If you want to build several versions of
|
2013-11-12 13:06:37 -05:00
|
|
|
wxWidgets and use them side by side, the former method is better.
|
2019-06-24 12:19:23 -04:00
|
|
|
Settings in `config.*` files are shared by all makefiles (including the
|
|
|
|
samples), but if you pass the options as arguments, you must use the same
|
2013-11-12 13:06:37 -05:00
|
|
|
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
|
2019-06-24 12:19:23 -04:00
|
|
|
change the "BUILD" variable definition in `build\msw\config.$compiler`
|
2013-11-12 13:06:37 -05:00
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `BUILD=release`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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
|
2019-06-24 12:28:25 -04:00
|
|
|
information by default, see `DEBUG_FLAG` for more information about it.
|
2004-10-27 15:27:14 -04:00
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `SHARED=1`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `UNICODE=0`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `WXUNIV=1`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2015-10-30 22:06:09 -04:00
|
|
|
Build wxUniversal instead of native wxMSW
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `MONOLITHIC=1`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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.
|
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `USE_GUI=0`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2003-08-07 03:58:21 -04:00
|
|
|
Disable building GUI parts of the library, build only wxBase components used
|
2019-06-24 12:28:25 -04:00
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `USE_$LIBRARY=0`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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,
|
2019-06-24 12:28:25 -04:00
|
|
|
MEDIA, GL (the option name is `USE_OPENGL` for this one), PROPGRID,
|
2013-11-12 13:06:37 -05:00
|
|
|
QA, RIBBON, RICHTEXT, STC, WEBVIEW, XRC.
|
2004-09-20 15:30:20 -04:00
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `RUNTIME_LIBS=static`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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.
|
2020-10-13 12:49:53 -04:00
|
|
|
Visual C++'s msvcrt.dll).
|
2003-08-07 03:58:21 -04:00
|
|
|
Caution: Do not use static runtime libraries when building DLL (SHARED=1)!
|
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `DEBUG_FLAG=0`
|
|
|
|
* `DEBUG_FLAG=1`
|
|
|
|
* `DEBUG_FLAG=2`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2010-07-23 19:44:05 -04:00
|
|
|
Specifies the level of debug support in wxWidgets. Notice that
|
2019-06-24 12:28:25 -04:00
|
|
|
this is independent from both BUILD and `DEBUG_INFO` options. By default
|
2010-07-23 19:44:05 -04:00
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `DEBUG_INFO=0`
|
|
|
|
* `DEBUG_INFO=1`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `DEBUG_RUNTIME_LIBS=0`
|
|
|
|
* `DEBUG_RUNTIME_LIBS=1`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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.
|
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `TARGET_CPU=X64|ARM64|IA64`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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.
|
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `VENDOR=<your company name>`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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
|
2019-06-24 12:28:25 -04: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
|
2019-06-24 12:28:25 -04:00
|
|
|
`wxmsw311u_core_vc_mycorp.dll.`
|
2003-08-07 03:58:21 -04:00
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `CFG=<configuration name>`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
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,
|
2021-09-05 11:44:57 -04:00
|
|
|
e.g. you could change `wxUSE_STL` to 1 in `%%WXWIN%\include\wx\msw\setup.h` and
|
2019-06-24 12:28:25 -04: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
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
* `COMPILER_PREFIX=<string>`
|
2018-10-03 12:11:54 -04:00
|
|
|
|
2007-05-15 08:48:26 -04:00
|
|
|
If you build with multiple versions of the same compiler, you can put
|
2019-06-24 12:28:25 -04:00
|
|
|
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
|
2020-05-24 18:58:29 -04:00
|
|
|
`wxwidgets.props` property sheet to (all) your project(s) using wxWidgets
|
|
|
|
by using "View|Property Manager" menu item to open the property manager
|
|
|
|
window and then selecting "Add Existing Property Sheet..." from the context
|
|
|
|
menu in this window.
|
|
|
|
|
|
|
|
If you've created a new empty project (i.e. chose "Empty Project" in the
|
|
|
|
"Create a new project" window shown by MSVS rather than "Windows Desktop"),
|
|
|
|
you need to change "Linker|System|SubSystem" in the project properties to
|
|
|
|
"Windows", from the default "Console". You don't need to do anything else.
|
2018-11-08 20:00:16 -05:00
|
|
|
|
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
|
|
|
|
2019-06-24 12:19:23 -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
|
2019-06-24 12:19:23 -04:00
|
|
|
different ways, e.g. MSVC users should use `$``(WXWIN)` instead of just
|
2019-06-24 12:28:25 -04:00
|
|
|
`$WXWIN`). And we will use `<wx-lib-dir>` as a shortcut for the subdirectory of
|
2019-06-24 12:19:23 -04:00
|
|
|
`$WXWIN\lib` which is composed from several parts separated by underscore:
|
2018-07-29 16:39:12 -04:00
|
|
|
first, a compiler-specific prefix (e.g. "vc" for MSVC, "gcc" for g++ or the
|
2019-06-24 12:28:25 -04:00
|
|
|
value of `COMPILER_PREFIX` if you set it explicitly), then optional "x64" if
|
2018-07-29 16:39:12 -04:00
|
|
|
building in 64 bits and finally either "lib" or "dll" depending on whether
|
|
|
|
static or dynamic wx libraries are being used.
|
|
|
|
|
2019-06-24 12:28:25 -04:00
|
|
|
For example, WXWIN could be "c:\wxWidgets\3.4.5" and `<wx-lib-dir>` could be
|
|
|
|
`c:\wxWidgets\3.4.5\lib\vc_x64_lib` for 64-bit static libraries built with
|
2018-07-29 16:39:12 -04:00
|
|
|
MSVC.
|
|
|
|
|
|
|
|
Here is what you need to do:
|
2011-11-28 09:16:03 -05:00
|
|
|
|
2019-06-24 12:19:23 -04:00
|
|
|
* Add `$WXWIN\include` to the
|
2011-11-28 09:16:03 -05:00
|
|
|
- compiler
|
|
|
|
- resource compiler
|
|
|
|
include paths.
|
2019-06-24 12:19:23 -04:00
|
|
|
* If using MSVC, prepend `$WXWIN\include\msvc` to the include paths too.
|
2019-06-24 12:28:25 -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`.
|
2019-06-24 12:28:25 -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
|
2019-06-24 12:28:25 -04:00
|
|
|
relevant libraries from the directory above, e.g. `wxmsw31ud_core.lib
|
2017-11-23 12:15:04 -05:00
|
|
|
wxbase31ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib
|
2019-06-24 12:28:25 -04:00
|
|
|
wxexpatd.lib` for a debug build of an application using the core library only
|
2011-11-28 09:16:03 -05:00
|
|
|
(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
|
2019-06-24 12:19:23 -04:00
|
|
|
project file from `$WXWIN\samples\minimal` or some other sample and adapt it to
|
2018-07-29 16:39:12 -04:00
|
|
|
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}
|
|
|
|
===============================
|
2019-09-17 13:45:53 -04:00
|
|
|
Build instructions to less common library configurations using different UI
|
2020-06-28 09:26:36 -04:00
|
|
|
backends are available here.
|
2018-10-03 12:11:54 -04:00
|
|
|
|
|
|
|
@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"
|
2020-02-22 16:48:35 -05:00
|
|
|
|
|
|
|
@subpage plat_msw_msys2_qt "Building with Win32 MSys2 Qt backend"
|