Difference between revisions of "Compiling wxWidgets 2.8.9 Monolithic Build with openGL for Windows"

From Code::Blocks
m (Added "/D" flag to "cd" commands)
 
(7 intermediate revisions by 2 users not shown)
Line 23: Line 23:
 
== Checking make Version ==
 
== 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>cd <MINGW>\bin
+
  <tt>cd /D <MINGW>\bin
 
  mingw32-make -v</tt>
 
  mingw32-make -v</tt>
 
The version should read 3.80 or higher.
 
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.
  
 
== Editing setup.h ==
 
== Editing setup.h ==
 +
If the file include/wx/msw/setup.h does not exist copy the master setup0.h.<br>
 +
<tt>copy <WXWIN>\include\wx\msw\setup0.h <WXWIN>\include\wx\msw\setup.h</tt>
 +
 
In file include/wx/msw/setup.h, change wxUSE_GLCANVAS to 1<br>
 
In file include/wx/msw/setup.h, change wxUSE_GLCANVAS to 1<br>
 
I do it by downloading sed.exe from http://gnuwin32.sourceforge.net/downlinks/sed.php<br>
 
I do it by downloading sed.exe from http://gnuwin32.sourceforge.net/downlinks/sed.php<br>
 
See http://gnuwin32.sourceforge.net/packages/sed.htm for info on sed.<br>
 
See http://gnuwin32.sourceforge.net/packages/sed.htm for info on sed.<br>
  <tt>cd <WXWIN>\include</tt>
+
  <tt>cd /D <WXWIN>\include</tt>
 
  <tt>sed --in-place "s/#define wxUSE_GLCANVAS      0/#define wxUSE_GLCANVAS      1/" wx\msw\setup.h
 
  <tt>sed --in-place "s/#define wxUSE_GLCANVAS      0/#define wxUSE_GLCANVAS      1/" wx\msw\setup.h
 
</tt>
 
</tt>
Line 37: Line 42:
 
== Building wxWidgets ==
 
== Building wxWidgets ==
 
To compile wxWidgets, open the command prompt window 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>
  
 
  <tt>SET PATH=<MINGW>\bin;<MINGW>\mingw32\bin</tt>
 
  <tt>SET PATH=<MINGW>\bin;<MINGW>\mingw32\bin</tt>
Line 43: Line 48:
  
 
Now clean up the source:
 
Now clean up the source:
  mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 USE_GUI=1 BUILD=release clean
+
  mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 USE_OPENGL=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:''' 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.
 +
 +
'''NOTE:''' If the file "<WXWIN>\lib\gcc_dll\mswu\wx\setup.h" exists, you should delete it after you run the '''clean''' step. Otherwise, your building with OpenGL may fail. The file "<WXWIN>\lib\gcc_dll\mswu\wx\setup.h" is copied from the edited file "include\wx\msw\setup.h" during the compiling command below.
  
 
When everything is clean you can start compiling wxWidgets:
 
When everything is clean you can start compiling wxWidgets:
  mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 USE_GUI=1 BUILD=release
+
  mingw32-make -f makefile.gcc  MONOLITHIC=1 SHARED=1 UNICODE=1 USE_OPENGL=1 BUILD=release
  
 
Patience. This step takes 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.

Latest revision as of 23:03, 21 September 2011

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 the wxWidgets Source Code

The wxWidgets 2.8.9 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.9 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.9\wxWidgets-2.8.9").

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.

Editing setup.h

If the file include/wx/msw/setup.h does not exist copy the master setup0.h.
copy <WXWIN>\include\wx\msw\setup0.h <WXWIN>\include\wx\msw\setup.h

In file include/wx/msw/setup.h, change wxUSE_GLCANVAS to 1
I do it by downloading sed.exe from http://gnuwin32.sourceforge.net/downlinks/sed.php
See http://gnuwin32.sourceforge.net/packages/sed.htm for info on sed.

cd /D <WXWIN>\include
sed --in-place "s/#define wxUSE_GLCANVAS       0/#define wxUSE_GLCANVAS       1/" wx\msw\setup.h

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 USE_OPENGL=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.

NOTE: If the file "<WXWIN>\lib\gcc_dll\mswu\wx\setup.h" exists, you should delete it after you run the clean step. Otherwise, your building with OpenGL may fail. The file "<WXWIN>\lib\gcc_dll\mswu\wx\setup.h" is copied from the edited file "include\wx\msw\setup.h" during the compiling command below.

When everything is clean you can start compiling wxWidgets:

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

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