Skip to content

An example C project using CMake that can interface with Nim code

License

Notifications You must be signed in to change notification settings

stoneface86/example-nim-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example-nim-cmake

An example C project using CMake that can interface with Nim code. You can use this as a template for a C/C++ project that will interface with Nim code, or integrate it into an existing project.

This example uses the code from the Nim Backend Integration manual page. The fib proc is exported and compiled as a static library which can then be called from our C application. The entire application is built using CMake.

Requirements

  • CMake (3.8 or higher)
  • A C compiler (MSVC, GCC or Clang, others will require configuration)
  • Nim (1.6.0 or higher)

Project layout

  • cmake/
    • FindNim.cmake - CMake Find module for locating nim and nimble
  • src/
    • nim/
      • Nim source code
      • CMakeLists.txt
    • C source code
    • CMakeLists.txt
  • CMakeLists.txt

Contributing

Feel free to submit an issue/PR. Open to comments, suggestions, improvements.

License

All code in this repo is available to the public domain. See LICENSE for details.

About

An example C project using CMake that can interface with Nim code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published