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
| | Upstream-status: https://gitlab.com/jgemu/bsnes/-/merge_requests/429
diff --git a/Makefile b/Makefile
index 7371ff4..a4a8457 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,9 @@ MKDIRS := deps/byuuML \
src/expansion \
src/processor
+# Set to 1 to use a system-provided SameBoy shared library.
+USE_EXTERNAL_SAMEBOY := 0
+
# Global symbols
# TODO: Darwin export files expect mangled symbols for C++
SYMBOLS :=
@@ -61,6 +64,9 @@ CPPFLAGS_GB := -DGB_INTERNAL -DGB_DISABLE_CHEATS -DGB_DISABLE_DEBUGGER \
-D_GNU_SOURCE -DGB_VERSION=\"0.16.6\"
INCLUDES += $(CFLAGS_SAMPLERATE) -I$(DEPDIR)
+ifeq ($(USE_EXTERNAL_SAMEBOY), 0)
+INCLUDES += -I$(DEPDIR)/gb
+endif
LIBS += $(LIBS_SAMPLERATE)
EXT := cpp
@@ -81,7 +87,13 @@ WARNINGS_CO := $(WARNINGS_MIN) -Wmissing-prototypes
WARNINGS_ICD := $(WARNINGS_CXX)
WARNINGS_GB := -Wall -Wno-missing-braces -Wno-multichar -Wno-unused-result
-CSRCS := deps/gb/apu.c \
+CSRCS := \
+ deps/libco/libco.c \
+ deps/snes_spc/spc_dsp.c
+
+ifeq ($(USE_EXTERNAL_SAMEBOY), 0)
+CSRCS += \
+ deps/gb/apu.c \
deps/gb/camera.c \
deps/gb/display.c \
deps/gb/gb.c \
@@ -96,9 +108,16 @@ CSRCS := deps/gb/apu.c \
deps/gb/sgb.c \
deps/gb/sm83_cpu.c \
deps/gb/timing.c \
- deps/gb/workboy.c \
- deps/libco/libco.c \
- deps/snes_spc/spc_dsp.c
+ deps/gb/workboy.c
+else
+CFLAGS_SAMEBOY = $(shell $(PKG_CONFIG) --cflags sameboy || echo fail)
+LIBS_SAMEBOY = $(shell $(PKG_CONFIG) --libs sameboy || echo fail)
+ifeq ($(CFLAGS_SAMEBOY)$(LIBS_SAMEBOY),failfail)
+$(error "pkg-config failure; CFLAGS_SAMEBOY and LIBS_SAMEBOY missing")
+endif
+INCLUDES += $(CFLAGS_SAMEBOY)
+LIBS += $(LIBS_SAMEBOY)
+endif
CXXSRCS := deps/byuuML/byuuML.cpp \
src/audio.cpp \
@@ -243,8 +262,11 @@ install-data: all
install-docs::
cp $(DEPDIR)/byuuML/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE-byuuML
- cp $(DEPDIR)/gb/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE-gb
cp $(DEPDIR)/libco/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE-libco
cp $(DEPDIR)/snes_spc/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE-spc
+ifeq ($(USE_EXTERNAL_SAMEBOY), 0)
+install-docs::
+ cp $(DEPDIR)/gb/LICENSE $(DESTDIR)$(DOCDIR)/LICENSE-gb
+endif
include $(SOURCEDIR)/mk/rules.mk
diff --git a/README b/README
index 3db6823..910c8d5 100644
--- a/README
+++ b/README
@@ -30,7 +30,8 @@ Options:
ENABLE_HTML - Set to a non-zero value to generate the html documentation.
ENABLE_STATIC - Set to a non-zero value to build a static archive.
ENABLE_STATIC_JG - Set to a non-zero value to build a static JG archive.
- USE_VENDORED_SAMPLERATE - Set non-zero to use vendored libsamplerate
+ USE_VENDORED_SAMPLERATE - Set non-zero to use vendored libsamplerate.
+ USE_EXTERNAL_SAMEBOY - Set non-zero to use system-provided sameboy.
Linux:
make
diff --git a/src/coprocessor/icd.cpp b/src/coprocessor/icd.cpp
index 2b0fb96..066b63e 100644
--- a/src/coprocessor/icd.cpp
+++ b/src/coprocessor/icd.cpp
@@ -28,7 +28,7 @@
#include "icd.hpp"
extern "C" {
- #include <gb/gb.h>
+ #include <gb.h>
}
//warning: the size of this object will be too large due to C++ size rules differing from C rules.
|