def test_no_pkg_config_no_include(self): c = CMake('foo', 'bar', []) out = StringIO() generate([c], out) assert ('include(FindPkgConfig)' not in out.getvalue())
def test_no_pkg_config_no_include(self): c = CMake('foo', 'bar') files = {} generate([c], get_filestore_writer(files)) assert ('CMakeLists.txt' in files) cmake = files['CMakeLists.txt'].getvalue() assert ('include(FindPkgConfig)' not in cmake)
def test_cmake_target(self): path = pjoin('foo', 'bar') c = CMake('bar', path) files = {} generate([c], get_filestore_writer(files), {}) assert ('CMakeLists.txt' in files) cmake = files['CMakeLists.txt'].getvalue() assert (f'add_subdirectory({path} {c})' in cmake)
def test_cmake_target(self): path = pjoin('foo', 'bar') c = CMake('bar', path, []) out = StringIO() generate([c], out) # Note: CMake supports '/' for path separators on Windows (in addition # to Unix), so for simplicity we use '/' universally upath = path.replace('\\', '/') assert (f'add_subdirectory({upath} {c.name})' in out.getvalue())
def resolve(self, name: str, seen: Dict[str, Target]) -> Target: deps = lookup_dependencies(name, self.dependencies, seen) identification = self.identify(name) result: Target if identification.type == 'group': assert isinstance(identification.path, Path) path = identification.path / 'group' / (name + '.mem') packages = resolve(PackageResolver(identification.path), list(bde_items(path))) result = Group(str(identification.path), deps, packages) TargetResolver._add_override(identification, name, result) if identification.type == 'package': assert isinstance(identification.path, Path) components = build_components(identification.path) result = Package(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'application': assert isinstance(identification.path, Path) components = build_components(identification.path) main_file = str(identification.path / f'{name}.m.cpp') if main_file not in {c['source'] for c in components}: components.append({ 'header': None, 'source': main_file, 'driver': None, }) result = Application(str(identification.path), deps, components) TargetResolver._add_override(identification, name, result) if identification.type == 'cmake': result = CMake(name, str(identification.path), deps) if identification.type == 'pkg_config': assert isinstance(identification.package, str) result = Pkg(name, identification.package, deps) if identification.type == 'virtual': result = Target(name, deps) if name in self._providers: result.has_output = False if any(d.name in self._runtime_libraries for d in deps): result.lazily_bound = True if name in self._plugin_tests: result.plugin_tests = True return result
def test_cmake_target(self): path = pjoin('foo', 'bar') c = CMake('bar', path) files = {} generate([c], get_filestore_writer(files)) assert ('CMakeLists.txt' in files) cmake = files['CMakeLists.txt'].getvalue() # Note: CMake supports '/' for path separators on Windows (in addition # to Unix), so for simplicity we use '/' universally upath = path.replace('\\', '/') assert (f'add_subdirectory({upath} {c.name})' in cmake)
def test_dependencies(self): c1 = CMake('c1', pj('path', 'c1'), []) c2 = CMake('c2', pj('path', 'c2'), [c1]) assert(c1 in c2.dependencies())
def test_different_path(self): c = CMake('d', pj('path', 'c'), []) assert(pj('path', 'c') == c.path())
def test_path(self): c = CMake('c', pj('path', 'c'), []) assert(pj('path', 'c') == c.path())
def test_name(self): c = CMake('c', pj('path', 'c'), []) assert('c' == c.name)
def test_different_path(self): c = CMake('d', pj('path', 'c')) assert('d' == c) assert(pj('path', 'c') == c.path())
def test_path(self): c = CMake('c', pj('path', 'c')) assert('c' == c) assert(pj('path', 'c') == c.path())
def test_str_ness(self): c = CMake('c', pj('path', 'c')) assert ('c' == c)