Replies: 1 comment 5 replies
-
In the cmake based targets (C and Cpp), there is a target property called With regard to the cli argument, I think that many of our properties should actually be CLI arguments (or configuration options in an Epoch project). I would be absolutely in favour of introducing |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So the Rust build tool Cargo has a very useful feature called profiles. A profile is a collection of settings applied to build tasks, mostly to configure the optimisation level of the produced binary. The most important profiles are dev and release:
cargo build
for instance, as it's the one you'd want to use in a development setup (eg when running tests).cargo build --release
This 2-profiles model matches nearly all development flows, as the improved compile times of the dev profile are useful during development, and you infrequently need to build a highly optimised "release-ready" binary.
During development of the Rust target, I initially setup cargo to use the
--release
profile always, to enable optimisations. But this was a bad idea, as I realised much more recently that many debug assertions built into the runtime were being stripped from the test binaries.In #628 I changed that behavior to invoke the rust compiler with dev profile by default, using a target property to control that:
I think it's not a good long term solution, as I think the choice of release vs debug build should be made outside of the program source. The program is the same, only the deployment environment is different.
However, the CLI of lfc doesn't have an option to pass arguments to the target compiler, so we can't do for instance
$ lfc --compiler-args ' --release' Snake.lf
to pass the
--release
flag to cargo.I think we should at the very least add such an option to LFC's CLI. Maybe it might even make sense to make LFC adopt the same model as Cargo, ie, have a built in
--release
flag which enables (target-specific) optimisations. Wdyt?Beta Was this translation helpful? Give feedback.
All reactions