Allow building the "c-bindings" program with Bazel

This commit is contained in:
Steve Harris 2019-05-22 14:01:21 -04:00 committed by Stanisław Barzowski
parent e7f9dcae99
commit 886fcaca1d
6 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,10 @@
workspace(name = "google_jsonnet_go")
local_repository(
name = "cpp_jsonnet",
path = "./cpp-jsonnet",
)
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",

View File

@ -9,11 +9,17 @@ go_library(
"json.h",
"libjsonnet.cpp",
],
cdeps = [
"@cpp_jsonnet//include:libjsonnet",
],
cgo = True,
copts = ["-std=c++11 -Wall"],
copts = ["-Wall -Icpp-jsonnet/include"], # keep
cxxopts = ["-std=c++11"],
importpath = "github.com/google/go-jsonnet/c-bindings",
visibility = ["//visibility:private"],
deps = ["//:go_default_library"],
deps = [
"//:go_default_library",
],
)
go_binary(

View File

@ -7,7 +7,7 @@ import (
"github.com/google/go-jsonnet"
// #cgo CXXFLAGS: -std=c++11 -Wall
// #cgo CXXFLAGS: -std=c++11 -Wall -I../cpp-jsonnet/include
// #include "internal.h"
"C"
)

View File

@ -1,5 +1,5 @@
extern "C" {
#include "../cpp-jsonnet/include/libjsonnet.h"
#include "libjsonnet.h"
}
#include "json.h"

View File

@ -22,8 +22,6 @@ limitations under the License.
#include <vector>
#include <map>
#include "../cpp-jsonnet/include/libjsonnet.h"
struct JsonnetJsonValue {
enum Kind {
ARRAY,

View File

@ -2,7 +2,7 @@
#include <stdlib.h>
extern "C" {
#include "../cpp-jsonnet/include/libjsonnet.h"
#include "libjsonnet.h"
#include "internal.h"
}