Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rlgl and audio functions into separate libraries #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
(lang dune 2.8)

(name raylib)

; cannot specify conditional deps otherwise

(generate_opam_files false)

(source (github tjammer/raylib-ocaml))
(source
(github tjammer/raylib-ocaml))

(license MIT)

(authors "Tobias Mock")

(maintainers "[email protected]")

(package
Expand All @@ -17,9 +23,34 @@
(depends
dune
dune-configurator
(ctypes (>= 0.14))
(integers (>= 0.5))
(patch (>= 2.0))))
(ctypes
(>= 0.14))
(integers
(>= 0.5))
(patch
(>= 2.0))))

(package
(name raylib-rlgl)
(version 1.3.1)
(description "OCaml bindings for raylib")
(synopsis "OCaml bindings for raylib")
(depends
dune
dune-configurator
(raylib
(= :version))))

(package
(name raylib-raudio)
(version 1.3.1)
(description "OCaml bindings for raylib")
(synopsis "OCaml bindings for raylib")
(depends
dune
dune-configurator
(raylib
(= :version))))

(package
(name raygui)
Expand All @@ -29,16 +60,16 @@
(depends
dune
dune-configurator
(ctypes (>= 0.14))
(raylib (>= 0.6))
(patch (>= 2.0))))
(ctypes
(>= 0.14))
(raylib
(>= 0.6))
(patch
(>= 2.0))))

(package
(name raylib-gen)
(version 0.1.0)
(description "Binding generation for raylib")
(synopsis "Binding generation for raylib")
(depends
dune
yojson
re))
(depends dune yojson re))
2 changes: 2 additions & 0 deletions examples/audio/audio_module_playing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let random_circle () =

let setup () =
let open Raylib in
let open Raudio in
set_config_flags [ ConfigFlags.Msaa_4x_hint ];
init_window width height "raylib [audio] example - module playing (streaming)";
init_audio_device ();
Expand All @@ -59,6 +60,7 @@ let setup () =
(circles, music)

let rec loop circles music pause =
let open Raudio in
match Raylib.window_should_close () with
| true ->
let open Raylib in
Expand Down
2 changes: 2 additions & 0 deletions examples/audio/audio_music_stream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ let height = 450

let setup () =
let open Raylib in
let open Raudio in
init_window width height "raylib [audio] example - music playing (streaming)";
init_audio_device ();

Expand All @@ -15,6 +16,7 @@ let setup () =

let rec loop music pause =
let open Raylib in
let open Raudio in
match window_should_close () with
| true ->
unload_music_stream music;
Expand Down
4 changes: 2 additions & 2 deletions examples/audio/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(executable
(name audio_module_playing)
(modules Audio_module_playing)
(libraries raylib))
(libraries raylib-raudio))

(executable
(name audio_music_stream)
(modules Audio_music_stream)
(libraries raylib))
(libraries raylib-raudio))
8 changes: 4 additions & 4 deletions examples/core/core_2d_camera_mouse_zoom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ let rec loop { zoom_mode; camera } =
Raylib.begin_mode_2d camera;
(* Draw the 3d grid, rotated 90 degrees and centered around 0,0
just so we have something in the XY plane *)
Raylib.Rlgl.push_matrix ();
Raylib.Rlgl.translatef 0. (25. *. 50.) 0.;
Raylib.Rlgl.rotatef 90. 1. 0. 0.;
Rlgl.push_matrix ();
Rlgl.translatef 0. (25. *. 50.) 0.;
Rlgl.rotatef 90. 1. 0. 0.;
Raylib.draw_grid 100 50.;
Raylib.Rlgl.pop_matrix ();
Rlgl.pop_matrix ();

(* Draw a reference circle *)
Raylib.draw_circle
Expand Down
2 changes: 1 addition & 1 deletion examples/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(executable
(name core_2d_camera_mouse_zoom)
(modules Core_2d_camera_mouse_zoom)
(libraries raylib))
(libraries raylib-rlgl))

(executable
(name core_2d_camera_platformer)
Expand Down
35 changes: 35 additions & 0 deletions raylib-raudio.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.3.1"
synopsis: "OCaml bindings for raylib"
description: "OCaml bindings for raylib"
maintainer: ["[email protected]"]
authors: ["Tobias Mock"]
license: "MIT"
homepage: "https://github.com/tjammer/raylib-ocaml"
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
depends: [
"dune" {>= "2.8"}
"raylib" {= version}
"odoc" {with-doc}
]
build: [
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
["dune" "build" "@doc" "-p" name ] {with-doc}
]
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
available: [arch != "arm32" & arch != "ppc64"]
x-ci-accept-failures: [
"centos-7" # C compiler is too old
"oraclelinux-7" # C compiler is too old
]
35 changes: 35 additions & 0 deletions raylib-rlgl.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.3.1"
synopsis: "OCaml bindings for raylib"
description: "OCaml bindings for raylib"
maintainer: ["[email protected]"]
authors: ["Tobias Mock"]
license: "MIT"
homepage: "https://github.com/tjammer/raylib-ocaml"
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
depends: [
"dune" {>= "2.8"}
"raylib" {= version}
"odoc" {with-doc}
]
build: [
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
["dune" "build" "@doc" "-p" name ] {with-doc}
]
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
available: [arch != "arm32" & arch != "ppc64"]
x-ci-accept-failures: [
"centos-7" # C compiler is too old
"oraclelinux-7" # C compiler is too old
]
56 changes: 50 additions & 6 deletions src/c/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,37 @@
(library
(name raylib_c)
(package raylib)
(modules
Raylib_c_generated_functions
Raylib_c_generated_math
Raylib_c_generated_rlgl)
(modules Raylib_c_generated_functions Raylib_c_generated_math)
(foreign_archives raylib)
(foreign_stubs
(language c)
(names c_generated_functions c_generated_math c_generated_rlgl)
(names c_generated_functions c_generated_math)
(include_dirs %{project_root}/src/c/vendor/raylib/src))
(libraries ctypes.stubs raylib_functions raylib_math raylib_rlgl)
(libraries ctypes.stubs raylib_functions raylib_math)
(library_flags
(:include library_flags.sexp)))

(library
(name raylib_rlgl_c)
(package raylib-rlgl)
(modules Raylib_c_generated_rlgl)
(foreign_stubs
(language c)
(names c_generated_rlgl)
(include_dirs %{project_root}/src/c/vendor/raylib/src))
(libraries ctypes.stubs raylib_rlgl)
(library_flags
(:include library_flags.sexp)))

(library
(name raylib_raudio_c)
(package raylib-raudio)
(modules Raylib_c_generated_raudio)
(foreign_stubs
(language c)
(names c_generated_raudio)
(include_dirs %{project_root}/src/c/vendor/raylib/src))
(libraries ctypes.stubs raylib_raudio)
(library_flags
(:include library_flags.sexp)))

Expand Down Expand Up @@ -64,11 +85,21 @@
c_generated_rlgl.c
(run stubgen/generate_c_rlgl.exe raylib_stub)))

(rule
(with-stdout-to
c_generated_raudio.c
(run stubgen/generate_c_raudio.exe raylib_stub)))

(rule
(with-stdout-to
raylib_c_generated_rlgl.ml
(run stubgen/generate_ml_rlgl.exe raylib_stub)))

(rule
(with-stdout-to
raylib_c_generated_raudio.ml
(run stubgen/generate_ml_raudio.exe raylib_stub)))

(data_only_dirs vendor)

(rule
Expand Down Expand Up @@ -212,7 +243,20 @@
(bash
"%{cc} %{c} -I '%{lib:ctypes:.}' -I %{ocaml_where} -I vendor/raylib/src -o %{targets}")))

(rule
(targets generate_raudio_types_step_2.exe)
(deps
(:c raudio_c_generated_types.c))
(action
(bash
"%{cc} %{c} -I '%{lib:ctypes:.}' -I %{ocaml_where} -I vendor/raylib/src -o %{targets}")))

(rule
(with-stdout-to
rlgl_c_generated_types.c
(run stubgen/generate_c_rlgl_types.exe raylib_stub)))

(rule
(with-stdout-to
raudio_c_generated_types.c
(run stubgen/generate_c_raudio_types.exe raylib_stub)))
10 changes: 9 additions & 1 deletion src/c/functions/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
(:standard -w -9-27))
(libraries ctypes.stubs raylib_fixed_types))

(library
(name raylib_raudio)
(package raylib)
(modules Raylib_raudio)
(flags
(:standard -w -9-27))
(libraries ctypes.stubs raudio_fixed_types))

(library
(name raylib_math)
(package raylib)
Expand All @@ -24,7 +32,7 @@

(library
(name raylib_rlgl)
(package raylib)
(package raylib-rlgl)
(modules Raylib_rlgl)
(flags
(:standard -w -9-27))
Expand Down
Loading
Loading