Difference between revisions of "Building with Code::Blocks"

From PioneerWiki
Jump to: navigation, search
(Undo revision 3537 by Wrwewvwre (talk))
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
 
These are instructions for building Pioneer for '''Windows''' using the '''Code::Blocks''' IDE, with GCC as the compiler.
 
These are instructions for building Pioneer for '''Windows''' using the '''Code::Blocks''' IDE, with GCC as the compiler.
  
 
== Compiler and IDE ==
 
== Compiler and IDE ==
  
First, acquire C::B: http://www.codeblocks.org/. Version 13.12 is verified to work.
+
First, acquire C::B: [http://www.codeblocks.org/ http://www.codeblocks.org/]. Version 13.12 is verified to work.
  
Then, you will need a compiler toolchain. Install the '''32-bit''' TDM-GCC bundle from: http://tdm-gcc.tdragon.net/. You may add the bin/ directory to your PATH but that is not necessary.
+
Then, you will need a compiler toolchain. Install the '''32-bit''' TDM-GCC bundle from: [http://tdm-gcc.tdragon.net/ http://tdm-gcc.tdragon.net/]. You may add the bin/ directory to your PATH but that is not necessary.
  
You may use other distributions (http://sourceforge.net/projects/mingwbuilds/, http://mingw-w64.sourceforge.net/) but then you most likely cannot use the prebuilt dependencies package.
+
You may use other distributions ([http://sourceforge.net/projects/mingwbuilds/ http://sourceforge.net/projects/mingwbuilds/], [http://mingw-w64.sourceforge.net/ http://mingw-w64.sourceforge.net/]) but then you most likely cannot use the prebuilt dependencies package.
  
 
In C::B, open Settings->Compiler..., selected compiler should be GNU GCC compiler. On tab "Toolchain executables" the paths should be:
 
In C::B, open Settings->Compiler..., selected compiler should be GNU GCC compiler. On tab "Toolchain executables" the paths should be:
  
* Compiler's install directory: C:\TDM-GCC-32 (or wherever you put it)
+
*Compiler's install directory: C:\TDM-GCC-32 (or wherever you put it)  
* C compiler: mingw32-gcc.exe
+
*C compiler: mingw32-gcc.exe  
* C++ compiler: mingw32-g++.exe
+
*C++ compiler: mingw32-g++.exe  
* Linker for dynamic libs: mingw32-g++.exe
+
*Linker for dynamic libs: mingw32-g++.exe  
* Linker for static libs: ar.exe
+
*Linker for static libs: ar.exe  
* Resource compiler: windres.exe
+
*Resource compiler: windres.exe  
* Make program: mingw32-make.exe
+
*Make program: mingw32-make.exe  
  
 
Also, in Settings->Debugger you can set the path to C:\TDM-GCC-32\bin\gdb.exe for debugging to work.
 
Also, in Settings->Debugger you can set the path to C:\TDM-GCC-32\bin\gdb.exe for debugging to work.
Line 25: Line 26:
 
[http://industriousone.com/premake Premake4] is used to generate the C::B project file. The latest release 4.3 might work, but here is a more recent executable built from the premake-stable branch:
 
[http://industriousone.com/premake Premake4] is used to generate the C::B project file. The latest release 4.3 might work, but here is a more recent executable built from the premake-stable branch:
  
https://dl.dropboxusercontent.com/u/95790686/premake4.zip
+
[https://dl.dropboxusercontent.com/u/95790686/premake4.zip https://dl.dropboxusercontent.com/u/95790686/premake4.zip]
  
 
TODO: put this in pioneer-thirdparty repository
 
TODO: put this in pioneer-thirdparty repository
Line 33: Line 34:
 
If you use TDM-GCC32 to compile, you can use this package with prebuilt dependencies (SDL, Assimp, libPNG etc.). Otherwise you have to gather your own dependencies.
 
If you use TDM-GCC32 to compile, you can use this package with prebuilt dependencies (SDL, Assimp, libPNG etc.). Otherwise you have to gather your own dependencies.
  
https://dl.dropboxusercontent.com/u/95790686/pioneer-cb-deps.7z
+
[https://dl.dropboxusercontent.com/u/95790686/pioneer-cb-deps.7z https://dl.dropboxusercontent.com/u/95790686/pioneer-cb-deps.7z]
  
 
Extract it to your preferred location, and copy the .dll files to the Pioneer directory.
 
Extract it to your preferred location, and copy the .dll files to the Pioneer directory.
Line 42: Line 43:
  
 
Open command prompt and go to pioneer/win32/codeblocks. Generate the project file:
 
Open command prompt and go to pioneer/win32/codeblocks. Generate the project file:
 
+
<pre>premake4.exe --thirdparty=D:/Dev/mingw32 codeblocks
<pre>
 
premake4.exe --thirdparty=D:/Dev/mingw32 codeblocks
 
 
</pre>
 
</pre>
  
Line 54: Line 53:
  
 
== Extra options for the premake script ==
 
== Extra options for the premake script ==
 
+
<pre>--thirdparty=[location], Folder where the third-party deps are extracted
<pre>
 
--thirdparty=[location], Folder where the third-party deps are extracted
 
 
--noconsole, Don't open a console window when running the game.
 
--noconsole, Don't open a console window when running the game.
 
--release-symbols, Include debug symbols in release build. Makes debugging possible, results in a larger executable.
 
--release-symbols, Include debug symbols in release build. Makes debugging possible, results in a larger executable.
Line 63: Line 60:
 
== Known issues ==
 
== Known issues ==
  
* Plenty of warnings from contrib header files.
+
*Plenty of warnings from contrib header files.  
* Starting the build for the entire workspace does not give the correct build order. Launch the build for the pioneer subproject instead.
+
*Starting the build for the entire workspace does not give the correct build order. Launch the build for the pioneer subproject instead.

Latest revision as of 04:36, 23 July 2018

These are instructions for building Pioneer for Windows using the Code::Blocks IDE, with GCC as the compiler.

Compiler and IDE

First, acquire C::B: http://www.codeblocks.org/. Version 13.12 is verified to work.

Then, you will need a compiler toolchain. Install the 32-bit TDM-GCC bundle from: http://tdm-gcc.tdragon.net/. You may add the bin/ directory to your PATH but that is not necessary.

You may use other distributions (http://sourceforge.net/projects/mingwbuilds/, http://mingw-w64.sourceforge.net/) but then you most likely cannot use the prebuilt dependencies package.

In C::B, open Settings->Compiler..., selected compiler should be GNU GCC compiler. On tab "Toolchain executables" the paths should be:

  • Compiler's install directory: C:\TDM-GCC-32 (or wherever you put it)
  • C compiler: mingw32-gcc.exe
  • C++ compiler: mingw32-g++.exe
  • Linker for dynamic libs: mingw32-g++.exe
  • Linker for static libs: ar.exe
  • Resource compiler: windres.exe
  • Make program: mingw32-make.exe

Also, in Settings->Debugger you can set the path to C:\TDM-GCC-32\bin\gdb.exe for debugging to work.

Premake4

Premake4 is used to generate the C::B project file. The latest release 4.3 might work, but here is a more recent executable built from the premake-stable branch:

https://dl.dropboxusercontent.com/u/95790686/premake4.zip

TODO: put this in pioneer-thirdparty repository

Third-party dependencies package

If you use TDM-GCC32 to compile, you can use this package with prebuilt dependencies (SDL, Assimp, libPNG etc.). Otherwise you have to gather your own dependencies.

https://dl.dropboxusercontent.com/u/95790686/pioneer-cb-deps.7z

Extract it to your preferred location, and copy the .dll files to the Pioneer directory.

TODO: put this in pioneer-thirdparty repository

Building the game

Open command prompt and go to pioneer/win32/codeblocks. Generate the project file:

premake4.exe --thirdparty=D:/Dev/mingw32 codeblocks

Substitute the correct location for the third-party deps root folder, using forward slashes. Using --thirdparty is optional if you set the correct include and lib paths in C::B settings.

Pioneer.cbp is generated in the build/ subdirectory, open it in C::B and build the pioneer subproject. The executables are placed in the pioneer root directory. Copy the .dlls from the third-party dependencies before running for the first time.

You need to regenerate the project every time a source file is added or removed. The generated project will not be committed to the repository.

Extra options for the premake script

--thirdparty=[location], Folder where the third-party deps are extracted
--noconsole, Don't open a console window when running the game.
--release-symbols, Include debug symbols in release build. Makes debugging possible, results in a larger executable.

Known issues

  • Plenty of warnings from contrib header files.
  • Starting the build for the entire workspace does not give the correct build order. Launch the build for the pioneer subproject instead.