squattingmonk / nasher

A build tool for Neverwinter Nights projects
MIT License
43 stars 17 forks source link

set nwn_script_comp as default compiler #113

Closed tinygiant98 closed 8 months ago

tinygiant98 commented 11 months ago

This commit sets nwn_script_comp as the default compiler and reuses the configuration options nssCompiler and nssFlags. nwn_script_comp output is read through peg and modified to appear nasher-organic.

Went a few different directions on this integration, so would appreciate feedback on the current incarnation. I've been away from nim for about six months, so I'm sure it can be written more efficiently. Flame awy.

I'd like to add a feature where the user can specify nssCompiler and nssFlags per target, or for a way to switch within the package. As I tested the various errors that nwn_script_comp provides, although generally much better than nwnsc, there are some that are much less informative. It would be handy to have a target that compiles with nwnsc when running into those specific errors where nwnsc would be a better compiler. Currently this is not possible as config opts are not overwritten by user-defined flags, but I'll look into it.

getFlags, though compiler-specific, was left in compile.nim instead of compiler.nim due to the requirement for opts and target, which cannot be included in compiler.nim without circular reference.

I've tested this against small module builds, single file compilation and various nasher commands, and it seems to work correctly. If you have nssCompiler and nssFlags set for nwnsc, nasher will not default to nwn_script_comp until you unset those options or reset nssCompiler to ../nwn_script_comp[.exe]. The nssFlags can be unset completely to allow nasher to build the option line, or can be set with flags per-target. Only tested on windows.

Documentation changes are still a WIP.

squattingmonk commented 8 months ago

Merged manually in 1cb7993 due to conflicts.