|
|
|
@ -44,6 +44,7 @@ known_basic_kwargs = {'install': True, |
|
|
|
|
'sources': True, |
|
|
|
|
'objects': True, |
|
|
|
|
'native': True, |
|
|
|
|
'build_by_default': True, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# These contain kwargs supported by both static and shared libraries. These are |
|
|
|
@ -252,11 +253,29 @@ class EnvironmentVariables(): |
|
|
|
|
env[name] = method(full_env, name, values, kwargs) |
|
|
|
|
return env |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BuildTarget(): |
|
|
|
|
def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): |
|
|
|
|
class Target: |
|
|
|
|
def __init__(self, name, subdir, build_by_default): |
|
|
|
|
self.name = name |
|
|
|
|
self.subdir = subdir |
|
|
|
|
self.build_by_default = build_by_default |
|
|
|
|
self.install = False |
|
|
|
|
self.build_always = False |
|
|
|
|
|
|
|
|
|
def get_basename(self): |
|
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
def get_subdir(self): |
|
|
|
|
return self.subdir |
|
|
|
|
|
|
|
|
|
def process_kwargs(self, kwargs): |
|
|
|
|
if 'build_by_default' in kwargs: |
|
|
|
|
self.build_by_default = kwargs['build_by_default'] |
|
|
|
|
if not isinstance(self.build_by_default, bool): |
|
|
|
|
raise InvalidArguments('build_by_default must be a boolean value.') |
|
|
|
|
|
|
|
|
|
class BuildTarget(Target): |
|
|
|
|
def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): |
|
|
|
|
super().__init__(name, subdir, True) |
|
|
|
|
self.subproject = subproject # Can not be calculated from subdir as subproject dirname can be changed per project. |
|
|
|
|
self.is_cross = is_cross |
|
|
|
|
self.is_unity = environment.coredata.get_builtin_option('unity') |
|
|
|
@ -507,6 +526,7 @@ class BuildTarget(): |
|
|
|
|
return self.custom_install_dir |
|
|
|
|
|
|
|
|
|
def process_kwargs(self, kwargs, environment): |
|
|
|
|
super().process_kwargs(kwargs) |
|
|
|
|
self.copy_kwargs(kwargs) |
|
|
|
|
kwargs.get('modules', []) |
|
|
|
|
self.need_install = kwargs.get('install', self.need_install) |
|
|
|
@ -643,9 +663,6 @@ class BuildTarget(): |
|
|
|
|
if not isinstance(self.pic, bool): |
|
|
|
|
raise InvalidArguments('Argument pic to static library {!r} must be boolean'.format(self.name)) |
|
|
|
|
|
|
|
|
|
def get_subdir(self): |
|
|
|
|
return self.subdir |
|
|
|
|
|
|
|
|
|
def get_filename(self): |
|
|
|
|
return self.filename |
|
|
|
|
|
|
|
|
@ -672,9 +689,6 @@ class BuildTarget(): |
|
|
|
|
transitive_deps += t.get_dependencies() |
|
|
|
|
return transitive_deps |
|
|
|
|
|
|
|
|
|
def get_basename(self): |
|
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
def get_source_subdir(self): |
|
|
|
|
return self.subdir |
|
|
|
|
|
|
|
|
@ -1229,7 +1243,7 @@ class SharedModule(SharedLibrary): |
|
|
|
|
raise MesonException('Shared modules must not specify the soversion kwarg.') |
|
|
|
|
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs) |
|
|
|
|
|
|
|
|
|
class CustomTarget: |
|
|
|
|
class CustomTarget(Target): |
|
|
|
|
known_kwargs = {'input': True, |
|
|
|
|
'output': True, |
|
|
|
|
'command': True, |
|
|
|
@ -1243,8 +1257,7 @@ class CustomTarget: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def __init__(self, name, subdir, kwargs, absolute_paths=False): |
|
|
|
|
self.name = name |
|
|
|
|
self.subdir = subdir |
|
|
|
|
super().__init__(name, subdir, False) |
|
|
|
|
self.dependencies = [] |
|
|
|
|
self.extra_depends = [] |
|
|
|
|
self.depend_files = [] # Files that this target depends on but are not on the command line. |
|
|
|
@ -1279,6 +1292,7 @@ class CustomTarget: |
|
|
|
|
return deps |
|
|
|
|
|
|
|
|
|
def process_kwargs(self, kwargs): |
|
|
|
|
super().process_kwargs(kwargs) |
|
|
|
|
self.sources = kwargs.get('input', []) |
|
|
|
|
if not isinstance(self.sources, list): |
|
|
|
|
self.sources = [self.sources] |
|
|
|
@ -1368,9 +1382,6 @@ class CustomTarget: |
|
|
|
|
mlog.debug(i) |
|
|
|
|
raise InvalidArguments('Unknown type {!r} in depend_files.'.format(type(i).__name__)) |
|
|
|
|
|
|
|
|
|
def get_basename(self): |
|
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
def get_dependencies(self): |
|
|
|
|
return self.dependencies |
|
|
|
|
|
|
|
|
@ -1380,9 +1391,6 @@ class CustomTarget: |
|
|
|
|
def get_custom_install_dir(self): |
|
|
|
|
return self.install_dir |
|
|
|
|
|
|
|
|
|
def get_subdir(self): |
|
|
|
|
return self.subdir |
|
|
|
|
|
|
|
|
|
def get_outputs(self): |
|
|
|
|
return self.output |
|
|
|
|
|
|
|
|
@ -1398,13 +1406,12 @@ class CustomTarget: |
|
|
|
|
def type_suffix(self): |
|
|
|
|
return "@cus" |
|
|
|
|
|
|
|
|
|
class RunTarget: |
|
|
|
|
class RunTarget(Target): |
|
|
|
|
def __init__(self, name, command, args, dependencies, subdir): |
|
|
|
|
self.name = name |
|
|
|
|
super().__init__(name, subdir, False) |
|
|
|
|
self.command = command |
|
|
|
|
self.args = args |
|
|
|
|
self.dependencies = dependencies |
|
|
|
|
self.subdir = subdir |
|
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
|
repr_str = "<{0} {1}: {2}>" |
|
|
|
@ -1413,9 +1420,6 @@ class RunTarget: |
|
|
|
|
def get_id(self): |
|
|
|
|
return self.name + self.type_suffix() |
|
|
|
|
|
|
|
|
|
def get_basename(self): |
|
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
def get_dependencies(self): |
|
|
|
|
return self.dependencies |
|
|
|
|
|
|
|
|
@ -1425,9 +1429,6 @@ class RunTarget: |
|
|
|
|
def get_sources(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_subdir(self): |
|
|
|
|
return self.subdir |
|
|
|
|
|
|
|
|
|
def should_install(self): |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|