'How do I build Nim library packages
I've created a nimble library package as per the documentation. When I try to build it using nimble build
I get the following error.
Error: Nothing to build. Did you specify a module to build using the
bin
key in your .nimble file?
I can do this and it does fix the error but according to the documentation adding the bin
key to the .nimble
file turns my package into a binary package.
Other things I have tried:
- Use
nimble install
: This does not appear to verify that my code will actually compile and will happily install anything to the local package directory (I added a C# class to my.nim
file, for example, and it was successfully installed). - Use
nimble c
: This works but I have to pass in the path to thenim
file I want to compile and thebinDir
entry in the.nimble
file is ignored resulting in the output being placed in the same directory as the file being built. This complicates the development cycle because I have to manually clean up after the compiler. - Use the compiler directly. This is pretty much the same as the previous option with the same flaws.
I guess I could also create a separate .nim
file and import my library after it is installed but this is a big overhead for just wanting to verify that a package in the early stages of development will actually compile.
I just want to be able to verify that the source code in my library package is syntactically correct and will compile. How is this meant to be done for library packages?
Solution 1:[1]
From your provided link to the nimble package manager documentation I have the feeling that
https://github.com/nim-lang/nimble#tests
is what you are looking for. But I have never used the test command, so I am not sure. I do my test manually still, I read the nimble docs maybe 4 years ago and can not really remember. And currently there is much package manager related work going on, I heard there is a new, alternative package manager called nimph, and from a forum thread I think I read something that nimble is going to change and improve also. Maybe you should consider subscribing to the Nim forum, that is the place where the bright Nim devs are. Well, at least a few of them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Salewski |