From 66a50d4e4a477a2fe11c12a896884a8cd8283b6a Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 2 Sep 2014 22:13:46 -0700 Subject: [PATCH] Add separate debug and release configurations in gyp files Disable optimizations in debug mode. Use that for specs. --- project.gyp | 16 ++++++++++++++++ script/util/run_tests.sh | 4 ++-- tests.gyp | 6 ++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/project.gyp b/project.gyp index f348a616..163dfae5 100644 --- a/project.gyp +++ b/project.gyp @@ -2,6 +2,7 @@ 'targets': [ { 'target_name': 'compiler', + 'type': 'static_library', 'include_dirs': [ 'include', @@ -117,11 +118,26 @@ ], 'target_defaults': { + 'default_configuration': 'Release', + 'configurations': { + 'Debug': { + 'cflags': [ '-g', '-O0' ], + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', + }, + }, + 'Release': { + 'cflags': [ '-O2', '-fno-strict-aliasing' ], + 'cflags!': [ '-O3', '-fstrict-aliasing' ], + }, + }, + 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter' ], + 'xcode_settings': { 'ALWAYS_SEARCH_USER_PATHS': 'NO', 'WARNING_CFLAGS': [ diff --git a/script/util/run_tests.sh b/script/util/run_tests.sh index 3ab7fb47..18befef6 100644 --- a/script/util/run_tests.sh +++ b/script/util/run_tests.sh @@ -23,7 +23,7 @@ function run_tests { local mode=normal local args=() local target=$1 - local cmd="out/Default/${target}" + local cmd="out/Debug/${target}" shift while getopts "df:ghv" option; do @@ -47,7 +47,7 @@ function run_tests { esac done - make $target + BUILDTYPE=Debug make $target args=${args:-""} case ${mode} in diff --git a/tests.gyp b/tests.gyp index 2eaf0d3a..8f7adf88 100644 --- a/tests.gyp +++ b/tests.gyp @@ -46,7 +46,12 @@ ], 'target_defaults': { + 'default_configuration': 'Debug', + 'configurations': {'Debug': {}}, + 'cflags': [ + '-g', + '-O0', '-Wall', '-Wextra', '-Wno-unused-parameter', @@ -58,6 +63,7 @@ 'cflags_cc': [ '-std=c++0x', ], + 'xcode_settings': { 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', 'ALWAYS_SEARCH_USER_PATHS': 'NO',