Added instructions to readme
This commit is contained in:
parent
1a463c6e46
commit
49d9d3ae96
1 changed files with 27 additions and 2 deletions
29
README.md
29
README.md
|
|
@ -1,4 +1,29 @@
|
|||
# spdlog
|
||||
This is [spdlog](https://github.com/gabime/spdlog), packaged for [Zig](https://ziglang.org/).
|
||||
This is [spdlog](https://github.com/gabime/spdlog), packaged for [Zig](https://ziglang.org/). (Intended for C++ projects using Zig as a build tool.)
|
||||
|
||||
Usage instructions to be added. Hopefully this things works. :)
|
||||
## Usage
|
||||
First, update your `build.zig.zon`:
|
||||
```sh
|
||||
zig fetch --save git+https://github.com/jessechounard/spdlog
|
||||
```
|
||||
|
||||
Next, in your `build.zig`, you can access the library as a dependency:
|
||||
```zig
|
||||
const spdlog_dep = b.dependency("spdlog", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
const spdlog_lib = spdlog_dep.artifact("spdlog");
|
||||
|
||||
exe.root_module.linkLibrary(spdlog_lib);
|
||||
```
|
||||
|
||||
Finally, in your C++ file, you can use the library:
|
||||
```cpp
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
int main() {
|
||||
spdlog::info("Hello, world (from spdlog)!");
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue