Skip to content

Commit 3d17500

Browse files
committed
Reduce dynamically linked libraries
1 parent 1844923 commit 3d17500

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

examples/opengl_bounce.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,14 @@ int main(void) {
145145
cfg.gl = samure_default_opengl_config();
146146
cfg.gl->major_version = 1;
147147
cfg.gl->minor_version = 0;
148-
cfg.gl->api = EGL_OPENGL_ES_API;
148+
cfg.gl->api = EGL_OPENGL_API;
149149

150-
struct samure_context *ctx =
151-
SAMURE_UNWRAP(context, samure_create_context(&cfg));
150+
SAMURE_RESULT(context) ctx_rs = samure_create_context(&cfg);
151+
if(ctx_rs.error != SAMURE_ERROR_NONE) {
152+
samure_perror("failed to create context", ctx_rs.error);
153+
return 1;
154+
}
155+
struct samure_context *ctx = ctx_rs.result;
152156

153157
ctx->backend->render_start(ctx, ctx->outputs[0]->sfc[0]);
154158

xmake.lua

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ option("backend_opengl")
1414
add_defines("BACKEND_OPENGL")
1515
option_end()
1616

17-
add_requires("wayland")
17+
add_requires("wayland-client", "wayland-cursor")
1818

1919
if get_config("backend_cairo") then
2020
add_requires("cairo")
2121
end
2222
if get_config("backend_opengl") then
23-
add_requires("libglvnd")
24-
add_requires("egl")
25-
add_requires("wayland-egl")
23+
add_requires("libglvnd", "egl", "wayland-egl")
2624
end
2725

2826
rule("wayland-protocol")
@@ -101,7 +99,7 @@ if get_config("backend_cairo") then
10199
target("samurai-render-backend-cairo")
102100
-- todo: also allow static linking
103101
set_kind("shared")
104-
add_packages("wayland", "cairo")
102+
add_packages("cairo")
105103
add_headerfiles(
106104
"samure/*.h",
107105
"samure/backends/cairo.h"
@@ -114,7 +112,7 @@ end
114112
if get_config("backend_opengl") then
115113
target("samurai-render-backend-opengl")
116114
set_kind("shared")
117-
add_packages("wayland", "wayland-egl", "egl", "libglvnd")
115+
add_packages("wayland-egl", "egl", "libglvnd")
118116
add_headerfiles(
119117
"samure/*.h",
120118
"samure/backends/opengl.h"
@@ -127,7 +125,7 @@ end
127125
target("samurai-render")
128126
set_kind("$(kind)")
129127
add_rules("utils.install.pkgconfig_importfiles")
130-
add_packages("wayland")
128+
add_packages("wayland-client", "wayland-cursor")
131129
add_options(
132130
"backend_cairo",
133131
"backend_opengl"
@@ -151,7 +149,7 @@ if get_config("build_examples") then
151149
add_requires("olive.c")
152150
target("olivec_bounce")
153151
set_kind("binary")
154-
add_packages("wayland", "olive.c")
152+
add_packages("olive.c")
155153
add_options(
156154
"backend_cairo",
157155
"backend_opengl"
@@ -161,7 +159,6 @@ if get_config("build_examples") then
161159
add_files("examples/olivec_bounce.c")
162160
target("blank")
163161
set_kind("binary")
164-
add_packages("wayland")
165162
add_options(
166163
"backend_cairo",
167164
"backend_opengl"
@@ -172,7 +169,7 @@ if get_config("build_examples") then
172169
if get_config("backend_cairo") then
173170
target("cairo_bounce")
174171
set_kind("binary")
175-
add_packages("wayland", "cairo")
172+
add_packages("cairo")
176173
add_options(
177174
"backend_cairo",
178175
"backend_opengl"
@@ -183,7 +180,7 @@ if get_config("build_examples") then
183180

184181
target("slurpy")
185182
set_kind("binary")
186-
add_packages("wayland", "cairo")
183+
add_packages("cairo")
187184
add_options(
188185
"backend_cairo",
189186
"backend_opengl"
@@ -194,7 +191,7 @@ if get_config("build_examples") then
194191

195192
target("image_draw")
196193
set_kind("binary")
197-
add_packages("wayland", "cairo")
194+
add_packages("cairo")
198195
add_options(
199196
"backend_cairo",
200197
"backend_opengl"
@@ -205,7 +202,7 @@ if get_config("build_examples") then
205202

206203
target("screenshot_draw")
207204
set_kind("binary")
208-
add_packages("wayland", "cairo")
205+
add_packages("cairo")
209206
add_options(
210207
"backend_cairo",
211208
"backend_opengl"
@@ -218,7 +215,7 @@ if get_config("build_examples") then
218215
target("opengl_bounce")
219216
set_kind("binary")
220217
add_syslinks("GL")
221-
add_packages("wayland", "libglvnd")
218+
add_packages("libglvnd")
222219
add_options(
223220
"backend_cairo",
224221
"backend_opengl"

0 commit comments

Comments
 (0)