2020-01-06 00:04:16 +00:00
|
|
|
# Building CNQ3
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
## Toolchains
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
There are 3 supported build toolchains:
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
- Visual C++ on Windows x64
|
2020-02-25 09:37:02 +00:00
|
|
|
- GCC or Clang on Linux x64
|
|
|
|
- Clang or GCC on FreeBSD x64
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
## Directories
|
|
|
|
|
|
|
|
| Directory | Contains |
|
|
|
|
|:----------|:--------------------------------------------------------------|
|
2017-08-01 20:30:04 +00:00
|
|
|
| makefiles | premake script and pre-generated Visual C++ and GNU makefiles |
|
2020-01-06 00:04:16 +00:00
|
|
|
| .build | intermediate build files |
|
|
|
|
| .bin | final executables (and symbol database files on Windows) |
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
## Building on Windows with Visual C++ 2019 or later
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Requirements**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
|
|
|
- The %QUAKE3DIR% environment variable must be defined to the absolute path to copy the .exe and .pdb files to
|
2024-01-14 00:34:01 +00:00
|
|
|
- nasm.exe (Netwide Assembler) is in your path for building the client
|
|
|
|
- One of the following is true for building the client:
|
|
|
|
- The %DXCPATH% environment variable contains the full path to dxc.exe
|
|
|
|
- dxc.exe is already in your %PATH%
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Options**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
|
|
|
- The %CPMADIR% environment variable must be defined to the name of the mod directory for launching through the debugger
|
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Build steps**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
- Set the %QUAKE3DIR% environment variable
|
|
|
|
- Open makefiles\windows_vs2019\cnq3.sln or makefiles\windows_vs2022\cnq3.sln
|
2017-08-01 20:30:04 +00:00
|
|
|
- Build
|
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Notes**
|
|
|
|
|
|
|
|
- You don't need to set environment variables globally
|
|
|
|
- Instead, we recomment you set them for the Visual Studio process only
|
|
|
|
|
2017-08-01 20:30:04 +00:00
|
|
|
Here's an example batch script for opening the Visual Studio solution:
|
2024-01-14 00:34:01 +00:00
|
|
|
```batch
|
|
|
|
cd cnq3\makefiles\windows_vs2022
|
|
|
|
set QUAKE3DIR=C:\Programs\Q3\Dev
|
2017-08-01 20:30:04 +00:00
|
|
|
set CPMADIR=cpma_dev
|
2024-01-14 00:34:01 +00:00
|
|
|
set DXCPATH=C:\Programs\dxc\bin\x64\dxc.exe
|
|
|
|
start "" cnq3.sln
|
|
|
|
exit
|
2017-08-01 20:30:04 +00:00
|
|
|
```
|
2020-02-25 09:37:02 +00:00
|
|
|
With this set-up, you can press F5 and run the engine through the Visual C++ debugger on the right q3 install and right mod folder immediately.
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
## Building on Linux / FreeBSD with GCC / Clang
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Requirements**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
- On FreeBSD, we link against libexecinfo for the backtrace functions. We thus require FreeBSD 10.0 or later.
|
2020-01-06 00:04:16 +00:00
|
|
|
|
|
|
|
**Options**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
|
|
|
- The $(QUAKE3DIR) environment variable can define the absolute path to copy the executables to
|
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
**Build steps**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
|
|
|
- Navigate to the root of the repository
|
2024-01-14 00:34:01 +00:00
|
|
|
- Run `make [config=debug|release] all|server` to build on Linux
|
2020-01-06 00:04:16 +00:00
|
|
|
For FreeBSD, use `gmake` instead of `make`
|
|
|
|
|
|
|
|
**Notes**
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-02-25 09:37:02 +00:00
|
|
|
- To create the QUAKE3DIR variable in the build shell, you can use `export QUAKE3DIR=~/games/q3`
|
|
|
|
- To delete the variable from the build shell, you can use `unset QUAKE3DIR`
|
|
|
|
- On FreeBSD, Clang is now the default compiler
|
|
|
|
- For most Linux distros, GCC is still the default compiler
|
|
|
|
- To force building with Clang, you can use `CC=clang CXX=clang++` as make/gmake arguments
|
|
|
|
- To force building with GCC, you can use `CC=gcc CXX=g++` as make/gmake arguments
|
|
|
|
- You don't have to specify $(CPP), it's not used by any of the makefiles
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-01-06 00:04:16 +00:00
|
|
|
## Environment variables
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-02-25 09:37:02 +00:00
|
|
|
There are 3 environment variables used for compiling and debugging:
|
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
| Env. Var. | Meaning | Example |
|
|
|
|
|:----------|:------------------------|:--------------------------------|
|
|
|
|
| QUAKE3DIR | absolute directory path | C:\Programs\Q3 |
|
|
|
|
| CPMADIR | mod folder name | cpma |
|
|
|
|
| DXCPATH | full dxc.exe file path | C:\Programs\dxc\bin\x64\dxc.exe |
|
2017-08-01 20:30:04 +00:00
|
|
|
|
2020-02-25 09:37:02 +00:00
|
|
|
| Env. Var. | Windows | Linux / FreeBSD |
|
|
|
|
|:----------|:-------------------------|:----------------------|
|
|
|
|
| QUAKE3DIR | required for building | optional for building |
|
|
|
|
| CPMADIR | required for debugging | unused |
|
2024-01-14 00:34:01 +00:00
|
|
|
| DXCPATH | optional for building(1) | unused |
|
2017-10-28 01:35:51 +00:00
|
|
|
|
2024-01-14 00:34:01 +00:00
|
|
|
1) DXCPATH is optional if you already have dxc.exe in your PATH
|