Skip to content

Commit 16788f4

Browse files
DrPizzary
authored andcommitted
Rename gyp files to produce useful solution names.
Hoist common settings into common.gypi. Restrict v8's common.gypi to v8 projects. Ensure v8 doesn't use /MP in debug builds. Add basic settings for other platforms. Make uv import common.gypi properly. Remove LTCG warning.
1 parent a5d90c4 commit 16788f4

File tree

13 files changed

+564
-533
lines changed

13 files changed

+564
-533
lines changed

common.gypi

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
'variables': {
3+
'target_arch%': 'ia32', # set v8's target architecture
4+
'host_arch%': 'ia32', # set v8's host architecture
5+
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
6+
'component%': 'static_library', # NB. these names match with what V8 expects
7+
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
8+
},
9+
10+
'target_defaults': {
11+
'default_configuration': 'Debug',
12+
'configurations': {
13+
'Debug': {
14+
'defines': [ 'DEBUG', '_DEBUG' ],
15+
'cflags': [ '-g', '-O0' ],
16+
'msvs_settings': {
17+
'VCCLCompilerTool': {
18+
'target_conditions': [
19+
['library=="static_library"', {
20+
'RuntimeLibrary': 1, # static debug
21+
}, {
22+
'RuntimeLibrary': 3, # DLL debug
23+
}],
24+
],
25+
'Optimization': 0, # /Od, no optimization
26+
'MinimalRebuild': 'true',
27+
'OmitFramePointers': 'false',
28+
'BasicRuntimeChecks': 3, # /RTC1
29+
},
30+
'VCLinkerTool': {
31+
'LinkIncremental': 2, # enable incremental linking
32+
},
33+
},
34+
},
35+
'Release': {
36+
'defines': [ 'NDEBUG' ],
37+
'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ],
38+
'msvs_settings': {
39+
'VCCLCompilerTool': {
40+
'target_conditions': [
41+
['library=="static_library"', {
42+
'RuntimeLibrary': 0, # static release
43+
}, {
44+
'RuntimeLibrary': 2, # debug release
45+
}],
46+
],
47+
'Optimization': 3, # /Ox, full optimization
48+
'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
49+
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
50+
'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
51+
'OmitFramePointers': 'true',
52+
'EnableFunctionLevelLinking': 'true',
53+
'EnableIntrinsicFunctions': 'true',
54+
'AdditionalOptions': [
55+
'/MP', # compile across multiple CPUs
56+
],
57+
},
58+
'VCLibrarianTool': {
59+
'AdditionalOptions': [
60+
'/LTCG', # link time code generation
61+
],
62+
},
63+
'VCLinkerTool': {
64+
'LinkTimeCodeGeneration': 1, # link-time code generation
65+
'OptimizeReferences': 2, # /OPT:REF
66+
'EnableCOMDATFolding': 2, # /OPT:ICF
67+
'LinkIncremental': 1, # disable incremental linking
68+
},
69+
},
70+
}
71+
},
72+
'msvs_settings': {
73+
'VCCLCompilerTool': {
74+
'StringPooling': 'true', # pool string literals
75+
'DebugInformationFormat': 3, # Generate a PDB
76+
'WarningLevel': 3,
77+
'BufferSecurityCheck': 'true',
78+
'ExceptionHandling': 1, # /EHsc
79+
'SuppressStartupBanner': 'true',
80+
'WarnAsError': 'false',
81+
},
82+
'VCLibrarianTool': {
83+
},
84+
'VCLinkerTool': {
85+
'GenerateDebugInformation': 'true',
86+
'RandomizedBaseAddress': 2, # enable ASLR
87+
'DataExecutionPrevention': 2, # enable DEP
88+
'AllowIsolation': 'true',
89+
'SuppressStartupBanner': 'true',
90+
},
91+
},
92+
'conditions': [
93+
['OS == "win"', {
94+
'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
95+
'defines': [
96+
'WIN32',
97+
# we don't really want VC++ warning us about
98+
# how dangerous C functions are...
99+
'_CRT_SECURE_NO_DEPRECATE',
100+
# ... or that C implementations shouldn't use
101+
# POSIX names
102+
'_CRT_NONSTDC_NO_DEPRECATE',
103+
],
104+
}],
105+
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
106+
'target_defaults': {
107+
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ],
108+
'ldflags': [ '-pthread', ],
109+
'conditions': [
110+
[ 'target_arch=="ia32"', {
111+
'cflags': [ '-m32' ],
112+
'ldflags': [ '-m32' ],
113+
}],
114+
[ 'OS=="linux"', {
115+
'cflags': [ '-ansi' ],
116+
}],
117+
[ 'visibility=="hidden"', {
118+
'cflags': [ '-fvisibility=hidden' ],
119+
}],
120+
],
121+
},
122+
}],
123+
['OS=="mac"', {
124+
'target_defaults': {
125+
'xcode_settings': {
126+
'ALWAYS_SEARCH_USER_PATHS': 'NO',
127+
'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
128+
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
129+
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
130+
# (Equivalent to -fPIC)
131+
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
132+
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
133+
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
134+
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
135+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
136+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
137+
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
138+
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
139+
'GCC_VERSION': '4.2',
140+
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
141+
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
142+
'PREBINDING': 'NO', # No -Wl,-prebind
143+
'USE_HEADERMAP': 'NO',
144+
'OTHER_CFLAGS': [
145+
'-fno-strict-aliasing',
146+
],
147+
'WARNING_CFLAGS': [
148+
'-Wall',
149+
'-Wendif-labels',
150+
'-W',
151+
'-Wno-unused-parameter',
152+
'-Wnon-virtual-dtor',
153+
],
154+
},
155+
'target_conditions': [
156+
['_type!="static_library"', {
157+
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
158+
}],
159+
],
160+
},
161+
}],
162+
],
163+
},
164+
}

deps/http_parser/http_parser.gyp

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,24 @@
55
# ./gyp/gyp -f make --depth=`pwd` http_parser.gyp
66
# ./out/Debug/test
77
{
8-
'target_defaults': {
9-
'default_configuration': 'Debug',
10-
'configurations': {
11-
# TODO: hoist these out and put them somewhere common, because
12-
# RuntimeLibrary MUST MATCH across the entire project
13-
'Debug': {
14-
'defines': [ 'DEBUG', '_DEBUG' ],
15-
'msvs_settings': {
16-
'VCCLCompilerTool': {
17-
'RuntimeLibrary': 1, # static debug
18-
},
19-
},
20-
},
21-
'Release': {
22-
'defines': [ 'NDEBUG' ],
23-
'msvs_settings': {
24-
'VCCLCompilerTool': {
25-
'RuntimeLibrary': 0, # static release
26-
},
27-
},
28-
}
29-
},
30-
'msvs_settings': {
31-
'VCCLCompilerTool': {
32-
},
33-
'VCLibrarianTool': {
34-
},
35-
'VCLinkerTool': {
36-
'GenerateDebugInformation': 'true',
37-
},
38-
},
39-
'conditions': [
40-
['OS == "win"', {
41-
'defines': [
42-
'WIN32'
43-
],
44-
}]
45-
],
46-
},
47-
488
'targets': [
499
{
5010
'target_name': 'http_parser',
51-
'type': 'static_library',
11+
'type': '<(library)',
5212
'include_dirs': [ '.' ],
5313
'direct_dependent_settings': {
5414
'include_dirs': [ '.' ],
5515
},
5616
'defines': [ 'HTTP_PARSER_STRICT=0' ],
5717
'sources': [ './http_parser.c', ],
58-
'conditions': [
59-
['OS=="win"', {
60-
'msvs_settings': {
61-
'VCCLCompilerTool': {
62-
# Compile as C++. http_parser.c is actually C99, but C++ is
63-
# close enough in this case.
64-
'CompileAs': 2,
65-
},
66-
},
67-
}]
68-
],
18+
'msvs_settings': {
19+
'VCCLCompilerTool': {
20+
# Compile as C++. http_parser.c is actually C99, but C++ is
21+
# close enough in this case.
22+
'CompileAs': 2, # compile as C++
23+
},
24+
},
6925
},
70-
7126
{
7227
'target_name': 'test',
7328
'type': 'executable',

0 commit comments

Comments
 (0)