Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

68 linhas
3.6 KiB

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