1
0

common.gypi 7.0 KB

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