# Build helper (/docs/reference/build-helper)

Build, test and launch CHUDCS2 through build.sh.

`build.sh` configures CMake, builds into `build/`, and optionally runs tests or launches the application. Run it from the repository root. It changes to its own directory before configuring.

```bash
./build.sh
```

The default is a Release build with the C++ test target enabled. Tests run only when `--test` is requested. Install the dependencies in [Installation](/docs/installation) first.

## Options [#options]

| Option          | Effect                                                                            |
| --------------- | --------------------------------------------------------------------------------- |
| `-h`, `--help`  | Print usage and exit.                                                             |
| `-s`, `--start` | Launch after a successful build, using sudo unless already root.                  |
| `-t`, `--test`  | Run CTest after building. A failure stops the script before launch.               |
| `-c`, `--clean` | Delete `build/` before configuring.                                               |
| `-d`, `--debug` | Select a Debug build instead of Release.                                          |
| `--no-tests`    | Configure without the C++ test target. Cannot be combined with `--test`.          |
| `--`            | End helper options and pass remaining arguments to the executable when launching. |

`--clean` removes everything under `build/`, including profiles and locally authored grenade data stored beside the executable. Back up those files first. See [Manage profiles](/docs/guides/profiles) and [Grenade authoring](/docs/guides/grenade-authoring).

## Examples [#examples]

Build and run the C++ tests:

```bash
./build.sh --test
```

Build and launch with X11/XWayland:

```bash
./build.sh --start -- --x11
```

Build Debug, run tests, then launch:

```bash
./build.sh --debug --test --start
```

Build without the test target:

```bash
./build.sh --no-tests
```

Builds run as your current user. The helper requests sudo only for launch. It does not start CS2 for you.

## Manual CMake builds [#manual-cmake-builds]

Use the manual commands in [Development](/docs/guides/development) when you need another build directory or a custom `CHUDCS2_MARCH` CPU target. The helper fixes its build directory to `build` and exposes only the options above.
