Private
Public Access
2
0

Add support for android build

Using NPM, this module can be cross-compiled for Android using NDK.
But, when compiling for Android, we need to add glob.c to source files
(as in Android.mk).
Also, re-arranged the layout in binding.gyp for better readability.

Signed-off-by: Robert Chiras <robert.chiras@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Robert Chiras
2016-04-22 18:11:36 +03:00
committed by Brendan Le Foll
parent c1465bd694
commit cdfdd2b9e3

View File

@@ -3,36 +3,39 @@
{ {
'target_name': 'mraa', 'target_name': 'mraa',
'sources': [ 'sources': [
@mraa_LIB_SRCS_GYP@ @mraa_LIB_SRCS_GYP@
'src/version.c', 'src/version.c',
'src/mraajsJAVASCRIPT_wrap.cxx' ], 'src/mraajsJAVASCRIPT_wrap.cxx'
],
'include_dirs': [ 'include_dirs': [
@mraa_LIB_INCLUDE_DIRS_GYP@ @mraa_LIB_INCLUDE_DIRS_GYP@
], ],
'variables': { 'variables': {
"v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g' | cut -c 1-5)", "v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g' | cut -c 1-5)",
"arch%": "<!(node -e 'console.log(process.arch)')" "arch%": "<!(node -e 'console.log(process.arch)')"
}, },
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ], 'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ], 'cflags!': [ '-fno-exceptions' ],
'conditions' : [ 'conditions' : [
[ 'arch=="x64"', ['OS=="android"', {
{ 'defines' : [ 'X86PLAT=ON' ], }, 'sources' : [ 'src/glob/glob.c' ],
], 'include_dirs' : [ 'src/glob' ],
[ 'arch=="ia32"', }],
{ 'defines' : [ 'X86PLAT=ON'], }, [ 'arch=="x64" or arch=="ia32"', {
], 'defines' : [ 'X86PLAT=ON' ],
[ 'arch=="arm"', }],
{ 'defines' : [ 'ARMPLAT=ON'], }, [ 'arch=="arm"', {
], 'defines' : [ 'ARMPLAT=ON'],
}],
], ],
'defines' : [ 'SWIG', 'defines' : [
'SWIGJAVASCRIPT', 'SWIG',
'FIRMATA=ON', 'SWIGJAVASCRIPT',
'ONEWIRE=ON', 'FIRMATA=ON',
'BUILDING_NODE_EXTENSION=1', 'ONEWIRE=ON',
'SWIG_V8_VERSION=0x0<(v8_version)', 'BUILDING_NODE_EXTENSION=1',
'V8_VERSION=0x0<(v8_version)' 'SWIG_V8_VERSION=0x0<(v8_version)',
'V8_VERSION=0x0<(v8_version)'
] ]
} }
] ]