Skip to content

Commit fb1c91a

Browse files
committed
Add rustler precompilation configs
1 parent 1194f49 commit fb1c91a

File tree

4 files changed

+44
-580
lines changed

4 files changed

+44
-580
lines changed

lib/baml_elixir/native.ex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
defmodule BamlClient.Resume do
2-
defstruct [:company, :job_title, :name]
3-
end
4-
51
defmodule BamlElixir.Native do
6-
use Rustler,
7-
otp_app: :baml_elixir
2+
version = Mix.Project.config()[:version]
3+
4+
use RustlerPrecompiled,
5+
otp_app: :baml_elixir,
6+
base_url: "https://github.com/emilsoman/baml-elixir/releases/download/v#{version}/",
7+
force_build: System.get_env("BAML_ELIXIR_BUILD") in ["1", "true"],
8+
version: version
89

910
def call(_client, _function_name, _args), do: :erlang.nif_error(:nif_not_loaded)
1011
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[target.x86_64-apple-darwin]
2+
rustflags = [
3+
"-C", "link-arg=-undefined",
4+
"-C", "link-arg=dynamic_lookup",
5+
]
6+
7+
[target.aarch64-apple-darwin]
8+
rustflags = [
9+
"-C", "link-arg=-undefined",
10+
"-C", "link-arg=dynamic_lookup",
11+
]
12+
13+
[target.x86_64-unknown-linux-musl]
14+
rustflags = [
15+
"-C", "target-feature=-crt-static"
16+
]
17+
18+
[target.aarch64-unknown-linux-musl]
19+
rustflags = [
20+
"-C", "target-feature=-crt-static"
21+
]

0 commit comments

Comments
 (0)