From ac1b80c38163270c33c809c8080313913402ee90 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 10 Oct 2014 13:47:22 +0800 Subject: [PATCH] Enable to build on Mac OS X 64 bits. --- binding.gyp | 13 ++++++++++++- lib/greenworks.js | 9 ++++++--- src/greenworks_api.cc | 6 +++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/binding.gyp b/binding.gyp index c5f4a941..15c62a46 100644 --- a/binding.gyp +++ b/binding.gyp @@ -26,8 +26,19 @@ ], }], ['OS=="mac"', { + 'conditions': [ + ['target_arch=="ia32"', { + 'variables': { + 'project_name': 'greenworks-osx32', + }, + }], + ['target_arch=="x64"', { + 'variables': { + 'project_name': 'greenworks-osx64', + }, + }], + ], 'variables': { - 'project_name': 'greenworks-osx', 'redist_bin_dir': 'osx32', 'lib_steam': 'libsteam_api.dylib' }, diff --git a/lib/greenworks.js b/lib/greenworks.js index 4fc538d9..528f9c92 100644 --- a/lib/greenworks.js +++ b/lib/greenworks.js @@ -1,9 +1,12 @@ var fs = require('fs'); var greenworks; -if (process.platform == 'darwin') - greenworks = require('../build/Release/greenworks-osx'); -else if (process.platform == 'win32') { +if (process.platform == 'darwin') { + if (process.arch == 'x64') + greenworks = require('../build/Release/greenworks-osx64'); + else if (process.arch == 'ia32') + greenworks = require('../build/Release/greenworks-osx32'); +} else if (process.platform == 'win32') { if (process.arch == 'x64') greenworks = require('../build/Release/greenworks-win64'); else if (process.arch == 'ia32') diff --git a/src/greenworks_api.cc b/src/greenworks_api.cc index bde2c089..e7294c4e 100644 --- a/src/greenworks_api.cc +++ b/src/greenworks_api.cc @@ -306,7 +306,11 @@ void init(v8::Handle exports) { NODE_MODULE(greenworks_win64, init) #endif #elif defined(__APPLE__) - NODE_MODULE(greenworks_osx, init) + #if defined(__x86_64__) || defined(__ppc64__) + NODE_MODULE(greenworks_osx64, init) + #else + NODE_MODULE(greenworks_osx32, init) + #endif #elif defined(__linux__) #if defined(__x86_64__) || defined(__ppc64__) NODE_MODULE(greenworks_linux64, init)