brightray.gypi 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. {
  2. 'includes': [
  3. '../vendor/download/libchromiumcontent/filenames.gypi',
  4. ],
  5. 'variables': {
  6. 'libchromiumcontent_component%': 1,
  7. 'pkg-config%': 'pkg-config',
  8. 'conditions': [
  9. # The "libchromiumcontent_component" is defined when calling "gyp".
  10. ['libchromiumcontent_component', {
  11. 'libchromiumcontent_dir%': '<(libchromiumcontent_shared_libraries_dir)',
  12. 'libchromiumcontent_libraries%': '<(libchromiumcontent_shared_libraries)',
  13. 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_shared_v8_libraries)',
  14. }, {
  15. 'libchromiumcontent_dir%': '<(libchromiumcontent_static_libraries_dir)',
  16. 'libchromiumcontent_libraries%': '<(libchromiumcontent_static_libraries)',
  17. 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_static_v8_libraries)',
  18. }],
  19. ],
  20. },
  21. 'target_defaults': {
  22. 'includes': [
  23. # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
  24. 'filename_rules.gypi',
  25. ],
  26. # Putting this in "configurations" will make overrides not working.
  27. 'xcode_settings': {
  28. 'ALWAYS_SEARCH_USER_PATHS': 'NO',
  29. 'ARCHS': ['x86_64'],
  30. 'COMBINE_HIDPI_IMAGES': 'YES',
  31. 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
  32. 'GCC_ENABLE_CPP_RTTI': 'NO',
  33. 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',
  34. 'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
  35. 'MACOSX_DEPLOYMENT_TARGET': '10.9',
  36. 'RUN_CLANG_STATIC_ANALYZER': 'YES',
  37. 'USE_HEADER_MAP': 'NO',
  38. },
  39. 'msvs_configuration_attributes': {
  40. 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
  41. 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
  42. 'CharacterSet': '1',
  43. },
  44. 'msvs_system_include_dirs': [
  45. '$(VSInstallDir)/VC/atlmfc/include',
  46. ],
  47. 'msvs_settings': {
  48. 'VCCLCompilerTool': {
  49. 'AdditionalOptions': ['/MP'],
  50. 'MinimalRebuild': 'false',
  51. 'BufferSecurityCheck': 'true',
  52. 'EnableFunctionLevelLinking': 'true',
  53. 'RuntimeTypeInfo': 'false',
  54. 'WarningLevel': '4',
  55. 'WarnAsError': 'true',
  56. 'DebugInformationFormat': '3',
  57. },
  58. 'VCLinkerTool': {
  59. 'GenerateDebugInformation': 'true',
  60. 'MapFileName': '$(OutDir)\\$(TargetName).map',
  61. 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
  62. 'LargeAddressAware': '2',
  63. 'AdditionalOptions': [
  64. # ATL 8.0 included in WDK 7.1 makes the linker to generate
  65. # following
  66. # warnings:
  67. # - warning LNK4254: section 'ATL' (50000040) merged into
  68. # '.rdata' (40000040) with different attributes
  69. # - warning LNK4078: multiple 'ATL' sections found with
  70. # different attributes
  71. '/ignore:4254',
  72. '/ignore:4078',
  73. # views_chromiumcontent.lib generates this warning because it's
  74. # symobls are defined as dllexport but used as static library:
  75. # - warning LNK4217: locally defined symbol imported in function
  76. # - warning LNK4049: locally defined symbol imported
  77. '/ignore:4217',
  78. '/ignore:4049',
  79. ],
  80. },
  81. },
  82. 'configurations': {
  83. # The "Debug" and "Release" configurations are not actually used.
  84. 'Debug': {},
  85. 'Release': {},
  86. 'Common_Base': {
  87. 'abstract': 1,
  88. 'defines': [
  89. # Needed by gin:
  90. 'V8_USE_EXTERNAL_STARTUP_DATA',
  91. # Special configuration for node:
  92. 'V8_PROMISE_INTERNAL_FIELD_COUNT=1',
  93. # From skia_for_chromium_defines.gypi:
  94. 'SK_SUPPORT_LEGACY_GETTOPDEVICE',
  95. 'SK_SUPPORT_LEGACY_BITMAP_CONFIG',
  96. 'SK_SUPPORT_LEGACY_DEVICE_VIRTUAL_ISOPAQUE',
  97. 'SK_SUPPORT_LEGACY_N32_NAME',
  98. 'SK_SUPPORT_LEGACY_SETCONFIG',
  99. 'SK_IGNORE_ETC1_SUPPORT',
  100. 'SK_IGNORE_GPU_DITHER',
  101. # NACL is not enabled:
  102. 'DISABLE_NACL',
  103. ],
  104. 'conditions': [
  105. ['OS!="mac"', {
  106. 'defines': [
  107. 'TOOLKIT_VIEWS',
  108. 'USE_AURA',
  109. ],
  110. }],
  111. ['OS in ["mac", "win"]', {
  112. 'defines': [
  113. 'USE_OPENSSL',
  114. ],
  115. }, {
  116. 'defines': [
  117. 'USE_X11',
  118. # "use_nss_certs" is set to 1 in libchromiumcontent.
  119. 'USE_NSS_CERTS',
  120. 'USE_NSS', # deprecated after Chrome 45.
  121. ],
  122. }],
  123. ['OS in ["linux", "mac"]', {
  124. 'defines': [
  125. 'WEBRTC_POSIX',
  126. 'UCHAR_TYPE=uint16_t',
  127. ],
  128. }],
  129. ['OS=="linux"', {
  130. 'defines': [
  131. '_LARGEFILE_SOURCE',
  132. '_LARGEFILE64_SOURCE',
  133. '_FILE_OFFSET_BITS=64',
  134. 'WEBRTC_LINUX',
  135. ],
  136. 'cflags_cc': [
  137. '-D__STRICT_ANSI__',
  138. '-fno-rtti',
  139. ],
  140. 'ldflags': [
  141. '-Wl,-z,noexecstack',
  142. ],
  143. }], # OS=="linux"
  144. ['OS=="linux" and target_arch in ["ia32", "x64", "arm64"]', {
  145. 'ldflags': [
  146. '-fuse-ld=lld', # Chromium Clang uses lld for linking
  147. ],
  148. }], # OS=="linux" and target_arch in ["ia32", "x64", "arm64"]
  149. ['OS=="mac"', {
  150. 'defines': [
  151. # The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
  152. # is required to see this macro.
  153. 'WEBRTC_MAC',
  154. ],
  155. }], # OS=="mac"
  156. ['OS=="win"', {
  157. 'include_dirs': [
  158. '<(libchromiumcontent_src_dir)/third_party/wtl/include',
  159. ],
  160. 'defines': [
  161. '_WIN32_WINNT=0x0602',
  162. 'WINVER=0x0602',
  163. 'WIN32',
  164. '_WINDOWS',
  165. 'NOMINMAX',
  166. 'PSAPI_VERSION=1',
  167. '_CRT_RAND_S',
  168. 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
  169. 'WIN32_LEAN_AND_MEAN',
  170. '_ATL_NO_OPENGL',
  171. '_SECURE_ATL',
  172. # The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
  173. # is required to see this macro.
  174. 'WEBRTC_WIN',
  175. 'UCHAR_TYPE=wchar_t',
  176. ],
  177. 'conditions': [
  178. ['target_arch=="x64"', {
  179. 'msvs_configuration_platform': 'x64',
  180. 'msvs_settings': {
  181. 'VCLinkerTool': {
  182. 'MinimumRequiredVersion': '5.02', # Server 2003.
  183. 'TargetMachine': '17', # x86 - 64
  184. # Doesn't exist x64 SDK. Should use oleaut32 in any case.
  185. 'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
  186. },
  187. 'VCLibrarianTool': {
  188. 'TargetMachine': '17', # x64
  189. },
  190. },
  191. }],
  192. ],
  193. }], # OS=="win"
  194. ],
  195. }, # Common_Base
  196. 'Debug_Base': {
  197. 'abstract': 1,
  198. 'defines': [
  199. # Use this instead of "NDEBUG" to determine whether we are in
  200. # Debug build, because "NDEBUG" is already used by Chromium.
  201. 'DEBUG',
  202. '_DEBUG',
  203. # Require when using libchromiumcontent.
  204. 'COMPONENT_BUILD',
  205. 'GURL_DLL',
  206. 'SKIA_DLL',
  207. 'USING_V8_SHARED',
  208. 'WEBKIT_DLL',
  209. ],
  210. 'msvs_settings': {
  211. 'VCCLCompilerTool': {
  212. 'RuntimeLibrary': '3', # /MDd (debug DLL)
  213. 'Optimization': '0', # 0 = /Od
  214. # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
  215. 'BasicRuntimeChecks': '3', # 3 = all checks enabled, 0 = off
  216. },
  217. 'VCLinkerTool': {
  218. 'OptimizeReferences': 2, # /OPT:REF
  219. 'EnableCOMDATFolding': 2, # /OPT:ICF
  220. },
  221. },
  222. 'conditions': [
  223. ['OS=="linux" and target_arch=="x64"', {
  224. 'defines': [
  225. '_GLIBCXX_DEBUG',
  226. ],
  227. 'cflags': [
  228. '-g',
  229. ],
  230. }], # OS=="linux"
  231. ],
  232. }, # Debug_Base
  233. 'Release_Base': {
  234. 'abstract': 1,
  235. 'defines': [
  236. 'NDEBUG',
  237. ],
  238. 'msvs_settings': {
  239. 'VCCLCompilerTool': {
  240. 'RuntimeLibrary': '2', # /MD (nondebug DLL)
  241. 'Optimization': '2', # /O2
  242. 'WholeProgramOptimization': 'true', # /GL
  243. # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
  244. 'InlineFunctionExpansion': '2', # 2 = max
  245. # See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
  246. 'OmitFramePointers': 'false',
  247. # The above is not sufficient (http://crbug.com/106711): it
  248. # simply eliminates an explicit "/Oy", but both /O2 and /Ox
  249. # perform FPO regardless, so we must explicitly disable.
  250. # We still want the false setting above to avoid having
  251. # "/Oy /Oy-" and warnings about overriding.
  252. 'AdditionalOptions': ['/Oy-', '/d2guard4'],
  253. },
  254. 'VCLibrarianTool': {
  255. 'LinkTimeCodeGeneration': 'true', # /LTCG
  256. },
  257. 'VCLinkerTool': {
  258. # Control Flow Guard is a security feature in Windows
  259. # 8.1 and higher designed to prevent exploitation of
  260. # indirect calls in executables.
  261. # Control Flow Guard is enabled using the /d2guard4
  262. # compiler setting in combination with the /guard:cf
  263. # linker setting.
  264. 'AdditionalOptions': ['/guard:cf'],
  265. # Turn off incremental linking to save binary size.
  266. 'LinkIncremental': '1', # /INCREMENTAL:NO
  267. 'LinkTimeCodeGeneration': '1', # /LTCG
  268. 'OptimizeReferences': 2, # /OPT:REF
  269. 'EnableCOMDATFolding': 2, # /OPT:ICF
  270. },
  271. },
  272. 'conditions': [
  273. ['OS=="linux"', {
  274. 'cflags': [
  275. '-O2',
  276. # Generate symbols, will be stripped later.
  277. '-g',
  278. # Don't emit the GCC version ident directives, they just end up
  279. # in the .comment section taking up binary size.
  280. '-fno-ident',
  281. # Put data and code in their own sections, so that unused symbols
  282. # can be removed at link time with --gc-sections.
  283. '-fdata-sections',
  284. '-ffunction-sections',
  285. ],
  286. 'ldflags': [
  287. # Specifically tell the linker to perform optimizations.
  288. # See http://lwn.net/Articles/192624/ .
  289. '-Wl,-O1',
  290. '-Wl,--as-needed',
  291. '-Wl,--gc-sections',
  292. ],
  293. }], # OS=="linux"
  294. ['OS=="linux" and target_arch in ["ia32", "x64", "arm64"]', {
  295. 'cflags': [
  296. '-flto=thin',
  297. ],
  298. 'ldflags': [
  299. '-flto=thin',
  300. '-Wl,--icf=all',
  301. '-Wl,--lto-O0', # this could be removed in future; see https://codereview.chromium.org/2939923004
  302. '-Wl,-mllvm,-function-sections',
  303. '-Wl,-mllvm,-data-sections',
  304. ],
  305. }],
  306. ],
  307. }, # Release_Base
  308. 'conditions': [
  309. ['libchromiumcontent_component', {
  310. 'D': {
  311. 'inherit_from': ['Common_Base', 'Debug_Base'],
  312. }, # D (Debug)
  313. }, {
  314. 'R': {
  315. 'inherit_from': ['Common_Base', 'Release_Base'],
  316. }, # R (Release)
  317. }], # libchromiumcontent_component
  318. ['OS=="win"', {
  319. 'conditions': [
  320. # gyp always assumes "_x64" targets on Windows.
  321. ['libchromiumcontent_component', {
  322. 'D_x64': {
  323. 'inherit_from': ['Common_Base', 'Debug_Base'],
  324. }, # D_x64
  325. }, {
  326. 'R_x64': {
  327. 'inherit_from': ['Common_Base', 'Release_Base'],
  328. }, # R_x64
  329. }], # libchromiumcontent_component
  330. ],
  331. }], # OS=="win"
  332. ],
  333. }, # configurations
  334. 'target_conditions': [
  335. # Putting this under "configurations" doesn't work.
  336. ['libchromiumcontent_component', {
  337. 'xcode_settings': {
  338. 'GCC_OPTIMIZATION_LEVEL': '0',
  339. },
  340. }, { # "Debug_Base"
  341. 'xcode_settings': {
  342. 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
  343. 'GCC_OPTIMIZATION_LEVEL': '2',
  344. 'OTHER_CFLAGS': [
  345. '-fno-inline',
  346. '-fno-omit-frame-pointer',
  347. '-fno-builtin',
  348. '-fno-optimize-sibling-calls',
  349. ],
  350. },
  351. }], # "Release_Base"
  352. ['OS=="mac" and libchromiumcontent_component==0 and _type in ["executable", "shared_library"]', {
  353. 'xcode_settings': {
  354. # Generates symbols and strip the binary.
  355. 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
  356. 'DEPLOYMENT_POSTPROCESSING': 'YES',
  357. 'STRIP_INSTALLED_PRODUCT': 'YES',
  358. 'STRIPFLAGS': '-x',
  359. },
  360. }], # OS=="mac" and libchromiumcontent_component==0 and _type in ["executable", "shared_library"]
  361. ['OS=="linux" and target_arch=="ia32" and _toolset=="target"', {
  362. 'ldflags': [
  363. # Workaround for linker OOM.
  364. '-Wl,--no-keep-memory',
  365. ],
  366. }],
  367. ], # target_conditions
  368. # Ignored compiler warnings of Chromium/Node.js
  369. 'conditions': [
  370. ['OS=="mac"', {
  371. 'xcode_settings': {
  372. 'WARNING_CFLAGS': [
  373. '-Wall',
  374. '-Wextra',
  375. '-Wno-unused-parameter',
  376. '-Wno-missing-field-initializers',
  377. '-Wno-deprecated-declarations',
  378. '-Wno-undefined-var-template', # https://crbug.com/604888
  379. '-Wno-unneeded-internal-declaration',
  380. '-Wno-inconsistent-missing-override',
  381. '-Wno-tautological-unsigned-enum-zero-compare',
  382. ],
  383. },
  384. }],
  385. ['OS=="linux" and clang==1', {
  386. 'cflags': [
  387. '-Wno-inconsistent-missing-override',
  388. '-Wno-undefined-var-template', # https://crbug.com/604888
  389. '-Wno-tautological-unsigned-enum-zero-compare',
  390. ],
  391. }],
  392. ['OS=="win"', {
  393. 'msvs_disabled_warnings': [
  394. 4100, # unreferenced formal parameter
  395. 4102, # unreferencd label
  396. 4121, # alignment of a member was sensitive to packing
  397. 4127, # conditional expression is constant
  398. 4189, # local variable is initialized but not referenced
  399. 4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data
  400. 4245, # 'initializing' : conversion from 'int' to 'const net::QuicVersionTag', signed/unsigned mismatch
  401. 4251, # class 'std::xx' needs to have dll-interface.
  402. 4310, # cast truncates constant value
  403. 4355, # 'this' : used in base member initializer list
  404. 4480, # nonstandard extension used: specifying underlying type for enum
  405. 4481, # nonstandard extension used: override specifier 'override'
  406. 4510, # default constructor could not be generated
  407. 4512, # assignment operator could not be generated
  408. 4610, # user defined constructor required
  409. 4702, # unreachable code
  410. 4715, # not all control paths return a value
  411. 4819, # The file contains a character that cannot be represented in the current code page
  412. 4275, # non dll-interface class used as base for dll-interface class
  413. ],
  414. }],
  415. ], # conditions
  416. }, # target_defaults
  417. }