rig/scripts/generate_cl.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
2019-09-03 14:36:27 +07:00
const { text2h, text2h_bundle, addIncludes } = require('./js/opencl');
// const cwd = process.cwd();
function cn()
{
const cn = addIncludes('cryptonight.cl', [
'algorithm.cl',
'wolf-aes.cl',
'wolf-skein.cl',
'jh.cl',
'blake256.cl',
'groestl256.cl',
'fast_int_math_v2.cl',
2019-09-01 08:49:28 +07:00
'fast_div_heavy.cl',
'keccak.cl'
]);
//fs.writeFileSync('cryptonight_gen.cl', cn);
fs.writeFileSync('cryptonight_cl.h', text2h(cn, 'xmrig', 'cryptonight_cl'));
}
2019-09-03 14:36:27 +07:00
function cn_r()
{
const items = {};
items.cryptonight_r_defines_cl = addIncludes('cryptonight_r_defines.cl', [ 'wolf-aes.cl' ]);
items.cryptonight_r_cl = fs.readFileSync('cryptonight_r.cl', 'utf8');
// for (let key in items) {
// fs.writeFileSync(key + '_gen.cl', items[key]);
// }
fs.writeFileSync('cryptonight_r_cl.h', text2h_bundle('xmrig', items));
}
process.chdir(path.resolve('src/backend/opencl/cl/cn'));
cn();
cn_r();