nodejs: Updated FindNodejs.cmake so exported variables match package name
Signed-off-by: Henry Bruce <henry.bruce@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
ff31d6763c
commit
3924070171
@@ -1,14 +1,12 @@
|
|||||||
# Macro to add directory to NODE_INCLUDE_DIRS if it exists and is not /usr/include
|
# Macro to add directory to NODEJS_INCLUDE_DIRS if it exists and is not /usr/include
|
||||||
macro(add_include_dir dir)
|
macro(add_include_dir dir)
|
||||||
if (IS_DIRECTORY ${dir} AND NOT ${dir} STREQUAL "/usr/include")
|
if (IS_DIRECTORY ${dir} AND NOT ${dir} STREQUAL "/usr/include")
|
||||||
set(NODE_INCLUDE_DIRS ${NODE_INCLUDE_DIRS} ${dir})
|
set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
set (Nodejs_FOUND TRUE)
|
find_program (NODEJS_EXECUTABLE NAMES node nodejs
|
||||||
|
|
||||||
find_program (NODE_EXECUTABLE NAMES node nodejs
|
|
||||||
HINTS
|
HINTS
|
||||||
$ENV{NODE_DIR}
|
$ENV{NODE_DIR}
|
||||||
PATH_SUFFIXES bin
|
PATH_SUFFIXES bin
|
||||||
@@ -20,7 +18,7 @@ include (FindPackageHandleStandardArgs)
|
|||||||
# If compat-libuv package exists, it must be at start of include path
|
# If compat-libuv package exists, it must be at start of include path
|
||||||
find_path (UV_ROOT_DIR "uv.h" PATHS /usr/include/compat-libuv010 NO_DEFAULT_PATH)
|
find_path (UV_ROOT_DIR "uv.h" PATHS /usr/include/compat-libuv010 NO_DEFAULT_PATH)
|
||||||
if (UV_ROOT_DIR)
|
if (UV_ROOT_DIR)
|
||||||
# set (NODE_INCLUDE_DIRS ${UV_ROOT_DIR})
|
# set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
|
||||||
add_include_dir(${UV_ROOT_DIR})
|
add_include_dir(${UV_ROOT_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -33,34 +31,34 @@ if (NODE_ROOT_DIR)
|
|||||||
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
|
add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
|
||||||
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
|
add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
|
||||||
else()
|
else()
|
||||||
|
unset(NODEJS_INCLUDE_DIRS)
|
||||||
message(ERROR " - node.h not found")
|
message(ERROR " - node.h not found")
|
||||||
set (Nodejs_FOUND FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check that v8.h is in NODE_INCLUDE_DIRS
|
# Check that v8.h is in NODEJS_INCLUDE_DIRS
|
||||||
find_path (V8_ROOT_DIR "v8.h" PATHS NODE_INCLUDE_DIRS)
|
find_path (V8_ROOT_DIR "v8.h" PATHS NODEJS_INCLUDE_DIRS)
|
||||||
if (NOT V8_ROOT_DIR)
|
if (NOT V8_ROOT_DIR)
|
||||||
|
unset(NODEJS_INCLUDE_DIRS)
|
||||||
message(ERROR " - v8.h not found")
|
message(ERROR " - v8.h not found")
|
||||||
set (Nodejs_FOUND FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check that uv.h is in NODE_INCLUDE_DIRS
|
# Check that uv.h is in NODEJS_INCLUDE_DIRS
|
||||||
find_path (UV_ROOT_DIR "u8.h" PATHS NODE_INCLUDE_DIRS)
|
find_path (UV_ROOT_DIR "uv.h" PATHS NODEJS_INCLUDE_DIRS)
|
||||||
if (NOT UV_ROOT_DIR)
|
if (NOT UV_ROOT_DIR)
|
||||||
|
unset(NODEJS_INCLUDE_DIRS)
|
||||||
message(ERROR " - uv.h not found")
|
message(ERROR " - uv.h not found")
|
||||||
set (Nodejs_FOUND FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package_handle_standard_args (Node DEFAULT_MSG
|
find_package_handle_standard_args (Nodejs DEFAULT_MSG
|
||||||
NODE_EXECUTABLE
|
NODEJS_EXECUTABLE
|
||||||
NODE_INCLUDE_DIRS
|
NODEJS_INCLUDE_DIRS
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NODE_EXECUTABLE)
|
if (NODEJS_EXECUTABLE)
|
||||||
execute_process(COMMAND ${NODE_EXECUTABLE} --version
|
execute_process(COMMAND ${NODEJS_EXECUTABLE} --version
|
||||||
OUTPUT_VARIABLE _VERSION
|
OUTPUT_VARIABLE _VERSION
|
||||||
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
||||||
execute_process(COMMAND ${NODE_EXECUTABLE} -e "console.log(process.versions.v8)"
|
execute_process(COMMAND ${NODEJS_EXECUTABLE} -e "console.log(process.versions.v8)"
|
||||||
OUTPUT_VARIABLE _V8_VERSION
|
OUTPUT_VARIABLE _V8_VERSION
|
||||||
RESULT_VARIABLE _V8_RESULT)
|
RESULT_VARIABLE _V8_RESULT)
|
||||||
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
|
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
|
||||||
@@ -91,10 +89,6 @@ if (NODE_EXECUTABLE)
|
|||||||
string (REGEX REPLACE "\n" "" V8_VERSION_STRING ${V8_VERSION_STRING})
|
string (REGEX REPLACE "\n" "" V8_VERSION_STRING ${V8_VERSION_STRING})
|
||||||
message ("INFO - Node version is " ${NODE_VERSION_STRING})
|
message ("INFO - Node version is " ${NODE_VERSION_STRING})
|
||||||
message ("INFO - Node using v8 " ${V8_VERSION_STRING})
|
message ("INFO - Node using v8 " ${V8_VERSION_STRING})
|
||||||
mark_as_advanced (NODE_EXECUTABLE)
|
mark_as_advanced (NODEJS_EXECUTABLE)
|
||||||
else()
|
|
||||||
message ("ERROR - node executable not found")
|
|
||||||
set (Nodejs_FOUND FALSE)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
find_package (Nodejs REQUIRED)
|
find_package (Nodejs REQUIRED)
|
||||||
if (NOT Nodejs_FOUND)
|
|
||||||
message(ERROR " - Nodejs not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories (
|
include_directories (
|
||||||
${NODE_INCLUDE_DIRS}
|
${NODEJS_INCLUDE_DIRS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -25,7 +22,7 @@ set_property (SOURCE mraajs.i PROPERTY SWIG_FLAGS "-node"
|
|||||||
set_source_files_properties (mraajs.i PROPERTIES CPLUSPLUS ON)
|
set_source_files_properties (mraajs.i PROPERTIES CPLUSPLUS ON)
|
||||||
|
|
||||||
swig_add_module (mraajs javascript mraajs.i ${mraa_LIB_SRCS})
|
swig_add_module (mraajs javascript mraajs.i ${mraa_LIB_SRCS})
|
||||||
swig_link_libraries (mraajs ${NODE_LIBRARIES} ${mraa_LIBS})
|
swig_link_libraries (mraajs ${mraa_LIBS})
|
||||||
|
|
||||||
set_target_properties (mraajs PROPERTIES
|
set_target_properties (mraajs PROPERTIES
|
||||||
COMPILE_FLAGS " -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
|
COMPILE_FLAGS " -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
|
||||||
|
|||||||
Reference in New Issue
Block a user