# A `.gyp` file for building a Node.js native add-on.
#
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
{
  'targets': [
    {
      # The target name should match the add-on export name:
      'target_name': 'addon',

      # Settings that should be applied when a target's object files are used as linker input:
      'link_settings': {

        # List libraries (object files, etc) which should be linked during linking:
        'libraries': [
          # Note: `module_root_dir` is provided by `node-gyp` based on the current working directory.
          '<(module_root_dir)/src/c_dasum.o',
          '<(module_root_dir)/src/dasum.o',
          '<(module_root_dir)/src/dasumsub.o'
        ]
      },

      # Define directories which contain relevant include headers:
      'include_dirs': [
        '<!(node -e "require(\'nan\')")',
        'include'
      ],

      # List the source files to compile:
      'sources': [
        './src/addon.cpp'
      ],

      # C++ compiler flags:
      'cflags': [
        # Generate platform-independent code:
        '-fPIC',

        # Enable commonly used warning options:
        '-Wall',

        # Aggressive optimization:
        '-O3',

        # Specify the C++ standard to which the program is expected to conform:
        '-std=c++11'
      ],

      # Apply conditions based on the runtime environment:
      'conditions': [
        [
          'OS=="win"',
          {
            'msvs_settings': {
              'VCCLCompilerTool': {
                'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
                'OmitFramePointers': 'true',
                'EnableFunctionLevelLinking': 'true',
                'EnableIntrinsicFunctions': 'true',
                'RuntimeTypeInfo': 'false',
                'ExceptionHandling': '1',
              },
              'VCLibrarianTool': {
                'AdditionalOptions': [
                  '/LTCG', # link time code generation
                ],
              },
              'VCLinkerTool': {
                'LinkTimeCodeGeneration': 1, # link-time code generation
                'OptimizeReferences': 2, # /OPT:REF
                'EnableCOMDATFolding': 2, # /OPT:ICF
                'LinkIncremental': 1, # disable incremental linking
              },
            }
          }
        ] # end OS=="win"
      ] # end conditions
    }
  ] # end targets
}

@@ -1439,1014 +1439,9 @@
 ': %5B
-%0A        %5B%0A          'OS==%22win%22',%0A          %7B%0A            'msvs_settings': %7B%0A              'VCCLCompilerTool': %7B%0A                'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG%0A                'OmitFramePointers': 'true',%0A                'EnableFunctionLevelLinking': 'true',%0A                'EnableIntrinsicFunctions': 'true',%0A                'RuntimeTypeInfo': 'false',%0A                'ExceptionHandling': '1',%0A              %7D,%0A              'VCLibrarianTool': %7B%0A                'AdditionalOptions': %5B%0A                  '/LTCG', # link time code generation%0A                %5D,%0A              %7D,%0A              'VCLinkerTool': %7B%0A                'LinkTimeCodeGeneration': 1, # link-time code generation%0A                'OptimizeReferences': 2, # /OPT:REF%0A                'EnableCOMDATFolding': 2, # /OPT:ICF%0A                'LinkIncremental': 1, # disable incremental linking%0A              %7D,%0A            %7D%0A          %7D%0A        %5D # end OS==%22win%22%0A      %5D # end conditions
+%5D
 %0A   

Remove MSVS settings