Skip to content

Instantly share code, notes, and snippets.

@jrhemstad
Last active May 27, 2024 07:34
Show Gist options
  • Save jrhemstad/811d1e41af9685670241fa472170ef32 to your computer and use it in GitHub Desktop.
Save jrhemstad/811d1e41af9685670241fa472170ef32 to your computer and use it in GitHub Desktop.
How to build with Ninja

How to Use Ninja

  1. Install Ninja
sudo apt install ninja-build
  1. Configure CMake to create Ninja build files
mkdir build && cd build
PARALLEL_LEVEL=N cmake -GNinja ..
  • Fill in N with an appropriate number of threads for your system.
  1. Build
ninja

That's it!

How to create a Ninja Trace

  1. Get ninjatracing
git clone https://github.com/nico/ninjatracing.git
  1. Use ninjatracing to convert log file into a Chrome trace file
./ninjatracing.py build/.ninja_log > trace.json
  1. Open trace file in Chrome
    • Enter chrome://tracing in the URL bar of Chrome
    • Click "Load" button on top left and select the trace.json file

ninja_trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment