Adjusted SDL build script to work with SDL3 (kind of).
This commit is contained in:
parent
1b8d6e175b
commit
941f94a7b6
13
recipes/SDL/fix_sdl3_from_worktree.patch
Normal file
13
recipes/SDL/fix_sdl3_from_worktree.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake
|
||||||
|
index a08895c64..d3873387d 100644
|
||||||
|
--- a/cmake/GetGitRevisionDescription.cmake
|
||||||
|
+++ b/cmake/GetGitRevisionDescription.cmake
|
||||||
|
@@ -143,7 +143,7 @@ function(get_git_head_revision _refspecvar _hashvar)
|
||||||
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||||
|
${worktree_ref})
|
||||||
|
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||||
|
- _git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||||
|
+ set(GIT_DIR "${git_worktree_dir}")
|
||||||
|
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
@ -6,22 +6,32 @@ from SCons.Script import *
|
|||||||
|
|
||||||
def _git_cook(env: Environment, repo: dict) -> dict:
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
|
|
||||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
||||||
libs = []
|
libs = []
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
if env['BUILD_TYPE'] == 'debug':
|
if env['BUILD_TYPE'] == 'debug':
|
||||||
libs.append('SDL2-staticd')
|
lib_names = ['SDL2-staticd', 'SDL3-staticd']
|
||||||
else:
|
else:
|
||||||
libs.append('SDL2-static')
|
lib_names = ['SDL2-static', 'SDL3-static']
|
||||||
libs.extend(('kernel32', 'user32', 'gdi32', 'winmm', 'imm32', 'ole32', 'oleaut32', 'version', 'uuid', 'advapi32', 'setupapi', 'shell32', 'dinput8'))
|
libs.extend(('kernel32', 'user32', 'gdi32', 'winmm', 'imm32', 'ole32', 'oleaut32', 'version', 'uuid', 'advapi32', 'setupapi', 'shell32', 'dinput8'))
|
||||||
else:
|
else:
|
||||||
if env['BUILD_TYPE'] == 'debug':
|
if env['BUILD_TYPE'] == 'debug':
|
||||||
libs.append('SDL2d')
|
lib_names = ['SDL2d', 'SDL3']
|
||||||
else:
|
else:
|
||||||
libs.append('SDL2')
|
lib_names = ['SDL2', 'SDL3']
|
||||||
|
lib_file = None
|
||||||
|
is_sdl3 = False
|
||||||
|
for lib_name in lib_names:
|
||||||
|
lib_file = env.FindLib(lib_name, paths=build_result['LIBPATH'], allow_fail=True)
|
||||||
|
if lib_file:
|
||||||
|
is_sdl3 = "SDL3" in lib_name
|
||||||
|
break
|
||||||
|
if not lib_file:
|
||||||
|
env.Error('Could not find SDL lib file.')
|
||||||
|
libs.insert(0, lib_file)
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
'CPPPATH': [os.path.join(build_result['install_dir'], (is_sdl3 and 'include' or 'include/SDL2'))], # SDL is really weird about include paths ...
|
||||||
'CPPPATH': [os.path.join(build_result['install_dir'], 'include/SDL2')], # SDL is really weird about include paths ...
|
|
||||||
'LIBS': libs
|
'LIBS': libs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user