Skip to content

Commit 1ae5636

Browse files
committed
feat: sdl3
1 parent aa5144c commit 1ae5636

File tree

177 files changed

+140600
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+140600
-47
lines changed

cmake/xpinmame/CMakeLists_linux-x64.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
33
file(READ src/version.h version)
44
string(REGEX MATCH "#define VERSION_MAJOR +([0-9]+).*#define VERSION_MINOR +([0-9]+).*#define VERSION_REV +([0-9]+)" _ ${version})
55

6-
set(PROJECT_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
6+
set(PROJECT_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
77
message("PROJECT_VERSION=${PROJECT_VERSION}")
88

99
project(xpinmame VERSION ${PROJECT_VERSION})
@@ -651,9 +651,9 @@ find_package(
651651
ALSA
652652
)
653653

654-
find_package(
655-
SDL2 REQUIRED
656-
)
654+
#find_package(
655+
# SDL2 REQUIRED
656+
#)
657657

658658
target_include_directories(xpinmame PUBLIC
659659
src
@@ -665,7 +665,12 @@ target_include_directories(xpinmame PUBLIC
665665
# ${X11_X11_INCLUDE_PATH}
666666
# ${X11_Xv_INCLUDE_PATH}
667667
${ALSA_INCLUDE_DIRS}
668-
${SDL2_INCLUDE_DIRS}
668+
# ${SDL2_INCLUDE_DIRS}
669+
${CMAKE_SOURCE_DIR}/platforms/linux/x64/external/include
670+
)
671+
672+
target_link_directories(xpinmame PUBLIC
673+
${CMAKE_SOURCE_DIR}/platforms/linux/x64/external/lib
669674
)
670675

671676
target_link_libraries(xpinmame PUBLIC
@@ -674,7 +679,8 @@ target_link_libraries(xpinmame PUBLIC
674679
# ${X11_Xv_LIB}
675680
# ${X11_Xext_LIB}
676681
${ALSA_LIBRARIES}
677-
${SDL2_LIBRARIES}
682+
# ${SDL2_LIBRARIES}
683+
SDL3
678684
)
679685

680686
set_target_properties(xpinmame PROPERTIES

platforms/linux/x64/external.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SDL_VERSION=3.1.3
6+
7+
NUM_PROCS=$(nproc)
8+
9+
echo "Building external libraries..."
10+
echo " SDL_VERSION: ${SDL_VERSION}"
11+
echo ""
12+
13+
if [ -z "${BUILD_TYPE}" ]; then
14+
BUILD_TYPE="Release"
15+
fi
16+
17+
echo "Build type: ${BUILD_TYPE}"
18+
echo "Procs: ${NUM_PROCS}"
19+
echo ""
20+
21+
CACHE_DIR="external/cache/${BUILD_TYPE}"
22+
23+
rm -rf external/include external/lib
24+
mkdir -p external/include external/lib ${CACHE_DIR}
25+
26+
rm -rf tmp
27+
mkdir tmp
28+
cd tmp
29+
30+
#
31+
# build SDL3, SDL_image, SDL_ttf and copy to external
32+
#
33+
34+
CACHE_NAME="SDL-${SDL_VERSION}_002"
35+
36+
if [ ! -f "../${CACHE_DIR}/${CACHE_NAME}.cache" ]; then
37+
curl -sL https://github.com/libsdl-org/SDL/releases/download/preview-${SDL_VERSION}/SDL3-${SDL_VERSION}.tar.xz -o SDL3-${SDL_VERSION}.tar.xz
38+
tar -xf SDL3-3.1.3.tar.xz
39+
cd SDL3-3.1.3
40+
cmake \
41+
-DSDL_SHARED=ON \
42+
-DSDL_STATIC=OFF \
43+
-DSDL_TEST_LIBRARY=OFF \
44+
-DSDL_OPENGLES=OFF \
45+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
46+
-B build
47+
cmake --build build -- -j${NUM_PROCS}
48+
mkdir -p ../../${CACHE_DIR}/${CACHE_NAME}/include/SDL3
49+
cp -r include/SDL3/* ../../${CACHE_DIR}/${CACHE_NAME}/include/SDL3
50+
mkdir -p ../../${CACHE_DIR}/${CACHE_NAME}/lib
51+
cp -a build/*.{so,so.*} ../../${CACHE_DIR}/${CACHE_NAME}/lib
52+
cd ..
53+
54+
touch "../${CACHE_DIR}/${CACHE_NAME}.cache"
55+
fi
56+
57+
mkdir -p ../external/include/SDL3
58+
cp -r ../${CACHE_DIR}/${CACHE_NAME}/include/SDL3/* ../external/include/SDL3
59+
cp -a ../${CACHE_DIR}/${CACHE_NAME}/lib/*.{so,so.*} ../external/lib
60+

platforms/linux/x64/external/cache/Release/SDL-3.1.3_002.cache

Whitespace-only changes.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
Simple DirectMedia Layer
3+
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
14+
claim that you wrote the original software. If you use this software
15+
in a product, an acknowledgment in the product documentation would be
16+
appreciated but is not required.
17+
2. Altered source versions must be plainly marked as such, and must not be
18+
misrepresented as being the original software.
19+
3. This notice may not be removed or altered from any source distribution.
20+
*/
21+
22+
/**
23+
* \file SDL.h
24+
*
25+
* Main include header for the SDL library, version 3.1.3
26+
*/
27+
28+
#ifndef SDL_h_
29+
#define SDL_h_
30+
31+
#include <SDL3/SDL_stdinc.h>
32+
#include <SDL3/SDL_assert.h>
33+
#include <SDL3/SDL_atomic.h>
34+
#include <SDL3/SDL_audio.h>
35+
#include <SDL3/SDL_bits.h>
36+
#include <SDL3/SDL_blendmode.h>
37+
#include <SDL3/SDL_camera.h>
38+
#include <SDL3/SDL_clipboard.h>
39+
#include <SDL3/SDL_cpuinfo.h>
40+
#include <SDL3/SDL_dialog.h>
41+
#include <SDL3/SDL_endian.h>
42+
#include <SDL3/SDL_error.h>
43+
#include <SDL3/SDL_events.h>
44+
#include <SDL3/SDL_filesystem.h>
45+
#include <SDL3/SDL_gamepad.h>
46+
#include <SDL3/SDL_gpu.h>
47+
#include <SDL3/SDL_guid.h>
48+
#include <SDL3/SDL_haptic.h>
49+
#include <SDL3/SDL_hidapi.h>
50+
#include <SDL3/SDL_hints.h>
51+
#include <SDL3/SDL_init.h>
52+
#include <SDL3/SDL_iostream.h>
53+
#include <SDL3/SDL_joystick.h>
54+
#include <SDL3/SDL_keyboard.h>
55+
#include <SDL3/SDL_keycode.h>
56+
#include <SDL3/SDL_loadso.h>
57+
#include <SDL3/SDL_locale.h>
58+
#include <SDL3/SDL_log.h>
59+
#include <SDL3/SDL_messagebox.h>
60+
#include <SDL3/SDL_metal.h>
61+
#include <SDL3/SDL_misc.h>
62+
#include <SDL3/SDL_mouse.h>
63+
#include <SDL3/SDL_mutex.h>
64+
#include <SDL3/SDL_pen.h>
65+
#include <SDL3/SDL_pixels.h>
66+
#include <SDL3/SDL_platform.h>
67+
#include <SDL3/SDL_power.h>
68+
#include <SDL3/SDL_process.h>
69+
#include <SDL3/SDL_properties.h>
70+
#include <SDL3/SDL_rect.h>
71+
#include <SDL3/SDL_render.h>
72+
#include <SDL3/SDL_scancode.h>
73+
#include <SDL3/SDL_sensor.h>
74+
#include <SDL3/SDL_storage.h>
75+
#include <SDL3/SDL_surface.h>
76+
#include <SDL3/SDL_system.h>
77+
#include <SDL3/SDL_thread.h>
78+
#include <SDL3/SDL_time.h>
79+
#include <SDL3/SDL_timer.h>
80+
#include <SDL3/SDL_touch.h>
81+
#include <SDL3/SDL_version.h>
82+
#include <SDL3/SDL_video.h>
83+
#include <SDL3/SDL_oldnames.h>
84+
85+
#endif /* SDL_h_ */

0 commit comments

Comments
 (0)