Added recipe for winsock2 and target_os to dependency conditions.
This commit is contained in:
parent
378c6ba341
commit
9c64f982fd
13
SConscript
13
SConscript
@ -126,7 +126,8 @@ def _deps_from_json(env: Environment, deps: dict) -> dict:
|
|||||||
for key, dep in deps.items():
|
for key, dep in deps.items():
|
||||||
if 'condition' in dep:
|
if 'condition' in dep:
|
||||||
if not _safe_eval(dep['condition'], {
|
if not _safe_eval(dep['condition'], {
|
||||||
'compiler_family': env['COMPILER_FAMILY']
|
'compiler_family': env['COMPILER_FAMILY'],
|
||||||
|
'target_os': os.name
|
||||||
}):
|
}):
|
||||||
to_remove.append(key)
|
to_remove.append(key)
|
||||||
continue
|
continue
|
||||||
@ -340,7 +341,7 @@ def _build_target(target: _Target):
|
|||||||
for lib in libs_copy:
|
for lib in libs_copy:
|
||||||
if isinstance(lib, str) and os.path.isabs(lib):
|
if isinstance(lib, str) and os.path.isabs(lib):
|
||||||
target.kwargs['LIBS'].remove(lib)
|
target.kwargs['LIBS'].remove(lib)
|
||||||
target.kwargs['source'].append(lib)
|
target.kwargs['source'].append(env.Entry(lib))
|
||||||
elif isinstance(lib, _Target):
|
elif isinstance(lib, _Target):
|
||||||
if not lib.target:
|
if not lib.target:
|
||||||
_build_target(lib)
|
_build_target(lib)
|
||||||
@ -404,6 +405,9 @@ if not config.get('PREPROCESSOR_PREFIX'):
|
|||||||
if 'COMPILATIONDB_FILTER_FILES' not in config:
|
if 'COMPILATIONDB_FILTER_FILES' not in config:
|
||||||
config['COMPILATIONDB_FILTER_FILES'] = True
|
config['COMPILATIONDB_FILTER_FILES'] = True
|
||||||
|
|
||||||
|
if 'WINDOWS_DISABLE_DEFAULT_DEFINES' not in config:
|
||||||
|
config['WINDOWS_DISABLE_DEFAULT_DEFINES'] = False
|
||||||
|
|
||||||
AddOption(
|
AddOption(
|
||||||
'--build_type',
|
'--build_type',
|
||||||
dest = 'build_type',
|
dest = 'build_type',
|
||||||
@ -687,6 +691,11 @@ if env['COMPILER_FAMILY'] == 'gcc':
|
|||||||
elif env['COMPILER_FAMILY'] == 'clang':
|
elif env['COMPILER_FAMILY'] == 'clang':
|
||||||
env.Append(CCFLAGS = ['-Wno-deprecated-volatile', '-Wno-nested-anon-types', '-Wno-unknown-warning-option'])
|
env.Append(CCFLAGS = ['-Wno-deprecated-volatile', '-Wno-nested-anon-types', '-Wno-unknown-warning-option'])
|
||||||
|
|
||||||
|
# platform specific options
|
||||||
|
if os.name == 'nt':
|
||||||
|
if not config['WINDOWS_DISABLE_DEFAULT_DEFINES']:
|
||||||
|
env.Append(CDEFINES = ['WIN32_LEAN_AND_MEAN', 'NOMINMAX', 'STRICT', 'UNICODE'], CPPDEFINES = ['WIN32_LEAN_AND_MEAN', 'NOMINMAX', 'STRICT', 'UNICODE'])
|
||||||
|
|
||||||
env.AddMethod(_cook, 'Cook')
|
env.AddMethod(_cook, 'Cook')
|
||||||
env.AddMethod(_parse_lib_conf, 'ParseLibConf')
|
env.AddMethod(_parse_lib_conf, 'ParseLibConf')
|
||||||
env.AddMethod(_rglob, 'RGlob')
|
env.AddMethod(_rglob, 'RGlob')
|
||||||
|
23
recipes/winsock2/recipe.py
Normal file
23
recipes/winsock2/recipe.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
from SCons.Script import *
|
||||||
|
|
||||||
|
|
||||||
|
def available(env: Environment):
|
||||||
|
if os.name != 'nt':
|
||||||
|
return 'Winsock2 is only available on Windows.'
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
if os.name == 'nt':
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
return {
|
||||||
|
'LIBS': ['Ws2_32']
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user