jimon / premake-ninja

Premake extension to support Ninja
MIT License
58 stars 17 forks source link

Add support for custom toolsets and enforce root-relative paths #34

Open lochnessdragon opened 2 months ago

lochnessdragon commented 2 months ago

Changes

Ninja expects all paths to be relative to the root ninja folder

(see: Issue 997 in ninja-build/ninja) Ninja expects paths to files to be relative to the root build file. Unfortunately, premake has no way of telling this to the toolsets, but we can work around this limitation by tricking them into generating paths relative to the workspace directory. See lines 255-262 and 273-280 for specifics.

RC files shouldn't be supported on targets other than windows

Since platforms like macos and linux don't integrate support for rc/res files, the "rc" rule shouldn't be generated. This removes the expectation that every toolset has a rc file command and allows support for custom toolsets, like emscripten, that don't support rc files.

Custom toolset support

Added simple support for custom toolset. Ninja will check for the function clang_like() on toolsets and if it returns true, will generate compilation rules using the gcc/clang branch of the conditional in compilation_rules(...).

Associated Issues

Fixes #32

Jarod42 commented 2 months ago

Better to split PRs.

tritao commented 1 month ago

Since platforms like macos and linux don't integrate support for rc/res files, the "rc" rule shouldn't be generated. This removes the expectation that every toolset has a rc file command and allows support for custom toolsets, like emscripten, that don't support rc files.

Do you remember which error you hit with Emscripten?

I have been using Ninja with https://github.com/tritao/premake-emscripten and so far have had no issues related to rc.