Separate .gyp files for libs and tests

This commit is contained in:
Max Brunsfeld 2014-07-25 12:55:00 -07:00
parent 6a8addb84f
commit f1eb9a92a3
3 changed files with 139 additions and 61 deletions

View file

@ -1,6 +1,5 @@
{
'targets': [
{
'target_name': 'compiler',
'type': 'static_library',
@ -9,15 +8,66 @@
'src',
],
'sources': [
'<!@(find include src/compiler -name "*.h" -or -name "*.cc")',
'src/compiler/build_tables/build_lex_table.cc',
'src/compiler/build_tables/build_parse_table.cc',
'src/compiler/build_tables/build_tables.cc',
'src/compiler/build_tables/first_set.cc',
'src/compiler/build_tables/get_metadata.cc',
'src/compiler/build_tables/item.cc',
'src/compiler/build_tables/item_set_closure.cc',
'src/compiler/build_tables/item_set_transitions.cc',
'src/compiler/build_tables/lex_conflict_manager.cc',
'src/compiler/build_tables/lex_item.cc',
'src/compiler/build_tables/parse_conflict_manager.cc',
'src/compiler/build_tables/parse_item.cc',
'src/compiler/build_tables/rule_can_be_blank.cc',
'src/compiler/build_tables/rule_transitions.cc',
'src/compiler/compile.cc',
'src/compiler/conflict.cc',
'src/compiler/generate_code/c_code.cc',
'src/compiler/grammar.cc',
'src/compiler/lex_table.cc',
'src/compiler/parse_table.cc',
'src/compiler/prepare_grammar/expand_repeats.cc',
'src/compiler/prepare_grammar/expand_tokens.cc',
'src/compiler/prepare_grammar/extract_tokens.cc',
'src/compiler/prepare_grammar/intern_symbols.cc',
'src/compiler/prepare_grammar/parse_regex.cc',
'src/compiler/prepare_grammar/prepare_grammar.cc',
'src/compiler/prepare_grammar/token_description.cc',
'src/compiler/prepared_grammar.cc',
'src/compiler/rules/blank.cc',
'src/compiler/rules/built_in_symbols.cc',
'src/compiler/rules/character_range.cc',
'src/compiler/rules/character_set.cc',
'src/compiler/rules/choice.cc',
'src/compiler/rules/metadata.cc',
'src/compiler/rules/named_symbol.cc',
'src/compiler/rules/pattern.cc',
'src/compiler/rules/repeat.cc',
'src/compiler/rules/rule.cc',
'src/compiler/rules/rules.cc',
'src/compiler/rules/seq.cc',
'src/compiler/rules/string.cc',
'src/compiler/rules/symbol.cc',
'src/compiler/rules/visitor.cc',
'src/compiler/util/string_helpers.cc',
],
'cflags_cc': [
'-std=c++0x',
],
'cflags_cc!': [
'-fno-rtti'
],
'cflags_cc!': [ '-fno-rtti' ],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'GCC_ENABLE_CPP_RTTI': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
},
'direct_dependent_settings': {
'include_dirs': ['include'],
'include_dirs': [
'include'
],
},
# Mac OS has an old version of libstdc++ that doesn't support c++11.
@ -47,60 +97,22 @@
'src',
],
'sources': [
'<!@(find include src/runtime -name "*.h" -or -name "*.c")',
'src/runtime/document.c',
'src/runtime/lexer.c',
'src/runtime/node.c',
'src/runtime/parser.c',
'src/runtime/stack.c',
'src/runtime/tree.c',
],
'cflags_c': [
'-std=c99'
],
'direct_dependent_settings': {
'include_dirs': ['include'],
'include_dirs': [
'include'
],
},
},
{
'target_name': 'compiler_specs',
'type': 'executable',
'dependencies': ['compiler'],
'include_dirs': [
'src',
'examples',
'spec',
'externals/bandit',
],
'cflags': [
'-Wno-unknown-pragmas',
],
'sources': [
'<!@(find spec/compiler examples/grammars -name "*.h" -or -name "*.cc")',
],
},
{
'target_name': 'runtime_specs',
'type': 'executable',
'dependencies': ['runtime'],
'include_dirs': [
'src',
'examples',
'spec',
'externals/bandit',
],
'variables': {
'USE_BOOST_REGEX%': 'false',
},
'conditions': [
['USE_BOOST_REGEX != "false"', {
'defines': ['USE_BOOST_REGEX'],
'libraries': ['-lboost_regex'],
}]
],
'cflags': [
'-Wno-unknown-pragmas',
],
'sources': [
'<!@(find spec/runtime -name "*.h" -or -name "*.cc" -or -name "*.c")',
'<!@(find examples/parsers -name "*.c")',
'<!@(find spec/runtime/languages -name "*.txt")',
],
},
],
'target_defaults': {
@ -109,14 +121,7 @@
'-Wextra',
'-Wno-unused-parameter'
],
'cflags_c': [
'-std=c99'
],
'cflags_cc': [
'-std=c++0x',
],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'WARNING_CFLAGS': [
'-Wall',

View file

@ -4,6 +4,7 @@ set -e
git submodule update --init --recursive
externals/gyp/gyp project.gyp --depth . --format=make $@
externals/gyp/gyp tests.gyp --depth . --format=make $@
if [ "$1" == "-h" ]; then
cat <<-HELP

72
tests.gyp Normal file
View file

@ -0,0 +1,72 @@
{
'targets': [
{
'target_name': 'compiler_specs',
'type': 'executable',
'dependencies': [
'project.gyp:compiler'
],
'include_dirs': [
'src',
'examples',
'spec',
'externals/bandit',
],
'sources': [
'<!@(find spec/compiler examples/grammars -name "*.cc")',
],
},
{
'target_name': 'runtime_specs',
'type': 'executable',
'dependencies': [
'project.gyp:runtime'
],
'include_dirs': [
'src',
'examples',
'spec',
'externals/bandit',
],
'sources': [
'<!@(find spec/runtime -name "*.cc" -or -name "*.c")',
'<!@(find examples/parsers -name "*.c")',
],
'variables': {
'USE_BOOST_REGEX%': 'false',
},
'conditions': [
['USE_BOOST_REGEX != "false"', {
'defines': ['USE_BOOST_REGEX'],
'libraries': ['-lboost_regex'],
}]
],
},
],
'target_defaults': {
'cflags': [
'-Wall',
'-Wextra',
'-Wno-unused-parameter'
'-Wno-unknown-pragmas',
],
'cflags_c': [
'-std=c99'
],
'cflags_cc': [
'-std=c++0x',
],
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'WARNING_CFLAGS': [
'-Wall',
'-Wextra',
'-Wno-unused-parameter'
],
},
}
}