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 049fd2a
Show file tree
Hide file tree
Showing 14 changed files with 281 additions and 160 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.
10 changes: 10 additions & 0 deletions cortex-js/cpuinfo/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"targets": [
{
"target_name": "cpuinfo",
"sources": ["src/cpuinfo.cpp"],
"include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")" ],
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ]
}
]
}
10 changes: 10 additions & 0 deletions cortex-js/cpuinfo/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Type definitions for cpuinfo
// Project: http://github.com/tryghost/node-sqlite3

/// <reference types="node" />
export type InstructionSet = 'AVX' | 'AVX2' | 'AVX512'; // Add more as needed later
declare module "cpuinfo" {
declare const cpuInfo: {
cpuInfo: () => InstructionSet[];
}
}
1 change: 1 addition & 0 deletions cortex-js/cpuinfo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = exports = { cpuInfo: require('./build/Release/cpuinfo.node') }
38 changes: 38 additions & 0 deletions cortex-js/cpuinfo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "cpuinfo",
"version": "1.0.0",
"description": "Get CPU instructions",
"main": "index.js",
"types": "./index.d.ts",
"scripts": {
"install": "prebuild-install -r napi || node-gyp rebuild"
},
"author": "",
"license": "ISC",
"gypfile": true,
"binary": {
"napi_versions": [
3,
6
]
},
"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 049fd2a

Please sign in to comment.