c3c icon indicating copy to clipboard operation
c3c copied to clipboard

wrong location of build artefact when building project

Open BluBloos opened this issue 1 year ago • 4 comments

I downloaded and unzipped to get a folder containing c3c.exe. I navigated cmd.exe to the folder. I ran: c3c init project. I ran: c3c compile project. main.exe was created in the same folder level as c3c.exe, whereas I expected main.exe to be created within the build folder belonging to the project.

BluBloos avatar Sep 20 '24 10:09 BluBloos

Two things:

  1. If you use c3c compile project it is actually saying "compile all the source files in the 'project' folder'. Use c3c build instead.
  2. If you build a project, then the .exe will end up in the same directory as the project.json by default. This behaviour can be overridden.
  3. The build folder is intended for intermediate build artifacts.

lerno avatar Sep 20 '24 13:09 lerno

Thanks for the response!

I misunderstood the purpose of the build folder because I skimmed https://c3-lang.org/guide/my-first-project/ and assumed the build folder is not only where intermediate build artifacts go but all artifacts.

As a first-time user, I think it's confusing that there are two commands compile and build. If I were to suggest a change, it would be to have just one command compile. The compile command would build all source files in a folder unless it recognizes that the folder is a project, in which case it builds the project. That being said, maybe this is another case of my lack of understanding for why there are two commands.

BluBloos avatar Sep 21 '24 09:09 BluBloos

They act quite differently. build takes a single "target" argument, which is what target in the project.json file one wishes to compile for, e.g. c3c build mygame-testversion, whereas compile is to just straight go and compile individual files, without a project, e.g. c3c compile foo.c3 bar.c3 baz.c3

lerno avatar Sep 21 '24 11:09 lerno

There is also compile-run (compile files and run them), and run (build the target and run it)

lerno avatar Sep 21 '24 11:09 lerno

Can I close this?

lerno avatar Nov 04 '24 22:11 lerno