MXS-1300: Build MaxCtrl if npm was found
If npm is installed on the local system, try to build MaxCtrl as a part of the core.
This commit is contained in:
16
cmake/FindNPM.cmake
Normal file
16
cmake/FindNPM.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Find the npm executable
|
||||||
|
#
|
||||||
|
# The following variables are set:
|
||||||
|
# NPM_FOUND - True if npm was found
|
||||||
|
# NPM_EXECUTABLE - Path to npm
|
||||||
|
|
||||||
|
find_program(NPM_EXECUTABLE npm)
|
||||||
|
|
||||||
|
if (${NPM_EXECUTABLE} MATCHES "NOTFOUND")
|
||||||
|
message(STATUS "Could not find npm")
|
||||||
|
set(NPM_FOUND FALSE CACHE INTERNAL "")
|
||||||
|
unset(NPM_EXECUTABLE)
|
||||||
|
else()
|
||||||
|
message(STATUS "Found npm: ${NPM_EXECUTABLE}")
|
||||||
|
set(NPM_FOUND TRUE CACHE INTERNAL "")
|
||||||
|
endif()
|
@ -1 +1,13 @@
|
|||||||
|
find_package(NPM)
|
||||||
|
|
||||||
|
if (NPM_FOUND)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/maxctrl/maxctrl
|
||||||
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.sh ${CMAKE_SOURCE_DIR}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
add_custom_target(maxctrl ALL DEPENDS ${CMAKE_BINARY_DIR}/maxctrl/maxctrl)
|
||||||
|
install_script(${CMAKE_BINARY_DIR}/maxctrl/maxctrl core)
|
||||||
|
else()
|
||||||
|
message(STATUS "Not building MaxCtrl: npm not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]
|
||||||
|
then
|
||||||
|
echo "Usage: $0 SRC"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy sources to working directory
|
||||||
|
src=$1
|
||||||
|
cp -r -t $PWD/maxctrl $src/maxctrl/* && cd $PWD/maxctrl
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
npm install pkg
|
npm install pkg
|
||||||
node_modules/pkg/lib-es5/bin.js -t node6-linux-x64 .
|
node_modules/pkg/lib-es5/bin.js -t node6-linux-x64 .
|
||||||
|
Reference in New Issue
Block a user