Skip to content

Commit 9e694ae

Browse files
author
宋文武
committed
add libretro port
1 parent b19611e commit 9e694ae

File tree

11 files changed

+5733
-0
lines changed

11 files changed

+5733
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "third_party/SheenBidi"]
1717
path = third_party/SheenBidi
1818
url = https://github.com/Tehreer/SheenBidi
19+
[submodule "third_party/SDL"]
20+
path = third_party/SDL
21+
url = https://github.com/libsdl-org/SDL.git

desktop_version/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ endif()
2323

2424
option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute paths to source directories compiled into the binary (if any) with relative paths" ON)
2525

26+
option(BUILD_LIBRETRO "Build a libretro core" OFF)
27+
option(LIBRETRO_STATIC "Statically link the libretro core" OFF)
2628

2729
# Architecture Flags
2830
if(APPLE)
@@ -136,6 +138,30 @@ if(WIN32)
136138
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
137139
elseif(ANDROID)
138140
add_library(VVVVVV SHARED ${VVV_SRC})
141+
elseif(BUILD_LIBRETRO)
142+
set(BUNDLE_DEPENDENCIES ON)
143+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
144+
add_subdirectory(libretro)
145+
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/third_party/SDL/include)
146+
set(SDL2_LIBRARIES sdl2)
147+
148+
list(APPEND VVV_SRC libretro/libretro.c libretro/SDL_libretro.c)
149+
if (LIBRETRO_STATIC)
150+
add_library(VVVVVV STATIC ${VVV_SRC})
151+
else()
152+
add_library(VVVVVV SHARED ${VVV_SRC})
153+
endif()
154+
155+
# Follow naming conventions for libretro cores
156+
set_target_properties(VVVVVV PROPERTIES
157+
PREFIX ""
158+
OUTPUT_NAME "vvvvvv_libretro"
159+
)
160+
target_link_options(VVVVVV PRIVATE
161+
-Wl,--version-script=${CMAKE_SOURCE_DIR}/libretro/link.T
162+
-Wl,--no-undefined
163+
-lm -pthread
164+
)
139165
else()
140166
add_executable(VVVVVV ${VVV_SRC})
141167
endif()
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# configure SDL2 for libretro
2+
file(COPY SDL_config.h DESTINATION ${CMAKE_SOURCE_DIR}/../third_party/SDL/include)
3+
file(COPY SDL_dynapi.h DESTINATION ${CMAKE_SOURCE_DIR}/../third_party/SDL/src/dynapi)
4+
5+
add_library(sdl2 STATIC
6+
../../third_party/SDL/src/SDL.c
7+
../../third_party/SDL/src/SDL_assert.c
8+
../../third_party/SDL/src/SDL_dataqueue.c
9+
../../third_party/SDL/src/SDL_error.c
10+
../../third_party/SDL/src/SDL_guid.c
11+
../../third_party/SDL/src/SDL_hints.c
12+
../../third_party/SDL/src/SDL_list.c
13+
../../third_party/SDL/src/SDL_log.c
14+
../../third_party/SDL/src/SDL_utils.c
15+
../../third_party/SDL/src/atomic/SDL_atomic.c
16+
../../third_party/SDL/src/atomic/SDL_spinlock.c
17+
../../third_party/SDL/src/audio/SDL_audio.c
18+
../../third_party/SDL/src/audio/SDL_audiocvt.c
19+
../../third_party/SDL/src/audio/SDL_audiodev.c
20+
../../third_party/SDL/src/audio/SDL_audiotypecvt.c
21+
../../third_party/SDL/src/audio/SDL_mixer.c
22+
../../third_party/SDL/src/audio/SDL_wave.c
23+
../../third_party/SDL/src/loadso/dlopen/SDL_sysloadso.c
24+
../../third_party/SDL/src/core/linux/SDL_threadprio.c
25+
../../third_party/SDL/src/filesystem/unix/SDL_sysfilesystem.c
26+
../../third_party/SDL/src/cpuinfo/SDL_cpuinfo.c
27+
../../third_party/SDL/src/dynapi/SDL_dynapi.c
28+
../../third_party/SDL/src/events/SDL_clipboardevents.c
29+
../../third_party/SDL/src/events/SDL_displayevents.c
30+
../../third_party/SDL/src/events/SDL_dropevents.c
31+
../../third_party/SDL/src/events/SDL_events.c
32+
../../third_party/SDL/src/events/SDL_gesture.c
33+
../../third_party/SDL/src/events/SDL_keyboard.c
34+
../../third_party/SDL/src/events/SDL_keysym_to_scancode.c
35+
../../third_party/SDL/src/events/SDL_mouse.c
36+
../../third_party/SDL/src/events/SDL_quit.c
37+
../../third_party/SDL/src/events/SDL_scancode_tables.c
38+
../../third_party/SDL/src/events/SDL_touch.c
39+
../../third_party/SDL/src/events/SDL_windowevents.c
40+
../../third_party/SDL/src/events/imKStoUCS.c
41+
../../third_party/SDL/src/file/SDL_rwops.c
42+
../../third_party/SDL/src/joystick/SDL_gamecontroller.c
43+
../../third_party/SDL/src/joystick/SDL_joystick.c
44+
../../third_party/SDL/src/joystick/SDL_steam_virtual_gamepad.c
45+
../../third_party/SDL/src/joystick/controller_type.c
46+
../../third_party/SDL/src/joystick/dummy/SDL_sysjoystick.c
47+
../../third_party/SDL/src/haptic/SDL_haptic.c
48+
../../third_party/SDL/src/haptic/dummy/SDL_syshaptic.c
49+
../../third_party/SDL/src/render/SDL_d3dmath.c
50+
../../third_party/SDL/src/render/SDL_render.c
51+
../../third_party/SDL/src/render/SDL_yuv_sw.c
52+
../../third_party/SDL/src/render/opengl/SDL_render_gl.c
53+
../../third_party/SDL/src/render/opengl/SDL_shaders_gl.c
54+
../../third_party/SDL/src/render/opengles/SDL_render_gles.c
55+
../../third_party/SDL/src/render/opengles2/SDL_render_gles2.c
56+
../../third_party/SDL/src/render/opengles2/SDL_shaders_gles2.c
57+
../../third_party/SDL/src/render/software/SDL_blendfillrect.c
58+
../../third_party/SDL/src/render/software/SDL_blendline.c
59+
../../third_party/SDL/src/render/software/SDL_blendpoint.c
60+
../../third_party/SDL/src/render/software/SDL_drawline.c
61+
../../third_party/SDL/src/render/software/SDL_drawpoint.c
62+
../../third_party/SDL/src/render/software/SDL_render_sw.c
63+
../../third_party/SDL/src/render/software/SDL_rotate.c
64+
../../third_party/SDL/src/render/software/SDL_triangle.c
65+
../../third_party/SDL/src/stdlib/SDL_crc16.c
66+
../../third_party/SDL/src/stdlib/SDL_crc32.c
67+
../../third_party/SDL/src/stdlib/SDL_getenv.c
68+
../../third_party/SDL/src/stdlib/SDL_iconv.c
69+
../../third_party/SDL/src/stdlib/SDL_malloc.c
70+
../../third_party/SDL/src/stdlib/SDL_mslibc.c
71+
../../third_party/SDL/src/stdlib/SDL_qsort.c
72+
../../third_party/SDL/src/stdlib/SDL_stdlib.c
73+
../../third_party/SDL/src/stdlib/SDL_string.c
74+
../../third_party/SDL/src/stdlib/SDL_strtokr.c
75+
../../third_party/SDL/src/thread/SDL_thread.c
76+
../../third_party/SDL/src/thread/pthread/SDL_syscond.c
77+
../../third_party/SDL/src/thread/pthread/SDL_sysmutex.c
78+
../../third_party/SDL/src/thread/pthread/SDL_syssem.c
79+
../../third_party/SDL/src/thread/pthread/SDL_systhread.c
80+
../../third_party/SDL/src/thread/pthread/SDL_systls.c
81+
../../third_party/SDL/src/timer/SDL_timer.c
82+
../../third_party/SDL/src/timer/unix/SDL_systimer.c
83+
../../third_party/SDL/src/video/SDL_RLEaccel.c
84+
../../third_party/SDL/src/video/SDL_blit.c
85+
../../third_party/SDL/src/video/SDL_blit_0.c
86+
../../third_party/SDL/src/video/SDL_blit_1.c
87+
../../third_party/SDL/src/video/SDL_blit_A.c
88+
../../third_party/SDL/src/video/SDL_blit_N.c
89+
../../third_party/SDL/src/video/SDL_blit_auto.c
90+
../../third_party/SDL/src/video/SDL_blit_copy.c
91+
../../third_party/SDL/src/video/SDL_blit_slow.c
92+
../../third_party/SDL/src/video/SDL_bmp.c
93+
../../third_party/SDL/src/video/SDL_clipboard.c
94+
../../third_party/SDL/src/video/SDL_egl.c
95+
../../third_party/SDL/src/video/SDL_fillrect.c
96+
../../third_party/SDL/src/video/SDL_pixels.c
97+
../../third_party/SDL/src/video/SDL_rect.c
98+
../../third_party/SDL/src/video/SDL_shape.c
99+
../../third_party/SDL/src/video/SDL_stretch.c
100+
../../third_party/SDL/src/video/SDL_surface.c
101+
../../third_party/SDL/src/video/SDL_video.c
102+
../../third_party/SDL/src/video/SDL_vulkan_utils.c
103+
../../third_party/SDL/src/video/SDL_yuv.c
104+
../../third_party/SDL/src/video/yuv2rgb/yuv_rgb_lsx.c
105+
../../third_party/SDL/src/video/yuv2rgb/yuv_rgb_sse.c
106+
../../third_party/SDL/src/video/yuv2rgb/yuv_rgb_std.c
107+
../../third_party/SDL/src/misc/SDL_url.c
108+
../../third_party/SDL/src/misc/unix/SDL_sysurl.c
109+
)
110+
target_include_directories(sdl2 PUBLIC
111+
../../third_party/SDL/include
112+
)

0 commit comments

Comments
 (0)