Private
Public Access
2
0

firmata: install node_modules to where cmake guessed node was

This does now mean that modules won't go to /usr/local with the default prefix
but may instead try to install in /usr/lib. However if using nvm they should go
to the right place as long as NODE_ROOT_DIR is set correctly. This commit
changes NODE_ROOT_DIR to actually refer to the root directory of node rather
than the include dir which is what FindNodejs gets

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2016-03-21 15:19:00 +00:00
parent fac9d99f01
commit a17079c460
4 changed files with 12 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ install:
- sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
- sudo update-java-alternatives -s java-8-oracle
before_script:
- export NODE_ROOT_DIR="/home/travis/.nvm/v0.10.36/include"
- export NODE_ROOT_DIR="/home/travis/.nvm/v0.10.36"
- if [ "$CC" = "gcc" ]; then export BUILDJAVA=ON; else export BUILDJAVA=OFF; fi
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
- if [ "${NODE4}" ]; then nvm install 4.1; export CC=gcc-4.8; export CXX=g++-4.8; export NODE_ROOT_DIR="/home/travis/.nvm/versions/node/`nvm version`/include"; fi

View File

@@ -23,13 +23,13 @@ if (UV_ROOT_DIR)
endif()
# Now look for node. Flag an error if not found
find_path (NODE_ROOT_DIR "node/node.h" "src/node.h"
find_path (NODE_ROOT_DIR "include/node/node.h" "include/src/node.h"
PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
if (NODE_ROOT_DIR)
add_include_dir(${NODE_ROOT_DIR}/src)
add_include_dir(${NODE_ROOT_DIR}/node)
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
add_include_dir(${NODE_ROOT_DIR}/include/src)
add_include_dir(${NODE_ROOT_DIR}/include/node)
add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
add_include_dir(${NODE_ROOT_DIR}/include/deps/uv/include)
else()
unset(NODEJS_INCLUDE_DIRS)
message(ERROR " - node.h not found")

View File

@@ -54,11 +54,14 @@ if (${V8_VERSION_MAJOR} GREATER 3)
endif ()
endif ()
set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/lib/node_modules/mraa/)
message (STATUS "INFO - install NODE modules to ${NODE_MODULE_INSTALL_PATH}")
macro (mraa_CREATE_INSTALL_PACKAGE_JSON generated_file install_location)
configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
endmacro (mraa_CREATE_INSTALL_PACKAGE_JSON)
mraa_create_install_package_json (package.json lib/node_modules/mraa)
mraa_create_install_package_json (package.json ${NODE_MODULE_INSTALL_PATH})
macro (mraa_CREATE_BINDING_GYP generated_file)
set (mraa_LIB_SRCS_GYP "")
@@ -110,4 +113,4 @@ if (BUILDDOC)
endif ()
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mraa.node
DESTINATION lib/node_modules/mraa)
DESTINATION ${NODE_MODULE_INSTALL_PATH})

View File

@@ -1,7 +1,7 @@
{
"name" : "mraa",
"description": "IO library that helps you use I2c, SPI, gpio, uart, pwm, analog inputs (aio) and more on a number of platforms such as the Intel galileo, the Intel edison and others",
"keywords":["gpio", "edison","galileo","io", "mraajs", "spi", "i2c", "minnow", "intel"],
"keywords":["gpio", "edison","galileo","io", "mraajs", "spi", "i2c", "minnow", "intel", "firmata"],
"homepage": "http://github.com/intel-iot-devkit/mraa",
"main" : "./mraa.node",
"engines": {