Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.40 KB | None | 0 0
  1. Installing wxWidgets for Windows
  2. --------------------------------
  3.  
  4. This is wxWidgets for Microsoft Windows 9x/ME, Windows NT
  5. and later (2000, XP, Vista, 7, 8, etc) including both 32 bit and 64
  6. bit versions.
  7.  
  8.  
  9. Table of Contents:
  10. - Installation
  11. - Building wxWidgets
  12. - Configuring the Build
  13. - Building Applications Using wxWidgets
  14.  
  15.  
  16. Installation
  17. ============
  18.  
  19. If you are using one of the supported compilers, you can download the
  20. pre-built in binaries from
  21.  
  22. https://sourceforge.net/projects/wxwindows/files/3.0.0/binaries/
  23.  
  24. or
  25.  
  26. ftp://ftp.wxwidgets.org/pub/3.0.0/binaries/
  27.  
  28. In this case, just uncompress the binaries archive under any directory
  29. and skip to "Building Applications Using wxWidgets" part.
  30.  
  31. Otherwise, or if you want to build a configuration of the library
  32. different from the default one, you need to build the library from
  33. sources before using it.
  34.  
  35. The first step, which you may have already performed, unless you are
  36. reading this file online, is to download the source archive and
  37. uncompress it in any directory. It is strongly advised to avoid using
  38. spaces in the name of this directory, i.e. notably do *not* choose a
  39. location under "C:\Program Files", as this risks creating problems
  40. with makefiles and other command-line tools.
  41.  
  42. After choosing the directory location, please define WXWIN environment
  43. variable containing the full path to this directory. While this is not
  44. actually required, this makes using the library more convenient and
  45. this environment variable is used in the examples below.
  46.  
  47. NB: If you checked your sources from version control repository and
  48. didn't obtain them from a release file, you also need to copy
  49. include/wx/msw/setup0.h to include/wx/msw/setup.h.
  50.  
  51.  
  52. Building wxWidgets
  53. ==================
  54.  
  55. The following sections explain how to compile wxWidgets with each supported
  56. compiler, see the "Building Applications" section about the instructions for
  57. building your application using wxWidgets.
  58.  
  59. All makefiles and project are located in build\msw directory.
  60.  
  61. Microsoft Visual C++ Compilation
  62. ----------------------------------------------------------------
  63.  
  64. * From command line using the provided makefiles:
  65.  
  66. 0. Open a "Visual Studio Command Prompt" window shortcut to which
  67. must have been installed to the "Start" menu or the "Start" screen
  68. by MSVS installation.
  69.  
  70. 1. Change directory to %WXWIN%\build\msw and type
  71.  
  72. > nmake /f makefile.vc
  73.  
  74. to build wxWidgets in the default debug configuration as a static
  75. library. You can also do
  76.  
  77. > nmake /f makefile.vc BUILD=release
  78.  
  79. to build a release version or
  80.  
  81. > nmake /f makefile.vc BUILD=release SHARED=1
  82.  
  83. to build a release DLL version. Finally, you can also add
  84. "TARGET_CPU=X64" to nmake command line to build Win64 versions
  85. (this only works if you are using a 64 bit compiler, of course).
  86.  
  87. See "Configuring the Build" for more information about the
  88. additional parameters that can be specified on the command line.
  89.  
  90. 2. To verify your build, change the directory to samples\minimal and
  91. run the same nmake command (with the same parameters there), this
  92. should create a working minimal wxWidgets sample.
  93.  
  94. 3. If you need to rebuild, use "clean" target first or "nmake /a".
  95.  
  96.  
  97. * From the IDE using the provided project files:
  98.  
  99. Ready to use project files are provided for VC++ versions 6, 7, 8, 9
  100. and 10 (also known as MSVS 6, 2003, 2005, 2008 and 2010 respectively).
  101. For VC++ 11 (2012, respectively), you need to import the existing VC10
  102. project files into VC11 IDE first.
  103.  
  104. Simply open wx_vcN.sln (for N=7, 8, 9 or 10) or wx.dsw (for VC6) file,
  105. select the appropriate configuration (Debug or Release, static or DLL)
  106. and build the solution. Notice that when building a DLL configuration,
  107. you may need to perform the build several times because the projects
  108. are not always built in the correct order, and this may result in link
  109. errors. Simply do the build again, up to 3 times, to fix this.
  110.  
  111. Notice that x64 configurations are only included in VC10 project
  112. currently. If you want to build Win64 libraries with the previous
  113. compiler versions, the simplest solution is to use the makefiles as
  114. described above.
  115.  
  116.  
  117. Cygwin/MinGW Compilation
  118. ----------------------------------------------------------------
  119.  
  120. wxWidgets supports Cygwin, MinGW, MinGW-w64 and TDM-GCC tool chains under
  121. Windows. They can be downloaded from:
  122.  
  123. http://www.cygwin.com/
  124. http://www.mingw.org/
  125. http://mingw-w64.sourceforge.net/
  126. http://tdm-gcc.tdragon.net/
  127.  
  128. respectively. Please retrieve and install the latest version of your preferred
  129. tool chain by following the instructions provided by these packages. Notice
  130. that Cygwin includes both native Cygwin compiler, which produces binaries that
  131. require Cygwin during run-time, and MinGW[-w64] cross-compilers which can still
  132. be used in Cygwin environment themselves but produce plain Windows binaries
  133. without any special run-time requirements. You will probably want to use the
  134. latter for developing your applications.
  135.  
  136. If using MinGW, you can download the add-on MSYS package to provide Unix-like
  137. tools that you'll need to build wxWidgets using configure.
  138.  
  139. C++11 note: If you want to compile wxWidgets in C++11 mode, you currently have
  140. to use -std=gnu++11 switch as -std=c++11 disables some extensions
  141. that wxWidgets relies on. I.e. please use CXXFLAGS="-std=gnu++11".
  142.  
  143. All of these tool chains can be used either with Unix-like configure+make build
  144. process (preferred) or with the provided makefile.gcc makefiles without using
  145. configure:
  146.  
  147. * Using configure
  148.  
  149. This method works in exactly the same way as under Unix systems,
  150. including OS X, and requires a Unix-like environment to work, i.e.
  151. either MSYS or Cygwin.
  152.  
  153. 0. Open MSYS or Cygwin shell prompt.
  154.  
  155. 1. Create a build directory: it is is strongly recommended to not
  156. build the library in the directory containing the sources ($WXWIN)
  157. but to create a separate build directory instead. The build
  158. directory can be placed anywhere (using the fastest available disk
  159. may be a good idea), but in this example we create it as a
  160. subdirectory of the source one:
  161.  
  162. $ cd $WXWIN
  163. $ mkdir build-debug
  164.  
  165. 2. Run configure passing it any of the options shown by "configure
  166. --help". Notice that configure builds shared libraries by default,
  167. use --disable-shared to build static ones. For example:
  168.  
  169. $ ../configure --enable-debug
  170.  
  171. 3. Build the library:
  172.  
  173. $ make
  174.  
  175. 4. Test the library build by building the minimal sample:
  176.  
  177. $ cd samples/minimal
  178. $ make
  179.  
  180. 5. Optionally install the library in a global location
  181.  
  182. $ make install
  183.  
  184. Notice that there is not much benefice to installing under Windows
  185. so this step can usually be omitted.
  186.  
  187.  
  188. * Using plain makefiles:
  189.  
  190. NOTE: The makefile.gcc makefiles are for compilation under MinGW using
  191. Windows command interpreter (command.com/cmd.exe), they won't work
  192. if you use Unix shell, as is the case with MSYS. Follow the instructions
  193. for using configure above instead if you prefer to use Unix shell.
  194.  
  195. 0. Open DOS command line window (cmd.exe, *not* Bash sh.exe).
  196.  
  197. 1. Change directory to %WXWIN%\build\msw and type
  198.  
  199. > mingw32-make -f makefile.gcc
  200.  
  201. to build wxWidgets in the default debug configuration as a static
  202. library. Add "BUILD=release" and/or "SHARED=1" to build the library
  203. in release configuration and/or as a shared library instead of the
  204. default static one.
  205.  
  206. 2. To verify your build, change the directory to samples\minimal and
  207. run the same mingw32-make command (with the same parameters there),
  208. this should create a working minimal wxWidgets sample.
  209.  
  210. 3. If you need to rebuild, use "clean" target first.
  211.  
  212.  
  213.  
  214.  
  215. Borland C++ Compilation
  216. ----------------------------------------------------------------
  217.  
  218. WARNING: Borland instructions are out of date, please send us your
  219. corrections if you are using it with wxWidgets 3.0.
  220.  
  221. The minimum version required is 5.5 (last version supported by BC++ 5.0 was
  222. 2.4.2), which can be downloaded for free from:
  223. http://www.borland.com/products/downloads/download_cbuilder.html
  224.  
  225. We have found that the free Turbo Explorer and commercial BDS work fine; the
  226. debugger is very good. To avoid linker errors you will need to add
  227. -DSHARED=1 to the makefile line for the library
  228.  
  229. The version 5.6 included in Borland C++ Builder 2006 works as well after the
  230. following small change: please remove the test for __WINDOWS__ from line 88
  231. of the file BCCDIR\include\stl\_threads.h.
  232.  
  233. Compiling using the makefiles:
  234.  
  235. 1. Change directory to build\msw. Type 'make -f makefile.bcc' to
  236. make the wxWidgets core library. Ignore the compiler warnings.
  237. This produces a couple of libraries in the lib\bcc_lib directory.
  238.  
  239. 2. Change directory to a sample or demo such as samples\minimal, and type
  240. 'make -f makefile.bcc'. This produces a windows exe file - by default
  241. in the bcc_mswd subdirectory.
  242.  
  243. Note (1): the wxWidgets makefiles assume dword structure alignment. Please
  244. make sure that your own project or makefile settings use the
  245. same alignment, or you could experience mysterious crashes. To
  246. change the alignment, change CPPFLAGS in build\msw\config.bcc.
  247.  
  248. Note (2): If you wish debug messages to be sent to the console in
  249. debug mode, edit makefile.bcc and change /aa to /Tpe in link commands.
  250.  
  251. Using the Debugger and IDE in BDS or Turbo Explorer
  252. ---------------------------------------------------
  253.  
  254. Doubleclick / open samples\minimal\borland.bdsproj. The current version
  255. is to be used with a dynamic build of wxWidgets-made by running
  256. make -f Makefile.bcc -DBUILD=debug -DSHARED=1
  257. in wxWidgets\build\msw. You also need the wxWidgets\lib\bcc_dll
  258. directory in your PATH. The debugger tracks your source and also
  259. traces into the wxWidgets sources.
  260.  
  261. To use this to debug other samples, copy the borland_ide.cpp
  262. and borland.bdsproj files, then replace all occurrences of
  263. "minimal" with the name of the new project files
  264.  
  265. Compilation succeeds with CBuilderX personal edition and CBuilder6, but
  266. you may have to copy make.exe from the 5.5 download to the new bin directory.
  267.  
  268. Compiling using the IDE files for Borland C++ 5.0 and using CBuilder IDE
  269. (v1-v6): not supported
  270.  
  271.  
  272. ** REMEMBER **
  273. In all of your wxWidgets applications, your source code should include
  274. the following preprocessor directive:
  275.  
  276. #ifdef __BORLANDC__
  277. #pragma hdrstop
  278. #endif
  279.  
  280. (check the samples -- e.g., \wx2\samples\minimal\minimal.cpp -- for
  281. more details)
  282.  
  283.  
  284.  
  285. Configuring the Build
  286. ================================================================
  287.  
  288. NOTE: If you use configure to build the library with Cygwin/MinGW, the
  289. contents of this section does not apply, just pass the arguments
  290. to configure directly in this case.
  291.  
  292. Library configuration
  293. ----------------------------------------------------------------
  294.  
  295. While it is never necessary to do it, you may want to change some of
  296. the options in the include/wx/msw/setup.h file before building wxWidgets.
  297. This file is heavily commented, please read it and enable or disable
  298. the features you would like to compile wxWidgets with[out].
  299.  
  300. Notice that this file is later copied into a directory under lib for
  301. each of the build configurations which allows to have different
  302. build options for different configurations too if you edit any
  303. configuration-specific file.
  304.  
  305.  
  306. Makefile parameters
  307. ----------------------------------------------------------------
  308.  
  309. When building using makefiles, you can specify many build settings
  310. (unlike when using the project files where you are limited to choosing
  311. just the configuration and platform). This can be done either by
  312. passing the values as arguments when invoking make or by editing
  313. build\msw\config.$(compiler) file where $(compiler) is same extension
  314. as the makefile you use has (see below). The latter is good for
  315. setting options that never change in your development process (e.g.
  316. GCC_VERSION or VENDOR). If you want to build several versions of
  317. wxWidgets and use them side by side, the former method is better.
  318. Settings in config.* files are shared by all makefiles (including the
  319. samples), but if you pass the options as arguments, you must use same
  320. arguments you used for the library when building samples!
  321.  
  322. For example, to build the library in release mode you can either
  323. change the "BUILD" variable definition in build\msw\config.$(compiler)
  324. or use
  325.  
  326. > nmake -f makefile.vc BUILD=debug
  327. > mingw32-make -f makefile.gcc BUILD=debug
  328.  
  329. depending on the compiler used.
  330.  
  331. The full list of the build settings follows:
  332.  
  333. BUILD=release
  334. Builds release version of the library. It differs from default 'debug' in
  335. lack of appended 'd' in name of library and uses the release CRT libraries
  336. instead of debug ones. Notice that even release builds do include debug
  337. information by default, see DEBUG_FLAG for more information about it.
  338.  
  339. SHARED=1
  340. Build shared libraries (DLLs). By default, DLLs are not built
  341. (SHARED=0).
  342.  
  343. UNICODE=0
  344. To completely disable Unicode support (default is UNICODE=1). It should not
  345. be necessary to do this unless, perhaps, you still wish to target Win9x
  346. systems and can't use MSLU (which requires MSLU=1) for some reason.
  347.  
  348. This option affect name of the library ('u' is appended in the default
  349. Unicode build) and the directory where the library and setup.h are stored
  350. (ditto).
  351.  
  352. WXUNIV=1
  353. Build wxUniversal instead of native wxMSW (see
  354. http://www.wxwidgets.org/wxuniv.htm for more information).
  355.  
  356. MONOLITHIC=1
  357. Starting with version 2.5.1, wxWidgets has the ability to be built as
  358. several smaller libraries instead of single big one as used to be the case
  359. in 2.4 and older versions. This is called "multilib build" and is the
  360. default behaviour of makefiles. You can still build single library
  361. ("monolithic build") by setting MONOLITHIC variable to 1.
  362.  
  363. USE_GUI=0
  364. Disable building GUI parts of the library, build only wxBase components used
  365. by console applications. Note that if you leave USE_GUI=1 then both wxBase
  366. and GUI libraries are built.
  367.  
  368. USE_$(LIBRARY)=0
  369. Do not build the corresponding library (all libraries are built by
  370. default). Library which can be disabled in this way are: AUI, HTML,
  371. MEDIA, GL (the option name is USE_OPENGL for this one), PROPGRID,
  372. QA, RIBBON, RICHTEXT, STC, WEBVIEW, XRC.
  373.  
  374. RUNTIME_LIBS=static
  375. Links static version of C and C++ runtime libraries into the executable, so
  376. that the program does not depend on DLLs provided with the compiler (e.g.
  377. Visual C++'s msvcrt.dll or Borland's cc3250mt.dll).
  378. Caution: Do not use static runtime libraries when building DLL (SHARED=1)!
  379.  
  380. MSLU=1
  381. Enables MSLU (Microsoft Layer for Unicode). This setting makes sense only if
  382. used together with UNICODE=1. If you want to be able to use Unicode version
  383. on Windows9x, you will need MSLU (Microsoft Layer for Unicode) runtime DLL
  384. and import lib. The former can be downloaded from Microsoft, the latter is
  385. part of the latest Platform SDK from Microsoft (see msdn.microsoft.com for
  386. details). An alternative implementation of import library can be downloaded
  387. from http://libunicows.sourceforge.net - unlike the official one, this one
  388. works with other compilers and does not require 300+ MB Platform SDK update.
  389.  
  390. DEBUG_FLAG=0
  391. DEBUG_FLAG=1
  392. DEBUG_FLAG=2
  393. Specifies the level of debug support in wxWidgets. Notice that
  394. this is independent from both BUILD and DEBUG_INFO options. By default
  395. always set to 1 meaning that debug support is enabled: asserts are compiled
  396. into the code (they are inactive by default in release builds of the
  397. application but can be enabled), wxLogDebug() and wxLogTrace() are available
  398. and __WXDEBUG__ is defined. Setting it to 0 completely disables all
  399. debugging code in wxWidgets while setting it to 2 enables even the time
  400. consuming assertions and checks which are deemed to be unsuitable for
  401. production environment.
  402.  
  403. DEBUG_INFO=0
  404. DEBUG_INFO=1
  405. This option affects whether debugging information is generated. If
  406. omitted or set to 'default' its value is determined the value of
  407. the BUILD option.
  408.  
  409. DEBUG_RUNTIME_LIBS=0
  410. DEBUG_RUNTIME_LIBS=1
  411. (VC++ only.) If set to 1, msvcrtd.dll is used, if to 0, msvcrt.dll
  412. is used. By default msvcrtd.dll is used only if the executable
  413. contains debug info and msvcrt.dll if it doesn't. It is sometimes
  414. desirable to build with debug info and still link against msvcrt.dll
  415. (e.g. when you want to ship the app to customers and still have
  416. usable .pdb files with debug information) and this setting makes it
  417. possible.
  418.  
  419. TARGET_CPU=X64|IA64
  420. (VC++ only.) Set this variable to build for x86_64 systems. If unset, x86
  421. build is performed.
  422.  
  423. VENDOR=<your company name>
  424. Set this to a short string identifying your company if you are planning to
  425. distribute wxWidgets DLLs with your application. Default value is 'custom'.
  426. This string is included as part of DLL name. wxWidgets DLLs contain compiler
  427. name, version information and vendor name in them. For example
  428. wxmsw300_core_vc_custom.dll is one of DLLs build using Visual C++ with
  429. default settings. If you set VENDOR=mycorp, the name will change to
  430. wxmsw300_core_vc_mycorp.dll.
  431.  
  432. CFG=<configuration name>
  433. Sets configuration name so that you can have multiple wxWidgets builds with
  434. different setup.h settings coexisting in same tree. The value of
  435. this option is appended to the build directories names. This is
  436. useful for building the library in some non-default configuration,
  437. e.g. you could change wxUSE_STL to 1 in include/wx/msw/setup.h and
  438. then build with "CFG=-stl". Alternatively, you could build with e.g.
  439. "RUNTIME_LIBS=static CFG=-mt" when using MSVC.
  440.  
  441. COMPILER_PREFIX=<string>
  442. If you build with multiple versions of the same compiler, you can put
  443. their outputs into directories like "vc6_lib", "vc8_lib" etc. instead of
  444. "vc_lib" by setting this variable to e.g. "vc6". This is merely a
  445. convenience variable, you can achieve the same effect (but different
  446. directory names) with the CFG option.
  447.  
  448. CFLAGS
  449. CXXFLAGS
  450. CPPFLAGS
  451. LDFLAGS
  452. Additional flags to be used with C compiler, C++ compiler, C
  453. preprocessor (used for both C and C++ compilation) and linker,
  454. respectively.
  455.  
  456.  
  457.  
  458. Building Applications Using wxWidgets
  459. =====================================
  460.  
  461. NB: The makefiles and project files provided with wxWidgets samples show which
  462. flags should be used when building applications using wxWidgets so in case
  463. of a problem, e.g. if the instructions here are out of date, you can always
  464. simply copy a makefile or project file from samples\minimal or some other
  465. sample and adapt it to your application.
  466.  
  467. Independently of the compiler and make/IDE you are using you must do the
  468. following to use wxWidgets sources under the directory $WXWIN (notice that
  469. different tool chains refer to environment variables such as WXWIN in
  470. different ways, e.g. MSVC users should use $(WXWIN) instead of just $WXWIN):
  471.  
  472. * Add $WXWIN/include to the
  473. - compiler
  474. - resource compiler
  475. include paths.
  476. * Define the following symbols for the preprocessor:
  477. - __WXMSW__ to ensure you use the correct wxWidgets port.
  478. - _UNICODE unless you want to use deprecated ANSI build of wxWidgets.
  479. - NDEBUG if you want to build in release mode, i.e. disable asserts.
  480. - WXUSINGDLL if you are using DLL build of wxWidgets.
  481. * If using MSVC 6 or 7 only (i.e. not for later versions), also define
  482. wxUSE_RC_MANIFEST=1 and WX_CPU_X86.
  483. * Add $WXWIN/lib/prefix_lib-or-dll to the libraries path. The prefix depends
  484. on the compiler, by default it is "vc" for MSVC, "gcc" for g++ and so on.
  485. * Add the list of libraries to link with to the linker input. The exact list
  486. depends on which libraries you use and whether you built wxWidgets in
  487. monolithic or default multlib mode and basically should include all the
  488. relevant libraries from the directory above, e.g. "wxmsw30ud_core.lib
  489. wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib
  490. wxexpatd.lib" for a debug build of an application using the core library only
  491. (all wxWidgets applications use the base library).
  492.  
  493.  
  494. Microsoft Visual C++ users can simplify the linker setup by prepending
  495. "$(WXWIN)/include/msvc" to the include path (it must come before the
  496. "$(WXWIN)/include" part!) and omitting the last step: the required libraries
  497. will be linked in automatically using the "#pragma comment(lib)" feature of
  498. this compiler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement