From 64b4f040dc6cd7a48f0ca82827eeecac66e6c1be Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Wed, 12 Oct 2016 13:00:07 -0700 Subject: [PATCH] npm: start generating the collateral needed to publish sources to npm Signed-off-by: Mihai Tudor Panu --- doxy/README.npm.md | 48 +++++++++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 17 ++++++++++++++++ src/binding.gyp.in | 25 +++++++++++++++++++++++ src/package.json.in | 4 ++-- 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 doxy/README.npm.md create mode 100644 src/binding.gyp.in diff --git a/doxy/README.npm.md b/doxy/README.npm.md new file mode 100644 index 00000000..8bc91c86 --- /dev/null +++ b/doxy/README.npm.md @@ -0,0 +1,48 @@ +UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA +============== + +The UPM repository provides software drivers for a wide variety of commonly +used sensors and actuators. These software drivers interact with the underlying +hardware platform (or microcontroller), as well as with the attached sensors, +through calls to [MRAA](https://github.com/intel-iot-devkit/mraa) APIs. + +These bindings are precompiled with Node.js 4.4. + +### Installing +To install a UPM module using npm simply type: + +`npm install jsupm_` + +### Supported Sensors +The full list is available on [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors). + +### IDE Integration +Intel® XDK IoT Edition is the recommended IDE for Node.js development. Visit +the Intel® Developer Zone [IDE page](https://software.intel.com/iot/software/ide) +for more information on how to get started. + +![Intel XDK](http://iotdk.intel.com/docs/master/upm/docs/icons/xdk.png) + +### Building UPM +See building documentation [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md). + +### Making your own UPM module +Our porting [link](https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md) +has more information on making new UPM modules. Also check out our main Github page as +we do have some guidelines if you would like to contribute your modules to the library. + +### API Documentation +Our Node.js documentation pages are hosted [here](http://iotdk.intel.com/docs/master/upm/node/). +For other supported languages and their APIs please visit our main Github page. + +### API Compatibility +Even if we try our best not to, every once in a while we are forced to modify +our API in a way that will break backwards compatibility. If you find yourself +unable to run code that was working fine before a library update, make sure +you check the [API changes](https://github.com/intel-iot-devkit/upm/blob/master/docs/apichanges.md) section first. + +### Changelog +Version changelog [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md). + +### Known Limitations +List of known limitations [here](https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md). diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9254dce5..708aaa2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -291,7 +291,24 @@ if (BUILDSWIGNODE) ${NODE_ROOT_DIR}/include/deps/uv/include ) macro(createpackagejson) + #Create list of source files + foreach (srcfile ${module_src}) + file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + set (upm_LIB_SRCS_GYP "'${rel}/${srcfile}',\n${upm_LIB_SRCS_GYP}") + endforeach (srcfile) + file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + set (upm_LIB_SRCS_GYP "'${rel}/jsupm_${libname}JAVASCRIPT_wrap.cxx',\n${upm_LIB_SRCS_GYP}") + #Create list of include directories + foreach (includedir ${UPM_COMMON_HEADER_DIRS}) + file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${includedir}) + set (upm_LIB_INCLUDE_DIRS_GYP "'${rel}',\n${upm_LIB_INCLUDE_DIRS_GYP}") + endforeach (includedir) + file (RELATIVE_PATH rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + set (upm_LIB_SRCS_GYP "'${rel}',\n${upm_LIB_SRCS_GYP}") + configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY) + configure_file (${PROJECT_SOURCE_DIR}/src/binding.gyp.in ${CMAKE_CURRENT_BINARY_DIR}/binding.gyp @ONLY) + configure_file (${PROJECT_SOURCE_DIR}/doxy/README.npm.md ${CMAKE_CURRENT_BINARY_DIR}/README.md) # If a CMAKE_INSTALL_PREFIX has NOT been provided, set NODE_MODULE_INSTALL_PATH # base on the NODE_ROOT_DIR. if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) diff --git a/src/binding.gyp.in b/src/binding.gyp.in new file mode 100644 index 00000000..07e6377a --- /dev/null +++ b/src/binding.gyp.in @@ -0,0 +1,25 @@ +{ + 'targets': [ + { + 'target_name': 'jsupm_@libname@', + 'sources': [ + @upm_LIB_SRCS_GYP@ + ], + 'include_dirs': [ + @upm_LIB_INCLUDE_DIRS_GYP@ + ], + 'variables': { + "v8_version%": "= 4.4.x" + "node": ">= 0.10.x" }, "bugs": { "url" : "http://github.com/intel-iot-devkit/upm/issues" }, "dependencies": { - "mraa": ">=@MRAA_VERSION@" + "mraa": ">=@MRAA_MINIMUM@" }, "license": "MIT", "version" : "@upm_VERSION_STRING@",