Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cpuinfo as node module - new build scripts #813

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat/cpuinfo-as-node-module-new-build-scripts
louis-menlo authored and hiento09 committed Jul 3, 2024
commit 7ebeee43ceedcc7e94ac760ade5b580ab74217a5
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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