From 71333b3f5b12183b2709704fec160df916cb637a Mon Sep 17 00:00:00 2001 From: Peter Bright Date: Sat, 6 Aug 2011 20:20:15 +0100 Subject: [PATCH] Modify GYP scripts for VC build --- Makefile | 3 + tools/all.gyp | 48 ++++++++---- tools/common.gypi | 141 ++++++++++++++++++++++++++++++++++ tools/gyp/pylib/gyp/generator/msvs.py | 17 +++- tools/gyp_node | 20 ++--- 5 files changed, 203 insertions(+), 26 deletions(-) create mode 100644 tools/common.gypi diff --git a/Makefile b/Makefile index c502faf..d97f4a4 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ all: out/Makefile out/Makefile: tools/gyp_node -f make +clean: + rm -rf out + distclean: rm -rf out diff --git a/tools/all.gyp b/tools/all.gyp index 856a8c0..59027ae 100644 --- a/tools/all.gyp +++ b/tools/all.gyp @@ -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 diff --git a/tools/common.gypi b/tools/common.gypi new file mode 100644 index 0000000..e1ab095 --- /dev/null +++ b/tools/common.gypi @@ -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%': + '