npm: Fix npm builds for ARM hosts
NPM builds don't support cross compiling and will always compile for the host. Binding.gyp now uses mraa_NPM_SRCS instead of mraa_LIB_SRCS_NOAUTO which contains all platforms. Cmake now uses mraa_LIB_PLAT_SRCS_NOAUTO to provide all the sources. NPM builds will build objects for all platforms reguardless of space which does meann slightly bigger binaries. Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -31,7 +31,11 @@ mraa_create_install_package_json (package.json lib/node_modules/mraa)
|
||||
|
||||
macro (mraa_CREATE_BINDING_GYP generated_file)
|
||||
set (mraa_LIB_SRCS_GYP "")
|
||||
foreach (srcfile ${mraa_LIB_SRCS_NOAUTO})
|
||||
set (mraa_NPM_SRCS ${mraa_LIB_SRCS_NOAUTO}
|
||||
${mraa_LIB_ARM_SRCS_NOAUTO}
|
||||
${mraa_LIB_X86_SRCS_NOAUTO}
|
||||
)
|
||||
foreach (srcfile ${mraa_NPM_SRCS})
|
||||
file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${srcfile})
|
||||
set (mraa_LIB_SRCS_GYP "'${rel}',\n${mraa_LIB_SRCS_GYP}")
|
||||
endforeach (srcfile)
|
||||
|
||||
@@ -10,16 +10,25 @@
|
||||
@mraa_LIB_INCLUDE_DIRS_GYP@
|
||||
],
|
||||
'variables': {
|
||||
"v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g')"
|
||||
"v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g')",
|
||||
"arch%": "<!(node -e 'console.log(process.arch)')"
|
||||
},
|
||||
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
|
||||
'cflags!': [ '-fno-exceptions' ],
|
||||
'conditions' : [
|
||||
[ 'arch=="x64"' or 'arch=="ia32"',
|
||||
{ 'defines' : [ 'X86PLAT=ON' ], },
|
||||
],
|
||||
[ 'arch=="arm"',
|
||||
{ 'defines' : [ 'ARMPLAT=ON'], },
|
||||
],
|
||||
],
|
||||
'defines' : [ 'SWIG',
|
||||
'SWIGJAVASCRIPT',
|
||||
'BUILDING_NODE_EXTENSION=1',
|
||||
'SWIG_V8_VERSION=0x0<(v8_version)',
|
||||
'V8_VERSION=0x0<(v8_version)',
|
||||
'X86PLAT=ON' ]
|
||||
'V8_VERSION=0x0<(v8_version)'
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user