1
0

common.gypi 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. },
  10. 'target_defaults': {
  11. 'default_configuration': 'Debug',
  12. 'configurations': {
  13. 'Debug': {
  14. 'defines': [ 'DEBUG', '_DEBUG' ],
  15. 'cflags': [ '-g', '-O0', '-fwrapv' ],
  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': 'false',
  27. 'OmitFramePointers': 'false',
  28. 'BasicRuntimeChecks': 3, # /RTC1
  29. },
  30. 'VCLinkerTool': {
  31. 'LinkIncremental': 2, # enable incremental linking
  32. },
  33. },
  34. 'xcode_settings': {
  35. 'GCC_OPTIMIZATION_LEVEL': '0',
  36. 'OTHER_CFLAGS': [ '-Wno-strict-aliasing' ],
  37. },
  38. 'conditions': [
  39. ['OS != "win"', {
  40. 'defines': [ 'EV_VERIFY=2' ],
  41. }],
  42. ]
  43. },
  44. 'Release': {
  45. 'defines': [ 'NDEBUG' ],
  46. 'cflags': [
  47. ## This will be passed from make.js '-O3',
  48. '-fstrict-aliasing',
  49. '-fomit-frame-pointer',
  50. '-fdata-sections',
  51. '-ffunction-sections',
  52. ],
  53. 'msvs_settings': {
  54. 'VCCLCompilerTool': {
  55. 'target_conditions': [
  56. ['library=="static_library"', {
  57. 'RuntimeLibrary': 0, # static release
  58. }, {
  59. 'RuntimeLibrary': 2, # debug release
  60. }],
  61. ],
  62. 'Optimization': 3, # /Ox, full optimization
  63. 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
  64. 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
  65. 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
  66. 'OmitFramePointers': 'true',
  67. 'EnableFunctionLevelLinking': 'true',
  68. 'EnableIntrinsicFunctions': 'true',
  69. },
  70. 'VCLibrarianTool': {
  71. 'AdditionalOptions': [
  72. '/LTCG', # link time code generation
  73. ],
  74. },
  75. 'VCLinkerTool': {
  76. 'LinkTimeCodeGeneration': 1, # link-time code generation
  77. 'OptimizeReferences': 2, # /OPT:REF
  78. 'EnableCOMDATFolding': 2, # /OPT:ICF
  79. 'LinkIncremental': 1, # disable incremental linking
  80. },
  81. },
  82. }
  83. },
  84. 'msvs_settings': {
  85. 'VCCLCompilerTool': {
  86. 'StringPooling': 'true', # pool string literals
  87. 'DebugInformationFormat': 3, # Generate a PDB
  88. 'WarningLevel': 3,
  89. 'BufferSecurityCheck': 'true',
  90. 'ExceptionHandling': 1, # /EHsc
  91. 'SuppressStartupBanner': 'true',
  92. 'WarnAsError': 'false',
  93. 'AdditionalOptions': [
  94. '/MP', # compile across multiple CPUs
  95. ],
  96. },
  97. 'VCLibrarianTool': {
  98. },
  99. 'VCLinkerTool': {
  100. 'GenerateDebugInformation': 'true',
  101. 'RandomizedBaseAddress': 2, # enable ASLR
  102. 'DataExecutionPrevention': 2, # enable DEP
  103. 'AllowIsolation': 'true',
  104. 'SuppressStartupBanner': 'true',
  105. 'target_conditions': [
  106. ['_type=="executable"', {
  107. 'SubSystem': 1, # console executable
  108. }],
  109. ],
  110. },
  111. },
  112. 'conditions': [
  113. ['OS == "win"', {
  114. 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
  115. 'defines': [
  116. 'WIN32',
  117. # we don't really want VC++ warning us about
  118. # how dangerous C functions are...
  119. '_CRT_SECURE_NO_DEPRECATE',
  120. # ... or that C implementations shouldn't use
  121. # POSIX names
  122. '_CRT_NONSTDC_NO_DEPRECATE',
  123. ],
  124. 'target_conditions': [
  125. ['target_arch=="x64"', {
  126. 'msvs_configuration_platform': 'x64'
  127. }]
  128. ]
  129. }],
  130. ['OS in "freebsd linux openbsd solaris android"', {
  131. 'cflags': [ '-Wall' ],
  132. 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
  133. 'target_conditions': [
  134. ['_type=="static_library"', {
  135. 'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
  136. }],
  137. ],
  138. 'conditions': [
  139. [ 'host_arch != target_arch and target_arch=="ia32"', {
  140. 'cflags': [ '-m32' ],
  141. 'ldflags': [ '-m32' ],
  142. }],
  143. [ 'OS=="linux"', {
  144. 'cflags': [ '-ansi' ],
  145. }],
  146. [ 'OS=="solaris"', {
  147. 'cflags': [ '-pthreads' ],
  148. 'ldflags': [ '-pthreads' ],
  149. }],
  150. [ 'OS not in "solaris android"', {
  151. 'cflags': [ '-pthread' ],
  152. 'ldflags': [ '-pthread' ],
  153. }],
  154. [ 'visibility=="hidden"', {
  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. 'PREBINDING': 'NO', # No -Wl,-prebind
  173. 'USE_HEADERMAP': 'NO',
  174. 'OTHER_CFLAGS': [
  175. '-fstrict-aliasing',
  176. ],
  177. 'WARNING_CFLAGS': [
  178. '-Wall',
  179. '-Wendif-labels',
  180. '-W',
  181. '-Wno-unused-parameter',
  182. ],
  183. },
  184. 'conditions': [
  185. ['target_arch=="ia32"', {
  186. 'xcode_settings': {'ARCHS': ['i386']},
  187. }],
  188. ['target_arch=="x64"', {
  189. 'xcode_settings': {'ARCHS': ['x86_64']},
  190. }],
  191. ],
  192. 'target_conditions': [
  193. ['_type!="static_library"', {
  194. 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
  195. }],
  196. ],
  197. }],
  198. ['OS=="solaris"', {
  199. 'cflags': [ '-fno-omit-frame-pointer' ],
  200. # pull in V8's postmortem metadata
  201. 'ldflags': [ '-Wl,-z,allextract' ]
  202. }],
  203. ],
  204. },
  205. }