mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
Modify GYP scripts for VC build
This commit is contained in:
3
Makefile
3
Makefile
@@ -6,6 +6,9 @@ all: out/Makefile
|
||||
out/Makefile:
|
||||
tools/gyp_node -f make
|
||||
|
||||
clean:
|
||||
rm -rf out
|
||||
|
||||
distclean:
|
||||
rm -rf out
|
||||
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
{
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Debug',
|
||||
'configurations': {
|
||||
# TODO: hoist these out and put them somewhere common, because
|
||||
# RuntimeLibrary MUST MATCH across the entire project
|
||||
'Debug': {
|
||||
'defines': [ 'DEBUG', '_DEBUG' ]
|
||||
'defines': [ 'DEBUG', '_DEBUG' ],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'RuntimeLibrary': 1, # static debug
|
||||
}
|
||||
}
|
||||
},
|
||||
'Release': {
|
||||
'defines': [ 'NDEBUG' ]
|
||||
'defines': [ 'NDEBUG' ],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'RuntimeLibrary': 0, # static release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
'variables': {
|
||||
'v8_use_snapshot': 'true',
|
||||
'target_arch': 'x64',
|
||||
'target_arch': 'ia32',
|
||||
'node_use_dtrace': 'false',
|
||||
'node_use_openssl': 'true'
|
||||
},
|
||||
@@ -31,6 +44,7 @@
|
||||
|
||||
'include_dirs': [
|
||||
'../src',
|
||||
'../deps/uv/src/ares',
|
||||
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
|
||||
],
|
||||
|
||||
@@ -40,7 +54,6 @@
|
||||
'../src/node.cc',
|
||||
'../src/node_buffer.cc',
|
||||
'../src/node_constants.cc',
|
||||
'../src/node_crypto.cc',
|
||||
'../src/node_dtrace.cc',
|
||||
'../src/node_extensions.cc',
|
||||
'../src/node_file.cc',
|
||||
@@ -68,25 +81,33 @@
|
||||
'conditions': [
|
||||
[ 'node_use_openssl=="true"', {
|
||||
'libraries': [ '-lssl', '-lcrypto' ],
|
||||
'defines': [ 'HAVE_OPENSSL=1' ]
|
||||
'defines': [ 'HAVE_OPENSSL=1' ],
|
||||
'sources': [ '../src/node_crypto.cc' ],
|
||||
}, {
|
||||
'defines': [ 'HAVE_OPENSSL=0' ]
|
||||
}],
|
||||
|
||||
[ 'OS=="win"', {
|
||||
# until we figure out a good way to get openssl into the build system
|
||||
'node_use_openssl': 'false',
|
||||
'defines': [
|
||||
'PTW32_STATIC_LIB',
|
||||
'PTW32_STATIC_LIB', # we'll need to add pthread-win32 and build/depend on that.
|
||||
'FD_SETSIZE=1024'
|
||||
],
|
||||
'libraries': [
|
||||
'-lws2_32',
|
||||
'-lwinmm',
|
||||
'../deps/pthread-win32/libpthreadGC2.a',
|
||||
'-lws2_32.lib',
|
||||
'-lwinmm.lib',
|
||||
],
|
||||
'sources': [
|
||||
'../src/platform_win32.cc',
|
||||
'../src/node_stdio_win32.cc'
|
||||
]
|
||||
'../src/node_stdio_win32.cc',
|
||||
'../deps/uv/src/eio/eio.c', # file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead.
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'WarningLevel': '3',
|
||||
},
|
||||
},
|
||||
},{ # POSIX
|
||||
'defines': [ '__POSIX__' ],
|
||||
'sources': [
|
||||
@@ -203,7 +224,8 @@
|
||||
'../src/macros.py'
|
||||
],
|
||||
}]
|
||||
]
|
||||
],
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
}, # end node_js2c
|
||||
|
||||
141
tools/common.gypi
Normal file
141
tools/common.gypi
Normal file
@@ -0,0 +1,141 @@
|
||||
{
|
||||
'variables': {
|
||||
'library%': 'static_library',
|
||||
'component%': 'static_library',
|
||||
'visibility%': 'hidden',
|
||||
'variables': {
|
||||
'conditions': [
|
||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
||||
# This handles the Linux platforms we generally deal with. Anything
|
||||
# else gets passed through, which probably won't work very well; such
|
||||
# hosts should pass an explicit target_arch to gyp.
|
||||
'host_arch%':
|
||||
'<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
|
||||
}, { # OS!="linux" and OS!="freebsd" and OS!="openbsd"
|
||||
'host_arch%': 'ia32',
|
||||
}],
|
||||
],
|
||||
},
|
||||
'host_arch%': '<(host_arch)',
|
||||
'target_arch%': '<(host_arch)',
|
||||
'v8_target_arch%': '<(target_arch)',
|
||||
},
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Debug',
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
'cflags': [ '-g', '-O0' ],
|
||||
'defines': [ '_DEBUG', 'DEBUG' ],
|
||||
},
|
||||
'Release': {
|
||||
'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
'conditions': [
|
||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
|
||||
'target_defaults': {
|
||||
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ],
|
||||
'ldflags': [ '-pthread', ],
|
||||
'conditions': [
|
||||
[ 'target_arch=="ia32"', {
|
||||
'cflags': [ '-m32' ],
|
||||
'ldflags': [ '-m32' ],
|
||||
}],
|
||||
[ 'OS=="linux"', {
|
||||
'cflags': [ '-ansi' ],
|
||||
}],
|
||||
[ 'visibility=="hidden"', {
|
||||
'cflags': [ '-fvisibility=hidden' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
}], # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"'
|
||||
['OS=="win"', {
|
||||
'target_defaults': {
|
||||
'defines': [
|
||||
'WIN32',
|
||||
'_CRT_SECURE_NO_DEPRECATE',
|
||||
'_CRT_NONSTDC_NO_DEPRECATE',
|
||||
],
|
||||
'conditions': [
|
||||
['component=="static_library"', {
|
||||
'defines': [
|
||||
'_HAS_EXCEPTIONS=0',
|
||||
],
|
||||
}],
|
||||
],
|
||||
'msvs_disabled_warnings': [4355, 4800],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'MinimalRebuild': 'false',
|
||||
'BufferSecurityCheck': 'true',
|
||||
'EnableFunctionLevelLinking': 'true',
|
||||
'RuntimeTypeInfo': 'false',
|
||||
'WarningLevel': '3',
|
||||
'WarnAsError': 'true',
|
||||
'DebugInformationFormat': '3',
|
||||
'Detect64BitPortabilityProblems': 'false',
|
||||
'conditions': [
|
||||
[ 'msvs_multi_core_compile', {
|
||||
'AdditionalOptions': ['/MP'],
|
||||
}],
|
||||
['component=="shared_library"', {
|
||||
'ExceptionHandling': '1', # /EHsc
|
||||
}, {
|
||||
'ExceptionHandling': '0',
|
||||
}],
|
||||
],
|
||||
},
|
||||
'VCLibrarianTool': {
|
||||
'AdditionalOptions': ['/ignore:4221'],
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'AdditionalDependencies': [
|
||||
],
|
||||
'GenerateDebugInformation': 'true',
|
||||
},
|
||||
},
|
||||
},
|
||||
}], # OS=="win"
|
||||
['OS=="mac"', {
|
||||
'target_defaults': {
|
||||
'xcode_settings': {
|
||||
'ALWAYS_SEARCH_USER_PATHS': 'NO',
|
||||
'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
|
||||
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
|
||||
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
|
||||
# (Equivalent to -fPIC)
|
||||
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
|
||||
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
|
||||
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
|
||||
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
|
||||
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
|
||||
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
|
||||
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
|
||||
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
|
||||
'GCC_VERSION': '4.2',
|
||||
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
|
||||
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
|
||||
'PREBINDING': 'NO', # No -Wl,-prebind
|
||||
'USE_HEADERMAP': 'NO',
|
||||
'OTHER_CFLAGS': [
|
||||
'-fno-strict-aliasing',
|
||||
],
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wall',
|
||||
'-Wendif-labels',
|
||||
'-W',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wnon-virtual-dtor',
|
||||
],
|
||||
},
|
||||
'target_conditions': [
|
||||
['_type!="static_library"', {
|
||||
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
|
||||
}],
|
||||
], # target_conditions
|
||||
}, # target_defaults
|
||||
}], # OS=="mac"
|
||||
],
|
||||
}
|
||||
@@ -56,7 +56,7 @@ generator_default_variables = {
|
||||
# of the warnings.
|
||||
|
||||
# TODO(jeanluc) I had: 'LIB_DIR': '$(OutDir)lib',
|
||||
'LIB_DIR': '$(OutDir)/lib',
|
||||
#'LIB_DIR': '$(OutDir)/lib',
|
||||
'RULE_INPUT_ROOT': '$(InputName)',
|
||||
'RULE_INPUT_EXT': '$(InputExt)',
|
||||
'RULE_INPUT_NAME': '$(InputFileName)',
|
||||
@@ -575,7 +575,18 @@ def _GenerateExternalRules(rules, output_dir, spec,
|
||||
'IntDir=$(IntDir)',
|
||||
'-j', '${NUMBER_OF_PROCESSORS_PLUS_1}',
|
||||
'-f', filename]
|
||||
cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True)
|
||||
|
||||
# Currently this weird argument munging is used to duplicate the way a
|
||||
# python script would need to be run as part of the chrome tree.
|
||||
# Eventually we should add some sort of rule_default option to set this
|
||||
# per project. For now the behavior chrome needs is the default.
|
||||
mcs = rule.get('msvs_cygwin_shell')
|
||||
if mcs is None:
|
||||
mcs = int(spec.get('msvs_cygwin_shell', 1))
|
||||
elif isinstance(mcs, str):
|
||||
mcs = int(mcs)
|
||||
quote_cmd = int(rule.get('msvs_quote_cmd', 1))
|
||||
cmd = _BuildCommandLineForRuleRaw(spec, cmd, mcs, False, quote_cmd)
|
||||
# Insert makefile as 0'th input, so it gets the action attached there,
|
||||
# as this is easier to understand from in the IDE.
|
||||
all_inputs = list(all_inputs)
|
||||
@@ -1095,7 +1106,7 @@ def _GetOutputFilePathAndTool(spec):
|
||||
# TODO(jeanluc) If we want to avoid the MSB8012 warnings in
|
||||
# VisualStudio 2010, we will have to change the value of $(OutDir)
|
||||
# to contain the \lib suffix, rather than doing it as below.
|
||||
'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)\\lib\\', '.lib'),
|
||||
'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)\\', '.lib'),
|
||||
'dummy_executable': ('VCLinkerTool', 'Link', '$(IntDir)\\', '.junk'),
|
||||
}
|
||||
output_file_props = output_file_map.get(spec['type'])
|
||||
|
||||
@@ -4,17 +4,16 @@ import os
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
tool_dir = os.path.dirname(__file__)
|
||||
node_root = os.path.normpath(os.path.join(tool_dir, os.pardir))
|
||||
script_dir = os.path.dirname(__file__)
|
||||
node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
|
||||
|
||||
sys.path.insert(0, os.path.join(tool_dir, 'gyp', 'pylib'))
|
||||
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
|
||||
import gyp
|
||||
|
||||
# Directory within which we want all generated files (including Makefiles)
|
||||
# to be written.
|
||||
output_dir = os.path.join(os.path.abspath(node_root), 'out')
|
||||
|
||||
|
||||
def run_gyp(args):
|
||||
rc = gyp.main(args)
|
||||
if rc != 0:
|
||||
@@ -23,16 +22,17 @@ def run_gyp(args):
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = sys.argv[1:]
|
||||
args.append(os.path.join(tool_dir, 'all.gyp'))
|
||||
args.append(os.path.join(script_dir, 'all.gyp'))
|
||||
args.append('--depth=' + node_root)
|
||||
|
||||
# Tell gyp to write the Makefiles into output_dir
|
||||
args.extend(['--generator-output', output_dir])
|
||||
if sys.platform != 'win32':
|
||||
# Tell gyp to write the Makefiles into output_dir
|
||||
args.extend(['--generator-output', output_dir])
|
||||
|
||||
# Tell make to write its output into the same dir
|
||||
args.extend(['-Goutput_dir=' + output_dir])
|
||||
# Tell make to write its output into the same dir
|
||||
args.extend(['-Goutput_dir=' + output_dir])
|
||||
|
||||
args.append('-Dtarget_arch=x64')
|
||||
args.append('-Dtarget_arch=ia32')
|
||||
args.append('-Dcomponent=static_library')
|
||||
args.append('-Dlibrary=static_library')
|
||||
gyp_args = list(args)
|
||||
|
||||
Reference in New Issue
Block a user