Skip to content

Commit

Permalink
Added the full SDL sources as a vendored lib. Preparing for SDL3
Browse files Browse the repository at this point in the history
  • Loading branch information
tanis2000 committed Jul 22, 2024
1 parent 14ae897 commit 4ca21aa
Show file tree
Hide file tree
Showing 1,556 changed files with 376,567 additions and 171,109 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ elseif(APPLE AND NOT ANDROID)
include(BinocleIOS)
elseif (WATCHOS)
message("Including watchOS defines")
include(BinocleWATCHOS)
include(BinocleWatchOS)
else()
message("Including Mac defines")
include(BinocleMac)
Expand Down
36 changes: 32 additions & 4 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if (APPLE)
include_directories(${CMAKE_SOURCE_DIR}/src/deps/sdl/include/configs/default)
include_directories(${PROJECT_SOURCE_DIR}/src/deps/lua/src)
include_directories(${PROJECT_SOURCE_DIR}/src/deps/luasocket/src)
elseif (WATCHOS)
include_directories(${CMAKE_SOURCE_DIR}/src/deps/sdl/include/configs/default)
include_directories(${PROJECT_SOURCE_DIR}/src/deps/lua/src)
include_directories(${PROJECT_SOURCE_DIR}/src/deps/luasocket/src)
else ()
include_directories(${CMAKE_SOURCE_DIR}/src/deps/sdl/include/configs/mac)
include_directories(${CMAKE_SOURCE_DIR}/src/deps/glew/include)
Expand Down Expand Up @@ -90,7 +94,7 @@ else ()
add_executable(ExampleProject MACOSX_BUNDLE ${EXE_TYPE} ${SOURCE_FILES} ${BINOCLE_ICON} ${RESOURCES})
endif ()

if (NOT EMSCRIPTEN AND NOT ANDROID AND NOT IOS)
if (NOT EMSCRIPTEN AND NOT ANDROID AND NOT IOS AND NOT WATCHOS)
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(OPENSSL_MSVC_STATIC_RT TRUE)
find_package(OpenSSL REQUIRED)
Expand Down Expand Up @@ -170,6 +174,30 @@ if (APPLE)
# COMMAND /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks ${CMAKE_SOURCE_DIR}/assets ${APP_NAME}
#)
endif ()

if (WATCHOS)
message("Using plist file: ${CMAKE_SOURCE_DIR}/platform/ios/Info.plist")
set_target_properties(
${PROJECT_NAME}
PROPERTIES
MACOSX_BUNDLE YES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/platform/ios/Info.plist"
XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Automatic"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iOS Developer"
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "Automatic"
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${IOS_DEVELOPMENT_TEAM_ID}"
XCODE_ATTRIBUTE_INFOPLIST_PREPROCESS YES
XCODE_ATTRIBUTE_WATCHOS_DEPLOYMENT_TARGET 7.0
RESOURCE "${RESOURCES}"
)

# Copy resources
#add_custom_command(
# TARGET ${NAME}
# POST_BUILD
# COMMAND /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks ${CMAKE_SOURCE_DIR}/assets ${APP_NAME}
#)
endif ()
endif ()


Expand All @@ -179,7 +207,7 @@ if (MSVC)
elseif (APPLE)
#ICNS
set(MACOSX_BUNDLE_ICON_FILE ExampleProject.icns)
if (NOT IOS)
if (NOT IOS AND NOT WATCHOS)
set(BINOCLE_ICON ${CMAKE_SOURCE_DIR}/cmake/Binocle.icns)
endif ()
set_source_files_properties(${BINOCLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
Expand All @@ -205,7 +233,7 @@ if (MSVC)
elseif (APPLE)
#ICNS
set(MACOSX_BUNDLE_ICON_FILE ExampleProject.icns)
if (NOT IOS)
if (NOT IOS AND NOT WATCHOS)
set(BINOCLE_ICON ${CMAKE_SOURCE_DIR}/build/cmake/Binocle.icns)
endif ()
set_source_files_properties(${BINOCLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
Expand Down Expand Up @@ -253,7 +281,7 @@ endif(NOT MSVC)
#endif ()

if (APPLE)
if (NOT IOS)
if (NOT IOS AND NOT WATCHOS)
add_custom_command ( TARGET ExampleProject POST_BUILD
COMMAND codesign -s - -f --entitlements "${CMAKE_SOURCE_DIR}/platform/macosx/entitlements.plist"
$<TARGET_FILE:ExampleProject>
Expand Down
4 changes: 2 additions & 2 deletions example/gameplay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ file(GLOB SOURCE_FILES
GroupSources("gameplay")

# TODO: make it shared only on the desktop and in debug mode
if(IOS OR ANDROID)
if(IOS OR ANDROID OR WATCHOS)
add_library(gameplay STATIC ${SOURCE_FILES})
else()
add_library(gameplay SHARED ${SOURCE_FILES})
endif(IOS OR ANDROID)
endif(IOS OR ANDROID OR WATCHOS)

#target_link_libraries(gameplay ${BINOCLE_LINK_LIBRARIES})
target_link_libraries(gameplay binocle-static)
Expand Down
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif ()

if (NOT EMSCRIPTEN)
set(BINOCLE_STATIC_LIBS ${BINOCLE_STATIC_LIBS}
$<TARGET_OBJECTS:sdl>
$<TARGET_OBJECTS:SDL2::SDL2>
$<TARGET_OBJECTS:ogg>
$<TARGET_OBJECTS:vorbis>
$<TARGET_OBJECTS:zlib>
Expand Down Expand Up @@ -71,6 +71,13 @@ if (IOS)
)
endif()

if (WATCHOS)
set(BINOCLE_STATIC_LIBS ${BINOCLE_STATIC_LIBS}
$<TARGET_OBJECTS:lua>
$<TARGET_OBJECTS:luasocket>
)
endif()

if (ANDROID)
set(BINOCLE_STATIC_LIBS ${BINOCLE_STATIC_LIBS}
$<TARGET_OBJECTS:vorbisidec>
Expand Down
9 changes: 7 additions & 2 deletions src/deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ add_subdirectory(libuv)
add_subdirectory(wren)

if (NOT EMSCRIPTEN)
add_subdirectory(sdl)
add_subdirectory(sdl EXCLUDE_FROM_ALL)
add_subdirectory(vorbis)
add_subdirectory(ogg)
else()
add_subdirectory(lua)
add_subdirectory(luasocket)
endif()

if (APPLE AND NOT IOS)
if (APPLE AND NOT IOS AND NOT WATCHOS)
add_subdirectory(glew)
# we're using lua instead of luajit on macos to be able to test with valgrind
#add_subdirectory(luajit)
Expand Down Expand Up @@ -55,6 +55,11 @@ if (IOS)
add_subdirectory(luasocket)
endif()

if (WATCHOS)
add_subdirectory(lua)
add_subdirectory(luasocket)
endif()

if (MSVC)
add_subdirectory(glew)
# we're using lua instead of luajit on macos to be able to test with valgrind
Expand Down
1 change: 0 additions & 1 deletion src/deps/sdl/.gitignore

This file was deleted.

130 changes: 130 additions & 0 deletions src/deps/sdl/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
LOCAL_PATH := $(call my-dir)

###########################
#
# SDL shared library
#
###########################

include $(CLEAR_VARS)

LOCAL_MODULE := SDL2

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
$(wildcard $(LOCAL_PATH)/src/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/aaudio/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/openslES/*.c) \
$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/hidapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/hidapi/android/*.cpp) \
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
$(wildcard $(LOCAL_PATH)/src/locale/*.c) \
$(wildcard $(LOCAL_PATH)/src/locale/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/misc/*.c) \
$(wildcard $(LOCAL_PATH)/src/misc/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/sensor/*.c) \
$(wildcard $(LOCAL_PATH)/src/sensor/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
$(wildcard $(LOCAL_PATH)/src/test/*.c))

LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
-Wall -Wextra \
-Wdocumentation \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \
-Wmissing-variable-declarations \
-Wfloat-conversion \
-Wshorten-64-to-32 \
-Wunreachable-code-return \
-Wshift-sign-overflow \
-Wstrict-prototypes \
-Wkeyword-macro \

# Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare

LOCAL_CXXFLAGS += -std=gnu++11

LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid

LOCAL_LDFLAGS := -Wl,--no-undefined

ifeq ($(NDK_DEBUG),1)
cmd-strip :=
endif

LOCAL_STATIC_LIBRARIES := cpufeatures

include $(BUILD_SHARED_LIBRARY)


###########################
#
# SDL static library
#
###########################

LOCAL_MODULE := SDL2_static

LOCAL_MODULE_FILENAME := libSDL2

LOCAL_LDLIBS :=

LOCAL_LDFLAGS :=

LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid

include $(BUILD_STATIC_LIBRARY)


###########################
#
# SDL main static library
#
###########################

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

LOCAL_MODULE := SDL2_main

LOCAL_MODULE_FILENAME := libSDL2main

include $(BUILD_STATIC_LIBRARY)

$(call import-module,android/cpufeatures)
16 changes: 16 additions & 0 deletions src/deps/sdl/BUGS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Bugs are now managed in the SDL issue tracker, here:

https://github.com/libsdl-org/SDL/issues

You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.


You may also find help at the SDL forums/mailing list:

https://discourse.libsdl.org/

Bug reports are welcome here, but we really appreciate if you use the issue
tracker, as bugs discussed on the mailing list may be forgotten or missed.

Loading

0 comments on commit 4ca21aa

Please sign in to comment.