Difference between revisions of "Compiling the source code"

From Platinum Arts Sandbox Free 3D Game Maker
Jump to: navigation, search
m (New page: Compiling the source code)
 
 
(49 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Compiling the source code
+
This page discusses on how to modify and compile the [http://www.sandboxgamemaker.com/wiki/index.php?title=Development source code].
 +
 
 +
=Windows=
 +
 
 +
[http://www.codeblocks.org/downloads/26 Click here] to download the version of Codeblocks with the mingw compiler.
 +
 
 +
Then go into your \src\windows folder. Click on sandbox.cbp and codeblocks should load up. Go to build and then build and it should create the Windows binary :)
 +
 
 +
If you get "Invalid Compiler" when building, you need to set up the Mingw Compiler location. When you are in Codeblocks go to "Settings" > "Compiler and Debugger". Then click the ">" button until you get to "Toolchain Executables". Click the "Auto-Detect" button. It should find the Mingw folder, if it is pointing to the wrong location click the "..." button and find the folder yourself.
 +
 
 +
If you are getting errors while compiling such as having to do with "_UnwindResume" you might have to link the libraries. You could do so like this: Go to "Settings" > "Compiler and Debugger", then click Linker Settings. Under link libraries click "Add" and go to the \src\lib folder then highlight all the ".lib" files and click "Ok". Now try compiling! :D
 +
Other Methods: There is a visual C++ project file included that you can use. Load up the proper file and compile :) I'm not sure if you'd need any libraries but you probably shouldn't need any.
 +
 
 +
=Linux=
 +
==Makefile==
 +
 
 +
First of all, make sure you have the the SDL and SDL_Image and SDL_Mixer development libraries installed on your system.
 +
Next up, go into src folder. and type 'make install', you can replace 'install' any of the following
 +
 
 +
* all - compiles client and server targets (see below)
 +
* libenet - compiles the enet library
 +
* clean - cleans up temporary files
 +
* client - builds enet and all clients
 +
* server - builds enet and all servers
 +
* install - builds the client and server targets (see the two above) and copies the produced binaries into ../bin/
 +
 
 +
==Debug==
 +
 
 +
A debug file is already set up. Debug versions can be compiled by invoking...
 +
<code>
 +
  make -f Makefile.debug install
 +
</code>
 +
 
 +
After this, simply run sandbox as normal with --debug at the end, for example...
 +
<code>
 +
    # this will load up gdb with the rpg's debug binary in windowed mode
 +
    ./sandbox_unix -grpg --debug -t0
 +
 
 +
    # to stop the program at any time, use ctrl - C
 +
    # to run the program, type this once gdb has started
 +
    run
 +
 
 +
    # to get a backtrace once sandbox has crashed
 +
    bt full
 +
 
 +
    # print a variable - also note you can type cast
 +
    print variablename
 +
</code>
 +
 
 +
We would strongly recommend that you get familiar with gdb and its commands if you intend to do debugging.
 +
 
 +
==trouble shooting==
 +
 
 +
'''sandbox cannot find 'SDL/*.h' files'''<br>
 +
Make sure that the SDL, SDL_mixer and SDL_image libraries are installed
 +
 
 +
'''enet fails to compile'''<br>
 +
If you see "./configure: /bin/sh^M: bad interpreter" use dos2unix to convert enet/configure<br>
 +
Otherwise invoke make -C enet distclean
 +
 
 +
if sandbox fails to compile for any other reason, do let us know
 +
 
 +
=MAC OSX=
 +
 
 +
To start, you should have Xcode installed on your computer. Either install the Developer tools from the OS X install disks that came with your computer, or download  Xcode from the apple website:
 +
http://developer.apple.com/technology/xcode.html
 +
 
 +
Building the app for PPC and Intel macs differs from that point. Once you get Xcode running, do the following:
 +
 
 +
 
 +
For PPC users only:
 +
 
 +
Download SDL:  http://www.libsdl.org/release/SDL-1.2.9.dmg
 +
 
 +
Download SDL_Image: http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.9.dmg
 +
 
 +
Download SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.8.dmg
 +
 
 +
 
 +
For Intel users only:
 +
 
 +
Download SDL from: http://www.libsdl.org/download-1.2.php
 +
 
 +
Download SDL_Image from: http://www.libsdl.org/projects/SDL_image/
 +
 
 +
Download SDL_Mixer from: http://www.libsdl.org/projects/SDL_mixer/
 +
 
 +
 
 +
Put each .framework file into /Library/Frameworks
 +
 
 +
Download the latest Multiplatform.zip of Sandbox. Unzip and double click on PASX.X.Xmultiplatform/src/xcode/sandbox.xcodeproj
 +
 
 +
Xcode will open the project.
 +
 
 +
 
 +
Change the '''Active Build Configuration''' from ''Debug'' to ''Release''. Click on build. the Binary should compile without the SDL libraries, so be sure to add them to ''sandbox.app''. You can do this by following these steps:
 +
 
 +
1: Go to /Library/Frameworks and copy SDL.framework, SDL_Mixer.framework, and SDL_Image.framework.
 +
 
 +
2: Right-click(ctrl+click) on ''sandbox.app'' and select ''Show Package Contents''.
 +
 
 +
3: Create a folder called ''Frameworks'' inside the ''Contents'' folder of ''sandbox.app'', and paste the SDL libraries inside that folder.
 +
 
 +
 
 +
If you want the launcher to be specific to your architecture, go to the "Project" menu and click "Edit Project Settings". Change ''''Architectures'''' from "ppc i386" to your architecture (ppc for power pc and i386 for intel).
 +
 
 +
By default the executables, launcher and sandbox, are created in the folder PASX.X.Xmultiplatform/src/xcode/build/Release/
 +
 
 +
Move the compiled sandbox.app into the top level of the ''sandbox'' folder. The launcher.app should be one level above that folder.
 +
 
 +
 
 +
'''Note:''' If for some reason the code did not compile, follow these steps:
 +
 
 +
 
 +
- If not already omitted, try leaving out '''(but not deleting)''' master.cpp and any .c, .cpp, and .h files reported missing by Xcode in the project file.
 +
 
 +
- Add any extra .c, .cpp, and .h files, one at a time, from the folders named enid, engine, fpsgame, and shared to the corresponding folders in the Xcode project file.
 +
 
 +
 
 +
--[[User:Popinman32|Popinman32]] 22:28, 6 August 2010 (UTC)
 +
 
 +
Maintained by Popinman32 and other MacOSX users.
 +
 
 +
=FreeBSD=
 +
 
 +
Unwritten

Latest revision as of 08:24, 7 June 2014

This page discusses on how to modify and compile the source code.

Windows

Click here to download the version of Codeblocks with the mingw compiler.

Then go into your \src\windows folder. Click on sandbox.cbp and codeblocks should load up. Go to build and then build and it should create the Windows binary :)

If you get "Invalid Compiler" when building, you need to set up the Mingw Compiler location. When you are in Codeblocks go to "Settings" > "Compiler and Debugger". Then click the ">" button until you get to "Toolchain Executables". Click the "Auto-Detect" button. It should find the Mingw folder, if it is pointing to the wrong location click the "..." button and find the folder yourself.

If you are getting errors while compiling such as having to do with "_UnwindResume" you might have to link the libraries. You could do so like this: Go to "Settings" > "Compiler and Debugger", then click Linker Settings. Under link libraries click "Add" and go to the \src\lib folder then highlight all the ".lib" files and click "Ok". Now try compiling! :D Other Methods: There is a visual C++ project file included that you can use. Load up the proper file and compile :) I'm not sure if you'd need any libraries but you probably shouldn't need any.

Linux

Makefile

First of all, make sure you have the the SDL and SDL_Image and SDL_Mixer development libraries installed on your system. Next up, go into src folder. and type 'make install', you can replace 'install' any of the following

  • all - compiles client and server targets (see below)
  • libenet - compiles the enet library
  • clean - cleans up temporary files
  • client - builds enet and all clients
  • server - builds enet and all servers
  • install - builds the client and server targets (see the two above) and copies the produced binaries into ../bin/

Debug

A debug file is already set up. Debug versions can be compiled by invoking...

  make -f Makefile.debug install

After this, simply run sandbox as normal with --debug at the end, for example...

    # this will load up gdb with the rpg's debug binary in windowed mode
   ./sandbox_unix -grpg --debug -t0
 
    # to stop the program at any time, use ctrl - C
    # to run the program, type this once gdb has started
    run
 
    # to get a backtrace once sandbox has crashed
    bt full
 
    # print a variable - also note you can type cast
    print variablename

We would strongly recommend that you get familiar with gdb and its commands if you intend to do debugging.

trouble shooting

sandbox cannot find 'SDL/*.h' files
Make sure that the SDL, SDL_mixer and SDL_image libraries are installed

enet fails to compile
If you see "./configure: /bin/sh^M: bad interpreter" use dos2unix to convert enet/configure
Otherwise invoke make -C enet distclean

if sandbox fails to compile for any other reason, do let us know

MAC OSX

To start, you should have Xcode installed on your computer. Either install the Developer tools from the OS X install disks that came with your computer, or download Xcode from the apple website: http://developer.apple.com/technology/xcode.html

Building the app for PPC and Intel macs differs from that point. Once you get Xcode running, do the following:


For PPC users only:

Download SDL: http://www.libsdl.org/release/SDL-1.2.9.dmg

Download SDL_Image: http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.9.dmg

Download SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.8.dmg


For Intel users only:

Download SDL from: http://www.libsdl.org/download-1.2.php

Download SDL_Image from: http://www.libsdl.org/projects/SDL_image/

Download SDL_Mixer from: http://www.libsdl.org/projects/SDL_mixer/


Put each .framework file into /Library/Frameworks

Download the latest Multiplatform.zip of Sandbox. Unzip and double click on PASX.X.Xmultiplatform/src/xcode/sandbox.xcodeproj

Xcode will open the project.


Change the Active Build Configuration from Debug to Release. Click on build. the Binary should compile without the SDL libraries, so be sure to add them to sandbox.app. You can do this by following these steps:

1: Go to /Library/Frameworks and copy SDL.framework, SDL_Mixer.framework, and SDL_Image.framework.

2: Right-click(ctrl+click) on sandbox.app and select Show Package Contents.

3: Create a folder called Frameworks inside the Contents folder of sandbox.app, and paste the SDL libraries inside that folder.


If you want the launcher to be specific to your architecture, go to the "Project" menu and click "Edit Project Settings". Change 'Architectures' from "ppc i386" to your architecture (ppc for power pc and i386 for intel).

By default the executables, launcher and sandbox, are created in the folder PASX.X.Xmultiplatform/src/xcode/build/Release/

Move the compiled sandbox.app into the top level of the sandbox folder. The launcher.app should be one level above that folder.


Note: If for some reason the code did not compile, follow these steps:


- If not already omitted, try leaving out (but not deleting) master.cpp and any .c, .cpp, and .h files reported missing by Xcode in the project file.

- Add any extra .c, .cpp, and .h files, one at a time, from the folders named enid, engine, fpsgame, and shared to the corresponding folders in the Xcode project file.


--Popinman32 22:28, 6 August 2010 (UTC)

Maintained by Popinman32 and other MacOSX users.

FreeBSD

Unwritten