1
0

common.gypi 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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': [
  46. # 'NDEBUG' ## cjdns remove NDEBUG in order to get all of the assertions
  47. ],
  48. 'cflags': [
  49. ## This will be passed from make.js '-O3',
  50. '-fstrict-aliasing',
  51. '-fomit-frame-pointer',
  52. '-fdata-sections',
  53. '-ffunction-sections',
  54. ],
  55. 'msvs_settings': {
  56. 'VCCLCompilerTool': {
  57. 'target_conditions': [
  58. ['library=="static_library"', {
  59. 'RuntimeLibrary': 0, # static release
  60. }, {
  61. 'RuntimeLibrary': 2, # debug release
  62. }],
  63. ],
  64. 'Optimization': 3, # /Ox, full optimization
  65. 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
  66. 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
  67. 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
  68. 'OmitFramePointers': 'true',
  69. 'EnableFunctionLevelLinking': 'true',
  70. 'EnableIntrinsicFunctions': 'true',
  71. },
  72. 'VCLibrarianTool': {
  73. 'AdditionalOptions': [
  74. '/LTCG', # link time code generation
  75. ],
  76. },
  77. 'VCLinkerTool': {
  78. 'LinkTimeCodeGeneration': 1, # link-time code generation
  79. 'OptimizeReferences': 2, # /OPT:REF
  80. 'EnableCOMDATFolding': 2, # /OPT:ICF
  81. 'LinkIncremental': 1, # disable incremental linking
  82. },
  83. },
  84. }
  85. },
  86. 'msvs_settings': {
  87. 'VCCLCompilerTool': {
  88. 'StringPooling': 'true', # pool string literals
  89. 'DebugInformationFormat': 3, # Generate a PDB
  90. 'WarningLevel': 3,
  91. 'BufferSecurityCheck': 'true',
  92. 'ExceptionHandling': 1, # /EHsc
  93. 'SuppressStartupBanner': 'true',
  94. 'WarnAsError': 'false',
  95. 'AdditionalOptions': [
  96. '/MP', # compile across multiple CPUs
  97. ],
  98. },
  99. 'VCLibrarianTool': {
  100. },
  101. 'VCLinkerTool': {
  102. 'GenerateDebugInformation': 'true',
  103. 'RandomizedBaseAddress': 2, # enable ASLR
  104. 'DataExecutionPrevention': 2, # enable DEP
  105. 'AllowIsolation': 'true',
  106. 'SuppressStartupBanner': 'true',
  107. 'target_conditions': [
  108. ['_type=="executable"', {
  109. 'SubSystem': 1, # console executable
  110. }],
  111. ],
  112. },
  113. },
  114. 'conditions': [
  115. ['OS == "win"', {
  116. 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
  117. 'defines': [
  118. 'WIN32',
  119. # we don't really want VC++ warning us about
  120. # how dangerous C functions are...
  121. '_CRT_SECURE_NO_DEPRECATE',
  122. # ... or that C implementations shouldn't use
  123. # POSIX names
  124. '_CRT_NONSTDC_NO_DEPRECATE',
  125. ],
  126. 'target_conditions': [
  127. ['target_arch=="x64"', {
  128. 'msvs_configuration_platform': 'x64'
  129. }]
  130. ]
  131. }],
  132. ['OS in "freebsd linux openbsd solaris android"', {
  133. 'cflags': [ '-Wall' ],
  134. 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
  135. 'target_conditions': [
  136. ['_type=="static_library"', {
  137. 'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
  138. }],
  139. ],
  140. 'conditions': [
  141. [ 'host_arch != target_arch and target_arch=="ia32"', {
  142. 'cflags': [ '-m32' ],
  143. 'ldflags': [ '-m32' ],
  144. }],
  145. [ 'OS=="linux"', {
  146. 'cflags': [ '-ansi' ],
  147. }],
  148. [ 'OS=="solaris"', {
  149. 'cflags': [ '-pthreads' ],
  150. 'ldflags': [ '-pthreads' ],
  151. }],
  152. [ 'OS not in "solaris android"', {
  153. 'cflags': [ '-pthread' ],
  154. 'ldflags': [ '-pthread' ],
  155. }],
  156. [ 'visibility=="hidden"', {
  157. 'cflags': [ '-fvisibility=hidden' ],
  158. }],
  159. ],
  160. }],
  161. ['OS=="mac"', {
  162. 'xcode_settings': {
  163. 'ALWAYS_SEARCH_USER_PATHS': 'NO',
  164. 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
  165. 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
  166. # (Equivalent to -fPIC)
  167. 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
  168. 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
  169. 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
  170. # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
  171. 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
  172. 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
  173. 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
  174. 'PREBINDING': 'NO', # No -Wl,-prebind
  175. 'USE_HEADERMAP': 'NO',
  176. 'OTHER_CFLAGS': [
  177. '-fstrict-aliasing',
  178. ],
  179. 'WARNING_CFLAGS': [
  180. '-Wall',
  181. '-Wendif-labels',
  182. '-W',
  183. '-Wno-unused-parameter',
  184. ],
  185. },
  186. 'conditions': [
  187. ['target_arch=="ia32"', {
  188. 'xcode_settings': {'ARCHS': ['i386']},
  189. }],
  190. ['target_arch=="x64"', {
  191. 'xcode_settings': {'ARCHS': ['x86_64']},
  192. }],
  193. ['target_arch=="arm"', {
  194. 'xcode_settings': {'ARCHS': ['arm64']},
  195. }],
  196. ],
  197. 'target_conditions': [
  198. ['_type!="static_library"', {
  199. 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
  200. }],
  201. ],
  202. }],
  203. ['OS=="solaris"', {
  204. 'cflags': [ '-fno-omit-frame-pointer' ],
  205. # pull in V8's postmortem metadata
  206. 'ldflags': [ '-Wl,-z,allextract' ]
  207. }],
  208. ],
  209. },
  210. }