projectMan.ninjaFile.write("# Begin files.\n"); projectMan.ninjaFile.write("\n"); for variant in deploy_variants: projectMan.get_project("tests", variant) projectMan.emit_deploy_targets() projectMan.emit_phony_targets() projectMan.emit_regenerator_target(currentScriptPath) ################################################################################ # Main script print("generating with rootDir=%s" % pynja.rootDir) repo.init() currentScriptPath = os.path.join(pynja.rootDir, os.path.basename(__file__)) # TODO: fix core pynja and remove these __main__ hacks pynja.root_paths._scriptPathsAbs['__main__'] = currentScriptPath pynja.root_paths._scriptPathsRel['__main__'] = '.' pynja.root_paths._scriptRelToAbs['.'] = currentScriptPath # Import subdirectories, to define all projects. pynja.import_subdir('imports') pynja.import_subdir('nstd') pynja.import_subdir('tests') # Generate the build. pynja.regenerate_build(generate_ninja_build, pynja.rootPaths.built, pynja.rootPaths.codeBrowsing)
import os, pynja, repo pynja.import_subdir_file('function/test_function.py') pynja.import_subdir_file('type_erasure/test_type_erasure.py') pynja.import_subdir_file('vector/test_vector.py') pynja.import_subdir('bench_func') @pynja.project class tests(repo.DeployProject): def emit(self): productDir = os.path.join(pynja.rootPaths.bin, 'tests', str(self.variant)) if os.name == 'nt': variant_os = 'windows' elif os.name == 'posix': variant_os = 'linux' else: raise Exception("Unsupported OS %s" % os.name) primaryVariantStr = "%s-%s-%s-%s-dcrt" % (variant_os, self.variant.toolchain, self.variant.arch, self.variant.config) primaryVariant = repo.CppVariant(primaryVariantStr) test_names = [ 'test_function', 'test_type_erasure', 'test_vector', 'bench_func', ] for test_name in test_names: self.add_runtime_dependency_project(self.get_project(test_name, primaryVariant))
import os, pynja, repo pynja.import_subdir('gtest')