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')
|
_inject_list(kwargs, dependency.cook_result, 'LIBS')
|
||||||
for depdep in dependency.depdeps:
|
for depdep in dependency.depdeps:
|
||||||
_inject_dependency(depdep, kwargs)
|
_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):
|
def _rglob(env: Environment, root_path: str, pattern: str, **kwargs):
|
||||||
result_nodes = []
|
result_nodes = []
|
||||||
@ -335,10 +343,11 @@ def _wrap_builder(builder, target_type: TargetType):
|
|||||||
if version_spec == {}:
|
if version_spec == {}:
|
||||||
dep_target = _find_target(env, name)
|
dep_target = _find_target(env, name)
|
||||||
if dep_target is not None and dep_target.target_type == TargetType.LIBRARY:
|
if dep_target is not None and dep_target.target_type == TargetType.LIBRARY:
|
||||||
if 'LIBS' in kwargs:
|
#if 'LIBS' in kwargs:
|
||||||
kwargs['LIBS'].append(dep_target)
|
# kwargs['LIBS'].append(dep_target)
|
||||||
else:
|
#else:
|
||||||
kwargs['LIBS'] = [dep_target]
|
# kwargs['LIBS'] = [dep_target]
|
||||||
|
target_dependencies.append(dep_target)
|
||||||
continue
|
continue
|
||||||
target_dependencies.append(_add_dependency(env, name, _parse_version_spec(version_spec)))
|
target_dependencies.append(_add_dependency(env, name, _parse_version_spec(version_spec)))
|
||||||
|
|
||||||
@ -747,6 +756,7 @@ env.Append(CPPDEFINES = [])
|
|||||||
env.Append(LINKFLAGS = [])
|
env.Append(LINKFLAGS = [])
|
||||||
|
|
||||||
# init SPP environment variables
|
# init SPP environment variables
|
||||||
|
env['SPP_DIR'] = _spp_dir.abspath
|
||||||
env['SPP_TARGETS'] = []
|
env['SPP_TARGETS'] = []
|
||||||
env['SPP_DEFAULT_TARGETS'] = []
|
env['SPP_DEFAULT_TARGETS'] = []
|
||||||
env['SPP_TARGET_DEPENDENCIES'] = []
|
env['SPP_TARGET_DEPENDENCIES'] = []
|
||||||
|
@ -35,7 +35,9 @@ def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str
|
|||||||
else:
|
else:
|
||||||
print(f'Not updating git repository {worktree_dir} as it is not on a branch.')
|
print(f'Not updating git repository {worktree_dir} as it is not on a branch.')
|
||||||
return {
|
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]':
|
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 platform
|
||||||
import re
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
@ -7,6 +8,13 @@ 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']
|
||||||
|
|
||||||
|
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'])
|
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':
|
||||||
|
@ -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">
|
<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>
|
<exec>
|
||||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
<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$" />
|
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||||
</exec>
|
</exec>
|
||||||
</tool>
|
</tool>
|
||||||
@ -18,11 +18,4 @@
|
|||||||
</tool>
|
</tool>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% 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>
|
</toolSet>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user