Difference between revisions of "Compiling wxWidgets 2.8.6 to develop Code::Blocks (MSW)"

From Code::Blocks
 
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Note: This is an copy of Compiling wxWidgets 2.6.2 to develop Code::Blocks (MSW)'''
+
Obsolete directions please see [[Compiling wxWidgets (MSW) 2.8.12 on Windows using makefile.gcc]]
https://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.6.2_to_develop_Code::Blocks_%28MSW%29
 
 
 
'''That is being updated for wxWidgets 2.6.3'''
 
  
 
These are the instructions for compiling wxWidgets for use with Code::Blocks. They are primarily intended in preparation for compiling Code::Blocks itself but (hopefully) may also help installing wxWidgets for general development using that framework.
 
These are the instructions for compiling wxWidgets for use with Code::Blocks. They are primarily intended in preparation for compiling Code::Blocks itself but (hopefully) may also help installing wxWidgets for general development using that framework.
Line 9: Line 6:
  
 
== Installing MinGW ==
 
== Installing MinGW ==
[[ https://wiki.codeblocks.org/index.php?title=MinGW_installation | How to install MinGW]]
+
Directions to install MinGW for Code::Blocks can be found here.
 +
[[MinGW installation]]
  
== Installing the wxWidgets source code ==
+
== Installing the wxWidgets Source Code ==
The wxWidgets 2.6.2 distribution can be found at the [http://www.wxwidgets.org/dl_msw2.htm#stable wxWidgets download site]. (Note that there is also a winhelp file available.) You can choose between an installer and a zip file. You can just get the zip file because the installer is also a zipped version.
+
The wxWidgets 2.8.6 distribution can be found at the [http://www.wxwidgets.org/downloads/#previous_stable wxWidgets download site]. (Note that there is also a winhelp file available.) You can choose between an installer and a zip file. You can just get the zip file because the installer is also a zipped version.
  
 
If you use the plain zip version, make sure to unzip using the full path. Otherwise the directories won't be created correctly.
 
If you use the plain zip version, make sure to unzip using the full path. Otherwise the directories won't be created correctly.
  
'''NOTE:''' For the remainder of these instructions we call the wxWidgets directory ''<WXWIN>''. You have to change it to your corresponding directory (e.g. "c:\wxWidgets-2.6.2").
+
The future patches for wxWidgets 2.8.6 distribution will be found at the
 +
[http://www.wxwidgets.org/downloads/patch.htm wxWidgets download site].
 +
 
 +
'''NOTE:''' For the remainder of these instructions we call the wxWidgets directory ''<WXWIN>''. You have to change it to your corresponding directory (e.g. "c:\wxMSW-2.8.6-1\wxWidgets-2.8.6").
  
 
'''NOTE:''' You do not need MSYS. Furthermore, you cannot have MSYS in your path, or the wxWidgets compilation will fail. Thus, if you have MSYS installed, ensure that ''<MSYS>\bin'' '''is not''' in your path before compiling wxWidgets. wxWidgets must be compiled from a "regular" command line (like cmd.exe), not from a Unix-like shell. The same problem could arise if Cygwin is in the path.
 
'''NOTE:''' You do not need MSYS. Furthermore, you cannot have MSYS in your path, or the wxWidgets compilation will fail. Thus, if you have MSYS installed, ensure that ''<MSYS>\bin'' '''is not''' in your path before compiling wxWidgets. wxWidgets must be compiled from a "regular" command line (like cmd.exe), not from a Unix-like shell. The same problem could arise if Cygwin is in the path.
  
== Checking make version ==
+
'''NOTE:''' For the remainder of these instructions we call the MinGW directory ''<MINGW>''. You have to change it to your corresponding directory (e.g. "C:\MinGW").
 +
 
 +
== Checking make Version ==
 
If you didn't install MinGW yourself you have to ensure you are using a recent enough version of the make utility. Open a command prompt and type:
 
If you didn't install MinGW yourself you have to ensure you are using a recent enough version of the make utility. Open a command prompt and type:
  <tt>mingw32-make -v</tt>
+
  <tt>cd /D <MINGW>\bin
The version should read 3.80 or greater, else you need to install a newer version.
+
mingw32-make -v</tt>
 +
The version should read 3.80 or higher.
 +
 
 +
'''NOTE:''' the <code>/D</code> flag after <code>cd</code> may be omitted from all commands; it simply allows command prompt to change drives if necessary.
  
 
== Building wxWidgets ==
 
== Building wxWidgets ==
Now it is time to compile wxWidgets, open the command promt and change to the wxWidgets directory:
+
To compile wxWidgets, open the command prompt window and change to the wxWidgets directory:
  <tt>cd <WXWIN>\build\msw</tt>
+
  <tt>cd /D <WXWIN>\build\msw</tt>
  
'''NOTE: The following instructions do not work with MSYS, or other forms of Unix on Windows.'''
+
<tt>SET PATH=<MINGW>\bin;<MINGW>\mingw32\bin</tt>
 +
'''NOTE:''' This is normally SET PATH=C:\MingGW\bin;C:\MingGW\mingw32\bin
  
Now the first thing to do is to clean up the source:
+
Now clean up the source:
 
  mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release clean
 
  mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release clean
'''NOTE:''' Make sure you use exactly the same options for this step and for the build step below. The clean target uses these variables and only cleans the specified version of the generated object and library files (so it will actually not clean the intended files if these variables are not identical).
+
'''NOTE:''' Make sure you use exactly the same options for this step and for the build step below. The clean target uses these variables and only cleans the specified version of the generated object and library files. (It will not clean the intended files if these variables are not identical.)
  
 
'''NOTE:''' If you still have problems with compiling after cleaning, you could try to manually remove the gcc_msw directory under the build\msw directory. This directory is the place where the object files are stored.
 
'''NOTE:''' If you still have problems with compiling after cleaning, you could try to manually remove the gcc_msw directory under the build\msw directory. This directory is the place where the object files are stored.
  
When everything is clean you can start actually compiling wxWidgets:
+
When everything is clean you can start compiling wxWidgets:
 
  mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release
 
  mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release
  
'''NOTE:''' These options are the officially supported Code::Blocks options. If you want another version of wxWidgets (debug or non-unicode) you still have to make sure you build a MONOLITHIC version (one big DLL) for linking Code::Blocks against.
+
'''NOTE:''' These options are the officially-supported Code::Blocks options. If you want another version of wxWidgets (debug or non-Unicode) you still have to make sure you build a MONOLITHIC version (one big DLL) for linking Code::Blocks.
  
Now you can get a cup of coffee or do something else because this step takes some time. Make sure there was no compilation error before you continue.
+
Patience. This step takes time. Make sure there was no compilation error before you continue.
  
 
'''NOTE:''' If you're having errors because of libjpeg, you might want to look at [http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1606032&group_id=9863 this patch]
 
'''NOTE:''' If you're having errors because of libjpeg, you might want to look at [http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1606032&group_id=9863 this patch]
Line 51: Line 58:
 
*Open the Code::Blocks project (CodeBlocks.cbp).
 
*Open the Code::Blocks project (CodeBlocks.cbp).
 
*It will ask you to define a [[Global compiler variables|Global variable]]
 
*It will ask you to define a [[Global compiler variables|Global variable]]
*Set the path to where you have wxWidgets installed (e.g. "c:\wxWidgets-2.6.2").
+
*Set the path to where you have wxWidgets installed (e.g. "c:\wxMSW-2.8.6-1\wxWidgets-2.8.6").
 
*Compile Code::Blocks.
 
*Compile Code::Blocks.
  
 
=== Post compilation steps ===
 
=== Post compilation steps ===
 
When the compilation process is finished, simply run the update.bat script. It will ensure that all resource files Code::Blocks uses are in the right place and up to date.
 
When the compilation process is finished, simply run the update.bat script. It will ensure that all resource files Code::Blocks uses are in the right place and up to date.
 
== Building wxWidgets 2.6.2 using VC++ Toolkit 2003 ==
 
I'll just throw in my notes on the process for both compiler versions as getting VC++ toolkit to work is quite a pain. Code::Blocks needs a couple of changes to support wxWidgets with the VC++ toolkit seamlessly.
 
 
install VCToolkitSetup.exe <br>
 
install PlatformSDK <br>
 
install .NET Framework SDK Version 1.1 <br>
 
run PlatformSDK->'''Run all''' Windows XP 32-bit Build Environment (Retail) batch files '''(find them in '''PlatformSDK\Setup''')''' <br>
 
C:\Program Files\Microsoft Visual C++ Toolkit 2003\'''Vc7\bin'''\vcvars32.bat (not needed) <br>
 
<br>
 
'''The following environment vars must be set/modified/added via 'Control Panel | System | Advanced | Environment Variables'.'''
 
<br>
 
<br>
 
set DOTNETSDK=C:\Program Files\Microsoft.NET\SDK\v1.1 (not needed) <br>
 
set MSVC=C:\Program Files\Microsoft Visual C++ Toolkit 2003 <br>
 
set MSSDK=C:\Program Files\Microsoft Platform SDK <br>
 
set VC7=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 <br>
 
set INCLUDE=%MSVC%\include;%MSSDK%\include <br>
 
set LIB=%MSVC%\lib;%MSSDK%\lib;%VC7%\lib <br>
 
set PATH=%MSVC%\bin;%MSSDK%\bin;%PATH% <br>
 
set PATH=%PATH%;%MSSDK%\bin\Win64 <br>
 
<br>
 
<b>
 
cd <WXWIN>\build\msw <br>
 
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 CFG=NonUnicode clean <br>
 
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 CFG=NonUnicode <br>
 
</b>
 
 
<b>
 
cd <WXWIN>\lib; move vc_dll codeblocks_vc<br>
 
</b>
 
<br>
 
codeblocks <br>
 
<pre>
 
project->build options
 
directories->compiler
 
<WXWIN>\lib\codeblocks_vc\msw
 
<WXWIN>\include
 
<WXWIN>\contrib\include
 
directories->linker
 
<WXWIN>\lib\codeblocks_vc
 
directories->resource compiler
 
<WXWIN>\include
 
compiler->#defines
 
WXUSINGDLL
 
compiler->compiler flags
 
enable c++ exception handling (or other options: /GX [same as /EHsc])
 
compiler->other options
 
delete -D__GNUWIN32__
 
linker->link libraries
 
delete ctl3d32
 
 
compile->compiler options
 
programs->additional paths
 
C:\wxWidgets-2.6.2\lib\codeblocks_vc
 
-OR- copy C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw26_vc_custom.dll
 
    to application exe directory or c:\windows\system32
 
-OR- change project->properties->targets->execution working dir
 
    to C:\wxWidgets-2.6.2\lib\codeblocks_vc (not recommended)
 
 
compile->compiler options
 
programs->additional paths
 
C:\Program Files\Microsoft Platform SDK\Bin
 
directories->compiler
 
add C:\Program Files\Microsoft Platform SDK\Include
 
directories->linker
 
add C:\Program Files\Microsoft Platform SDK\Lib
 
 
copy C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw26.exp
 
    to C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw.exp
 
copy C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw26.lib
 
    to C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw.lib
 
copy C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw26_stc.exp
 
    to C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw_stc.exp
 
copy C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw26_stc.lib
 
    to C:\wxWidgets-2.6.2\lib\codeblocks_vc\wxmsw_stc.lib
 
 
compile->rebuild
 
</pre>
 
<br>
 
building from the commandline (wxwidgets demos) <br>
 
nmake -f makefile.vc SHARED=1 MONOLITHIC=1 BUILD=release
 

Latest revision as of 01:09, 14 December 2016

Obsolete directions please see Compiling wxWidgets (MSW) 2.8.12 on Windows using makefile.gcc

These are the instructions for compiling wxWidgets for use with Code::Blocks. They are primarily intended in preparation for compiling Code::Blocks itself but (hopefully) may also help installing wxWidgets for general development using that framework.

Although these instructions are targeted at the Windows operating system, it should be possible to apply them with slight adjustments to other platforms, since we make use of MinGW.

Installing MinGW

Directions to install MinGW for Code::Blocks can be found here. MinGW installation

Installing the wxWidgets Source Code

The wxWidgets 2.8.6 distribution can be found at the wxWidgets download site. (Note that there is also a winhelp file available.) You can choose between an installer and a zip file. You can just get the zip file because the installer is also a zipped version.

If you use the plain zip version, make sure to unzip using the full path. Otherwise the directories won't be created correctly.

The future patches for wxWidgets 2.8.6 distribution will be found at the wxWidgets download site.

NOTE: For the remainder of these instructions we call the wxWidgets directory <WXWIN>. You have to change it to your corresponding directory (e.g. "c:\wxMSW-2.8.6-1\wxWidgets-2.8.6").

NOTE: You do not need MSYS. Furthermore, you cannot have MSYS in your path, or the wxWidgets compilation will fail. Thus, if you have MSYS installed, ensure that <MSYS>\bin is not in your path before compiling wxWidgets. wxWidgets must be compiled from a "regular" command line (like cmd.exe), not from a Unix-like shell. The same problem could arise if Cygwin is in the path.

NOTE: For the remainder of these instructions we call the MinGW directory <MINGW>. You have to change it to your corresponding directory (e.g. "C:\MinGW").

Checking make Version

If you didn't install MinGW yourself you have to ensure you are using a recent enough version of the make utility. Open a command prompt and type:

cd /D <MINGW>\bin
mingw32-make -v

The version should read 3.80 or higher.

NOTE: the /D flag after cd may be omitted from all commands; it simply allows command prompt to change drives if necessary.

Building wxWidgets

To compile wxWidgets, open the command prompt window and change to the wxWidgets directory:

cd /D <WXWIN>\build\msw
SET PATH=<MINGW>\bin;<MINGW>\mingw32\bin

NOTE: This is normally SET PATH=C:\MingGW\bin;C:\MingGW\mingw32\bin

Now clean up the source:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release clean

NOTE: Make sure you use exactly the same options for this step and for the build step below. The clean target uses these variables and only cleans the specified version of the generated object and library files. (It will not clean the intended files if these variables are not identical.)

NOTE: If you still have problems with compiling after cleaning, you could try to manually remove the gcc_msw directory under the build\msw directory. This directory is the place where the object files are stored.

When everything is clean you can start compiling wxWidgets:

mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release

NOTE: These options are the officially-supported Code::Blocks options. If you want another version of wxWidgets (debug or non-Unicode) you still have to make sure you build a MONOLITHIC version (one big DLL) for linking Code::Blocks.

Patience. This step takes time. Make sure there was no compilation error before you continue.

NOTE: If you're having errors because of libjpeg, you might want to look at this patch

Compiling Code::Blocks

Setting up paths

Before finally compiling Code::Blocks itself, you need to setup the paths:

  • Open the Code::Blocks project (CodeBlocks.cbp).
  • It will ask you to define a Global variable
  • Set the path to where you have wxWidgets installed (e.g. "c:\wxMSW-2.8.6-1\wxWidgets-2.8.6").
  • Compile Code::Blocks.

Post compilation steps

When the compilation process is finished, simply run the update.bat script. It will ensure that all resource files Code::Blocks uses are in the right place and up to date.