-
Notifications
You must be signed in to change notification settings - Fork 23
/
BUILD.bazel
145 lines (132 loc) · 2.81 KB
/
BUILD.bazel
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary")
alias(
name = "windows",
actual = "@bazel_tools//src/conditions:windows"
)
alias(
name = "macos",
actual = "@bazel_tools//src/conditions:darwin_x86_64"
)
alias(
name = "linux",
actual = "@bazel_tools//src/conditions:linux_x86_64"
)
SDL_LINKOPTS = select({
"//:windows": [
"-DEFAULTLIB:user32",
"-DEFAULTLIB:gdi32",
"-DEFAULTLIB:winmm",
"-DEFAULTLIB:imm32",
"-DEFAULTLIB:ole32",
"-DEFAULTLIB:oleaut32",
"-DEFAULTLIB:version",
"-DEFAULTLIB:uuid",
"-DEFAULTLIB:shell32",
"-DEFAULTLIB:advapi32",
"-DEFAULTLIB:hid",
"-DEFAULTLIB:setupapi",
"-DEFAULTLIB:opengl32",
"-DEFAULTLIB:kernel32",
],
"//conditions:default": [],
})
cc_library(
name = "SDL2_hdrs",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
cc_library(
name = "SDL2base",
srcs = [
"src/SDL_assert.c",
"src/SDL_dataqueue.c",
"src/SDL_error.c",
"src/SDL_hints.c",
"src/SDL_log.c",
"src/SDL.c",
],
deps = ["//src/thread:thread"],
hdrs = glob(["include/**/*.h", "src/*.h"]),
includes = ["include", "src"],
visibility = ["//:__subpackages__"],
)
cc_library(
name = "SDL2internal",
hdrs = glob(["include/**/*.h", "src/*.h"]),
includes = ["include", "src"],
visibility = ["//:__subpackages__"],
)
apple_binary(
name = "SDL2_mac",
binary_type = "dylib",
deps = [
":SDL2_lib",
],
platform_type = "macos",
visibility = ["//:__subpackages__"],
)
genrule(
name = "SDL2_dylib",
srcs = ["SDL2_mac"],
outs = ["SDL2.dylib"],
cmd = "cp $(location SDL2_mac) $(location SDL2.dylib)",
)
cc_binary(
name = "libSDL2.so",
linkshared = True,
deps = [
":SDL2_lib",
],
visibility = ["//visibility:public"],
)
cc_binary(
name = "SDL2.dll",
linkshared = True,
deps = [
":SDL2_lib",
],
linkopts = SDL_LINKOPTS,
visibility = ["//visibility:public"],
)
cc_library(
name = "SDL2_lib",
hdrs = glob(["include/*.h"]),
includes = ["include", "src"],
srcs = glob(["include/*.h", "src/*.c", "src/*.h"]),
alwayslink = True,
deps = [
":SDL2internal",
"//src/atomic:atomic",
"//src/audio:audio",
"//src/core:core",
"//src/cpuinfo:cpuinfo",
"//src/dynapi:dynapi",
"//src/events:events",
"//src/file:file",
"//src/filesystem:filesystem",
"//src/haptic:haptic",
"//src/hidapi:hidapi",
"//src/joystick:joystick",
"//src/libm:libm",
"//src/loadso:loadso",
"//src/locale:locale",
"//src/main:main",
"//src/power:power",
"//src/render:render",
"//src/sensor:sensor",
"//src/stdlib:stdlib",
"//src/thread:thread",
"//src/timer:timer",
"//src/video:video",
"//src/misc:misc",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "SDL2test",
hdrs = glob(["include/SDL_test*.h"]),
srcs = glob(["src/test/**/*.c"]),
deps = ["//:SDL2"],
visibility = ["//test:__subpackages__"],
)