Skip to content

Commit

Permalink
Merge pull request #5 from flybywiresim/feat/use-static-lib
Browse files Browse the repository at this point in the history
refactor: use simconnect static lib
  • Loading branch information
Saschl authored Oct 18, 2023
2 parents 8f7844d + cbe4b67 commit fb306f7
Show file tree
Hide file tree
Showing 7 changed files with 4,992 additions and 8,997 deletions.
Binary file modified dist/libs/simconnect.node
Binary file not shown.
13,899 changes: 4,943 additions & 8,956 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
"devDependencies": {
"@flybywiresim/eslint-config": "^0.2.2",
"@jest/globals": "^29.3.1",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.0.0",
"@types/es6-promise": "^3.3.0",
"@types/jest": "^27.0.2",
"@typescript-eslint/parser": "^4.31.2",
"eslint": "^7.32.0",
"eslint-plugin-jest": "^24.4.2",
"jest": "^27.0.0",
"rollup": "^2.57.0",
"rollup": "^4.1.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-typescript2": "^0.36.0",
"ts-jest": "^27.0.5",
"typescript": "^4.0.5"
},
Expand Down
68 changes: 33 additions & 35 deletions rollup.config.js → rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
'use strict';

import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import typescript from 'rollup-plugin-typescript2';

import packageJson from './package.json';

export default {
input: 'src/index.ts',
output: [
{
file: packageJson.main,
format: 'cjs',
sourcemap: true,
},
{
file: packageJson.module,
format: 'esm',
sourcemap: true,
},
],
plugins: [
commonjs(),
typescript({
useTsconfigDeclarationDir: true,
exclude: ['**/*.test.ts', '**/*.spec.ts', 'examples/**/*.ts'],
}),
copy({
targets: [
{ src: 'src/bindings/simconnect/build/Release/simconnect.node', dest: 'dist/libs/' },
],
}),
],
};
'use strict';

import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import typescript from 'rollup-plugin-typescript2';

export default {
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
format: 'cjs',
sourcemap: true,
},
{
file: 'dist/index.esm.js',
format: 'esm',
sourcemap: true,
},
],
plugins: [
commonjs(),
typescript({
useTsconfigDeclarationDir: true,
exclude: ['**/*.test.ts', '**/*.spec.ts', 'examples/**/*.ts'],
}),
copy({
targets: [
{ src: 'src/bindings/simconnect/build/Release/simconnect.node', dest: 'dist/libs/' },
],
}),
],
};
9 changes: 8 additions & 1 deletion src/bindings/simconnect/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"simulatordataarea.cc",
"systemevent.cc"
],
"msvs_settings": {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/MD'
],
}
},
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
Expand All @@ -20,7 +27,7 @@
],
"dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
"libraries": [
"C:\\MSFS SDK\\SimConnect SDK\\lib\\SimConnect.lib"
"C:\\MSFS SDK\\SimConnect SDK\\lib\\static\\SimConnect.lib",
]
}
],
Expand Down
3 changes: 3 additions & 0 deletions src/bindings/simconnect/connection.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#pragma once
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "user32.lib")

#include <string>
#include <list>
Expand Down
2 changes: 1 addition & 1 deletion src/simconnect/receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type ReceiverCallbacks = {
export class Receiver {
private dispatcher: Dispatcher = null;

private interval: NodeJS.Timer = null;
private interval: NodeJS.Timeout = null;

private callbacks: ReceiverCallbacks = {
open: null,
Expand Down

0 comments on commit fb306f7

Please sign in to comment.