Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to depend on native code? #349

Open
njlr opened this issue Apr 3, 2023 · 1 comment
Open

How to depend on native code? #349

njlr opened this issue Apr 3, 2023 · 1 comment

Comments

@njlr
Copy link
Contributor

njlr commented Apr 3, 2023

I was wondering if anyone has figured out how to depend on native libraries in a rules_dotnet target?

load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_dotnet//dotnet:defs.bzl", "fsharp_binary")

cc_library(
  name = "math",
  srcs = [ "math.c" ],
  hdrs = [ "math.h" ],
)

fsharp_binary(
  name = "app",
  srcs = [
    "Program.fs",
  ],
  target_frameworks = [ "net6.0" ],
  private_deps = [
    "@paket.main//microsoft.netcore.app.ref",
  ],
  deps = [
    "@paket.main//fsharp.core",
  ],
  data = [
    ":math", # This is not right of course!
  ],
)

I was thinking about building a NuGet zip file containing a shared library built for each target platform and then depending on that?

Full repo: https://github.com/njlr/bazel-fsharp-native

@purkhusid
Copy link
Collaborator

I haven't had use for this yet so I haven't really thought this through. I think we might just need to add an compatability layer in the deps attribute which accepts the providers that the c/c++ rules outputs. I'm not very likely to implement this since I don't need this at the moment but I can review an implementation if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants