Skip to content

Commit

Permalink
feat/cpuinfo-as-node-module-new-build-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Jul 2, 2024
1 parent 683b12c commit eed4ed4
Show file tree
Hide file tree
Showing 12 changed files with 409 additions and 184 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ cortex.log
api.log
prism.log
api.json
openai-python/*
openai-python/*
build
cortex-js/cortex.exe
cortex-js/package-lock.json
.vscode
cortex-js/command
cortex-js/src/infrastructure/commanders/test/test_data
Binary file removed cortex-js/cpuinfo/bin/cpuinfo
Binary file not shown.
Binary file removed cortex-js/cpuinfo/bin/cpuinfo.exe
Binary file not shown.
8 changes: 8 additions & 0 deletions cortex-js/cpuinfo/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "cpuinfo",
"sources": ["src/cpuinfo.cpp"]
}
]
}
4 changes: 4 additions & 0 deletions cortex-js/cpuinfo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type InstructionSet = 'AVX' | 'AVX2' | 'AVX512'; // Add more as needed later
export const cpuInfo = require('bindings')('cpuinfo') as {
cpuInfo: () => InstructionSet[];
};
33 changes: 33 additions & 0 deletions cortex-js/cpuinfo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "cpuinfo",
"version": "1.0.0",
"description": "Get CPU instructions",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"test": "ts-node index.ts",
"install": "prebuild-install -r napi || node-gyp rebuild"
},
"author": "",
"license": "ISC",
"gypfile": true,
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^7.0.0",
"prebuild-install": "^7.1.1"
},
"devDependencies": {
"@types/node": "^20.14.9",
"typescript": "^5.5.3"
},
"peerDependencies": {
"node-gyp": "8.x"
},
"files": [
"binding.gyp",
"deps/",
"*.js",
"*.d.ts",
"src/"
]
}
Loading

0 comments on commit eed4ed4

Please sign in to comment.