Automatically apply patch when compiling SDL3.
This commit is contained in:
parent
2b05834798
commit
f2dc9872f7
18
SConscript
18
SConscript
@ -119,6 +119,14 @@ def _inject_dependency(dependency, kwargs: dict, add_sources: bool = True) -> No
|
||||
_inject_list(kwargs, dependency.cook_result, 'LIBS')
|
||||
for depdep in dependency.depdeps:
|
||||
_inject_dependency(depdep, kwargs)
|
||||
elif isinstance(dependency, _Target):
|
||||
_inject_list(kwargs, dependency.kwargs, 'CPPPATH')
|
||||
_inject_list(kwargs, dependency.kwargs, 'CPPDEFINES')
|
||||
_inject_list(kwargs, dependency.kwargs, 'LIBPATH')
|
||||
_inject_list(kwargs, dependency.kwargs, 'LIBS')
|
||||
_inject_list(kwargs, {'LIBS': [dependency]}, 'LIBS')
|
||||
for depdep in dependency.dependencies:
|
||||
_inject_dependency(depdep, kwargs)
|
||||
|
||||
def _rglob(env: Environment, root_path: str, pattern: str, **kwargs):
|
||||
result_nodes = []
|
||||
@ -335,10 +343,11 @@ def _wrap_builder(builder, target_type: TargetType):
|
||||
if version_spec == {}:
|
||||
dep_target = _find_target(env, name)
|
||||
if dep_target is not None and dep_target.target_type == TargetType.LIBRARY:
|
||||
if 'LIBS' in kwargs:
|
||||
kwargs['LIBS'].append(dep_target)
|
||||
else:
|
||||
kwargs['LIBS'] = [dep_target]
|
||||
#if 'LIBS' in kwargs:
|
||||
# kwargs['LIBS'].append(dep_target)
|
||||
#else:
|
||||
# kwargs['LIBS'] = [dep_target]
|
||||
target_dependencies.append(dep_target)
|
||||
continue
|
||||
target_dependencies.append(_add_dependency(env, name, _parse_version_spec(version_spec)))
|
||||
|
||||
@ -747,6 +756,7 @@ env.Append(CPPDEFINES = [])
|
||||
env.Append(LINKFLAGS = [])
|
||||
|
||||
# init SPP environment variables
|
||||
env['SPP_DIR'] = _spp_dir.abspath
|
||||
env['SPP_TARGETS'] = []
|
||||
env['SPP_DEFAULT_TARGETS'] = []
|
||||
env['SPP_TARGET_DEPENDENCIES'] = []
|
||||
|
@ -35,7 +35,9 @@ def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str
|
||||
else:
|
||||
print(f'Not updating git repository {worktree_dir} as it is not on a branch.')
|
||||
return {
|
||||
'checkout_root': worktree_dir
|
||||
'checkout_root': worktree_dir,
|
||||
'repo': repo,
|
||||
'origin': origin
|
||||
}
|
||||
|
||||
def _git_tags(env: Environment, repo_name: str, remote_url: str, force_fetch: bool = False) -> 'list[str]':
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
from SCons.Script import *
|
||||
@ -7,6 +8,13 @@ from SCons.Script import *
|
||||
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||
checkout_root = repo['checkout_root']
|
||||
|
||||
if os.path.exists(os.path.join(repo['checkout_root'], 'cmake', 'GetGitRevisionDescription.cmake')):
|
||||
try:
|
||||
repo['repo'].git.apply('--unsafe-paths', '--directory', repo['checkout_root'], os.path.join(env['SPP_DIR'], 'recipes', 'SDL', 'fix_sdl3_from_worktree.patch'))
|
||||
except:
|
||||
# either already applied or not applicable anymore
|
||||
pass
|
||||
|
||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
||||
libs = []
|
||||
if platform.system() == 'Windows':
|
||||
|
@ -5,7 +5,7 @@
|
||||
<tool name="{{ executable.name }} {{ build_type_name }}" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="-j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ executable.filename }}" />
|
||||
<option name="PARAMETERS" value="-j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ executable.filename }} compile_commands.json" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
@ -18,11 +18,4 @@
|
||||
</tool>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<tool name="Regenerate Project" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="--generate_project=clion" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
</toolSet>
|
||||
|
Loading…
x
Reference in New Issue
Block a user