Skip to content

Commit

Permalink
feat: add Electron build support
Browse files Browse the repository at this point in the history
  • Loading branch information
artch committed Apr 16, 2018
1 parent 391d987 commit eef512a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion make-runtime-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ let snapshot = ivm.Isolate.createSnapshot([ { code, filename: '<runtime>' } ]);
let buffer = Buffer.from(snapshot.copy());
fs.writeFileSync(path.resolve(__dirname, './build/runtime.snapshot.bin'), buffer);
console.log(`Runtime snapshot created (${buffer.length} bytes)`);

process.exit();
4 changes: 4 additions & 0 deletions native/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
[ 'OS == "win"', { 'defines': ['NOMINMAX'] } ],
[ 'OS == "win"',
{ 'defines': [ 'IVM_DLLEXPORT=__declspec(dllexport)' ] },
{ 'defines': [ 'IVM_DLLEXPORT=' ] },
],
],
'sources': [
'src/main.cc',
Expand Down
2 changes: 1 addition & 1 deletion native/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace screeps {
}
};

extern "C" void InitForContext(v8::Isolate* isolate, v8::Local<v8::Context> context, v8::Local<v8::Object> target) {
extern "C" IVM_DLLEXPORT void InitForContext(v8::Isolate* isolate, v8::Local<v8::Context> context, v8::Local<v8::Object> target) {
Nan::Set(target, Nan::New("search").ToLocalChecked(), Nan::GetFunction(Nan::New<v8::FunctionTemplate>(screeps::search)).ToLocalChecked());
Nan::Set(target, Nan::New("loadTerrain").ToLocalChecked(), Nan::GetFunction(Nan::New<v8::FunctionTemplate>(screeps::load_terrain)).ToLocalChecked());
}
Expand Down

0 comments on commit eef512a

Please sign in to comment.