Skip to content

Commit

Permalink
Enable to build on windows 64bits, fixes #10.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed Oct 9, 2014
1 parent 94aa5e6 commit 2d3c5a0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
25 changes: 19 additions & 6 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@

'conditions': [
['OS=="win"', {
'variables': {
'project_name': 'greenworks-win',
'redist_bin_dir': '',
'lib_steam': 'steam_api.lib',
},
'conditions': [
['target_arch=="ia32"', {
'variables': {
'project_name': 'greenworks-win32',
'redist_bin_dir': '',
'lib_steam': 'steam_api.lib',
'lib_dll_steam': 'steam_api.dll',
},
}],
['target_arch=="x64"', {
'variables': {
'project_name': 'greenworks-win64',
'redist_bin_dir': 'win64',
'lib_steam': 'steam_api64.lib',
'lib_dll_steam': 'steam_api64.dll',
},
}],
],
}],
['OS=="mac"', {
'variables': {
Expand Down Expand Up @@ -80,7 +93,7 @@
'conditions': [
['OS=="win"', {
'files': [
'<(source_root_dir)/<(steamworks_sdk_dir)/redistributable_bin/<(redist_bin_dir)/steam_api.dll'
'<(source_root_dir)/<(steamworks_sdk_dir)/redistributable_bin/<(redist_bin_dir)/<(lib_dll_steam)'
],
}],
['OS=="mac" or OS=="linux"', {
Expand Down
17 changes: 10 additions & 7 deletions lib/greenworks.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
var os = require('os');
var fs = require('fs');
var greenworks;
if (os.platform() == 'darwin')

if (process.platform == 'darwin')
greenworks = require('../build/Release/greenworks-osx');
else if (os.platform() == 'win32' || os.platform() == 'win64')
greenworks = require('../build/Release/greenworks-win');
else if (os.platform() == 'linux') {
if (os.arch() == 'x64')
else if (process.platform == 'win32') {
if (process.arch == 'x64')
greenworks = require('../build/Release/greenworks-win64');
else if (process.arch == 'ia32')
greenworks = require('../build/Release/greenworks-win32');
} else if (process.platform == 'linux') {
if (process.arch == 'x64')
greenworks = require('../build/Release/greenworks-linux64');
else if (os.arch() == 'ia32')
else if (process.arch == 'ia32')
greenworks = require('../build/Release/greenworks-linux32');
}

Expand Down
16 changes: 10 additions & 6 deletions src/greenworks_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,16 @@ void init(v8::Handle<v8::Object> exports) {

} // namespace

#ifdef _WIN32
NODE_MODULE(greenworks_win, init)
#elif __APPLE__
NODE_MODULE(greenworks_osx, init)
#elif __linux__
#if __x86_64__ || __ppc64__
#if defined(_WIN32)
#if defined(_M_IX86)
NODE_MODULE(greenworks_win32, init)
#elif defined(_M_AMD64)
NODE_MODULE(greenworks_win64, init)
#endif
#elif defined(__APPLE__)
NODE_MODULE(greenworks_osx, init)
#elif defined(__linux__)
#if defined(__x86_64__) || defined(__ppc64__)
NODE_MODULE(greenworks_linux64, init)
#else
NODE_MODULE(greenworks_linux32, init)
Expand Down

0 comments on commit 2d3c5a0

Please sign in to comment.