npm: start generating the collateral needed to publish sources to npm

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Tudor Panu
2016-10-12 13:00:07 -07:00
parent 40a695a87f
commit 64b4f040dc
4 changed files with 92 additions and 2 deletions

View File

@ -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)

25
src/binding.gyp.in Normal file
View File

@ -0,0 +1,25 @@
{
'targets': [
{
'target_name': 'jsupm_@libname@',
'sources': [
@upm_LIB_SRCS_GYP@
],
'include_dirs': [
@upm_LIB_INCLUDE_DIRS_GYP@
],
'variables': {
"v8_version%": "<!(node -e 'console.log(process.versions.v8)' | sed 's/\.//g' | cut -c 1-5)",
"arch%": "<!(node -e 'console.log(process.arch)')"
},
'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
'cflags!': [ '-fno-exceptions' ],
'defines' : [
'SWIG',
'BUILDING_NODE_EXTENSION=1',
'SWIG_V8_VERSION=0x0<(v8_version)',
'V8_VERSION=0x0<(v8_version)'
]
}
]
}

View File

@ -9,13 +9,13 @@
"url": "https://github.com/intel-iot-devkit/upm"
},
"engines" : {
"node": ">= 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@",