Difference between revisions of "Fs2 open on Linux/Compiling"

From FreeSpace Wiki
Jump to: navigation, search
(then asks the barman for another one ...)
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Page Navigation|
 +
BookName=[[The fs2_open on Linux Guide]]|
 +
CurrentPage=Compiling|Compiling|
 +
PrevPage=[[Fs2_open on Linux/Optimization|Optimization]]|
 +
NextPage=[[Fs2_open on Linux/Compile Script|Compile Script]]}}
 +
<p></p>
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 +
 +
<h1>Compiling The Source Code</h1>
 +
 +
The source code can now be compiled to a desired binary. This binary can be in 3 variants:
 +
 +
<ol>
 +
<li>Release - Good for playing the game normally</li>
 +
<li>FastDebug - Used to find errors during gameplay (Used for mod level debugging)</li>
 +
<li>Debug - Used to find errors on a code level. Please check this if the user wants to develop and debug the code further</li>
 +
</ol>
 +
 +
<h2>For New Users - Compile Using Visual Studio Code</h2>
 +
 +
To compile the code in Visual Studio Code, the user must first set the desired build variant. To select this, the user must:
 +
 +
<ol>
 +
<li>Open the Command Palette (CTRL + SHIFT + P)</li>
 +
<li>Search or Type CMake: Select Variant<li>
 +
<li>Select the desired variant</li>
 +
<li>
 +
Build the code by using any of the following methods:
 +
    <ol>
 +
        <li>Open Command Palette and type CMake: Build</li>
 +
        <li>Press the Build button</li>
 +
    </ol>
 +
</li>
 +
</ol>
 +
 +
<h2>The Build Artifacts</h2>
 +
 +
The build artifacts should be inside the build directory. The full path of the binary must be:
 +
 +
${workspaceFolder}/build/bin/fs2_open_<version>_<instruction_set>-<variant>
 +
 +
The version will be the version of the source code.
 +
 +
Instruction Set will denote which type of CPU SIMD instructions are executed, SSE2 or AVX.
 +
 +
Variant will be the type of variant that the user selected earlier.
 +
 +
For eg. File name for the version 24.2.0, instruction set of AVX and of debug variant will be
 +
 +
fs2_open_24_2_0_AVX-debug
 +
 +
If you see the build in the build directory, congratulations! The binary is ready to be used to play and debug!
 +
 +
<hr>
 +
 
Run from within your fs2_open directory:
 
Run from within your fs2_open directory:
 
  $ make
 
  $ make
 
Sit back and enjoy gcc work its magic.<br>
 
Sit back and enjoy gcc work its magic.<br>
 
You will find the binary executable in <i>code/</i> as either fs2_open_r if you built a release build or fs2_open_d if you built a debug build.
 
You will find the binary executable in <i>code/</i> as either fs2_open_r if you built a release build or fs2_open_d if you built a debug build.
 +
 +
NOTE: in 3.6.15 and higher, quiet compiles are turned on by default.  To get a verbose compile:
 +
$ V=1 make
 +
Also, the binary executable in <i>code/</i> is now called fs2_open_3.6.15 and fs2_open_3.6.15_DEBUG
 +
 +
[[Category:FreeSpace Open on Linux|Compiling]]

Latest revision as of 07:23, 22 April 2025

« Optimization The fs2_open on Linux Guide
Compiling
Compile Script »

Note: This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.

Compiling The Source Code

The source code can now be compiled to a desired binary. This binary can be in 3 variants:

  1. Release - Good for playing the game normally
  2. FastDebug - Used to find errors during gameplay (Used for mod level debugging)
  3. Debug - Used to find errors on a code level. Please check this if the user wants to develop and debug the code further

For New Users - Compile Using Visual Studio Code

To compile the code in Visual Studio Code, the user must first set the desired build variant. To select this, the user must:

  1. Open the Command Palette (CTRL + SHIFT + P)
  2. Search or Type CMake: Select Variant
  3. Select the desired variant
  4. Build the code by using any of the following methods:
    1. Open Command Palette and type CMake: Build
    2. Press the Build button

The Build Artifacts

The build artifacts should be inside the build directory. The full path of the binary must be:

${workspaceFolder}/build/bin/fs2_open_<version>_<instruction_set>-<variant>

The version will be the version of the source code.

Instruction Set will denote which type of CPU SIMD instructions are executed, SSE2 or AVX.

Variant will be the type of variant that the user selected earlier.

For eg. File name for the version 24.2.0, instruction set of AVX and of debug variant will be

fs2_open_24_2_0_AVX-debug

If you see the build in the build directory, congratulations! The binary is ready to be used to play and debug!


Run from within your fs2_open directory:

$ make

Sit back and enjoy gcc work its magic.
You will find the binary executable in code/ as either fs2_open_r if you built a release build or fs2_open_d if you built a debug build.

NOTE: in 3.6.15 and higher, quiet compiles are turned on by default. To get a verbose compile:

$ V=1 make

Also, the binary executable in code/ is now called fs2_open_3.6.15 and fs2_open_3.6.15_DEBUG