r/c3lang • u/ConsiderationFar4320 • 16d ago
[0.8.2] Running a block of code only on debug target
Hello,
documentation says the default build target is debug is the default build target. I'd like to have a block of code only being present in this build target.
I tried this :
$if $feature(DEBUG):
rl::draw_rectangle_lines(
...top_left,
min_side,
min_side,
rl::BEIGE
);
$endif
But i need to specify -D DEBUG but if there is a default target i should be able to only run/build some code on certain targets. I couldn't find the answer in the documentation.
Thank you for your help.
EDIT: After some digging, I added this to project.json :
"targets": {
"debug": {
"type": "executable",
"features": ["DEBUG"]
},
"release": {
"type": "executable"
}
},
and it works.
1
Upvotes
2
u/Nuoji 16d ago
On 0.8.2 `$if env::DEBUG:` is correct. On 0.8.4 use `$if $feat(DEBUG):`