Skip to content

Commit

Permalink
Add include dirs to the CGO command line arguments (#134)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/buck2#134

Pull Request resolved: #8

X-link: facebook/ocamlrep#23

Without the include dirs, the cgo command won't be able to find the header files causing `buck2 build` to fail.

Reviewed By: krallin

Differential Revision: D44788778

fbshipit-source-id: d1ed1a8ec2463aaba615844c0a3ff54158c1dc69
  • Loading branch information
jvshahid authored and facebook-github-bot committed Apr 13, 2023
1 parent 81233d0 commit aa4dcea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go/cgo_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def _cgo(

pre = cxx_merge_cpreprocessors(ctx, own_pre, inherited_pre)
pre_args = pre.set.project_as_args("args")
pre_include_dirs = pre.set.project_as_args("include_dirs")

gen_dir = "cgo_gen"

Expand Down Expand Up @@ -96,6 +97,7 @@ def _cgo(
args.add(cmd_args(go_srcs[0].as_output(), format = "--output={}/.."))
args.add(cmd_args(cxx_toolchain.c_compiler_info.preprocessor, format = "--cpp={}"))
args.add(cmd_args(pre_args, format = "--cpp={}"))
args.add(cmd_args(pre_include_dirs, format = "--cpp={}"))
args.add(srcs)

argsfile = ctx.actions.declare_output(paths.join(gen_dir, ".cgo.argsfile"))
Expand Down

0 comments on commit aa4dcea

Please sign in to comment.