|
|
|
@ -81,6 +81,9 @@ class ExternalProject(NewExtensionModule): |
|
|
|
|
_l = self.env.coredata.get_option(OptionKey('libdir')) |
|
|
|
|
assert isinstance(_l, str), 'for mypy' |
|
|
|
|
self.libdir = Path(_l) |
|
|
|
|
_l = self.env.coredata.get_option(OptionKey('bindir')) |
|
|
|
|
assert isinstance(_l, str), 'for mypy' |
|
|
|
|
self.bindir = Path(_l) |
|
|
|
|
_i = self.env.coredata.get_option(OptionKey('includedir')) |
|
|
|
|
assert isinstance(_i, str), 'for mypy' |
|
|
|
|
self.includedir = Path(_i) |
|
|
|
@ -118,6 +121,7 @@ class ExternalProject(NewExtensionModule): |
|
|
|
|
|
|
|
|
|
d = [('PREFIX', '--prefix=@PREFIX@', self.prefix.as_posix()), |
|
|
|
|
('LIBDIR', '--libdir=@PREFIX@/@LIBDIR@', self.libdir.as_posix()), |
|
|
|
|
('BINDIR', '--bindir=@PREFIX@/@BINDIR@', self.bindir.as_posix()), |
|
|
|
|
('INCLUDEDIR', None, self.includedir.as_posix()), |
|
|
|
|
] |
|
|
|
|
self._validate_configure_options(d, state) |
|
|
|
@ -278,6 +282,7 @@ class ExternalProjectModule(ExtensionModule): |
|
|
|
|
|
|
|
|
|
def __init__(self, interpreter: 'Interpreter'): |
|
|
|
|
super().__init__(interpreter) |
|
|
|
|
self.devenv: T.Optional[EnvironmentVariables] = None |
|
|
|
|
self.methods.update({'add_project': self.add_project, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -299,8 +304,19 @@ class ExternalProjectModule(ExtensionModule): |
|
|
|
|
kwargs['env'], |
|
|
|
|
kwargs['verbose'], |
|
|
|
|
kwargs['depends']) |
|
|
|
|
abs_libdir = Path(project.install_dir, project.rel_prefix, project.libdir).as_posix() |
|
|
|
|
abs_bindir = Path(project.install_dir, project.rel_prefix, project.bindir).as_posix() |
|
|
|
|
env = state.environment.get_env_for_paths({abs_libdir}, {abs_bindir}) |
|
|
|
|
if self.devenv is None: |
|
|
|
|
self.devenv = env |
|
|
|
|
else: |
|
|
|
|
self.devenv.merge(env) |
|
|
|
|
return ModuleReturnValue(project, project.targets) |
|
|
|
|
|
|
|
|
|
def postconf_hook(self, b: build.Build) -> None: |
|
|
|
|
if self.devenv is not None: |
|
|
|
|
b.devenv.append(self.devenv) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(interp: 'Interpreter') -> ExternalProjectModule: |
|
|
|
|
return ExternalProjectModule(interp) |
|
|
|
|