GYP upates

This commit is contained in:
Peter Bright 2011-08-13 20:23:35 -07:00 committed by Ryan Dahl
parent 035fd5beb0
commit 2942f5a8cc
4 changed files with 180 additions and 544 deletions

326
all.gyp
View File

@ -1,326 +0,0 @@
{
'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' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
},
},
},
'Release': {
'defines': [ 'NDEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
},
},
}
},
'msvs_settings': {
'VCCLCompilerTool': {
},
'VCLibrarianTool': {
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
},
},
'conditions': [
['OS == "win"', {
'defines': [
'WIN32'
],
}]
],
},
'targets': [
{
'target_name': 'uv',
'type': 'static_library',
'include_dirs': [ 'include' ],
'direct_dependent_settings': {
'include_dirs': [ 'include' ],
},
'defines': [
'HAVE_CONFIG_H'
],
'sources': [
'include/ares.h',
'include/ares_version.h',
'include/uv.h',
'src/uv-common.c',
'src/uv-common.h',
'src/ares/ares__close_sockets.c',
'src/ares/ares__get_hostent.c',
'src/ares/ares__read_line.c',
'src/ares/ares__timeval.c',
'src/ares/ares_cancel.c',
'src/ares/ares_data.c',
'src/ares/ares_data.h',
'src/ares/ares_destroy.c',
'src/ares/ares_dns.h',
'src/ares/ares_expand_name.c',
'src/ares/ares_expand_string.c',
'src/ares/ares_fds.c',
'src/ares/ares_free_hostent.c',
'src/ares/ares_free_string.c',
'src/ares/ares_gethostbyaddr.c',
'src/ares/ares_gethostbyname.c',
'src/ares/ares_getnameinfo.c',
'src/ares/ares_getopt.c',
'src/ares/ares_getopt.h',
'src/ares/ares_getsock.c',
'src/ares/ares_init.c',
'src/ares/ares_ipv6.h',
'src/ares/ares_library_init.c',
'src/ares/ares_library_init.h',
'src/ares/ares_llist.c',
'src/ares/ares_llist.h',
'src/ares/ares_mkquery.c',
'src/ares/ares_nowarn.c',
'src/ares/ares_nowarn.h',
'src/ares/ares_options.c',
'src/ares/ares_parse_a_reply.c',
'src/ares/ares_parse_aaaa_reply.c',
'src/ares/ares_parse_mx_reply.c',
'src/ares/ares_parse_ns_reply.c',
'src/ares/ares_parse_ptr_reply.c',
'src/ares/ares_parse_srv_reply.c',
'src/ares/ares_parse_txt_reply.c',
'src/ares/ares_private.h',
'src/ares/ares_process.c',
'src/ares/ares_query.c',
'src/ares/ares_rules.h',
'src/ares/ares_search.c',
'src/ares/ares_send.c',
'src/ares/ares_setup.h',
'src/ares/ares_strcasecmp.c',
'src/ares/ares_strcasecmp.h',
'src/ares/ares_strdup.c',
'src/ares/ares_strdup.h',
'src/ares/ares_strerror.c',
'src/ares/ares_timeout.c',
'src/ares/ares_version.c',
'src/ares/ares_writev.c',
'src/ares/ares_writev.h',
'src/ares/bitncmp.c',
'src/ares/bitncmp.h',
'src/ares/inet_net_pton.c',
'src/ares/inet_net_pton.h',
'src/ares/inet_ntop.c',
'src/ares/inet_ntop.h',
'src/ares/nameser.h',
'src/ares/setup_once.h',
],
'conditions': [
[ 'OS=="win"', {
'include_dirs': [
'src/ares/config_win32'
],
'sources': [ 'src/ares/windows_port.c' ],
'defines': [
'_WIN32_WINNT=0x0502',
'EIO_STACKSIZE=262144',
'_GNU_SOURCE',
],
'sources': [
'include/tree.h',
'include/uv-win.h',
'src/ares/config_win32/ares_config.h',
'src/win/async.c',
'src/win/cares.c',
'src/win/core.c',
'src/win/error.c',
'src/win/getaddrinfo.c',
'src/win/handle.c',
'src/win/internal.h',
'src/win/loop-watcher.c',
'src/win/ntdll.h',
'src/win/pipe.c',
'src/win/process.c',
'src/win/req.c',
'src/win/stdio.c',
'src/win/stream.c',
'src/win/tcp.c',
'src/win/timer.c',
'src/win/util.c',
'src/win/winapi.c',
]
}, { # Not Windows i.e. POSIX
'cflags': [
'-g',
'--std=gnu89',
'-pedantic',
'-Wall',
'-Wextra',
'-Wno-unused-parameter'
],
'sources': [
'include/eio.h',
'include/ev.h',
'include/ngx-queue.h',
'include/uv-unix.h',
'src/uv-eio.c',
'src/uv-eio.h',
'src/uv-unix.c',
'src/ares/config_cygwin/ares_config.h',
'src/ares/config_darwin/ares_config.h',
'src/ares/config_freebsd/ares_config.h',
'src/ares/config_linux/ares_config.h',
'src/ares/config_openbsd/ares_config.h',
'src/ares/config_sunos/ares_config.h',
'src/eio/config_cygwin.h',
'src/eio/config_darwin.h',
'src/eio/config_freebsd.h',
'src/eio/config_linux.h',
'src/eio/config_sunos.h',
'src/eio/ecb.h',
'src/eio/eio.c',
'src/eio/xthread.h',
'src/ev/config_cygwin.h',
'src/ev/config_darwin.h',
'src/ev/config_freebsd.h',
'src/ev/config_linux.h',
'src/ev/config_sunos.h',
'src/ev/ev.c',
'src/ev/ev_vars.h',
'src/ev/ev_wrap.h',
'src/ev/event.h',
],
'include_dirs': [
'src/ev'
],
'defines': [
'_LARGEFILE_SOURCE',
'_FILE_OFFSET_BITS=64',
'_GNU_SOURCE',
'EIO_STACKSIZE=262144'
],
'libraries': [ '-lm' ]
}],
[ 'OS=="mac"', {
'include_dirs': [ 'src/ares/config_darwin' ],
'sources': [ 'src/uv-darwin.c' ],
'direct_dependent_settings': {
'libraries': [ '-framework CoreServices' ],
},
'defines': [
'EV_CONFIG_H="config_darwin.h"',
'EIO_CONFIG_H="config_darwin.h"',
]
}],
[ 'OS=="linux"', {
'include_dirs': [ 'src/ares/config_linux' ],
'sources': [ 'src/uv-linux.c' ],
'defines': [
'EV_CONFIG_H="config_linux.h"',
'EIO_CONFIG_H="config_linux.h"',
],
'direct_dependent_settings': {
'libraries': [ '-lrt' ],
},
}],
# TODO add OS=='sun'
]
},
{
'target_name': 'run-tests',
'type': 'executable',
'dependencies': [ 'uv' ],
'sources': [
'test/echo-server.c',
'test/run-tests.c',
'test/runner.c',
'test/runner.h',
'test/task.h',
'test/test-async.c',
'test/test-callback-stack.c',
'test/test-connection-fail.c',
'test/test-delayed-accept.c',
'test/test-fail-always.c',
'test/test-get-currentexe.c',
'test/test-getaddrinfo.c',
'test/test-gethostbyname.c',
'test/test-getsockname.c',
'test/test-hrtime.c',
'test/test-idle.c',
'test/test-list.h',
'test/test-loop-handles.c',
'test/test-pass-always.c',
'test/test-ping-pong.c',
'test/test-pipe-bind-error.c',
'test/test-ref.c',
'test/test-shutdown-eof.c',
'test/test-spawn.c',
'test/test-tcp-bind-error.c',
'test/test-tcp-bind6-error.c',
'test/test-tcp-writealot.c',
'test/test-timer-again.c',
'test/test-timer.c',
],
'conditions': [
[ 'OS=="win"', {
'sources': [
'test/runner-win.c',
'test/runner-win.h'
],
'libraries': [ 'ws2_32.lib' ]
}, { # POSIX
'defines': [ '_GNU_SOURCE' ],
'ldflags': [ '-pthread' ],
'sources': [
'test/runner-unix.c',
'test/runner-unix.h',
]
}]
]
},
{
'target_name': 'run-benchmarks',
'type': 'executable',
'dependencies': [ 'uv' ],
'sources': [
'test/benchmark-ares.c',
'test/benchmark-getaddrinfo.c',
'test/benchmark-list.h',
'test/benchmark-ping-pongs.c',
'test/benchmark-pound.c',
'test/benchmark-pump.c',
'test/benchmark-sizes.c',
'test/benchmark-spawn.c',
'test/dns-server.c',
'test/echo-server.c',
'test/run-benchmarks.c',
'test/runner.c',
'test/runner.h',
'test/task.h',
],
'conditions': [
[ 'OS=="win"', {
'sources': [
'test/runner-win.c',
'test/runner-win.h',
],
'libraries': [ 'ws2_32.lib' ]
}, { # POSIX
'defines': [ '_GNU_SOURCE' ],
'ldflags': [ '-pthread' ],
'sources': [
'test/runner-unix.c',
'test/runner-unix.h',
]
}]
]
}
]
}

View File

@ -1,13 +1,164 @@
{
'conditions': [
['OS=="win"', {
'target_defaults': {
'variables': {
'target_arch%': 'ia32', # set v8's target architecture
'host_arch%': 'ia32', # set v8's host architecture
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
'component%': 'static_library', # NB. these names match with what V8 expects
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
},
'target_defaults': {
'default_configuration': 'Debug',
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'cflags': [ '-g', '-O0' ],
'msvs_settings': {
'VCCLCompilerTool': {
'target_conditions': [
['library=="static_library"', {
'RuntimeLibrary': 1, # static debug
}, {
'RuntimeLibrary': 3, # DLL debug
}],
],
'Optimization': 0, # /Od, no optimization
'MinimalRebuild': 'true',
'OmitFramePointers': 'false',
'BasicRuntimeChecks': 3, # /RTC1
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
'LinkIncremental': 2, # enable incremental linking
},
},
},
}], # OS=="win"
],
}
'Release': {
'defines': [ 'NDEBUG' ],
'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ],
'msvs_settings': {
'VCCLCompilerTool': {
'target_conditions': [
['library=="static_library"', {
'RuntimeLibrary': 0, # static release
}, {
'RuntimeLibrary': 2, # debug release
}],
],
'Optimization': 3, # /Ox, full optimization
'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
'OmitFramePointers': 'true',
'EnableFunctionLevelLinking': 'true',
'EnableIntrinsicFunctions': 'true',
'AdditionalOptions': [
'/MP', # compile across multiple CPUs
],
},
'VCLibrarianTool': {
'AdditionalOptions': [
'/LTCG', # link time code generation
],
},
'VCLinkerTool': {
'LinkTimeCodeGeneration': 1, # link-time code generation
'OptimizeReferences': 2, # /OPT:REF
'EnableCOMDATFolding': 2, # /OPT:ICF
'LinkIncremental': 1, # disable incremental linking
},
},
}
},
'msvs_settings': {
'VCCLCompilerTool': {
'StringPooling': 'true', # pool string literals
'DebugInformationFormat': 3, # Generate a PDB
'WarningLevel': 3,
'BufferSecurityCheck': 'true',
'ExceptionHandling': 1, # /EHsc
'SuppressStartupBanner': 'true',
'WarnAsError': 'false',
},
'VCLibrarianTool': {
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
'RandomizedBaseAddress': 2, # enable ASLR
'DataExecutionPrevention': 2, # enable DEP
'AllowIsolation': 'true',
'SuppressStartupBanner': 'true',
},
},
'conditions': [
['OS == "win"', {
'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
'defines': [
'WIN32',
# we don't really want VC++ warning us about
# how dangerous C functions are...
'_CRT_SECURE_NO_DEPRECATE',
# ... or that C implementations shouldn't use
# POSIX names
'_CRT_NONSTDC_NO_DEPRECATE',
],
}],
[ '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=="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']},
}],
],
},
}],
],
},
}

View File

@ -1,207 +0,0 @@
{
'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' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
},
},
},
'Release': {
'defines': [ 'NDEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
},
},
}
},
'msvs_settings': {
'VCCLCompilerTool': {
},
'VCLibrarianTool': {
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
},
},
'conditions': [
['OS == "win"', {
'defines': [
'WIN32'
],
}]
],
},
'targets': [
{
'target_name': 'pthread-win32',
'type': 'static_library',
'include_dirs': [ '../' ],
'direct_dependent_settings': {
'include_dirs': [ '../' ],
},
'defines': [
'HAVE_PTW32_CONFIG_H',
'__CLEANUP_C',
'WIN32'
],
'msvs_settings': {
'VCCLCompilerTool': {
},
'VCLibrarianTool': {
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
},
},
'sources': [
'../autostatic.c',
'../cleanup.c',
'../create.c',
'../dll.c',
'../errno.c',
'../fork.c',
'../global.c',
'../pthread_attr_destroy.c',
'../pthread_attr_getdetachstate.c',
'../pthread_attr_getinheritsched.c',
'../pthread_attr_getschedparam.c',
'../pthread_attr_getschedpolicy.c',
'../pthread_attr_getscope.c',
'../pthread_attr_getstackaddr.c',
'../pthread_attr_getstacksize.c',
'../pthread_attr_init.c',
'../pthread_attr_setdetachstate.c',
'../pthread_attr_setinheritsched.c',
'../pthread_attr_setschedparam.c',
'../pthread_attr_setschedpolicy.c',
'../pthread_attr_setscope.c',
'../pthread_attr_setstackaddr.c',
'../pthread_attr_setstacksize.c',
'../pthread_barrierattr_destroy.c',
'../pthread_barrierattr_getpshared.c',
'../pthread_barrierattr_init.c',
'../pthread_barrierattr_setpshared.c',
'../pthread_barrier_destroy.c',
'../pthread_barrier_init.c',
'../pthread_barrier_wait.c',
'../pthread_cancel.c',
'../pthread_condattr_destroy.c',
'../pthread_condattr_getpshared.c',
'../pthread_condattr_init.c',
'../pthread_condattr_setpshared.c',
'../pthread_cond_destroy.c',
'../pthread_cond_init.c',
'../pthread_cond_signal.c',
'../pthread_cond_wait.c',
'../pthread_delay_np.c',
'../pthread_detach.c',
'../pthread_equal.c',
'../pthread_exit.c',
'../pthread_getconcurrency.c',
'../pthread_getschedparam.c',
'../pthread_getspecific.c',
'../pthread_getunique_np.c',
'../pthread_getw32threadhandle_np.c',
'../pthread_join.c',
'../pthread_key_create.c',
'../pthread_key_delete.c',
'../pthread_kill.c',
'../pthread_mutexattr_destroy.c',
'../pthread_mutexattr_getkind_np.c',
'../pthread_mutexattr_getpshared.c',
'../pthread_mutexattr_getrobust.c',
'../pthread_mutexattr_gettype.c',
'../pthread_mutexattr_init.c',
'../pthread_mutexattr_setkind_np.c',
'../pthread_mutexattr_setpshared.c',
'../pthread_mutexattr_setrobust.c',
'../pthread_mutexattr_settype.c',
'../pthread_mutex_consistent.c',
'../pthread_mutex_destroy.c',
'../pthread_mutex_init.c',
'../pthread_mutex_lock.c',
'../pthread_mutex_timedlock.c',
'../pthread_mutex_trylock.c',
'../pthread_mutex_unlock.c',
'../pthread_num_processors_np.c',
'../pthread_once.c',
'../pthread_rwlockattr_destroy.c',
'../pthread_rwlockattr_getpshared.c',
'../pthread_rwlockattr_init.c',
'../pthread_rwlockattr_setpshared.c',
'../pthread_rwlock_destroy.c',
'../pthread_rwlock_init.c',
'../pthread_rwlock_rdlock.c',
'../pthread_rwlock_timedrdlock.c',
'../pthread_rwlock_timedwrlock.c',
'../pthread_rwlock_tryrdlock.c',
'../pthread_rwlock_trywrlock.c',
'../pthread_rwlock_unlock.c',
'../pthread_rwlock_wrlock.c',
'../pthread_self.c',
'../pthread_setcancelstate.c',
'../pthread_setcanceltype.c',
'../pthread_setconcurrency.c',
'../pthread_setschedparam.c',
'../pthread_setspecific.c',
'../pthread_spin_destroy.c',
'../pthread_spin_init.c',
'../pthread_spin_lock.c',
'../pthread_spin_trylock.c',
'../pthread_spin_unlock.c',
'../pthread_testcancel.c',
'../pthread_timechange_handler_np.c',
'../pthread_win32_attach_detach_np.c',
'../ptw32_calloc.c',
'../ptw32_callUserDestroyRoutines.c',
'../ptw32_cond_check_need_init.c',
'../ptw32_getprocessors.c',
'../ptw32_is_attr.c',
'../ptw32_MCS_lock.c',
'../ptw32_mutex_check_need_init.c',
'../ptw32_new.c',
'../ptw32_processInitialize.c',
'../ptw32_processTerminate.c',
'../ptw32_relmillisecs.c',
'../ptw32_reuse.c',
'../ptw32_rwlock_cancelwrwait.c',
'../ptw32_rwlock_check_need_init.c',
'../ptw32_semwait.c',
'../ptw32_spinlock_check_need_init.c',
'../ptw32_threadDestroy.c',
'../ptw32_threadStart.c',
'../ptw32_throw.c',
'../ptw32_timespec.c',
'../ptw32_tkAssocCreate.c',
'../ptw32_tkAssocDestroy.c',
'../sched_getscheduler.c',
'../sched_get_priority_max.c',
'../sched_get_priority_min.c',
'../sched_setscheduler.c',
'../sched_yield.c',
'../sem_close.c',
'../sem_destroy.c',
'../sem_getvalue.c',
'../sem_init.c',
'../sem_open.c',
'../sem_post.c',
'../sem_post_multiple.c',
'../sem_timedwait.c',
'../sem_trywait.c',
'../sem_unlink.c',
'../sem_wait.c',
'../signal.c',
'../w32_CancelableWait.c',
],
},
]
}

26
gyp_uv Normal file → Executable file
View File

@ -5,7 +5,7 @@ import shlex
import sys
script_dir = os.path.dirname(__file__)
uv_root = os.path.abspath(script_dir)
uv_root = os.path.normpath(script_dir)
sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib'))
import gyp
@ -14,7 +14,6 @@ import gyp
# to be written.
output_dir = os.path.join(os.path.abspath(uv_root), 'out')
def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
@ -24,8 +23,23 @@ def run_gyp(args):
if __name__ == '__main__':
args = sys.argv[1:]
args.append(os.path.join(script_dir, 'all.gyp'))
args.append('-I' + os.path.join(script_dir, 'common.gypi'))
# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
if sys.platform == 'win32':
args.append(os.path.join(uv_root, 'uv.gyp'))
common_fn = os.path.join(uv_root, 'common.gypi')
options_fn = os.path.join(uv_root, 'options.gypi')
else:
args.append(os.path.join(os.path.abspath(uv_root), 'uv.gyp'))
common_fn = os.path.join(os.path.abspath(uv_root), 'common.gypi')
options_fn = os.path.join(os.path.abspath(uv_root), 'options.gypi')
if os.path.exists(common_fn):
args.extend(['-I', common_fn])
if os.path.exists(options_fn):
args.extend(['-I', options_fn])
args.append('--depth=' + uv_root)
@ -38,5 +52,9 @@ if __name__ == '__main__':
# Tell make to write its output into the same dir
args.extend(['-Goutput_dir=' + output_dir])
args.append('-Dtarget_arch=ia32')
args.append('-Dcomponent=static_library')
args.append('-Dlibrary=static_library')
gyp_args = list(args)
print gyp_args
run_gyp(gyp_args)