forked from alvatar/sphere-sdl2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ssrunfile.scm
69 lines (62 loc) · 1.9 KB
/
ssrunfile.scm
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
67
68
69
(include "~~lib/ssrun/tasks/core.scm")
(define (sdl2-config-cc)
(string-append
(with-input-from-process
(list path: "sdl2-config"
arguments: '("--cflags")) read-line)
"-w"))
(define (sdl2-config-ld . static)
(with-input-from-process
(list path: "sdl2-config"
arguments: (list (if (null? static)
"--libs"
"--static-libs")))
read-line))
(define libraries
`(((spheres/sdl2 sdl2)
.
,(lambda (lib)
(ssrun#compile-library
lib
cond-expand-features: '(debug)
cc-options: (sdl2-config-cc)
ld-options: (sdl2-config-ld))))
((spheres/sdl2 sdl2-image)
.
,(lambda (lib)
(ssrun#compile-library
lib
cond-expand-features: '(debug)
cc-options: (sdl2-config-cc)
ld-options: (string-append (sdl2-config-ld) " " "-lSDL2_image"))))
((spheres/sdl2 sdl2-mixer)
.
,(lambda (lib)
(ssrun#compile-library
lib
cond-expand-features: '(debug)
cc-options: (sdl2-config-cc)
ld-options: (string-append (sdl2-config-ld) " " "-lSDL2_mixer"))))
((spheres/sdl2 sdl2-ttf)
.
,(lambda (lib)
(ssrun#compile-library
lib
cond-expand-features: '(debug)
cc-options: (sdl2-config-cc)
ld-options: (string-append (sdl2-config-ld) " " "-lSDL2_ttf"))))))
(define-task (compile library) ()
;; This fixes and issue in OSX: pkg-config not finding GL
;; (if (eq? (sake#host-platform) 'osx)
;; (setenv "PKG_CONFIG_PATH" "/opt/X11/lib/pkgconfig/"))
(if library
(let ((entry (assoc library libraries))) ((cdr entry) (car entry)))
(for-each (lambda (entry) ((cdr entry) (car entry))) libraries)))
(define-task (test file) ()
(if file
(ssrun#run-file (string-append "test/" file))
(ssrun#run-all-files "test/")))
(define-task clean ()
(ssrun#clean-libraries (map car libraries)))
(define-task all (compile)
(void))