aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Le Foll <brendan.le.foll@intel.com>2015-11-11 13:47:43 +0000
committerBrendan Le Foll <brendan.le.foll@intel.com>2015-11-11 13:47:43 +0000
commit80024ff1844d539131b453dec3a94cb4cfe579c0 (patch)
tree68ac0a61adda54abe65dde80bdf81abcea48d24b
parent049ba5fa9f2d18ac0ec6729c46916b34998d3c5f (diff)
javascript: Fix build for nodejs v5 which has smaller version string
SWIG uses SWIG_V8_VERSION made of 0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH}. Because newer v8 versions don't seem to have a patch version that is padded the version string ends up too small ending with using the node.js 0.10.x paths. This fix pads the version string to 8chars which (we assume) is always correct. Fixes #358 Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
-rw-r--r--src/javascript/CMakeLists.txt15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/javascript/CMakeLists.txt b/src/javascript/CMakeLists.txt
index 47a9096..adfc82c 100644
--- a/src/javascript/CMakeLists.txt
+++ b/src/javascript/CMakeLists.txt
@@ -7,11 +7,18 @@ include_directories (
# SWIG treats SWIG_FLAGS as a list and not a string so semicolon seperation is
# required. This hardcodes V8_VERSION to be <10 but I assume that's not going
-# to be a problem for a little while!
-#set_source_files_properties (mraajs.i PROPERTIES SWIG_FLAGS "-node;-DV8_VERSION=0x0${V8_VERSION_HEX};-I${CMAKE_BINARY_DIR}/src")
-#set_source_files_properties (mraajs.i PROPERTIES SWIG_FLAGS "-node;-I${CMAKE_BINARY_DIR}/src")
+# to be a problem for a little while! SWIG uses a padded SWIG_V8 version which
+# we hack together from our findnode module.
+set (V8_VERSION_HEX 0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH})
+string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
+while (V8_VERSION_HEX_length LESS 8)
+ set (V8_VERSION_HEX "${V8_VERSION_HEX}0")
+ message (DEBUG " - Padded V8 version to match SWIG format")
+ string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
+endwhile ()
+
set_property (SOURCE mraajs.i PROPERTY SWIG_FLAGS "-node"
- "-I${CMAKE_BINARY_DIR}/src" "-DV8_VERSION=0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH}")
+ "-I${CMAKE_BINARY_DIR}/src" "-DV8_VERSION=${V8_VERSION_HEX}")
set_source_files_properties (mraajs.i PROPERTIES CPLUSPLUS ON)
swig_add_module (mraajs javascript mraajs.i ${mraa_LIB_SRCS})