/common.gypi

http://github.com/joyent/libuv · Unknown · 183 lines · 182 code · 1 blank · 0 comment · 0 complexity · 5f1a2618946fa2e452e698ef3c27e6bc MD5 · raw file

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