def run_build(self): if self.with_nvvl: if self.system_nvvl: raise DistutilsArgError("system-nvvl and with-nvvl are mutually exclusive") libpath = os.path.join(self.with_nvvl, "libnvvl.so") if not os.path.isfile(libpath): raise DistutilsFileError("Provided with-nvvl path, but " + libpath + " doesn't exit.") for ext in self.extensions: ext.library_dirs += [self.with_nvvl] self.distribution.data_files = [ ('nvvl/', [libpath])] elif not self.system_nvvl: output_dir = os.path.join(self.build_temp, "nvvl-build") mkpath(output_dir, 0o777, dry_run=self.dry_run) cmake_cmd = ["cmake", "-B"+output_dir, "-H"+nvvl_path] spawn(cmake_cmd, dry_run=self.dry_run) make_cmd = ["make", "-C", output_dir, "-j4"] spawn(make_cmd, dry_run=self.dry_run) for ext in self.extensions: ext.library_dirs += [output_dir] ext.runtime_library_dirs = ["$ORIGIN"] self.distribution.data_files = [ ('nvvl/', [os.path.join(output_dir, "libnvvl.so")])] build_ext_orig.run(self)
def run(self): # Run the original BuildExtension first. We need this before building # the tests. BuildExtension.run(self) if _check_env_flag('BUILD_CPP_TESTS', default='1'): # Build the C++ tests. cmd = [os.path.join(base_dir, 'test/cpp/run_tests.sh'), '-B'] if subprocess.call(cmd) != 0: print('Failed to build tests: {}'.format(cmd), file=sys.stderr) sys.exit(1)