Skip to content

Commit 0e65e95

Browse files
committed
Factor the list of C headers for stubgen into a helper library
1 parent 9cf0016 commit 0e65e95

File tree

6 files changed

+34
-45
lines changed

6 files changed

+34
-45
lines changed

config/dune

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(executables
22
(names discover)
33
(flags (:standard -safe-string))
4-
(libraries base stdio dune.configurator))
4+
(libraries base stdio dune.configurator)
5+
(modules discover))
56

67
(rule
78
(targets wlroots-ccopt.sexp
@@ -15,6 +16,13 @@
1516
pixman-1-ccopt.sexp
1617
pixman-1-cclib.sexp
1718
pixman-1-ccopt
18-
pixman-1-cclib)
19+
pixman-1-cclib
20+
wayland-protocols-dir
21+
wayland-scanner-bin)
1922
(deps (:discover discover.exe))
2023
(action (run %{discover})))
24+
25+
(library
26+
(name wlroots_config)
27+
(public_name wlroots.config)
28+
(modules wlroots_config))

config/wlroots_config.ml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
let stubgen_prologue ="
2+
#define _POSIX_C_SOURCE 200809L
3+
#include <wayland-server.h>
4+
#include <wlr/backend.h>
5+
#include <wlr/render/wlr_renderer.h>
6+
#include <wlr/types/wlr_cursor.h>
7+
#include <wlr/types/wlr_compositor.h>
8+
#include <wlr/types/wlr_data_device.h>
9+
#include <wlr/types/wlr_input_device.h>
10+
#include <wlr/types/wlr_keyboard.h>
11+
#include <wlr/types/wlr_matrix.h>
12+
#include <wlr/types/wlr_output.h>
13+
#include <wlr/types/wlr_output_layout.h>
14+
#include <wlr/types/wlr_pointer.h>
15+
#include <wlr/types/wlr_seat.h>
16+
#include <wlr/types/wlr_xcursor_manager.h>
17+
#include <wlr/backend.h>
18+
#include <wlr/util/log.h>
19+
#include <wlr/types/wlr_xdg_shell.h>
20+
"

ffi/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(modules generated_types ffi)
55
(flags (:standard -w -9))
66
(libraries wlroots_types_f
7-
wlroots_common
7+
wlroots_config wlroots_common
88
ctypes ctypes.stubs
99
unix-time.unix mtime.clock.os
1010
xkbcommon))

ffi/stubgen.ml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
let prefix = "wlroots_stub"
22

3-
let prologue = "
4-
#define _POSIX_C_SOURCE 200809L
5-
#include <wayland-server.h>
6-
#include <wlr/render/wlr_renderer.h>
7-
#include <wlr/types/wlr_cursor.h>
8-
#include <wlr/types/wlr_compositor.h>
9-
#include <wlr/types/wlr_data_device.h>
10-
#include <wlr/types/wlr_input_device.h>
11-
#include <wlr/types/wlr_keyboard.h>
12-
#include <wlr/types/wlr_matrix.h>
13-
#include <wlr/types/wlr_output.h>
14-
#include <wlr/types/wlr_output_layout.h>
15-
#include <wlr/types/wlr_pointer.h>
16-
#include <wlr/types/wlr_seat.h>
17-
#include <wlr/types/wlr_xcursor_manager.h>
18-
#include <wlr/backend.h>
19-
#include <wlr/util/log.h>
20-
"
21-
223
let () =
234
let generate_ml, generate_c = ref false, ref false in
245
let () =
@@ -34,5 +15,5 @@ let () =
3415
| true, false ->
3516
Cstubs.write_ml Format.std_formatter ~prefix (module Wlroots_ffi_f.Ffi.Make)
3617
| false, true ->
37-
print_endline prologue;
18+
print_endline Wlroots_config.stubgen_prologue;
3819
Cstubs.write_c Format.std_formatter ~prefix (module Wlroots_ffi_f.Ffi.Make)

types/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(executables
1010
(names stubgen)
1111
(modules stubgen)
12-
(libraries wlroots_types_f ctypes.stubs ctypes))
12+
(libraries wlroots_config wlroots_types_f ctypes.stubs ctypes))
1313

1414
; C file built by stubgen
1515
(rule (with-stdout-to "types_stubgen.c" (run "./stubgen.exe")))

types/stubgen.ml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
1-
let prologue = "
2-
#define _POSIX_C_SOURCE 200809L
3-
#include <wayland-server.h>
4-
#include <wlr/backend.h>
5-
#include <wlr/render/wlr_renderer.h>
6-
#include <wlr/types/wlr_cursor.h>
7-
#include <wlr/types/wlr_compositor.h>
8-
#include <wlr/types/wlr_data_device.h>
9-
#include <wlr/types/wlr_input_device.h>
10-
#include <wlr/types/wlr_keyboard.h>
11-
#include <wlr/types/wlr_matrix.h>
12-
#include <wlr/types/wlr_output.h>
13-
#include <wlr/types/wlr_output_layout.h>
14-
#include <wlr/types/wlr_pointer.h>
15-
#include <wlr/types/wlr_seat.h>
16-
#include <wlr/types/wlr_xcursor_manager.h>
17-
#include <wlr/backend.h>
18-
#include <wlr/util/log.h>
19-
"
20-
211
let () =
22-
print_endline prologue;
2+
print_endline Wlroots_config.stubgen_prologue;
233
Cstubs_structs.write_c Format.std_formatter
244
(module Wlroots_types_f.Types.Make)

0 commit comments

Comments
 (0)