-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
140 lines (109 loc) · 4.16 KB
/
CMakeLists.txt
File metadata and controls
140 lines (109 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Use of this file is subject to license terms as set forth in the LICENSE file found in the root directory of the project.
cmake_minimum_required(VERSION 2.6)
project(node)
if(USE_GCOV)
set(CMAKE_BUILD_TYPE "Debug")
# Set global c and c++ flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
# Link flags used for creating executables
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs")
# Link flags used for creating shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs")
endif()
#
# options
#
find_package(PythonInterp 2 REQUIRED)
# NB. The code is not guaranteed to build if WEBOS is False.
set(WEBOS True CACHE INTERNAL "build for webOS")
option(SHARED_V8 "use system shared V8 library")
option(SHARED_LIBEV "use system shared libev library")
option(SHARED_CARES "use system shared c-ares library")
option(V8_SNAPSHOT "turn on snapshot when building stock v8")
option(V8_OPROFILE "Add oprofile support")
option(V8_GDBJIT "add gdbjit support")
option(DTRACE "build with DTrace (experimental)")
# cmake policies to get rid of some warnings
cmake_policy(SET CMP0009 NEW) # GLOB_RECURSE should no follow symlinks
# generic cmake configuration
include("cmake/configure.cmake")
# find and configure libs
include("cmake/libs.cmake")
# setup node build targets
include("cmake/node_build.cmake")
# setup v8 build targets
include("cmake/v8_build.cmake")
# docs
## might want to move this to doc/CMakeLists.txt
include("cmake/docs.cmake")
# tests
enable_testing()
include(CTest)
add_subdirectory("test/")
# package
include("cmake/package.cmake")
if(WEBOS)
# Make sure the build system's version of this component matches what we're building.
# The intent is for it to pass in NODEJS_COMPONENT_VERSION via the CMake command line.
# This can't appear any earlier in the code because node_version_string isn't set until
# cmake/package.cmake is invoked.
if (DEFINED NODEJS_COMPONENT_VERSION)
if (NOT (node_version_string STREQUAL NODEJS_COMPONENT_VERSION))
message(FATAL_ERROR "Component version from build system (${NODEJS_COMPONENT_VERSION}) != configured version (${node_version_string})")
endif ()
endif ()
# For some unknown reason, the upstream code doesn't process nodejs.pc.in . This can't go into cmake/configure.cmake
# because node_version_string isn't set until cmake/package.cmake is invoked.
if(NOT DEFINED ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
endif()
set(VERSION "${node_version_string}")
configure_file(${PROJECT_SOURCE_DIR}/tools/nodejs.pc.in
${PROJECT_BINARY_DIR}/tools/nodejs.pc @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/tools/nodejs.pc" DESTINATION "lib/pkgconfig")
endif()
#
# Final build configuration output
#
message("** Build Summary **")
message(" Version: ${node_version_string}")
message(" Prefix: ${PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" Platform: ${node_platform}")
if(SHARED_V8)
message(" V8: ${V8_LIBRARY_PATH}")
else()
message(" V8: deps/v8/libv8.a")
endif()
if(SHARED_libev)
message(" libev: ${LIBEV_LIBRARY}")
else()
message(" libev: deps/libev/libev.a")
endif()
if(SHARED_CARES)
message(" libc-ares: ${LIBCARES_LIBRARY}")
else()
message(" libc-ares: deps/c-ares/libcares.a")
endif()
message(" RT library: ${RT}")
message(" DL library: ${DL}")
if(${OPENSSL_FOUND} MATCHES TRUE)
message(" OpenSSL: ${OPENSSL_LIBRARIES}")
endif()
if(USE_GCOV)
message(" gcov: enabled")
endif()
message(" CCFLAGS: ${CCFLAGS}")
message(" CPPFLAGS: ${CPPFLAGS}")
if(WEBOS)
if(WEBOS_DEVICE)
message(" webOS target: device")
elseif(WEBOS_EMULATOR)
message(" webOS target: emulator")
else()
message(" webOS target: desktop")
endif()
message(" core OS: ${TARGET_CORE_OS}")
endif()