Difference between revisions of "Compiling wxWidgets 2.6.2 to develop Code::Blocks (MSW)"
Sethjackson (talk | contribs) |
Sethjackson (talk | contribs) |
||
Line 56: | Line 56: | ||
When everything is clean we can compile wxWidgets: | When everything is clean we can compile wxWidgets: | ||
<tt>mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1</tt> | <tt>mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1</tt> | ||
− | '''NOTE:''' these options are the official Code::Blocks options. When you want another version of wxWidgets (unicode or debug) you have to make sure you build a MONOLITHIC version. (One big dll) | + | '''NOTE:''' these options are the official Code::Blocks options. When you want another version of wxWidgets (non-unicode or debug) you have to make sure you build a MONOLITHIC version. (One big dll) |
Now you can get a cup of coffee, or do something else, because this could take a long time. | Now you can get a cup of coffee, or do something else, because this could take a long time. | ||
Revision as of 16:37, 30 March 2006
These are the instructions to compile wxWidgets so that you can compile Code::Blocks on your own.
NOTE: These instructions are MS Windows (TM) specific, but because we are using MinGW it should be possible to use these instructions with some modifications on other platforms.
Install MinGW
If you don't have the Code::Blocks + MinGW bundle, grab the latest MinGW stuff from the MinGW site and install it under a directory you like. NOTE: In these instructions we're calling the MinGW directory <MINGW>, so you have to replace that with you're own directory.
If you DO have the Code::Blocks + MinGW bundle, or have already installed MINGW on your own, you can skip this section.
NOTE: The files are compressed in the tar.gz format. You need a third-party extraction utility to unzip them. (like 7-zip)
You need at least the following files:
- gcc-core-3.4.2-20040916-1.tar.gz
- gcc-g++-3.4.2-20040916-1.tar.gz
- mingw-runtime-3.7.tar.gz
- mingw-utils-0.3.tar.gz
- w32api-3.2.tar.gz
- binutils-2.15.91-20040904-1.tar.gz
- mingw32-make-3.80.0-3.exe
- gdb-6.3-2.exe
GDB is not really needed, but could be usefull for debugging.
After you install, make sure you have the following directories under your path:
- <MINGW>\bin;
- <MINGW>\mingw32\bin;
Download and Install the wxWidgets source code
The wxWidgets 2.6.2 distribution can be found at the wxWidgets website. (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.
NOTE: In the rest of these instructions we are calling the wxWidgets directory <WXWIN> you have to change it to your own directory. (e.g. "c:\wxWidgets-2.6.2")
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 (cmd.exe), not from a unix-like shell. BTW, The same problem would probably arise as well if cygwin is in the path.
Check make version
If you didn't install MingW yourself you have to make sure you have the right version of make. Open the command prompt and type:
mingw32-make -v
If the version is 3.80 or greater it is allright to go on, else you have to install the new make.
Building wxWidgets
Now it is time to compile wxWidgets, open the command promt and change to the wxWidgets directory:
cd <WXWIN>\build\msw
NOTE: The following directions do not work with msys, or other forms of Unix on windows.
Regaurding warning: type attributes are honored only at type definition:
the warnings are because the makefile turned all warnings on... you can easily edit it at ur wishes
-lowjoel (Moderator wxWidgets forum) http://wxforum.shadonet.com/viewtopic.php?t=3324
Now we are on the right place we are first going to clean up the source:
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean
NOTE: make sure you use the same options to clean that you use for the build step below. the clean target uses these environment variables and only cleans that version of the generated object and library files (so it will actually not clean the intended files if these variables are not present)
NOTE: if you still have problems with compiling after cleaning, you may want to remove the directory in the build\msw directory. (it contains object files...)
When everything is clean we can compile wxWidgets:
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
NOTE: these options are the official Code::Blocks options. When you want another version of wxWidgets (non-unicode or debug) you have to make sure you build a MONOLITHIC version. (One big dll) Now you can get a cup of coffee, or do something else, because this could take a long time.
Copy libraries
When compilation is finished it is usefull to copy the libs to another directory. By doing this you can make several builds (e.g. debug and release).
- So first we create a directory this could be done in <WXWIN>\lib.
- Then we go to the directory <WXWIN>\lib\gcc_dll (could called diffrent when you changed the build options)
- Now we move all the files (.a .dll) and the directory (msw) to the directory of your choice. (for me it is <WXWIN>\lib\codeblocks)
NOTE: Make sure you everything is removed from the directory <WXWIN>\lib\gcc_dll else you can get trouble when compiling another version.
Setting up paths
Everything is done now, and we can start compiling Code::Blocks, couldn't we? No! First we have 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. Eg. ("c:\wxWidgets-2.6.2").
- Compile Code::Blocks.
Post compilation steps (before running C::B)
When compilation process is finished, simply run the update.bat script. It will ensure that all resource files (that C::B uses) are in the right place and up to date.
Note: This step requires appropriate zip command, which you likely have already set up and working. However, in case you have not, you should find something usable here.
Building wxWidgets 2.6.2 & 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 on the vc++ toolkit seamlessly.
install VCToolkitSetup.exe
install PlatformSDK
install .NET Framework SDK Version 1.1
run PlatformSDK->Run all Windows XP 32-bit Build Environment (Retail) batch files (find them in PlatformSDK\Setup)
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Vc7\bin\vcvars32.bat (not needed)
The following environment vars must be set/modified/added via 'Control Panel | System | Advanced | Environment Variables'.
set DOTNETSDK=C:\Program Files\Microsoft.NET\SDK\v1.1 (not needed)
set MSVC=C:\Program Files\Microsoft Visual C++ Toolkit 2003
set MSSDK=C:\Program Files\Microsoft Platform SDK
set VC7=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
set INCLUDE=%MSVC%\include;%MSSDK%\include
set LIB=%MSVC%\lib;%MSSDK%\lib;%VC7%\lib
set PATH=%MSVC%\bin;%MSSDK%\bin;%PATH%
set PATH=%PATH%;%MSSDK%\bin\Win64
cd <WXWIN>\build\msw
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 CFG=NonUnicode clean
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 CFG=NonUnicode
cd <WXWIN>\lib; move vc_dll codeblocks_vc
codeblocks
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
building from the commandline (wxwidgets demos)
nmake -f makefile.vc SHARED=1 MONOLITHIC=1 BUILD=release