mirror of https://github.com/gabime/spdlog.git
Add support for Bazel
parent
83b40b8cda
commit
3506f6a678
@ -0,0 +1 @@
|
|||||||
|
3.4.1
|
@ -0,0 +1,8 @@
|
|||||||
|
# Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
|
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "HelloWorld",
|
||||||
|
srcs = ["main.cpp"],
|
||||||
|
deps = ["@spdlog"]
|
||||||
|
)
|
@ -0,0 +1,30 @@
|
|||||||
|
# How to use spdlog with Bazel?
|
||||||
|
|
||||||
|
1. Add to your `WORKSPACE` file this:
|
||||||
|
|
||||||
|
```python
|
||||||
|
http_archive(
|
||||||
|
name = "spdlog",
|
||||||
|
build_file = "//:spdlog.BUILD",
|
||||||
|
sha256 = "f0114a4d3c88be9e696762f37a7c379619443ce9d668546c61b21d41affe5b62",
|
||||||
|
strip_prefix = "spdlog-1.7.0",
|
||||||
|
urls = ["https://github.com/gabime/spdlog/archive/v1.7.0.tar.gz"],
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2. Copy `spdlog.BUILD` to your workspace directry.
|
||||||
|
|
||||||
|
Note: If you make use of the FMT library already in your project you can use that one also for spdlog: Remove the comments in the `spdlog.BUILD` file.
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
This directory contains `WORKSPACE.bazel` file that how to integrate `spdlog` into your Bazel project.
|
||||||
|
|
||||||
|
To test it run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bazel run //:HelloWorld
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
# Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
|
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
workspace(name = "spdlogDemo")
|
||||||
|
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "spdlog",
|
||||||
|
build_file = "//:spdlog.BUILD",
|
||||||
|
sha256 = "f0114a4d3c88be9e696762f37a7c379619443ce9d668546c61b21d41affe5b62",
|
||||||
|
strip_prefix = "spdlog-1.7.0",
|
||||||
|
urls = ["https://github.com/gabime/spdlog/archive/v1.7.0.tar.gz"],
|
||||||
|
)
|
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
#include <spdlog/sinks/basic_file_sink.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
spdlog::info("Welcome to spdlog!");
|
||||||
|
spdlog::error("Some error message with arg: {}", 1);
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
|
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "spdlog",
|
||||||
|
srcs = [
|
||||||
|
"src/async.cpp",
|
||||||
|
"src/cfg.cpp",
|
||||||
|
"src/color_sinks.cpp",
|
||||||
|
"src/file_sinks.cpp",
|
||||||
|
"src/fmt.cpp",
|
||||||
|
"src/spdlog.cpp",
|
||||||
|
"src/stdout_sinks.cpp",
|
||||||
|
],
|
||||||
|
hdrs = glob(["include/**/*.h*"]),
|
||||||
|
defines = [
|
||||||
|
"SPDLOG_COMPILED_LIB",
|
||||||
|
#"SPDLOG_FMT_EXTERNAL",
|
||||||
|
],
|
||||||
|
includes = ["include"],
|
||||||
|
linkopts = select({
|
||||||
|
"@bazel_tools//src/conditions:windows": [],
|
||||||
|
"@bazel_tools//src/conditions:darwin": [],
|
||||||
|
"//conditions:default": ["-lpthread"],
|
||||||
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
#deps = ["@fmt"],
|
||||||
|
)
|
Loading…
Reference in New Issue