HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
291 stars 186 forks source link

Cmdline options containing a "-" wont be parsed. #262

Closed dazKind closed 9 years ago

dazKind commented 9 years ago

I have a flow project which results in the following Options.txt:

arch-32=1
arch_32=1
client=1
desktop=1
enhaxe=1
enhx_use_xmp=1
foo3d=1
format=1
haxe3=1
haxe_ver=3.3
haxebullet=1
hscript=1
hx-nanovg=1
hx_nanovg=1
hxcpp=1
hxcpp_api_level=321
hxcpp_static_std=1
hxtypedarray=1
no-compilation=1
no_compilation=1
snow=1
snow_module_audio_openal=1
snow_module_input_sdl=1
snow_module_windowing_sdl=1
snow_native=1
source-header=Generated by Haxe
spod_macro=1
windows=1
hxcpp=C:\HaxeToolkit\haxe\lib\hxcpp/git/

When flow generates a cmdline for hxcpp to be run it adds arch-32=1 and the rest after the defines. hxcpp wont parse this option and fail with an error.

Upon review I found the cause to be a regexp in /tools/BuildTool.hx @ line 992: ~/^[a-zA-Z0-9_]*=/. This regexp is missing a "-". If I add it & rebuild hxcpp all is fine and works as expected.

ruby0x1 commented 9 years ago

Originally the options.txt were in flux, flow was passing them around. But since hxcpp has nailed that down, the passing of the options on cli from flow was not needed. Earlier today I had already removed this so the error shouldn't present on git versions of haxe.

It should still probably be patched to support the - in the regex though.

hughsando commented 9 years ago

If it is a valid haxe-define, it should not break the tool. Tweaking the regex seems like a good idea.

On Fri, Aug 7, 2015 at 2:47 AM, Sven Bergström notifications@github.com wrote:

originally the options.txt were in flux, flow was passing them around. But since hxcpp has nailed that down, the passing of the options on cli from flow was not needed. Earlier today I had already removed this https://github.com/underscorediscovery/flow/commit/466ff602b3cccd3d2390a72c8dc2d6787f215663 so the error shouldn't present on git versions of haxe.

It should still probably be packed to support the - in the regex though.

— Reply to this email directly or view it on GitHub https://github.com/HaxeFoundation/hxcpp/issues/262#issuecomment-128471834 .