Wanager (aka wng) is a package manager & build tool (like cargo for Rustlang) for the C programming language written in Rust. It allow you to create projects, headers, to install libraries & to compile and run fast and easily.
Make sure to have Git & gcc installed on your computer.
To install wng you can either :
- Download the latest binary in the releases
- Download updater.sh (Nix only and needs cargo)
- *Note : you can setup a cron to keep an up to date wng version 😉
- Run cargo install wng
- In /bin/ if you are on *nix
- In C:\Program Files\ if you are on Windows
Open the command prompt and run :
$ wng new <project_name>
$ cd project_name/
Three folders have been created, tests/
, src/
and build/
In src/
, you'll find file main.c
that contains a basic hello world program.
``` $ wng build
$ wng run
NOTE : wng build
will build a debug executable, with flags -W -Wall -Werror -Wextra. To disable this, build in release mode with : wng build --release
To build with a custom build, you have to create a build.py
or build.rb
file with your code to build.
If you want to specify a special python / ruby interpreter path, add the section "pyinterpreter" : "path2python"
or "rbinterpreter" : "path2ruby"
to your project.json.
Minimal python version required : 3.5 Minimal ruby version required : 2.3
Then run your script with wng build --custom
Wngbuild library provides some useful features to compile your project
It is available in Ruby and Python
Note : If both build.rb & build.py files exists, build.py will be used
```py from wngbuild import * # Import all from wngbuild module
build = BuildProfile(files="src/*.c",output="build/custom/prog.exe" ) # setup a build profile that will compile all files in src/ and place the binary in build/custom/prog.exe build.cc = "C:\MinGW\bin\gcc.exe" # Setup the compiler (optional, by default "gcc") build.flags = "-W -Wall -Werror -Wextra" # Setup the flags that the command will be run with (optional)
build.run() # Run the compilation command build.runOutput() # Run the binary produced by the compilation command (Will raise an error if the compilation command fails) ```
```rb require_relative "wngbuild"
build=BuildProfile.new("src/*.c", "build/custom/prog") * Setup a build profile builc.cc="C:\Program Files\clang\bin\clang.exe"
build.run() * Run compilation build.runOutput() * Run produced file (Will raise an error if compilation failed) ```
You can just check if there is any errors or warnings in your code without producing any binary with wng check
To create a gunzip archive of your project files, just run wng archive
and a file called project.tar.gz
will be created
$ wng reinit
Really want to reinit ? Y/N : Y
Project renitialized !
``` $ wng header foo $ cat foo.h
```
Tests have to be in tests/tests.c
To use functions that are in src/ files, just include the header with #include "../src/<header>.h"
Then you can run them with wng test
$ cd yourproject/
$ wng install <source>:<username>/<repo_name>
Available sources are : github
,gitlab
& bitbucket
NOTE : Repository has to have a lib/
folder inside or wng will refuse to install it
Create a repository on GitHub, BitBucket or GitLab with your project, library files have to be in a lib/
folder
See our contribution guidelines.