11cb0ef41Sopenharmony_ci{
21cb0ef41Sopenharmony_ci  'variables': {
31cb0ef41Sopenharmony_ci    'target_arch%': 'ia32',          # set v8's target architecture
41cb0ef41Sopenharmony_ci    'host_arch%': 'ia32',            # set v8's host architecture
51cb0ef41Sopenharmony_ci    'uv_library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
61cb0ef41Sopenharmony_ci    'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not using the V8 way
71cb0ef41Sopenharmony_ci  },
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci  'target_defaults': {
101cb0ef41Sopenharmony_ci    'default_configuration': 'Debug',
111cb0ef41Sopenharmony_ci    'configurations': {
121cb0ef41Sopenharmony_ci      'Debug': {
131cb0ef41Sopenharmony_ci        'defines': [ 'DEBUG', '_DEBUG' ],
141cb0ef41Sopenharmony_ci        'cflags': [ '-g' ],
151cb0ef41Sopenharmony_ci        'msvs_settings': {
161cb0ef41Sopenharmony_ci          'VCCLCompilerTool': {
171cb0ef41Sopenharmony_ci            'target_conditions': [
181cb0ef41Sopenharmony_ci              ['uv_library=="static_library"', {
191cb0ef41Sopenharmony_ci                'RuntimeLibrary': 1, # /MTd static debug
201cb0ef41Sopenharmony_ci              }, {
211cb0ef41Sopenharmony_ci                'RuntimeLibrary': 3, # /MDd DLL debug
221cb0ef41Sopenharmony_ci              }],
231cb0ef41Sopenharmony_ci            ],
241cb0ef41Sopenharmony_ci            'Optimization': 0, # /Od, no optimization
251cb0ef41Sopenharmony_ci            'MinimalRebuild': 'false',
261cb0ef41Sopenharmony_ci            'OmitFramePointers': 'false',
271cb0ef41Sopenharmony_ci            'BasicRuntimeChecks': 3, # /RTC1
281cb0ef41Sopenharmony_ci          },
291cb0ef41Sopenharmony_ci          'VCLinkerTool': {
301cb0ef41Sopenharmony_ci            'LinkIncremental': 2, # enable incremental linking
311cb0ef41Sopenharmony_ci          },
321cb0ef41Sopenharmony_ci        },
331cb0ef41Sopenharmony_ci        'xcode_settings': {
341cb0ef41Sopenharmony_ci          'GCC_OPTIMIZATION_LEVEL': '0',
351cb0ef41Sopenharmony_ci        },
361cb0ef41Sopenharmony_ci        'conditions': [
371cb0ef41Sopenharmony_ci          ['OS != "zos"', {
381cb0ef41Sopenharmony_ci            'cflags': [ '-O0', '-fno-common', '-fwrapv' ]
391cb0ef41Sopenharmony_ci          }],
401cb0ef41Sopenharmony_ci          ['OS == "android"', {
411cb0ef41Sopenharmony_ci            'cflags': [ '-fPIE' ],
421cb0ef41Sopenharmony_ci            'ldflags': [ '-fPIE', '-pie' ]
431cb0ef41Sopenharmony_ci          }]
441cb0ef41Sopenharmony_ci        ]
451cb0ef41Sopenharmony_ci      },
461cb0ef41Sopenharmony_ci      'Release': {
471cb0ef41Sopenharmony_ci        'defines': [ 'NDEBUG' ],
481cb0ef41Sopenharmony_ci        'cflags': [
491cb0ef41Sopenharmony_ci          '-O3',
501cb0ef41Sopenharmony_ci        ],
511cb0ef41Sopenharmony_ci        'msvs_settings': {
521cb0ef41Sopenharmony_ci          'VCCLCompilerTool': {
531cb0ef41Sopenharmony_ci            'target_conditions': [
541cb0ef41Sopenharmony_ci              ['uv_library=="static_library"', {
551cb0ef41Sopenharmony_ci                'RuntimeLibrary': 0, # /MT static release
561cb0ef41Sopenharmony_ci              }, {
571cb0ef41Sopenharmony_ci                'RuntimeLibrary': 2, # /MD DLL release
581cb0ef41Sopenharmony_ci              }],
591cb0ef41Sopenharmony_ci            ],
601cb0ef41Sopenharmony_ci            'Optimization': 3, # /Ox, full optimization
611cb0ef41Sopenharmony_ci            'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
621cb0ef41Sopenharmony_ci            'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
631cb0ef41Sopenharmony_ci            'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
641cb0ef41Sopenharmony_ci            'OmitFramePointers': 'true',
651cb0ef41Sopenharmony_ci            'EnableFunctionLevelLinking': 'true',
661cb0ef41Sopenharmony_ci            'EnableIntrinsicFunctions': 'true',
671cb0ef41Sopenharmony_ci          },
681cb0ef41Sopenharmony_ci          'VCLibrarianTool': {
691cb0ef41Sopenharmony_ci            'AdditionalOptions': [
701cb0ef41Sopenharmony_ci              '/LTCG', # link time code generation
711cb0ef41Sopenharmony_ci            ],
721cb0ef41Sopenharmony_ci          },
731cb0ef41Sopenharmony_ci          'VCLinkerTool': {
741cb0ef41Sopenharmony_ci            'LinkTimeCodeGeneration': 1, # link-time code generation
751cb0ef41Sopenharmony_ci            'OptimizeReferences': 2, # /OPT:REF
761cb0ef41Sopenharmony_ci            'EnableCOMDATFolding': 2, # /OPT:ICF
771cb0ef41Sopenharmony_ci            'LinkIncremental': 1, # disable incremental linking
781cb0ef41Sopenharmony_ci          },
791cb0ef41Sopenharmony_ci        },
801cb0ef41Sopenharmony_ci        'conditions': [
811cb0ef41Sopenharmony_ci          ['OS != "zos"', {
821cb0ef41Sopenharmony_ci            'cflags': [
831cb0ef41Sopenharmony_ci              '-fdata-sections',
841cb0ef41Sopenharmony_ci              '-ffunction-sections',
851cb0ef41Sopenharmony_ci              '-fno-common',
861cb0ef41Sopenharmony_ci              '-fomit-frame-pointer',
871cb0ef41Sopenharmony_ci            ],
881cb0ef41Sopenharmony_ci          }],
891cb0ef41Sopenharmony_ci        ]
901cb0ef41Sopenharmony_ci      }
911cb0ef41Sopenharmony_ci    },
921cb0ef41Sopenharmony_ci    'msvs_settings': {
931cb0ef41Sopenharmony_ci      'VCCLCompilerTool': {
941cb0ef41Sopenharmony_ci        'StringPooling': 'true', # pool string literals
951cb0ef41Sopenharmony_ci        'DebugInformationFormat': 3, # Generate a PDB
961cb0ef41Sopenharmony_ci        'WarningLevel': 3,
971cb0ef41Sopenharmony_ci        'BufferSecurityCheck': 'true',
981cb0ef41Sopenharmony_ci        'ExceptionHandling': 1, # /EHsc
991cb0ef41Sopenharmony_ci        'SuppressStartupBanner': 'true',
1001cb0ef41Sopenharmony_ci        'WarnAsError': 'false',
1011cb0ef41Sopenharmony_ci        'AdditionalOptions': [
1021cb0ef41Sopenharmony_ci           '/MP', # compile across multiple CPUs
1031cb0ef41Sopenharmony_ci         ],
1041cb0ef41Sopenharmony_ci      },
1051cb0ef41Sopenharmony_ci      'VCLibrarianTool': {
1061cb0ef41Sopenharmony_ci      },
1071cb0ef41Sopenharmony_ci      'VCLinkerTool': {
1081cb0ef41Sopenharmony_ci        'GenerateDebugInformation': 'true',
1091cb0ef41Sopenharmony_ci        'RandomizedBaseAddress': 2, # enable ASLR
1101cb0ef41Sopenharmony_ci        'DataExecutionPrevention': 2, # enable DEP
1111cb0ef41Sopenharmony_ci        'AllowIsolation': 'true',
1121cb0ef41Sopenharmony_ci        'SuppressStartupBanner': 'true',
1131cb0ef41Sopenharmony_ci        'target_conditions': [
1141cb0ef41Sopenharmony_ci          ['_type=="executable"', {
1151cb0ef41Sopenharmony_ci            'SubSystem': 1, # console executable
1161cb0ef41Sopenharmony_ci          }],
1171cb0ef41Sopenharmony_ci        ],
1181cb0ef41Sopenharmony_ci      },
1191cb0ef41Sopenharmony_ci    },
1201cb0ef41Sopenharmony_ci    'conditions': [
1211cb0ef41Sopenharmony_ci      ['OS == "win"', {
1221cb0ef41Sopenharmony_ci        'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
1231cb0ef41Sopenharmony_ci        'defines': [
1241cb0ef41Sopenharmony_ci          'WIN32',
1251cb0ef41Sopenharmony_ci          # we don't really want VC++ warning us about
1261cb0ef41Sopenharmony_ci          # how dangerous C functions are...
1271cb0ef41Sopenharmony_ci          '_CRT_SECURE_NO_DEPRECATE',
1281cb0ef41Sopenharmony_ci          # ... or that C implementations shouldn't use
1291cb0ef41Sopenharmony_ci          # POSIX names
1301cb0ef41Sopenharmony_ci          '_CRT_NONSTDC_NO_DEPRECATE',
1311cb0ef41Sopenharmony_ci        ],
1321cb0ef41Sopenharmony_ci        'target_conditions': [
1331cb0ef41Sopenharmony_ci          ['target_arch=="x64"', {
1341cb0ef41Sopenharmony_ci            'msvs_configuration_platform': 'x64'
1351cb0ef41Sopenharmony_ci          }]
1361cb0ef41Sopenharmony_ci        ]
1371cb0ef41Sopenharmony_ci      }],
1381cb0ef41Sopenharmony_ci      ['OS in "freebsd dragonflybsd linux openbsd solaris android aix os400"', {
1391cb0ef41Sopenharmony_ci        'cflags': [ '-Wall' ],
1401cb0ef41Sopenharmony_ci        'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
1411cb0ef41Sopenharmony_ci        'target_conditions': [
1421cb0ef41Sopenharmony_ci          ['_type=="static_library"', {
1431cb0ef41Sopenharmony_ci            'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
1441cb0ef41Sopenharmony_ci          }],
1451cb0ef41Sopenharmony_ci        ],
1461cb0ef41Sopenharmony_ci        'conditions': [
1471cb0ef41Sopenharmony_ci          [ 'host_arch != target_arch and target_arch=="ia32"', {
1481cb0ef41Sopenharmony_ci            'cflags': [ '-m32' ],
1491cb0ef41Sopenharmony_ci            'ldflags': [ '-m32' ],
1501cb0ef41Sopenharmony_ci          }],
1511cb0ef41Sopenharmony_ci          [ 'target_arch=="x32"', {
1521cb0ef41Sopenharmony_ci            'cflags': [ '-mx32' ],
1531cb0ef41Sopenharmony_ci            'ldflags': [ '-mx32' ],
1541cb0ef41Sopenharmony_ci          }],
1551cb0ef41Sopenharmony_ci          [ 'OS=="linux"', {
1561cb0ef41Sopenharmony_ci            'cflags': [ '-ansi' ],
1571cb0ef41Sopenharmony_ci          }],
1581cb0ef41Sopenharmony_ci          [ 'OS=="solaris"', {
1591cb0ef41Sopenharmony_ci            'cflags': [ '-pthreads' ],
1601cb0ef41Sopenharmony_ci            'ldflags': [ '-pthreads' ],
1611cb0ef41Sopenharmony_ci          }],
1621cb0ef41Sopenharmony_ci          [ 'OS not in "solaris android zos"', {
1631cb0ef41Sopenharmony_ci            'cflags': [ '-pthread' ],
1641cb0ef41Sopenharmony_ci            'ldflags': [ '-pthread' ],
1651cb0ef41Sopenharmony_ci          }],
1661cb0ef41Sopenharmony_ci          [ 'OS=="aix" and target_arch=="ppc64"', {
1671cb0ef41Sopenharmony_ci            'cflags': [ '-maix64' ],
1681cb0ef41Sopenharmony_ci            'ldflags': [ '-maix64' ],
1691cb0ef41Sopenharmony_ci          }],
1701cb0ef41Sopenharmony_ci        ],
1711cb0ef41Sopenharmony_ci      }],
1721cb0ef41Sopenharmony_ci      ['OS=="mac"', {
1731cb0ef41Sopenharmony_ci        'xcode_settings': {
1741cb0ef41Sopenharmony_ci          'ALWAYS_SEARCH_USER_PATHS': 'NO',
1751cb0ef41Sopenharmony_ci          'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
1761cb0ef41Sopenharmony_ci          'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
1771cb0ef41Sopenharmony_ci                                                    # (Equivalent to -fPIC)
1781cb0ef41Sopenharmony_ci          'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
1791cb0ef41Sopenharmony_ci          'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
1801cb0ef41Sopenharmony_ci          'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
1811cb0ef41Sopenharmony_ci          'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
1821cb0ef41Sopenharmony_ci          'PREBINDING': 'NO',                       # No -Wl,-prebind
1831cb0ef41Sopenharmony_ci          'USE_HEADERMAP': 'NO',
1841cb0ef41Sopenharmony_ci          'WARNING_CFLAGS': [
1851cb0ef41Sopenharmony_ci            '-Wall',
1861cb0ef41Sopenharmony_ci            '-Wendif-labels',
1871cb0ef41Sopenharmony_ci            '-W',
1881cb0ef41Sopenharmony_ci            '-Wno-unused-parameter',
1891cb0ef41Sopenharmony_ci            '-Wstrict-prototypes',
1901cb0ef41Sopenharmony_ci          ],
1911cb0ef41Sopenharmony_ci        },
1921cb0ef41Sopenharmony_ci        'conditions': [
1931cb0ef41Sopenharmony_ci          ['target_arch=="ia32"', {
1941cb0ef41Sopenharmony_ci            'xcode_settings': {'ARCHS': ['i386']},
1951cb0ef41Sopenharmony_ci          }],
1961cb0ef41Sopenharmony_ci          ['target_arch=="x64"', {
1971cb0ef41Sopenharmony_ci            'xcode_settings': {'ARCHS': ['x86_64']},
1981cb0ef41Sopenharmony_ci          }],
1991cb0ef41Sopenharmony_ci        ],
2001cb0ef41Sopenharmony_ci        'target_conditions': [
2011cb0ef41Sopenharmony_ci          ['_type!="static_library"', {
2021cb0ef41Sopenharmony_ci            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
2031cb0ef41Sopenharmony_ci          }],
2041cb0ef41Sopenharmony_ci        ],
2051cb0ef41Sopenharmony_ci      }],
2061cb0ef41Sopenharmony_ci     ['OS=="solaris"', {
2071cb0ef41Sopenharmony_ci       'cflags': [ '-fno-omit-frame-pointer' ],
2081cb0ef41Sopenharmony_ci       # pull in V8's postmortem metadata
2091cb0ef41Sopenharmony_ci       'ldflags': [ '-Wl,-z,allextract' ]
2101cb0ef41Sopenharmony_ci     }],
2111cb0ef41Sopenharmony_ci    ],
2121cb0ef41Sopenharmony_ci  },
2131cb0ef41Sopenharmony_ci}
214