Windows Build/CodeBlocks
From K-3D
Code::Blocks is a GPL cross platform IDE, it does work on Linux and Windows. Though there are plenty of IDEs on the Linux/Unix platforms, this one might please developers who have to work on the Win32 platform. It has an integrated debugger and you'll feel at ease if you're accustomed to MS Visual C++. The underlying compiler is still MinGW.
Build Overview
- K-3D version: 0.5 / 0.6.
- Build environment: MinGW with Code::Blocks.
- Runtime environment: Native Win32.
- Pros
- Preferred method of delivering a Win32 build, since it uses a 100% GNU toolchain.
- Nice and easy to use IDE.
- Native OpenGL performance.
- Stable.
- Cons
- Code::Blocks-specific project files have to be maintained separately from Autotools Makefiles.
- Known Issues
- None.
- Requirements
Challenges
The main challenges for this build are:
- Correctly downloading and installing required dependencies.
- Keeping the project files up-to-date.
Note
There is a Makefile.codeblocks file in the root k3d directory that is designed to be used with Cygwin to generate version.h and other files that must be created from their corresponding *.in files. When downloading required libraries, make sure you get and install the runtime and development packages.
Initial Build Instructions
- Download and install Cygwin. When running the Cygwin installer, make sure you include the "cvs", "make", and "sed" packages (optionally : "doxygen", "gdb"). "sed" is checked by default in the Base menu, "cvs" and "make" are in Devel
- Download and install the most up-to-date Python 2.4 (Note: Reccommended path is c:\Python24 but if you want, put it where you like, no absolute need to install to a specific place anymore).
- Download and install the most recent Win32 GTK 2.8 developer libraries from http://gladewin32.sourceforge.net (again recommended place is c:\gtk, but you can install it anywhere, no specific path needed).
- Download and install the most up-to-date gtkmm 2.8 "Developer (Full) Environment" libraries from http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ (Warning, make absolutely sure you install it in the same place as GTK2. Recommended place is c:\gtk, but they can be elsewhere, as long as they are consistent).
- Download and install Code::Blocks full install including MinGW, this currently includes gcc 3.4.2. If you already have MinGW, you can download the core install, but make sure you have the appropriate gcc version installed. Don't run it right now.
- Get the K-3D sources. Either download a source package, or grab the source tree from CVS : use Cygwin's CVS or TortoiseCVS (see TortoiseCVS Setup for basic configuration). Note that CVS under Win32 can be problematic and unpredictable at times.
- Using Cygwin, open a Cygwin Bash Shell and follow SourceForge's instructions :
$ cvs -d:pserver:anonymous@k3d.cvs.sourceforge.net:/cvsroot/k3d login $ cvs -z3 -d:pserver:anonymous@k3d.cvs.sourceforge.net:/cvsroot/k3d co -P k3d
Note: if you installed Cygwin in C:\Cygwin\, the sources will be in C:\Cygwin\home\my_user_name\k3d\
- Configure the K-3D sources:
$ cd k3d $ make -f Makefile.codeblocks all
- Run Code::Blocks, and load the codeblocks.workspace file from the root k3d directory.
- Add the following to the "Settings > Compiler > Custom Variables" tab (change them to match the location of your Python and GTK):
- PYTHON_HOME=C:\Python24
- GTK_HOME=C:\GTK
- Add the following to the "Settings > Directories > Compiler" tab:
- $(PYTHON_HOME)\include
- $(GTK_HOME)\include
- $(GTK_HOME)\include\gtk-2.0
- $(GTK_HOME)\include\glib-2.0
- $(GTK_HOME)\include\pango-1.0
- $(GTK_HOME)\include\atk-1.0
- $(GTK_HOME)\include\gtkglext-1.0
- $(GTK_HOME)\lib\gtk-2.0\include
- $(GTK_HOME)\lib\glib-2.0\include
- $(GTK_HOME)\lib\gtkglext-1.0\include
- $(GTK_HOME)\include\libglade-2.0
- $(GTK_HOME)\include\libxml2
- $(GTK_HOME)\include\freetype2
- $(GTK_HOME)\include\sigc++-2.0
- $(GTK_HOME)\lib\sigc++-2.0\include
- $(GTK_HOME)\include\glibmm-2.4
- $(GTK_HOME)\include\atkmm-1.6
- $(GTK_HOME)\include\gdkmm-2.4
- $(GTK_HOME)\include\pangomm-1.4
- $(GTK_HOME)\include\gtkmm-2.4
- $(GTK_HOME)\lib\glibmm-2.4\include
- $(GTK_HOME)\lib\gdkmm-2.4\include
- $(GTK_HOME)\include\cairo
- $(GTK_HOME)\lib\gtkmm-2.4\include
- $(GTK_HOME)\include\gtk-2.0\gdk
- Add the following to the "Settings > Directories > Linker" tab:
- $(GTK_HOME)\lib
- $(PYTHON_HOME)\libs
- If you installed GTK+ libraries during this session, reboot.
- Select "Build > Build Workspace" (process takes one to several hours).
- If everything went fine, activate the application project (right mouse click) and hit the "run" button (blue arrow).
Creating Binary Installers
Included with K-3D are two NullSoft installer scripts that can be used to create binary installers for Win32. The installer script sources are:
distributions/win32_setup.nsi.in distributions/win32_all_in_one_setup.nsi.in
If you need to modify the installers, make sure you are editing the *.in files, and not the *.nsi files!
- Don't forget subfolders such as those in /share
- Change the uninstall section for any files and folders you add to the install section.
When you build the installers, the *.in files are used to create the corresponding *.nsi files:
distributions/win32_setup.nsi distributions/win32_all_in_one_setup.nsi
These files are then compiled using the NullSoft compiler to produce the Win32 installers:
distributions/k3d-setup-<version>.exe distributions/k3d-all-in-one-setup-<version>.exe
To build the installers:
- Download and install NullSoft version 2.18 or greater.
- Start Cygwin shell, and generate the installers:
$ cd k3d $ make -f Makefile.codeblocks installers
- In order for this to work, the path to NSIS must be present in your Windows system path variable. you mostly likely need to add ";c:\program files\nsis" to the end of the existing path.
- If you are unfamilar with cygwin this may help. In order to cd into the correct directory, you most liky need to cd into cygdrive. For example, if the files are in c:\k3dsrc\k3d then at the cygwin prompt type:
$ cd /cygdrive/c/k3dsrc/k3d $ make -f Makefile.codeblocks installers
"No-Installer" Binaries
See Win32 USB for work on creating a minimal installation that doesn't require an installer (i.e. it runs it of a single directory).

