HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.18k stars 655 forks source link

How to compile with main inside src directory? #4140

Closed vance closed 9 years ago

vance commented 9 years ago

http://stackoverflow.com/questions/29476328/how-to-configure-haxe-build-file-hxml-to-build-from-src-directory

I'm trying to build a pre-existing HaxePunk project in sublime (switching away from FlashDevelop).

problem: Error: Could not process argument

-neko
-cp "c:/path/to/project/src"
-main Main

I've read somewhere that you shouldn't use the /src convention for your src files. That's annoying, since I want assets and binaries in their own directories separate from src files. How do I properly configure this?

nadako commented 9 years ago

I've read somewhere that you shouldn't use the /src convention for your src files.

That is clearly wrong. Where did you read that? Most haxe libraries use this convention.

The problem with your hxml file seems to be that there's no argument for -neko option.

vance commented 9 years ago

Sorry, I'm brand new to compiling Haxe with hxml, FD was such a crutch. So, some playing around (switching to swf target to avoid other errors). I changed targets and set my path to src manually , and this seems to work. Now on to getting the OpenFL assets and Haxepunk to work. Fingers crossed. =)

-swf game.swf
-swf-version 11.2
-cp c:/dev/haxe/garden-anxiety/src
-main Main
-lib actuate 
-lib HaxePunk
-lib lime
-lib openfl

P.S.

Maybe I misread this... it's a tip for making haxe libraries, not apps. http://old.haxe.org/doc/haxelib/using_haxelib

Usually, a user should be able to compile your sources by simply adding to the haxe commandline -cp path/to/myproject. Do NOT put the sources intended to be used by the end-user into a src package or another convention. For instance, if you don't have any package, the sources should be in the same directory as haxelib.xml.

nadako commented 9 years ago

This isn't really relevant to Haxe itself, but I think OpenFL actually generates hxml file based on its own project file, no matter what IDE/Editor you use. I mean, those hxml files are not meant to be used directly, but generated and then passed to the haxe compiler by openfl/lime build tool.