Debian Codegraph @

projects/scripts/README.md

raw symbols SCIP
1 Here are dependency-less build scripts for raylib projects.
2
3 ## Dependencies
4 The scripts, as mentioned above, do not have dependencies. There's one
5 exception to this however, and that is Windows, because Windows
6 doesn't have a built-in C compiler. On Windows, you'll need to install
7 [Visual Studio][visual-studio] or the [build tools][vs-tools]. If you
8 didn't install them in the default location, write your changes around
9 line 38 of [`build-windows.bat`](build-windows.bat).
10
11 ## Script customization
12 First of all, the scripts have a few variables at the very top, which
13 are supposed to be configured for each project separately:
14 - `GAME_NAME` variable is used for the executable name.
15 - `SOURCES` is a list of .c source files, divided by spaces, which are
16 going to be compiled and linked with raylib to create the final
17 executable. You can use wildcards, so if you have all your .c files
18 in a directory called `src`, you can just set `SOURCES` to
19 `../../src/*.c`. Note: the paths should be either absolute, or
20 relative to `builds/platform`, hence `../../`.
21 - `RAYLIB_SRC` should point to the raylib/src directory. In this case,
22 it's `../../src`, but as with the `SOURCES`, if the path is
23 relative, it should be relative to `temp/debug`, so it's actually
24 `../../../../src`.
25
26 ## Compilation flags
27 - `-Os` (`/O1` with MSVC, `-O2` with clang\*) is used for release
28 builds, to save space. Since it's a good practice to make your games
29 run on the slowest possible systems, only a few games would benefit
30 from additional runtime performance on almost all systems. Other
31 flags: `-flto` (`/GL` and `/LTCG` for MSVC) in release builds, `-O0
32 -g` (`/Od /Zi` for MSVC) in debug builds.
33 - `-Wall -Wextra -Wpedantic` (`/Wall` for MSVC) are used for warnings.
34
35 \* Clang 7.0.1 seems to have problems compiling with `-flto` and `-Os`
36 enabled at the same time, so `-Os` is replaced with `-O2` for clang.
37
38 ## Command line arguments
39 The build scripts accept some flags, which can be given either one at
40 a time (`-d -c -r`) or in bunches (`-dcr`). Here's a description of
41 all of the flags.
42 - `-h` Describes all the flags, and a few example commands
43 - `-d` Faster builds that have debug symbols, and enable warnings
44 - `-u` Run upx\* on the executable after compilation (before -r)
45 - `-r` Run the executable after compilation
46 - `-c` Remove the temp/(debug|release) directory, ie. full recompile
47 - `-q` Suppress this script's informational prints
48 - `-qq` Suppress all prints, complete silence
49 - `-v` cl.exe normally prints out a lot of superficial information, as
50 well as the MSVC build environment activation scripts, but these are
51 mostly suppressed by default. If you do want to see everything, use
52 this flag.
53
54 \* This is mostly here to make building simple "shipping" versions
55 easier, and it's a very small bit in the build scripts. The option
56 requires that you have upx installed and on your path, of course.
57
58 #### Examples
59 | What the command does | Command |
60 |-------------------------------------------------------------|---------------------------|
61 | Build a release build, on Windows | `build-windows.bat` |
62 | Build a release build, full recompile, on Linux | `./build-linux.sh -c` |
63 | Build a debug build and run, on macOS | `./build-osx.sh -d -r` |
64 | Build in debug, run, don't print at all, on Linux with `sh` | `sh build-linux.sh -drqq` |
65
66
67 [visual-studio]: https://visualstudio.microsoft.com/downloads/#visual-studio-community-2017
68 [vs-tools]: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017