Can have multiple different configurations of the same dependency.
This commit is contained in:
parent
137365b5b3
commit
3d4aad9e0d
|
@ -72,4 +72,4 @@ forbidden_target_names = {'clean': None,
|
||||||
|
|
||||||
class MesonException(Exception):
|
class MesonException(Exception):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
Exception.__init__(args, kwargs)
|
Exception.__init__(self, *args, **kwargs)
|
||||||
|
|
|
@ -25,8 +25,8 @@ import os, stat, glob, subprocess, shutil
|
||||||
from coredata import MesonException
|
from coredata import MesonException
|
||||||
|
|
||||||
class DependencyException(MesonException):
|
class DependencyException(MesonException):
|
||||||
def __init__(self, args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
MesonException.__init__(args, kwargs)
|
MesonException.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
class Dependency():
|
class Dependency():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -322,6 +322,15 @@ class Qt5Dependency():
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def get_dep_identifier(name, kwargs):
|
||||||
|
elements = [name]
|
||||||
|
modlist = kwargs.get('modules', [])
|
||||||
|
if isinstance(modlist, str):
|
||||||
|
modlist = [modlist]
|
||||||
|
for module in modlist:
|
||||||
|
elements.append(module)
|
||||||
|
return '/'.join(elements)
|
||||||
|
|
||||||
# This has to be at the end so the classes it references
|
# This has to be at the end so the classes it references
|
||||||
# are defined.
|
# are defined.
|
||||||
packages = {'boost': BoostDependency,
|
packages = {'boost': BoostDependency,
|
||||||
|
|
|
@ -680,13 +680,14 @@ class Interpreter():
|
||||||
def func_find_dep(self, node, args, kwargs):
|
def func_find_dep(self, node, args, kwargs):
|
||||||
self.validate_arguments(args, 1, [str])
|
self.validate_arguments(args, 1, [str])
|
||||||
name = args[0]
|
name = args[0]
|
||||||
if name in self.coredata.deps:
|
identifier = dependencies.get_dep_identifier(name, kwargs)
|
||||||
dep = self.coredata.deps[name]
|
if identifier in self.coredata.deps:
|
||||||
|
dep = self.coredata.deps[identifier]
|
||||||
else:
|
else:
|
||||||
dep = dependencies.Dependency() # Returns always false for dep.found()
|
dep = dependencies.Dependency() # Returns always false for dep.found()
|
||||||
if not dep.found():
|
if not dep.found():
|
||||||
dep = dependencies.find_external_dependency(name, kwargs)
|
dep = dependencies.find_external_dependency(name, kwargs)
|
||||||
self.coredata.deps[name] = dep
|
self.coredata.deps[identifier] = dep
|
||||||
return dep
|
return dep
|
||||||
|
|
||||||
def func_executable(self, node, args, kwargs):
|
def func_executable(self, node, args, kwargs):
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
project('boosttest', 'cxx')
|
project('boosttest', 'cxx')
|
||||||
|
|
||||||
# Use a Boost module that requires a shared library.
|
# We want to have multiple separate configurations of Boost
|
||||||
# Eventually we would like to be able to detect Boost
|
# within one project. The need to be independent of each other.
|
||||||
# multiple times with different library combinations.
|
# Use one without a library dependency and one with it.
|
||||||
|
|
||||||
|
nolinkdep = find_dep('boost', modules: 'utility', required : true)
|
||||||
linkdep = find_dep('boost', modules : 'thread', required : true)
|
linkdep = find_dep('boost', modules : 'thread', required : true)
|
||||||
|
|
||||||
|
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', deps : nolinkdep)
|
||||||
linkexe = executable('linkedexe', 'linkexe.cc', deps : linkdep)
|
linkexe = executable('linkedexe', 'linkexe.cc', deps : linkdep)
|
||||||
|
|
||||||
|
add_test('Boost nolinktext', nolinkexe)
|
||||||
add_test('Boost linktext', linkexe)
|
add_test('Boost linktext', linkexe)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include<boost/utility.hpp>
|
||||||
|
|
||||||
|
class MyClass : boost::noncopyable {
|
||||||
|
public:
|
||||||
|
MyClass() {};
|
||||||
|
~MyClass() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
MyClass obj;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue