This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
宋文武
committed
Sep 30, 2021
0 parents
commit 5de0598
Showing
21 changed files
with
2,974 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "deps/tinycoroutine"] | ||
path = deps/tinycoroutine | ||
url = https://github.com/soundsrc/tinycoroutine.git | ||
[submodule "deps/libretro-common"] | ||
path = deps/libretro-common | ||
url = https://github.com/libretro/libretro-common.git |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
STATIC_LINKING := 0 | ||
AR := ar | ||
|
||
ifneq ($(V),1) | ||
Q := @ | ||
endif | ||
|
||
ifneq ($(SANITIZER),) | ||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS) | ||
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS) | ||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS) | ||
endif | ||
|
||
ifeq ($(platform),) | ||
platform = unix | ||
ifeq ($(shell uname -a),) | ||
platform = win | ||
else ifneq ($(findstring MINGW,$(shell uname -a)),) | ||
platform = win | ||
else ifneq ($(findstring Darwin,$(shell uname -a)),) | ||
platform = osx | ||
else ifneq ($(findstring win,$(shell uname -a)),) | ||
platform = win | ||
endif | ||
endif | ||
|
||
# system platform | ||
system_platform = unix | ||
ifeq ($(shell uname -a),) | ||
EXE_EXT = .exe | ||
system_platform = win | ||
else ifneq ($(findstring Darwin,$(shell uname -a)),) | ||
system_platform = osx | ||
arch = intel | ||
ifeq ($(shell uname -p),powerpc) | ||
arch = ppc | ||
endif | ||
else ifneq ($(findstring MINGW,$(shell uname -a)),) | ||
system_platform = win | ||
endif | ||
|
||
CORE_DIR += . | ||
TARGET_NAME := onscripter | ||
LIBM = -lm | ||
|
||
ifeq ($(ARCHFLAGS),) | ||
ifeq ($(archs),ppc) | ||
ARCHFLAGS = -arch ppc -arch ppc64 | ||
else | ||
ARCHFLAGS = -arch i386 -arch x86_64 | ||
endif | ||
endif | ||
|
||
ifeq ($(platform), osx) | ||
ifndef ($(NOUNIVERSAL)) | ||
CXXFLAGS += $(ARCHFLAGS) | ||
LFLAGS += $(ARCHFLAGS) | ||
endif | ||
endif | ||
|
||
ifeq ($(STATIC_LINKING), 1) | ||
EXT := a | ||
endif | ||
|
||
ifeq ($(platform), unix) | ||
EXT ?= so | ||
TARGET := $(TARGET_NAME)_libretro.$(EXT) | ||
fpic := -fPIC | ||
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined | ||
else ifeq ($(platform), linux-portable) | ||
TARGET := $(TARGET_NAME)_libretro.$(EXT) | ||
fpic := -fPIC -nostdlib | ||
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T | ||
LIBM := | ||
else ifneq (,$(findstring osx,$(platform))) | ||
TARGET := $(TARGET_NAME)_libretro.dylib | ||
fpic := -fPIC | ||
SHARED := -dynamiclib | ||
else ifneq (,$(findstring ios,$(platform))) | ||
TARGET := $(TARGET_NAME)_libretro_ios.dylib | ||
fpic := -fPIC | ||
SHARED := -dynamiclib | ||
|
||
ifeq ($(IOSSDK),) | ||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) | ||
endif | ||
|
||
DEFINES := -DIOS | ||
CC = cc -arch armv7 -isysroot $(IOSSDK) | ||
ifeq ($(platform),ios9) | ||
CC += -miphoneos-version-min=8.0 | ||
CXXFLAGS += -miphoneos-version-min=8.0 | ||
else | ||
CC += -miphoneos-version-min=5.0 | ||
CXXFLAGS += -miphoneos-version-min=5.0 | ||
endif | ||
else ifneq (,$(findstring qnx,$(platform))) | ||
TARGET := $(TARGET_NAME)_libretro_qnx.so | ||
fpic := -fPIC | ||
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined | ||
else ifeq ($(platform), emscripten) | ||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc | ||
fpic := -fPIC | ||
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined | ||
else ifeq ($(platform), vita) | ||
TARGET := $(TARGET_NAME)_vita.a | ||
CC = arm-vita-eabi-gcc | ||
AR = arm-vita-eabi-ar | ||
CXXFLAGS += -Wl,-q -Wall -O3 | ||
STATIC_LINKING = 1 | ||
else | ||
CC = gcc | ||
TARGET := $(TARGET_NAME)_libretro.dll | ||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined | ||
endif | ||
|
||
LDFLAGS += $(LIBM) | ||
|
||
ifeq ($(DEBUG), 1) | ||
CFLAGS += -O0 -g -DDEBUG | ||
CXXFLAGS += -O0 -g -DDEBUG | ||
else | ||
CFLAGS += -O3 | ||
CXXFLAGS += -O3 | ||
endif | ||
|
||
include Makefile.common | ||
|
||
OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) | ||
|
||
CFLAGS += -Wall -D__LIBRETRO__ $(fpic) | ||
CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic) | ||
|
||
all: $(TARGET) | ||
|
||
$(TARGET): $(OBJECTS) | ||
ifeq ($(STATIC_LINKING), 1) | ||
$(AR) rcs $@ $(OBJECTS) | ||
else | ||
@$(if $(Q), $(shell echo echo LD $@),) | ||
$(Q)$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS) | ||
endif | ||
|
||
%.o: %.c | ||
@$(if $(Q), $(shell echo echo CC $<),) | ||
$(Q)$(CC) $(CFLAGS) $(fpic) -c -o $@ $< | ||
|
||
%.o: %.cpp | ||
@$(if $(Q), $(shell echo echo CXX $<),) | ||
$(Q)$(CXX) $(CXXFLAGS) $(fpic) -c -o $@ $< | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(TARGET) | ||
|
||
.PHONY: clean | ||
|
||
print-%: | ||
@echo '$*=$($*)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# -*- mode: makefile -*- | ||
DEPS_DIR = $(CORE_DIR)/deps | ||
LIBRETRO_COMM_DIR = $(DEPS_DIR)/libretro-common | ||
SDL_LIBRETRO_DIR = $(CORE_DIR)/sdl-libretro | ||
|
||
INCFLAGS := \ | ||
-I$(LIBRETRO_COMM_DIR)/include \ | ||
-I$(DEPS_DIR)/bzip2 \ | ||
-I$(DEPS_DIR)/freetype/include \ | ||
-I$(DEPS_DIR)/libjpeg-turbo \ | ||
-I$(DEPS_DIR)/libogg/include \ | ||
-I$(DEPS_DIR)/libvorbis/include \ | ||
-I$(SDL_LIBRETRO_DIR) \ | ||
-I$(DEPS_DIR)/sdl/include \ | ||
-I$(DEPS_DIR)/sdl-image \ | ||
-I$(DEPS_DIR)/sdl-mixer \ | ||
-I$(DEPS_DIR)/sdl-ttf \ | ||
-I$(DEPS_DIR)/tinycoroutine \ | ||
-I$(CORE_DIR) \ | ||
-I$(DEPS_DIR) | ||
|
||
|
||
CFLAGS += $(INCFLAGS) | ||
CXXFLAGS += $(INCFLAGS) | ||
|
||
# bzip2 | ||
CFLAGS += -D_FILE_OFFSET_BITS=64 | ||
SOURCES_C += \ | ||
$(DEPS_DIR)/bzip2/blocksort.c \ | ||
$(DEPS_DIR)/bzip2/huffman.c \ | ||
$(DEPS_DIR)/bzip2/crctable.c \ | ||
$(DEPS_DIR)/bzip2/randtable.c \ | ||
$(DEPS_DIR)/bzip2/compress.c \ | ||
$(DEPS_DIR)/bzip2/decompress.c \ | ||
$(DEPS_DIR)/bzip2/bzlib.c | ||
|
||
# freetype | ||
CFLAGS += -DFT2_BUILD_LIBRARY=1 | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/freetype/src/,\ | ||
base/ftbase.c \ | ||
base/ftdebug.c \ | ||
base/ftinit.c \ | ||
base/ftsystem.c \ | ||
base/ftbitmap.c \ | ||
base/ftglyph.c \ | ||
base/ftstroke.c \ | ||
autofit/autofit.c \ | ||
psnames/psnames.c \ | ||
sfnt/sfnt.c \ | ||
truetype/truetype.c \ | ||
raster/raster.c \ | ||
smooth/smooth.c \ | ||
) | ||
|
||
# libjpeg-turbo | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/libjpeg-turbo/,\ | ||
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ | ||
jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ | ||
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c \ | ||
jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c \ | ||
jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c \ | ||
jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c \ | ||
jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c \ | ||
jaricom.c jcarith.c jdarith.c \ | ||
jsimd_none.c \ | ||
) | ||
|
||
# libogg | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/libogg/src/,\ | ||
bitwise.c framing.c \ | ||
) | ||
|
||
# libvorbis | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/libvorbis/lib/,\ | ||
mdct.c smallft.c block.c envelope.c window.c lsp.c \ | ||
lpc.c analysis.c synthesis.c psy.c info.c \ | ||
floor1.c floor0.c \ | ||
res0.c mapping0.c registry.c codebook.c sharedbook.c \ | ||
lookup.c bitrate.c vorbisfile.c \ | ||
) | ||
|
||
# sdl | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/sdl/src/,\ | ||
SDL.c SDL_error.c SDL_fatal.c \ | ||
audio/SDL_audio.c audio/SDL_audiocvt.c audio/SDL_audiodev.c \ | ||
audio/SDL_mixer.c audio/SDL_mixer_m68k.c audio/SDL_wave.c \ | ||
cdrom/SDL_cdrom.c cpuinfo/SDL_cpuinfo.c \ | ||
events/SDL_active.c events/SDL_events.c events/SDL_expose.c \ | ||
events/SDL_keyboard.c events/SDL_mouse.c events/SDL_quit.c \ | ||
events/SDL_resize.c \ | ||
file/SDL_rwops.c \ | ||
joystick/SDL_joystick.c \ | ||
stdlib/SDL_getenv.c stdlib/SDL_iconv.c \ | ||
stdlib/SDL_malloc.c stdlib/SDL_qsort.c \ | ||
stdlib/SDL_stdlib.c stdlib/SDL_string.c \ | ||
thread/SDL_thread.c timer/SDL_timer.c \ | ||
video/SDL_blit_0.c video/SDL_blit_1.c video/SDL_blit_A.c \ | ||
video/SDL_blit.c video/SDL_blit_N.c video/SDL_bmp.c video/SDL_cursor.c \ | ||
video/SDL_gamma.c video/SDL_pixels.c video/SDL_RLEaccel.c \ | ||
video/SDL_stretch.c video/SDL_surface.c video/SDL_video.c \ | ||
video/SDL_yuv.c video/SDL_yuv_mmx.c video/SDL_yuv_sw.c \ | ||
cdrom/dummy/SDL_syscdrom.c \ | ||
joystick/dummy/SDL_sysjoystick.c \ | ||
loadso/dummy/SDL_sysloadso.c \ | ||
) | ||
SOURCES_C += $(addprefix $(SDL_LIBRETRO_DIR)/, \ | ||
audio.c events.c video.c thread.c timer.c \ | ||
) | ||
LDFLAGS += -lpthread | ||
|
||
# sdl-image | ||
CFLAGS += -DSIZEOF_SIZE_T=__SIZEOF_SIZE_T__ -DLOAD_JPG | ||
SOURCES_C += $(filter-out %/showimage.c, $(wildcard $(DEPS_DIR)/sdl-image/*.c)) | ||
|
||
# sdl-mixer | ||
CFLAGS += -DOGG_MUSIC | ||
SOURCES_C += $(addprefix $(DEPS_DIR)/sdl-mixer/,\ | ||
mixer.c \ | ||
music.c \ | ||
effects_internal.c \ | ||
effect_position.c \ | ||
load_voc.c \ | ||
load_aiff.c \ | ||
load_ogg.c \ | ||
music_ogg.c \ | ||
dynamic_ogg.c \ | ||
) | ||
|
||
# sdl-ttf | ||
SOURCES_C += $(DEPS_DIR)/sdl-ttf/SDL_ttf.c | ||
|
||
# libretro-common | ||
SOURCES_C += $(addprefix $(LIBRETRO_COMM_DIR)/,\ | ||
compat/compat_strl.c \ | ||
encodings/encoding_utf.c \ | ||
string/stdstring.c \ | ||
time/rtime.c \ | ||
file/file_path.c \ | ||
) | ||
|
||
# tinycoroutine | ||
SOURCES_C += $(DEPS_DIR)/tinycoroutine/tinycoroutine.c | ||
|
||
# onscripter | ||
SOURCES_CXX := $(CORE_DIR)/libretro.cpp | ||
SOURCES_CXX += $(addprefix $(DEPS_DIR)/onscripter/,\ | ||
ONScripter.cpp \ | ||
ONScripter_animation.cpp \ | ||
ONScripter_command.cpp \ | ||
ONScripter_effect.cpp \ | ||
ONScripter_effect_breakup.cpp \ | ||
ONScripter_effect_cascade.cpp \ | ||
ONScripter_event.cpp \ | ||
ONScripter_file.cpp \ | ||
ONScripter_file2.cpp \ | ||
ONScripter_image.cpp \ | ||
ONScripter_lut.cpp \ | ||
ONScripter_rmenu.cpp \ | ||
ONScripter_sound.cpp \ | ||
ONScripter_text.cpp \ | ||
resize_image.cpp \ | ||
sjis2utf16.cpp \ | ||
Encoding.cpp \ | ||
DirectReader.cpp \ | ||
SarReader.cpp \ | ||
NsaReader.cpp \ | ||
ScriptHandler.cpp \ | ||
ScriptParser.cpp \ | ||
ScriptParser_command.cpp \ | ||
FontInfo.cpp \ | ||
AnimationInfo.cpp \ | ||
DirtyRect.cpp \ | ||
) |
Oops, something went wrong.