-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathnaylib.nimble
59 lines (49 loc) · 1.81 KB
/
naylib.nimble
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
# Package
version = "24.52.0"
author = "Antonis Geralis"
description = "Raylib Nim wrapper"
license = "MIT"
srcDir = "src"
# Deps
requires "nim >= 2.0.0"
#requires "eminim == 2.8.2"
# https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux
import std/distros
if detectOs(Ubuntu):
foreignDep "libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev"
foreignDep "libxkbcommon-dev libwayland-bin"
elif detectOs(Fedora):
foreignDep "alsa-lib-devel mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel libatomic"
foreignDep "libxkbcommon-devel wayland-devel"
elif detectOs(ArchLinux) or detectOs(Manjaro):
foreignDep "alsa-lib mesa libx11 libxrandr libxi libxcursor libxinerama"
foreignDep "libxkbcommon wayland"
# Tasks
import std/[os, strutils, parseutils]
proc editRaylibDirConst(dir: string) =
withDir(dir):
var file = readFile("raylib.nim")
let first = find(file, "raylibDir")
let skipped = skipUntil(file, '\n', start = first)
let str = "\"" & (dir / "raylib") & "\""
file[first..first+skipped-1] = "raylibDir = Path" & str
writeFile("raylib.nim", file)
task localInstall, "Install on your local workspace":
echo "To complete the installation, run:\n"
echoForeignDeps()
# Works with atlas
editRaylibDirConst(thisDir() / "src")
after install:
when defined(atlas):
localInstallTask()
else:
echo "To complete the installation, run:\n"
echoForeignDeps()
# Fails with atlas
editRaylibDirConst(thisDir())
task test, "Runs the test suite":
localInstallTask()
exec "nim c -d:release tests/basic_window.nim"
when defined(linux):
exec "nim c -d:release -d:wayland tests/basic_window.nim"
exec "nim c -d:release -d:emscripten tests/basic_window_web.nim"