1# This file is used with the GYP meta build system.
2# http://code.google.com/p/gyp/
3# To build try this:
4#   svn co http://gyp.googlecode.com/svn/trunk gyp
5#   ./gyp/gyp -f make --depth=`pwd` http_parser.gyp
6#   ./out/Debug/test
7{
8  'target_defaults': {
9    'default_configuration': 'Debug',
10    'configurations': {
11      # TODO: hoist these out and put them somewhere common, because
12      #       RuntimeLibrary MUST MATCH across the entire project
13      'Debug': {
14        'defines': [ 'DEBUG', '_DEBUG' ],
15        'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
16        'msvs_settings': {
17          'VCCLCompilerTool': {
18            'RuntimeLibrary': 1, # static debug
19          },
20        },
21      },
22      'Release': {
23        'defines': [ 'NDEBUG' ],
24        'cflags': [ '-Wall', '-Wextra', '-O3' ],
25        'msvs_settings': {
26          'VCCLCompilerTool': {
27            'RuntimeLibrary': 0, # static release
28          },
29        },
30      }
31    },
32    'msvs_settings': {
33      'VCCLCompilerTool': {
34      },
35      'VCLibrarianTool': {
36      },
37      'VCLinkerTool': {
38        'GenerateDebugInformation': 'true',
39      },
40    },
41    'conditions': [
42      ['OS == "win"', {
43        'defines': [
44          'WIN32'
45        ],
46      }]
47    ],
48  },
49
50  'targets': [
51    {
52      'target_name': 'http_parser',
53      'type': 'static_library',
54      'include_dirs': [ '.' ],
55      'direct_dependent_settings': {
56        'defines': [ 'HTTP_PARSER_STRICT=0' ],
57        'include_dirs': [ '.' ],
58      },
59      'defines': [ 'HTTP_PARSER_STRICT=0' ],
60      'sources': [ './http_parser.c', ],
61      'conditions': [
62        ['OS=="win"', {
63          'msvs_settings': {
64            'VCCLCompilerTool': {
65              # Compile as C++. http_parser.c is actually C99, but C++ is
66              # close enough in this case.
67              'CompileAs': 2,
68            },
69          },
70        }]
71      ],
72    },
73
74    {
75      'target_name': 'http_parser_strict',
76      'type': 'static_library',
77      'include_dirs': [ '.' ],
78      'direct_dependent_settings': {
79        'defines': [ 'HTTP_PARSER_STRICT=1' ],
80        'include_dirs': [ '.' ],
81      },
82      'defines': [ 'HTTP_PARSER_STRICT=1' ],
83      'sources': [ './http_parser.c', ],
84      'conditions': [
85        ['OS=="win"', {
86          'msvs_settings': {
87            'VCCLCompilerTool': {
88              # Compile as C++. http_parser.c is actually C99, but C++ is
89              # close enough in this case.
90              'CompileAs': 2,
91            },
92          },
93        }]
94      ],
95    },
96
97    {
98      'target_name': 'test-nonstrict',
99      'type': 'executable',
100      'dependencies': [ 'http_parser' ],
101      'sources': [ 'test.c' ]
102    },
103
104    {
105      'target_name': 'test-strict',
106      'type': 'executable',
107      'dependencies': [ 'http_parser_strict' ],
108      'sources': [ 'test.c' ]
109    }
110  ]
111}
112