niv / neverwinter.nim

CLI tools and nim library used in Neverwinter Nights: Enhanced Edition development
MIT License
131 stars 29 forks source link

nwn_script_comp: Cannot compile an include file on its own #99

Open PhilippeChab opened 11 months ago

PhilippeChab commented 11 months ago

Description

This feature was added in the nwnsc and was useful for the language server. It would be neat to have it available in the nwn_script_comp as well.

mtijanic commented 11 months ago

I can see how it could be useful, but also I would definitely want the "no main function" to be an error by default. This could be a flag to the nim frontend, to just generate a temporary file like

#include "actual_file"
void main() {}

and compile that, discarding the result.

Would you need this in burst mode too, or just when compiling a single include?

PhilippeChab commented 11 months ago

It is actually what I would have done on my end if it was not going to be supported.

A flag parameter would be perfect.

The most complex case I need to support is the following:

With const_cli.nss being an include:

#include "const_colors"
#include "inc_database"

...

~I would need to be able to compile all 3 includes at once.~

EDIT: With the --dirs flag and children includes loaded in resman, I only need this for a single include.