5 ms·
Regarding CMake’s horrific documentation: I will literally be willing to pay money for someone who can show me how/if it’s possible to wire in a different langu
by girvo 4y ago
Regarding CMake’s horrific documentation: I will literally be willing to pay money for someone who can show me how/if it’s possible to wire in a different language to CMake! I believe it’s possible, I’ve seen some functions deep in the crappy docs that make it look like it is, but I cannot for the life of me work it out. The language in question produces C object files!
- AlotOfReading 4y agoCMake is pretty simple internally. Every "keyword" is a function call. Every function call is implemented as a class. The simplest way to hijack it would be to have a function that calls out to your external interpreter/tool with the state you want. I could see doing that in a couple of ways: * Add a builtin command [1] that takes a string or filename and calls the interpreter with any additional data you want to pass. * Add a flow control command [1] that passes the inline block to the interpreter of your choice. You'd probably have to override cmFunctionBlocker as well for this. Note that this can't fix the deep design issues in CMake like the insane string representation. And no, I'm definitely not in therapy from CMake-induced PTSD. [1] https://github.com/Kitware/CMake/blob/master/Source/cmCommands.cxx#L120 https://github.com/Kitware/CMake/blob/master/Source/cmComman...
- girvo 4y agoChampion! That’s exactly what I’ve been looking for haha I’m trying to remove the need for external commands to compile Nim when used with ESP-IDF for embedded firmware development, which is dependent on CMake. Going to take a crack at this today :)
- Abishek_Muthian 4y agoHave you replaced writing C code for ESP with writing Nim and compiling it to C instead?
- girvo 4y agoThat’s exactly what we’re doing, yeah. --compileOnly gets pretty far, and I’d love to remove the need for having to run that compilation step separately before CMake builds the firmware from the generated C sources
- Abishek_Muthian 4y agoExcellent, I've been hearing good things about Nim. I'm eager to try it out soon for a embedded project.
- girvo 4y agoYou'll find me (and some others) in the #embedded channel on Nim's Discord/Matrix if you have questions!
- Abishek_Muthian 4y agoYay! Thank you.