ninja-build / ninja

a small build system with a focus on speed
https://ninja-build.org/
Apache License 2.0
11.3k stars 1.61k forks source link

$pwd #1152

Open bkaradzic opened 8 years ago

bkaradzic commented 8 years ago

It seems that everything is relative to directory from where ninja is invoked, not relative to current location of ninja file. This makes really confusing when creating common ninja files that are included from multiple places.

I couldn't find $pwd, but it would fix this issue. In some common file I would have global builddir defined for all projects, and inclusion of that common.ninja file wouldn't cause directory to move around depending on from where it's included.

builddir = $pwd/../.build

This is my usage: https://github.com/bkaradzic/bgfx/blob/master/scripts/common.ninja https://github.com/bkaradzic/bgfx/blob/master/examples/assets/meshes/build.ninja

Or maybe there is better way to do this?

zlolik commented 8 years ago

At first look I was confused too, look at #1119. My ninja-files are written by generator (python script with https://github.com/ninja-build/ninja/blob/master/misc/ninja_syntax.py) and if I want to build project in another directory - first I run build script - and it found $pwd and set builddir carefully. And this approach was useful for me when one project become subproject of bigger one - simple call of generator function with subdirectory as parameter.

jhasse commented 5 years ago

$pwd would be the location of the current ninja file or the directory from where ninja is invoked?