|
@@ -1,12 +1,12 @@
|
1
|
|
- # Macro to add directory to NODE_INCLUDE_DIRS if it exists and is not /usr/include
|
|
1
|
+ # Macro to add directory to NODEJS_INCLUDE_DIRS if it exists and is not /usr/include
|
2
|
2
|
macro(add_include_dir dir)
|
3
|
|
- if (IS_DIRECTORY ${dir})
|
4
|
|
- set(NODE_INCLUDE_DIRS ${NODE_INCLUDE_DIRS} ${dir})
|
|
3
|
+ if (IS_DIRECTORY ${dir} AND NOT ${dir} STREQUAL "/usr/include")
|
|
4
|
+ set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIRS} ${dir})
|
5
|
5
|
endif()
|
6
|
6
|
endmacro()
|
7
|
7
|
|
8
|
8
|
|
9
|
|
-find_program (NODE_EXECUTABLE NAMES node nodejs
|
|
9
|
+find_program (NODEJS_EXECUTABLE NAMES node nodejs
|
10
|
10
|
HINTS
|
11
|
11
|
$ENV{NODE_DIR}
|
12
|
12
|
PATH_SUFFIXES bin
|
|
@@ -18,47 +18,47 @@ include (FindPackageHandleStandardArgs)
|
18
|
18
|
# If compat-libuv package exists, it must be at start of include path
|
19
|
19
|
find_path (UV_ROOT_DIR "uv.h" PATHS /usr/include/compat-libuv010 NO_DEFAULT_PATH)
|
20
|
20
|
if (UV_ROOT_DIR)
|
21
|
|
- # set (NODE_INCLUDE_DIRS ${UV_ROOT_DIR})
|
|
21
|
+ # set (NODEJS_INCLUDE_DIRS ${UV_ROOT_DIR})
|
22
|
22
|
add_include_dir(${UV_ROOT_DIR})
|
23
|
23
|
endif()
|
24
|
24
|
|
25
|
25
|
# Now look for node. Flag an error if not found
|
26
|
|
-find_path (NODE_ROOT_DIR "node/node.h" "src/node.h"
|
|
26
|
+find_path (NODE_ROOT_DIR "include/node/node.h" "include/src/node.h"
|
27
|
27
|
PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include)
|
28
|
28
|
if (NODE_ROOT_DIR)
|
29
|
|
- add_include_dir(${NODE_ROOT_DIR}/src)
|
30
|
|
- add_include_dir(${NODE_ROOT_DIR}/node)
|
31
|
|
- add_include_dir(${NODE_ROOT_DIR}/deps/v8/include)
|
32
|
|
- add_include_dir(${NODE_ROOT_DIR}/deps/uv/include)
|
|
29
|
+ add_include_dir(${NODE_ROOT_DIR}/include/src)
|
|
30
|
+ add_include_dir(${NODE_ROOT_DIR}/include/node)
|
|
31
|
+ add_include_dir(${NODE_ROOT_DIR}/include/deps/v8/include)
|
|
32
|
+ add_include_dir(${NODE_ROOT_DIR}/include/deps/uv/include)
|
33
|
33
|
else()
|
34
|
|
- unset(NODE_INCLUDE_DIRS)
|
|
34
|
+ unset(NODEJS_INCLUDE_DIRS)
|
35
|
35
|
message(ERROR " - node.h not found")
|
36
|
36
|
endif()
|
37
|
37
|
|
38
|
|
-# Check that v8.h is in NODE_INCLUDE_DIRS
|
39
|
|
-find_path (V8_ROOT_DIR "v8.h" PATHS ${NODE_INCLUDE_DIRS})
|
|
38
|
+# Check that v8.h is in NODEJS_INCLUDE_DIRS
|
|
39
|
+find_path (V8_ROOT_DIR "v8.h" PATHS ${NODEJS_INCLUDE_DIRS})
|
40
|
40
|
if (NOT V8_ROOT_DIR)
|
41
|
|
- unset(NODE_INCLUDE_DIRS)
|
|
41
|
+ unset(NODEJS_INCLUDE_DIRS)
|
42
|
42
|
message(ERROR " - v8.h not found")
|
43
|
43
|
endif()
|
44
|
44
|
|
45
|
|
-# Check that uv.h is in NODE_INCLUDE_DIRS
|
46
|
|
-find_path (UV_ROOT_DIR "uv.h" PATHS ${NODE_INCLUDE_DIRS})
|
|
45
|
+# Check that uv.h is in NODEJS_INCLUDE_DIRS
|
|
46
|
+find_path (UV_ROOT_DIR "uv.h" PATHS ${NODEJS_INCLUDE_DIRS})
|
47
|
47
|
if (NOT UV_ROOT_DIR)
|
48
|
|
- unset(NODE_INCLUDE_DIRS)
|
|
48
|
+ unset(NODEJS_INCLUDE_DIRS)
|
49
|
49
|
message(ERROR " - uv.h not found")
|
50
|
50
|
endif()
|
51
|
51
|
|
52
|
52
|
find_package_handle_standard_args (Nodejs DEFAULT_MSG
|
53
|
|
- NODE_EXECUTABLE
|
54
|
|
- NODE_INCLUDE_DIRS
|
|
53
|
+ NODEJS_EXECUTABLE
|
|
54
|
+ NODEJS_INCLUDE_DIRS
|
55
|
55
|
)
|
56
|
56
|
|
57
|
|
-if (NODE_EXECUTABLE)
|
58
|
|
- execute_process(COMMAND ${NODE_EXECUTABLE} --version
|
|
57
|
+if (NODEJS_EXECUTABLE)
|
|
58
|
+ execute_process(COMMAND ${NODEJS_EXECUTABLE} --version
|
59
|
59
|
OUTPUT_VARIABLE _VERSION
|
60
|
60
|
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
61
|
|
- execute_process(COMMAND ${NODE_EXECUTABLE} -e "console.log(process.versions.v8)"
|
|
61
|
+ execute_process(COMMAND ${NODEJS_EXECUTABLE} -e "console.log(process.versions.v8)"
|
62
|
62
|
OUTPUT_VARIABLE _V8_VERSION
|
63
|
63
|
RESULT_VARIABLE _V8_RESULT)
|
64
|
64
|
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
|
|
@@ -69,6 +69,8 @@ if (NODE_EXECUTABLE)
|
69
|
69
|
list (GET _VERSION_LIST 2 NODE_VERSION_PATCH)
|
70
|
70
|
set (V8_VERSION_STRING ${_V8_VERSION})
|
71
|
71
|
string (REPLACE "." ";" _V8_VERSION_LIST "${_V8_VERSION}")
|
|
72
|
+ string (REPLACE "." "" V8_DEFINE_STRING "${_V8_VERSION}")
|
|
73
|
+ string (STRIP ${V8_DEFINE_STRING} V8_DEFINE_STRING)
|
72
|
74
|
list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR)
|
73
|
75
|
list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR)
|
74
|
76
|
list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH)
|
|
@@ -80,8 +82,8 @@ if (NODE_EXECUTABLE)
|
80
|
82
|
set (NODE_VERSION_MINOR "10")
|
81
|
83
|
set (NODE_VERSION_PATCH "30")
|
82
|
84
|
set (V8_VERSION_MAJOR "3")
|
83
|
|
- set (V8_VERSION_MINOR"14")
|
84
|
|
- set (V8_VERSION_PATCH "5")
|
|
85
|
+ set (V8_VERSION_MINOR "28")
|
|
86
|
+ set (V8_VERSION_PATCH "72")
|
85
|
87
|
set (V8_VERSION_STRING "3.28.72")
|
86
|
88
|
message ("defaulted to node 0.10.30")
|
87
|
89
|
endif ()
|
|
@@ -89,7 +91,7 @@ if (NODE_EXECUTABLE)
|
89
|
91
|
string (REGEX REPLACE "\n" "" V8_VERSION_STRING ${V8_VERSION_STRING})
|
90
|
92
|
message ("INFO - Node version is " ${NODE_VERSION_STRING})
|
91
|
93
|
message ("INFO - Node using v8 " ${V8_VERSION_STRING})
|
92
|
|
- mark_as_advanced (NODE_EXECUTABLE)
|
|
94
|
+ mark_as_advanced (NODEJS_EXECUTABLE)
|
93
|
95
|
endif ()
|
94
|
96
|
|
95
|
|
-
|
|
97
|
+mark_as_advanced (NODE_EXECUTABLE)
|