Split oboy.ml

This commit is contained in:
Fabien Freling 2019-05-12 11:17:17 +02:00
parent fe2c5e8ba1
commit a206b9d7ca
4 changed files with 16 additions and 12 deletions

View file

@ -4,8 +4,8 @@ BUILD:=_build
# dune build src/core/oboy.exe
core:
dune build src/core/oboy.so
cp _build/default/src/core/oboy.so $(BUILD)/liboboycore.so
dune build src/core/cbindings.exe.o
ar -rs $(BUILD)/liboboycore.a _build/default/src/core/cbindings.exe.o
# check:
# ocamlbuild -use-ocamlfind -I src -lflag -g test/test_bit.byte --

3
src/core/cbindings.ml Normal file
View file

@ -0,0 +1,3 @@
let () =
Callback.register "name" Version.name;
Callback.register "version" Version.version;

View file

@ -1,7 +1,12 @@
; oboy.ml as the top-level file
; cbindings.ml as the top-level file
; building a shared library because we are relying on pthread and we cannot
; combine static pthread with dynamic libc
(executable
(name oboy)
(libraries threads)
(modes shared_object))
(name cbindings)
(modes object))
; Standalone binary
; TODO: split with core module
;(executable
; (name main.ml)
; (libraries threads))

View file

@ -60,7 +60,7 @@ let power_up cartridge =
run cpu mem screen
(** let main =
let () =
if Array.length Sys.argv < 2 then begin
prerr_endline "Please specify a ROM.";
eprintf "Usage: %s path/to/rom\n" Sys.argv.(0);
@ -70,8 +70,4 @@ let power_up cartridge =
let cartridge = Cartridge.read_cartridge Sys.argv.(1) in
match cartridge with
| None -> print_endline "Invalid ROM file."
| Some c -> power_up c *)
let () =
Callback.register "name" Version.name;
Callback.register "version" Version.version;
| Some c -> power_up c