diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 276b1f69..22f34547 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -306,6 +306,11 @@ if (BUILDSWIGNODE) ) macro(createpackagejson) if (NPM) + # Dependency to generate wrappers before packing, skip modules that depend on 3rd party libs + if (NOT DEFINED reqlibname) + set (reqlibname "") + endif () + if (reqlibname STREQUAL "" OR reqlibname MATCHES "mraa") # Grab all module sources and headers, also add sources to gyp list file (GLOB srcfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.c" @@ -330,16 +335,25 @@ if (BUILDSWIGNODE) file (COPY ${CMAKE_SOURCE_DIR}/include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) set (upm_LIB_INCLUDE_DIRS_GYP "'.',\n${upm_LIB_INCLUDE_DIRS_GYP}") - # Dependency to generate wrappers before packing - add_dependencies (npmpkg jsupm_${libname}) + # Utilities and interfaces + file (COPY ${CMAKE_SOURCE_DIR}/src/utilities DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) + file (COPY ${CMAKE_SOURCE_DIR}/src/upm DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) + set (upm_LIB_SRCS_GYP "'utilities/upm_utilities.c',\n${upm_LIB_SRCS_GYP}") + set (upm_LIB_INCLUDE_DIRS_GYP "'utilities',\n${upm_LIB_INCLUDE_DIRS_GYP}") + set (upm_LIB_INCLUDE_DIRS_GYP "'upm',\n${upm_LIB_INCLUDE_DIRS_GYP}") - # Add readme for NPM and node-gyp config file + # Add readme, package.json for NPM and node-gyp config file configure_file (${PROJECT_SOURCE_DIR}/src/binding.gyp.in ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}/binding.gyp @ONLY) - configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}/package.json @ONLY) + configure_file (${PROJECT_SOURCE_DIR}/src/package.json.npm.in ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}/package.json @ONLY) configure_file (${PROJECT_SOURCE_DIR}/doxy/README.npm.md ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}/README.md) + + add_dependencies (npmpkg jsupm_${libname}) + else () + message ("Skipping jsupm_${libname}, needs ${reqlibname}") + endif () endif (NPM) - # package.json is required for any kind of install + # package.json for regular install configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY) # If a CMAKE_INSTALL_PREFIX has NOT been provided, set NODE_MODULE_INSTALL_PATH diff --git a/src/package.json.in b/src/package.json.in index f78790f2..e2becba6 100644 --- a/src/package.json.in +++ b/src/package.json.in @@ -15,7 +15,7 @@ "url" : "http://github.com/intel-iot-devkit/upm/issues" }, "dependencies": { - "mraa": ">=@MRAA_MINIMUM@" + "mraa": ">=@MRAA_MINIMUM@" }, "license": "MIT", "version" : "@upm_VERSION_STRING@", diff --git a/src/package.json.npm.in b/src/package.json.npm.in new file mode 100644 index 00000000..93db78ee --- /dev/null +++ b/src/package.json.npm.in @@ -0,0 +1,20 @@ +{ + "name" : "jsupm_@libname@", + "description": "Sensor library based on MRAA that allows you to use various sensors on platforms such as the Intel Galileo, Intel Edison, Minnowboard MAX and others.", + "keywords":["intel", "edison", "galileo", "minnow", "io", "mraajs", "upmjs", "gpio", "spi", "i2c", "uart", "aio", "sensor", "actuator"], + "homepage": "http://github.com/intel-iot-devkit/upm", + "main" : "./build/Release/jsupm_@libname@.node", + "repository": { + "type": "git", + "url": "https://github.com/intel-iot-devkit/upm" + }, + "engines" : { + "node": ">= 0.10.x" + }, + "bugs": { + "url" : "http://github.com/intel-iot-devkit/upm/issues" + }, + "license": "MIT", + "version" : "@upm_VERSION_STRING@", + "authors": "See http://github.com/intel-iot-devkit/upm/graphs/contributors" +}