-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
66 lines (58 loc) · 2.22 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
defmodule SerialLoraCommunicator.MixProject do
use Mix.Project
@target System.get_env("MIX_TARGET") || "nerves_system_ch341_rpi"
def project do
[
app: :serial_lora_communicator,
version: "0.1.0",
elixir: "~> 1.4",
target: @target,
archives: [nerves_bootstrap: "~> 1.0"],
deps_path: "deps/#{@target}",
build_path: "_build/#{@target}",
lockfile: "mix.lock.#{@target}",
start_permanent: Mix.env() == :prod,
aliases: [loadconfig: [&bootstrap/1]],
deps: deps()
]
end
# Starting nerves_bootstrap adds the required aliases to Mix.Project.config()
# Aliases are only added if MIX_TARGET is set.
def bootstrap(args) do
System.put_env("MIX_TARGET", "nerves_system_ch341_rpi")
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {SerialLoraCommunicator.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:nerves, "~> 1.0", runtime: false},
{:shoehorn, "~> 0.2"}
] ++ deps(@target)
end
# Specify target specific dependencies
defp deps("host"), do: []
defp deps(target) do
[
{:nerves_runtime, "~> 0.4"},
{:nerves_uart, "~> 1.2"}
] ++ system(target)
end
defp system("rpi"), do: [{:nerves_system_rpi, "~> 1.0", runtime: false}]
defp system("rpi0"), do: [{:nerves_system_rpi0, "~> 1.0", runtime: false}]
defp system("rpi2"), do: [{:nerves_system_rpi2, "~> 1.0", runtime: false}]
defp system("rpi3"), do: [{:nerves_system_rpi3, "~> 1.0", runtime: false}]
defp system("bbb"), do: [{:nerves_system_bbb, "~> 1.0", runtime: false}]
defp system("ev3"), do: [{:nerves_system_ev3, "~> 1.0", runtime: false}]
defp system("qemu_arm"), do: [{:nerves_system_qemu_arm, "~> 1.0", runtime: false}]
defp system("x86_64"), do: [{:nerves_system_x86_64, "~> 1.0", runtime: false}]
defp system("nerves_system_ch341_rpi"), do: [{:nerves_system_ch341_rpi, git: "[email protected]:sjoulbak/nerves_system_ch341_rpi.git", runtime: false}]
defp system(target), do: Mix.raise("Unknown MIX_TARGET: #{target}")
end