EmbeddedNim / picostdlib

Nim wrapper for the raspberry pi stdlib
MIT License
70 stars 11 forks source link

Add gitignore and setup command #36

Closed auxym closed 2 years ago

auxym commented 2 years ago

First of all, I tagged this PR WIP, because #33 should be resolved before merging the current PR. If I understand correctly, @beef331 probably plans on running CMake on every build. This renders the setup command not relevant anymore. However, the code in this PR for setup that runs CMake could be reused as-is for the build command.

That said, this PR introduces the following changes:

Add .gitignore file to the template.

It contains a single entry, csource/build. Moving all intermediate build outputs this subdirectory makes the separation of "source" with "build and intermediate outputs" clearer (see next point).

Nim generated C files are put in csource/build/nimcache

Currently they were in csource. This avoids mixing source that should not be ignored with intermediate files that should.

Template contains a single CMakeLists.txt file

It currently contained two files, one of which was copied as the in-use file depending on the dev's preference of downloading or reusing the pico SDK. Here I propose a single file, the SDK preference is passed in as a command-line option to CMake.

This simplifies the setup command and makes it possible for a project dev to customize their CMakeLists file while also sharing it with other devs that have different SDK preferences.

This change is somewhat backwards incompatible, but from my understanding, picostdlib is currently in a refactoring phase that includes other breaking changes, so hopefully this is acceptable.

Add the setup command.

The setup command currently does one thing: run CMake in order to generate the csource/build dir, which is ignored. Thus, after a fresh clone, or running git clean on a pico project, a dev needs to run piconim setup in the project root, optionally passing in their SDK preference, and they are ready to build. The readme file was also updated with information on this command.

Finally: sorry for the messy git history, please squash-merge this PR. Or let me know if I should squash on my end.

auxym commented 2 years ago

Just pushed a new commit that adds the csource dir to the include search path in CMakeLists.txt. It removes the need for piconim build to copy the nimbase.h to nimcache, which I had been doing.

casey-SK commented 2 years ago

Hey, this is good stuff. I merged #36 and #37 and did a bunch of refactoring afterwards. See comments on #37 .

auxym commented 2 years ago

Heya,

I'm not sure what the current plan is with #37, but it appears that we don't need to rerun CMake after all. Thus, I do believe that the setup command is relevant. Therefore, I think this PR can be merged as-is. Or, feel free to suggest changes such as changing the name of the setup command.

If everyone is OK with this LMK and I'll bump the version.