Skip to content

Latest commit

 

History

History
158 lines (99 loc) · 8.98 KB

readme-developer.md

File metadata and controls

158 lines (99 loc) · 8.98 KB

Build instructions

Most of the current development work is done on Ubuntu Linux. Building the code on any Linux variant should be relatively straightforward. Building it on Windows or Mac OS X is a bit more complicated.

You can get a copy of the code either using "git clone," or using the repo's download button to obtain a .ZIP archive. The game's root directory, where your unzipped/git cloned files reside, will be your starting point for compiling the game.

How you build Endless Sky will then depend on your operating system:

Linux

Use your favorite package manager to install the following (version numbers may vary depending on your distribution):

DEB-based distros:
  • g++
  • scons
  • libsdl2-dev
  • libpng-dev
  • libjpeg-dev
  • libgl1-mesa-dev
  • libglew-dev
  • libopenal-dev
  • libmad0-dev
  • uuid-dev
RPM-based distros:
  • gcc-c++
  • scons
  • SDL2-devel
  • libpng-devel
  • libjpeg-turbo-devel
  • mesa-libGL-devel
  • glew-devel
  • openal-soft-devel
  • libmad-devel
  • libuuid-devel

Then, from the project root folder, simply type:

    $ scons
    $ ./endless-sky

The program will run, using the "data" and "images" folders that are found in the project root. For more Linux help, and to view other command-line flags, consult the man page (endless-sky.6), by running man endless-sky in the project directory. The program also accepts a --help command line flag.

To compile and also run unit tests, the "test" target can be used:

  $ scons test

The produced test binary will be invoked with a reasonable set of arguments. To run any test benchmarks, you will need to invoke the test binary directly. Refer to the build pipeline definitions for the current required arguments. More information on unit tests can be found in the project's "tests" directory, or by running the binary with the --tests flag.

Windows

Two methods of building the game on Windows are supported. The official build is done on the command-line with the Scons program, but the game may also be built using the Code::Blocks IDE. Both require a MinGW toolchain and the precompiled libraries linked below.

MinGW provides the tools used to compile the source code into the game's executable. For most cases, you should download the MinGW-W64 Online Installer. When installing, use the following settings:

  • Version: 8.1.0 (or greater; this document assumes 8.1.0)
  • Architecture: x86_64
  • Threads: posix
  • Exception: seh

Endless Sky requires precompiled libraries to compile and play: Download link

The zip can be extracted anywhere on your filesystem; to minimize additional configuration, you can move the dev64 folder to C:\.

Building with Scons

If you want to build the game from the command line via Scons, you will need Python 3.8 or later. When installing, be sure to select the "Add to PATH" checkbox.

Afterwards, you will need to add your MinGW installation to your path manually. To do so on Windows 10, to to Settings > System > About > System info or Related Settings > Advanced system settings > Environment Variables. From each, select Path under System variables, and click Edit.

If you used the defaults for MinGW up to this point, add "New" and enter the following in separate entries:

  • C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
  • C:\Program Files (x86)\Git\usr\bin\ or C:\Program Files\Git\usr\bin\, depending on which you have installed

From there, restart your command line if you had one open, and simply cd to your Endless Sky directory, then type mingw32-make.exe -f .winmake. (make's standard -j N flag is supported, to increase the number of active parallel build tasks to N.)

IMPORTANT: Before the game will run the first time, you will need to skip down to the instructions at Running the game below.

Building with Code::Blocks

If you instead want to build the game with a visual IDE, then you can use Code::Blocks, the main supported IDE for Endless Sky on Windows. As you have already installed a compiler via MinGW, you should select a version without one.

After you install it, Code::Blocks will likely detect a "GNU GCC Compiler" from MinGW. Select this as your compiler, then take these steps to configure it:

  • Go to Settings > Compiler > Global Compiler Settings > Toolchain Executables. Set the Compiler's installation directory to C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin, if you followed the default MinGW installation process above.
  • Modify Linker for static libs from ar.exe to gcc-ar.exe.

After this, the game should be ready to compile. Use Code::Blocks to open the "EndlessSky.workspace" (not EndlessSky.cbp) file in the directory where you've cloned the game's code. This workspace consists of three projects: one for the majority of source code, one for the game binary, and one for the unit tests. As with most IDE-based projects, you must explicitly add new files to the respective project for them to be compiled.

With the workspace open, you can double-click a project in the left-hand menu to activate that project, binding the toolbar & keyboard shortcuts for "Build," "Run,", "Build & Run," etc. to it, no matter which file is being edited.

For example, when making lots of changes to the game, you will generally have the "endless-sky-lib" project active, so that you can ensure changes compile without needing to fully link things together into the actual game binary. After making changes, you would then activate the "EndlessSky" project and use the "Build & Run" option with the "Release" target, which will fully link the compiled code into the small, performant executable.

You can continue making tweaks to files that belong to the "endless-sky-lib" project without reactivating it, so that "Build & Run" will still launch the game with your latest tweaks. Should you experience some show-stopper bug in your modified game, you would then change to the "Debug" build target to help determine the source(s) of the issue.

IMPORTANT: Before the game will run the first time, you will need to skip down to the instructions at Running the game below.

Building with other IDEs

Refer to the build pipeline files under .github\ to tailor the build process to your chosen IDE.

Running the Game

For Endless Sky to run on Windows, it needs various .dll files included in the base directory. Go to C:\dev64\bin\, and copy the files to your base directory. These should include:

  • glew32.dll
  • libgcc_s_seh-1.dll
  • libjpeg-62.dll
  • libmad-0.dll
  • libpng15-15.dll
  • libstdc++-6.dll
  • libturbojpeg.dll
  • libwinpthread-1.dll
  • OpenAL32.dll
  • SDL2.dll
  • soft_oal.dll
  • zlib1.dll

After you have copied all those libraries, take note of the bolded libraries. Those will need to be included from your MinGW installation, instead of from the precompiled ones. By default, you can go to C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin, and copy those libraries to your Endless Sky directory to overwrite the current ones.

Once all the libraries in place, the game is ready to run! You have three options depending on how you built it:

  • If you built the game via Scons, open a terminal to the base Endless Sky directory, then run bin\pkgd\release\endless-sky.exe.
  • If you built the game via Code::Blocks, double click EndlessSky in the file panel on the left, then either click the green arrow on top, or hit Control+F10.
  • If you want to run the game manually, use one of the methods above to build the game, then copy an executable from under the bin\ folder to your base directory, then open the game.

macOS:

To build Endless Sky with native tools, you will first need to download Xcode from the App Store.

Next, install Homebrew. Once it is installed, use it to install the libraries you will need:

  $ brew install libmad libpng jpeg-turbo

Homebrew will install the latest version of the libraries, so if the versions of those libraries are different from the ones that the Xcode project is set up for, you will need to modify the file paths in the “Frameworks” section in Xcode. (Occasionally, the Xcode project will be updated to reflect these new versions.) It is possible that you will also need to modify the “Header Search Paths” and “Library Search Paths” in “Build Settings”, in case your Homebrew for Intel Mac installation does not use the standard /usr/local prefix. The first time you build the project, a library for the SDL framework will be downloaded.

Note: there is extremely limited development support for macOS, and no intent to support macOS's new ARM architecture.