Code::Blocks is a free, open-source cross-platform IDE that supports multiple compilers.
This repository contains a special version of the 17.12
stable release in order to provide full support for the DreamSDK package. DreamSDK is a modern, ready-to-use environment for the Sega Dreamcast development, designed for the Microsoft Windows platform. It's a package composed by a lot of pre-compiled tools; and Code::Blocks is a nice IDE which unleash the power of DreamSDK.
Notables changes of this special release of Code::Blocks includes:
- New compiler/options file (
dc-gcc
) which specify theGNU GCC Compiler for Sega Dreamcast
compiler. - The
compiler
anddebugger
plugins have been patched to run the loader (i.e.dc-tool
) before running the target. - The
Sega Dreamcast Project
(dc
) wizard template has been added (Note: a newsdk
(codeblocks.dll
) module is needed to expose the requiredCallHooks
function in the Squirrel script, that's why almost all compiled binaries are provided in the generated patch).
Basically this repository purpose is to build the Code::Blocks Patcher for DreamSDK (codeblocks-patcher.exe
) file.
This patcher will be embedded in the DreamSDK Setup file.
Please read this document in order to generate the Code::Blocks Patcher.
Install all prerequisites before trying to work with this repository:
- 7-Zip
- Boost
- Code::Blocks
- TDM-GCC-32
- Lazarus
- Zip from Info-ZIP
The last version of the Boost libraries supporting Windows XP is the 1.64.0
version. After that version, Windows XP is unsupported. To keep the XP support (as the original Code::Blocks 17.12 release) you must use that specific version. Please don't try to update it!
-
Unzip boost 1.64.0.
-
Open the TDM-GCC-32 prompt.
-
Enter the following commands:
cd /D <path>\boost_1_64_0 bootstrap gcc b2 --toolset=gcc "--prefix=C:\Program Files\CodeBlocks" install
To build Code::Blocks you will need... Code::Blocks. Install the IDE and TDM-GCC-32 if not already done.
- Start Code::Blocks then open the
.\codeblocks\codeblocks\src\CodeBlocks.workspace
file. This will open theCode::Blocks wx2.8.x
workspace. - Select the Settings > Global Variable menu item then select (or create) the
boost
variable. In thebase
directory field, enterC:\Program Files\CodeBlocks
. In theinclude
field, enterC:\Program Files\CodeBlocks\include\boost-1_64
then in thelib
field, enterC:\Program Files\CodeBlocks\lib
. - Select (or create) the
cb_release_type
variable and enter-g -O0
in thebase
field. - Select (or create) the
wx
variable, enter./wxMSW
(e.g.C:\codeblocks\wxMSW
) in thebase
field. Please use the providedwxMSW
directory provided in that repository.
If you want to debug the Code::Blocks build, select the src
target and install a DreamSDK working package in E:\DreamSDK\
.
If you don't have an E:
drive, you have to do some modifications:
-
Change the
DREAMSDK_HOME_DEBUG_DRIVE
variable in.\packager\mkpkg.cmd
. -
Change the
E:
drive reference in the two files below:.\codeblocks\src\plugins\compilergcc\resources\compilers\compiler_dc-gcc.xml
.\codeblocks\src\plugins\compilergcc\resources\compilers\options_dc-gcc.xml
-
In the debugged Code::Blocks, go to the Settings > Compiler menu, select the GNU GCC Compiler for Sega Dreamcast profile and click on Reset defaults. Code::Blocks should detect the DreamSDK package environment used for debug your Code::Blocks build.
-
The GNU Debugger (GDB) included in the latest release of TDM-GCC is buggy: some breakpoints are never reached. You should use a newer GNU Debugger (GDB) binary, for example the one included in DreamSDK (i.e.
E:\DreamSDK\bin\gdb.exe
). To change that, you may update the Debugger profile inside Code::Blocks (in theSettings
menu).
-
Make your changes in the Code:Blocks source (basically in
sdk
,Compiler
andDebugger
targets). -
Select the Settings > Global Variable menu item then select the
cb_release_type
variable and enter-O2
in thebase
field. -
Change the content of the
.\codeblocks\src\include\autorevision.h
file. In normal conditions, this file is created automatically when using SVN and theautorevision
tool. Or you may just create thisautorevision.h
file manually. The SVN revision11256
is the official revision for the17.12
release./*0*/ //don't include this header, only configmanager-revision.cpp should do this. #ifndef AUTOREVISION_H #define AUTOREVISION_H #include <wx/string.h> namespace autorevision { const unsigned int svn_revision = 11256; const wxString svnRevision(_T("11256")); const wxString svnDate(_T("YYYY-MM-DD hh:mm:ss")); // update manually the date/time using this format } #endif
-
Rebuild the the whole workspace.
-
Run the
.\codeblocks\src\update.bat
file.
After building the Code::Blocks release, you need to build the package that will be embedded in the Code::Blocks Patcher for DreamSDK.
- Build Code::Blocks in Release mode (i.e.
cb_release_type
variable should be-O2
) and run the.\codeblocks\src\update.bat
file. - Go to the
.\packager
directory. - From there, run the
mkpkg.cmd
file. - Build the
.\cbpatcher\src\splash\codeblocks-splash.lpi
in Release mode from Lazarus, then pack the.\cbpatcher\src\engine\embedded\codeblocks-splash.exe
file with UPX. - Build the
.\cbpatcher\src\codeblocks-patcher.lpi
in Release mode from Lazarus. No need to pack this with UPX. - Done! You should have now the
codeblocks-patcher.exe
file which can be embedded in the DreamSDK Setup file. Don't be surprised, it's a big file around10MB
.
Sometimes, the breakpoints are never reached while compiling with TDM-GCC-32 including GCC 5.1.0.
Please verify the following:
- The
cb_release_type
global variable should be set to-g -O0
in order to activate debug symbols. - Sometimes the GDB version included in TDM-GCC-32 is buggy. Try to use another GDB build (like the one included in DreamSDK itself).
When you rebuild the whole Code::Blocks workspace, the following message may be displayed:
Fatal Error: Mismatch between the program and library build versions detected.
The library used 2.8 (wchar_t,compiler with C++ ABI 1008,STL containers,compatible with 2.8),
and your program used 2.8 (wchar_t,compiler with C++ ABI 1002,STL containers,compatible with 2.8).
The only difference is the C++ ABI version i.e. 1008
vs. 1002
.
After some investigation, the problem arises from the fact that Code::Blocks was compiled with gcc 5.1.0, which defines __GXX_ABI_VERSION
as 1008
, but the pre-compiled wxWidgets library was made with clang 3.6, which defines __GXX_ABI_VERSION
as 1002
(See reference).
To solve this issue, you may need to recompile the provided wxMSW
library (wxWidgets):
- Open the TDM-GCC-32 command prompt from the
Start
menu. - Type
cd .\wxMSW\build\msw
thenmingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=cb CXXFLAGS=-fpermissive
(Read more). This should update the.\wxMSW\lib\gcc_dll\wxmsw28u_gcc_cb.dll
file. - Copy the updated
.\wxMSW\lib\gcc_dll\wxmsw28u_gcc_cb.dll
file to.\codeblocks\src\devel\
(this is important!). - Rebuild the Code::Blocks source.
- Try again.
Note: You may need to enable debugging for wxWidgets, in this case you should just set the BUILD
parameter to debug
(i.e. BUILD=debug
). Do this if you want to debug the wxWidgets library.
This message is sometimes shown when starting the debug build of Code::Blocks. It caused by missing image files in the .\codeblocks\src\devel\share\CodeBlocks\images\
directory.
To solve this issue, you just have to run the .\codeblocks\src\update.bat
file, this will copy the missing files to the devel
and output
directories.