mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
build: fix cctest compilation
Currently the cctest target compiles sources files even though they are compiled for the node target. This is my fault as when I worked on the task of getting the cctest to use the object files from the node target I missed a few sources that were being included from node.gypi. This also effects the build time as these sources are compiled twice. This commit moves the conditions in question into the node target in node.gyp. With this commit there should be no object files in out/Release/obj.target/cctest/src/ (the path will vary depending on the operating system being used). PR-URL:https://github.com/nodejs/node/pull/16887 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
1aac4c1d8f
commit
f5809d8e35
@ -325,6 +325,11 @@ Next add the test to the `sources` in the `cctest` target in node.gyp:
|
||||
...
|
||||
],
|
||||
```
|
||||
Note that the only sources that should be included in the cctest target are
|
||||
actual test or helper source files. There might be a need to include specific
|
||||
object files that are compiled by the `node` target and this can be done by
|
||||
adding them to the `libraries` section in the cctest target.
|
||||
|
||||
The test can be executed by running the `cctest` target:
|
||||
```console
|
||||
$ make cctest
|
||||
|
260
node.gyp
260
node.gyp
@ -309,16 +309,149 @@
|
||||
'V8_DEPRECATION_WARNINGS=1',
|
||||
'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"',
|
||||
],
|
||||
|
||||
'direct_dependent_settings': {
|
||||
'defines': [
|
||||
'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
[ 'node_shared=="true" and node_module_version!="" and OS!="win"', {
|
||||
'product_extension': '<(shlib_suffix)',
|
||||
}]
|
||||
}],
|
||||
[ 'v8_enable_inspector==1', {
|
||||
'defines': [
|
||||
'HAVE_INSPECTOR=1',
|
||||
],
|
||||
'sources': [
|
||||
'src/inspector_agent.cc',
|
||||
'src/inspector_io.cc',
|
||||
'src/inspector_js_api.cc',
|
||||
'src/inspector_socket.cc',
|
||||
'src/inspector_socket_server.cc',
|
||||
'src/inspector_agent.h',
|
||||
'src/inspector_io.h',
|
||||
'src/inspector_socket.h',
|
||||
'src/inspector_socket_server.h',
|
||||
],
|
||||
'dependencies': [
|
||||
'v8_inspector_compress_protocol_json#host',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/include', # for inspector
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
],
|
||||
}, {
|
||||
'defines': [ 'HAVE_INSPECTOR=0' ]
|
||||
}],
|
||||
[ 'OS=="win"', {
|
||||
'sources': [
|
||||
'src/backtrace_win32.cc',
|
||||
'src/res/node.rc',
|
||||
],
|
||||
'defines!': [
|
||||
'NODE_PLATFORM="win"',
|
||||
],
|
||||
'defines': [
|
||||
'FD_SETSIZE=1024',
|
||||
# we need to use node's preferred "win32" rather than gyp's preferred "win"
|
||||
'NODE_PLATFORM="win32"',
|
||||
'_UNICODE=1',
|
||||
],
|
||||
'libraries': [ '-lpsapi.lib' ]
|
||||
}, { # POSIX
|
||||
'defines': [ '__POSIX__' ],
|
||||
'sources': [ 'src/backtrace_posix.cc' ],
|
||||
}],
|
||||
[ 'node_use_dtrace=="true"', {
|
||||
'defines': [ 'HAVE_DTRACE=1' ],
|
||||
'dependencies': [
|
||||
'node_dtrace_header',
|
||||
'specialize_node_d',
|
||||
],
|
||||
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
|
||||
#
|
||||
# DTrace is supported on linux, solaris, mac, and bsd. There are
|
||||
# three object files associated with DTrace support, but they're
|
||||
# not all used all the time:
|
||||
#
|
||||
# node_dtrace.o all configurations
|
||||
# node_dtrace_ustack.o not supported on mac and linux
|
||||
# node_dtrace_provider.o All except OS X. "dtrace -G" is not
|
||||
# used on OS X.
|
||||
#
|
||||
# Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
|
||||
# actually exist. They're listed here to trick GYP into linking the
|
||||
# corresponding object files into the final "node" executable. These
|
||||
# object files are generated by "dtrace -G" using custom actions
|
||||
# below, and the GYP-generated Makefiles will properly build them when
|
||||
# needed.
|
||||
#
|
||||
'sources': [ 'src/node_dtrace.cc' ],
|
||||
'conditions': [
|
||||
[ 'OS=="linux"', {
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
|
||||
],
|
||||
}],
|
||||
[ 'OS!="mac" and OS!="linux"', {
|
||||
'sources': [
|
||||
'src/node_dtrace_ustack.cc',
|
||||
'src/node_dtrace_provider.cc',
|
||||
]
|
||||
}
|
||||
] ]
|
||||
} ],
|
||||
[ 'node_use_openssl=="true"', {
|
||||
'defines': [ 'HAVE_OPENSSL=1' ],
|
||||
'sources': [
|
||||
'src/node_crypto.cc',
|
||||
'src/node_crypto_bio.cc',
|
||||
'src/node_crypto_clienthello.cc',
|
||||
'src/node_crypto.h',
|
||||
'src/node_crypto_bio.h',
|
||||
'src/node_crypto_clienthello.h',
|
||||
'src/tls_wrap.cc',
|
||||
'src/tls_wrap.h'
|
||||
],
|
||||
'conditions': [
|
||||
['openssl_fips != ""', {
|
||||
'defines': [ 'NODE_FIPS_MODE' ],
|
||||
}],
|
||||
[ 'node_shared_openssl=="false"', {
|
||||
'dependencies': [
|
||||
'./deps/openssl/openssl.gyp:openssl',
|
||||
|
||||
# For tests
|
||||
'./deps/openssl/openssl.gyp:openssl-cli',
|
||||
],
|
||||
'conditions': [
|
||||
# -force_load or --whole-archive are not applicable for
|
||||
# the static library
|
||||
[ 'node_target_type!="static_library"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
['OS in "linux freebsd" and node_shared=="false"', {
|
||||
'ldflags': [
|
||||
'-Wl,--whole-archive,'
|
||||
'<(OBJ_DIR)/deps/openssl/'
|
||||
'<(OPENSSL_PRODUCT)',
|
||||
'-Wl,--no-whole-archive',
|
||||
],
|
||||
}],
|
||||
# openssl.def is based on zlib.def, zlib symbols
|
||||
# are always exported.
|
||||
['use_openssl_def==1', {
|
||||
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
|
||||
}],
|
||||
['OS=="win" and use_openssl_def==0', {
|
||||
'sources': ['deps/zlib/win32/zlib.def'],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
}]]
|
||||
}, {
|
||||
'defines': [ 'HAVE_OPENSSL=0' ]
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -675,8 +808,6 @@
|
||||
'defines': [ 'NODE_WANT_INTERNALS=1' ],
|
||||
|
||||
'sources': [
|
||||
'src/node_platform.cc',
|
||||
'src/node_platform.h',
|
||||
'test/cctest/node_test_fixture.cc',
|
||||
'test/cctest/test_aliased_buffer.cc',
|
||||
'test/cctest/test_base64.cc',
|
||||
@ -692,14 +823,14 @@
|
||||
'conditions': [
|
||||
['node_target_type!="static_library"', {
|
||||
'libraries': [
|
||||
'<(OBJ_GEN_PATH)<(OBJ_SEPARATOR)node_javascript.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_debug_options.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)async-wrap.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)env.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_buffer.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_debug_options.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_i18n.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_perf.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_platform.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_url.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)util.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)string_bytes.<(OBJ_SUFFIX)',
|
||||
@ -710,6 +841,15 @@
|
||||
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_buffer.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_writer.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)trace_event.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_GEN_PATH)<(OBJ_SEPARATOR)node_javascript.<(OBJ_SUFFIX)',
|
||||
],
|
||||
}],
|
||||
[ 'node_use_openssl=="true"', {
|
||||
'libraries': [
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_bio.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_clienthello.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)tls_wrap.<(OBJ_SUFFIX)',
|
||||
],
|
||||
}],
|
||||
['v8_enable_inspector==1', {
|
||||
@ -717,33 +857,30 @@
|
||||
'test/cctest/test_inspector_socket.cc',
|
||||
'test/cctest/test_inspector_socket_server.cc'
|
||||
],
|
||||
'conditions': [
|
||||
[ 'node_shared_zlib=="false"', {
|
||||
'dependencies': [
|
||||
'deps/zlib/zlib.gyp:zlib',
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_openssl=="false" and node_shared=="false"', {
|
||||
'dependencies': [
|
||||
'deps/openssl/openssl.gyp:openssl'
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_http_parser=="false"', {
|
||||
'dependencies': [
|
||||
'deps/http_parser/http_parser.gyp:http_parser'
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_libuv=="false"', {
|
||||
'dependencies': [
|
||||
'deps/uv/uv.gyp:libuv'
|
||||
]
|
||||
}]
|
||||
'libraries': [
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_agent.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_io.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_js_api.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket.<(OBJ_SUFFIX)',
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket_server.<(OBJ_SUFFIX)',
|
||||
],
|
||||
'defines': [
|
||||
'HAVE_INSPECTOR=1',
|
||||
],
|
||||
}],
|
||||
[ 'node_use_dtrace=="true"', {
|
||||
'libraries': [
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)',
|
||||
]
|
||||
}],
|
||||
[ 'node_use_v8_platform=="true"', {
|
||||
'dependencies': [
|
||||
'deps/v8/src/v8.gyp:v8_libplatform',
|
||||
],
|
||||
[ 'OS=="win"', {
|
||||
'libraries': [
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_win32.<(OBJ_SUFFIX)',
|
||||
],
|
||||
}, {
|
||||
'libraries': [
|
||||
'<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_posix.<(OBJ_SUFFIX)',
|
||||
],
|
||||
}],
|
||||
[ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
|
||||
'copies': [{
|
||||
@ -755,9 +892,60 @@
|
||||
]},
|
||||
],
|
||||
}],
|
||||
[ 'node_shared_zlib=="false"', {
|
||||
'dependencies': [
|
||||
'deps/zlib/zlib.gyp:zlib',
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_openssl=="false" and node_shared=="false"', {
|
||||
'dependencies': [
|
||||
'deps/openssl/openssl.gyp:openssl'
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_http_parser=="false"', {
|
||||
'dependencies': [
|
||||
'deps/http_parser/http_parser.gyp:http_parser'
|
||||
]
|
||||
}],
|
||||
[ 'node_shared_libuv=="false"', {
|
||||
'dependencies': [
|
||||
'deps/uv/uv.gyp:libuv'
|
||||
]
|
||||
}],
|
||||
[ 'node_use_v8_platform=="true"', {
|
||||
'dependencies': [
|
||||
'deps/v8/src/v8.gyp:v8_libplatform',
|
||||
],
|
||||
}],
|
||||
['OS=="solaris"', {
|
||||
'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ]
|
||||
}],
|
||||
[ 'node_use_openssl=="true"', {
|
||||
'conditions': [
|
||||
[ 'node_shared_openssl=="false"', {
|
||||
'conditions': [
|
||||
# -force_load or --whole-archive are not applicable for
|
||||
# the static library
|
||||
[ 'node_target_type!="static_library"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
['OS in "linux freebsd" and node_shared=="false"', {
|
||||
'ldflags': [
|
||||
'-Wl,--whole-archive,'
|
||||
'<(OBJ_DIR)/deps/openssl/'
|
||||
'<(OPENSSL_PRODUCT)',
|
||||
'-Wl,--no-whole-archive',
|
||||
],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
}]]
|
||||
}],
|
||||
]
|
||||
}
|
||||
], # end targets
|
||||
|
141
node.gypi
141
node.gypi
@ -70,128 +70,6 @@
|
||||
'deps/v8/src/third_party/vtune/v8vtune.gyp:v8_vtune'
|
||||
],
|
||||
}],
|
||||
[ 'v8_enable_inspector==1', {
|
||||
'defines': [
|
||||
'HAVE_INSPECTOR=1',
|
||||
],
|
||||
'sources': [
|
||||
'src/inspector_agent.cc',
|
||||
'src/inspector_io.cc',
|
||||
'src/inspector_js_api.cc',
|
||||
'src/inspector_socket.cc',
|
||||
'src/inspector_socket_server.cc',
|
||||
'src/inspector_agent.h',
|
||||
'src/inspector_io.h',
|
||||
'src/inspector_socket.h',
|
||||
'src/inspector_socket_server.h',
|
||||
],
|
||||
'dependencies': [
|
||||
'v8_inspector_compress_protocol_json#host',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/include', # for inspector
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
],
|
||||
}, {
|
||||
'defines': [ 'HAVE_INSPECTOR=0' ]
|
||||
}],
|
||||
[ 'node_use_openssl=="true"', {
|
||||
'defines': [ 'HAVE_OPENSSL=1' ],
|
||||
'sources': [
|
||||
'src/node_crypto.cc',
|
||||
'src/node_crypto_bio.cc',
|
||||
'src/node_crypto_clienthello.cc',
|
||||
'src/node_crypto.h',
|
||||
'src/node_crypto_bio.h',
|
||||
'src/node_crypto_clienthello.h',
|
||||
'src/tls_wrap.cc',
|
||||
'src/tls_wrap.h'
|
||||
],
|
||||
'conditions': [
|
||||
['openssl_fips != ""', {
|
||||
'defines': [ 'NODE_FIPS_MODE' ],
|
||||
}],
|
||||
[ 'node_shared_openssl=="false"', {
|
||||
'dependencies': [
|
||||
'./deps/openssl/openssl.gyp:openssl',
|
||||
|
||||
# For tests
|
||||
'./deps/openssl/openssl.gyp:openssl-cli',
|
||||
],
|
||||
# Do not let unused OpenSSL symbols to slip away
|
||||
'conditions': [
|
||||
# -force_load or --whole-archive are not applicable for
|
||||
# the static library
|
||||
[ 'node_target_type!="static_library"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
['OS in "linux freebsd" and node_shared=="false"', {
|
||||
'ldflags': [
|
||||
'-Wl,--whole-archive,'
|
||||
'<(OBJ_DIR)/deps/openssl/'
|
||||
'<(OPENSSL_PRODUCT)',
|
||||
'-Wl,--no-whole-archive',
|
||||
],
|
||||
}],
|
||||
# openssl.def is based on zlib.def, zlib symbols
|
||||
# are always exported.
|
||||
['use_openssl_def==1', {
|
||||
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
|
||||
}],
|
||||
['OS=="win" and use_openssl_def==0', {
|
||||
'sources': ['deps/zlib/win32/zlib.def'],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
}]]
|
||||
}, {
|
||||
'defines': [ 'HAVE_OPENSSL=0' ]
|
||||
}],
|
||||
[ 'node_use_dtrace=="true"', {
|
||||
'defines': [ 'HAVE_DTRACE=1' ],
|
||||
'dependencies': [
|
||||
'node_dtrace_header',
|
||||
'specialize_node_d',
|
||||
],
|
||||
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
|
||||
|
||||
#
|
||||
# DTrace is supported on linux, solaris, mac, and bsd. There are
|
||||
# three object files associated with DTrace support, but they're
|
||||
# not all used all the time:
|
||||
#
|
||||
# node_dtrace.o all configurations
|
||||
# node_dtrace_ustack.o not supported on mac and linux
|
||||
# node_dtrace_provider.o All except OS X. "dtrace -G" is not
|
||||
# used on OS X.
|
||||
#
|
||||
# Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
|
||||
# actually exist. They're listed here to trick GYP into linking the
|
||||
# corresponding object files into the final "node" executable. These
|
||||
# object files are generated by "dtrace -G" using custom actions
|
||||
# below, and the GYP-generated Makefiles will properly build them when
|
||||
# needed.
|
||||
#
|
||||
'sources': [ 'src/node_dtrace.cc' ],
|
||||
'conditions': [
|
||||
[ 'OS=="linux"', {
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
|
||||
],
|
||||
}],
|
||||
[ 'OS!="mac" and OS!="linux"', {
|
||||
'sources': [
|
||||
'src/node_dtrace_ustack.cc',
|
||||
'src/node_dtrace_provider.cc',
|
||||
]
|
||||
}
|
||||
] ]
|
||||
} ],
|
||||
[ 'node_use_lttng=="true"', {
|
||||
'defines': [ 'HAVE_LTTNG=1' ],
|
||||
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
|
||||
@ -255,25 +133,6 @@
|
||||
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
|
||||
}],
|
||||
|
||||
[ 'OS=="win"', {
|
||||
'sources': [
|
||||
'src/backtrace_win32.cc',
|
||||
'src/res/node.rc',
|
||||
],
|
||||
'defines!': [
|
||||
'NODE_PLATFORM="win"',
|
||||
],
|
||||
'defines': [
|
||||
'FD_SETSIZE=1024',
|
||||
# we need to use node's preferred "win32" rather than gyp's preferred "win"
|
||||
'NODE_PLATFORM="win32"',
|
||||
'_UNICODE=1',
|
||||
],
|
||||
'libraries': [ '-lpsapi.lib' ]
|
||||
}, { # POSIX
|
||||
'defines': [ '__POSIX__' ],
|
||||
'sources': [ 'src/backtrace_posix.cc' ],
|
||||
}],
|
||||
[ 'OS=="mac"', {
|
||||
# linking Corefoundation is needed since certain OSX debugging tools
|
||||
# like Instruments require it for some features
|
||||
|
Loading…
Reference in New Issue
Block a user