prusa3d / Prusa-Firmware-MMU

Other
32 stars 15 forks source link

🚧 WIP: create library for application and link into all executables #248

Closed gudnimg closed 1 year ago

gudnimg commented 1 year ago

Just an idea I'm playing with.

Currently it takes around 60 seconds and 640 steps to compile and link the unit tests.

With this PR I've reduced it to 40 seconds and 231 steps.

[build] [639/640 99% :: 63.743] Linking CXX executable tests\unit\logic\failing_tmc\failing_tmc_tests.exe

DRracer commented 1 year ago

@gudnimg how do we handle scenarios when one source file needs to be compiled with different #defines? AFAIK at least motion.h/cpp is one of them.

gudnimg commented 1 year ago

@gudnimg how do we handle scenarios when one source file needs to be compiled with different #defines? AFAIK at least motion.h/cpp is one of them.

I don’t think we are handling that at all currently. I would need to double check when I have time.

My first approach to this would be to create another header file which redefines these #define’s OR somehow redefine them in the cpp file above all the includes.

I think there is a lot of potential to make the build more efficient regarding application.exe. I may play more with this next week if I need something to tinker with 🤓

One thing I don’t like about my current Pull Request is the linking of application.exe into ALL tests. Most of the test don’t require it.