From a97398d014025888cc471a85af25fccbbe6493d5 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sun, 16 Sep 2018 05:57:13 -0400 Subject: [PATCH] enabled sqlite debug flags while testing --- binding.gyp | 19 +++-------- deps/common.gypi | 51 +++++++++++++++++----------- deps/sqlite3.gyp | 86 ++++++++++++++---------------------------------- 3 files changed, 59 insertions(+), 97 deletions(-) diff --git a/binding.gyp b/binding.gyp index 274ed9baa..b056fb6b4 100644 --- a/binding.gyp +++ b/binding.gyp @@ -3,9 +3,8 @@ 'targets': [ { 'target_name': 'better_sqlite3', - 'dependencies': [ - 'deps/sqlite3.gyp:sqlite3', - ], + 'dependencies': ['deps/sqlite3.gyp:sqlite3'], + 'sources': ['src/better_sqlite3.cpp'], 'cflags': [ '-std=c++11', ], @@ -15,21 +14,11 @@ '-stdlib=libc++', ], }, - 'sources': [ - 'src/better_sqlite3.cpp', - ], }, { 'target_name': 'test_extension', - 'dependencies': [ - 'deps/sqlite3.gyp:action_before_build', - ], - 'cflags_cc': [ - '-Wno-unused-value', - ], - 'sources': [ - 'deps/test_extension.c', - ], + 'dependencies': ['deps/sqlite3.gyp:action_before_build'], + 'sources': ['deps/test_extension.c'], }, ], } diff --git a/deps/common.gypi b/deps/common.gypi index 0d4aae2fd..a7a37e1af 100644 --- a/deps/common.gypi +++ b/deps/common.gypi @@ -5,52 +5,63 @@ 'target_defaults': { 'default_configuration': 'Release', 'msbuild_toolset': '', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': 1, + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32', + ], + }], + ], 'configurations': { 'Debug': { 'defines!': [ 'NDEBUG', ], - 'cflags_cc!': [ - '-O3', - '-Os', - '-DNDEBUG', + 'defines': [ + 'DEBUG', + '_DEBUG', + 'SQLITE_DEBUG', + 'SQLITE_MEMDEBUG', + 'SQLITE_ENABLE_API_ARMOR', + 'SQLITE_WIN32_MALLOC_VALIDATE', + ], + 'cflags': [ + '-O0', ], 'xcode_settings': { 'MACOSX_DEPLOYMENT_TARGET': '10.7', - 'OTHER_CPLUSPLUSFLAGS!': [ - '-O3', - '-Os', - '-DDEBUG', - ], 'GCC_OPTIMIZATION_LEVEL': '0', 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', }, 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 1, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', }, }, }, 'Release': { + 'defines!': [ + 'DEBUG', + '_DEBUG', + ], 'defines': [ 'NDEBUG', ], + 'cflags': [ + '-O3', + ], 'xcode_settings': { 'MACOSX_DEPLOYMENT_TARGET': '10.7', - 'OTHER_CPLUSPLUSFLAGS!': [ - '-Os', - '-O2', - ], 'GCC_OPTIMIZATION_LEVEL': '3', 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO', 'DEAD_CODE_STRIPPING': 'YES', 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', }, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 1, - }, - }, }, }, }, diff --git a/deps/sqlite3.gyp b/deps/sqlite3.gyp index 7264d4cee..080be69e3 100755 --- a/deps/sqlite3.gyp +++ b/deps/sqlite3.gyp @@ -1,22 +1,18 @@ { 'includes': ['common.gypi'], 'target_defaults': { - 'default_configuration': 'Release', - 'cflags': [ - '-std=c99', - ], - 'xcode_settings': { - 'OTHER_CFLAGS': [ - '-std=c99', - ], - }, 'configurations': { 'Debug': { - 'defines': [ - 'DEBUG', - '_DEBUG', - 'SQLITE_ENABLE_API_ARMOR', + 'cflags': [ + '-Wno-sign-compare', + '-Wno-unused-function', ], + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-Wno-sign-compare', + '-Wno-unused-function', + ], + }, 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1, # static debug @@ -24,9 +20,6 @@ }, }, 'Release': { - 'defines': [ - 'NDEBUG', - ], 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0, # static release @@ -34,64 +27,36 @@ }, }, }, - 'msvs_settings': { - 'VCCLCompilerTool': {}, - 'VCLibrarianTool': {}, - 'VCLinkerTool': { - 'GenerateDebugInformation': 'true', - }, - }, - 'conditions': [ - ['OS == "win"', { - 'defines': [ - 'WIN32', - ], - }], - ], }, - 'targets': [ { 'target_name': 'action_before_build', 'type': 'none', 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'unpack_sqlite_dep', - 'inputs': [ - './sqlite-autoconf-<@(sqlite_version).tar.gz', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c', - ], - 'action': [ - 'node', - './extract.js', - './sqlite-autoconf-<@(sqlite_version).tar.gz', - '<(SHARED_INTERMEDIATE_DIR)', - ], - }, - ], - 'direct_dependent_settings': { - 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/'], - }, + 'actions': [{ + 'action_name': 'unpack_sqlite_dep', + 'inputs': ['./sqlite-autoconf-<@(sqlite_version).tar.gz'], + 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'], + 'action': ['node', './extract.js', './sqlite-autoconf-<@(sqlite_version).tar.gz', '<(SHARED_INTERMEDIATE_DIR)'], + }], }, { 'target_name': 'sqlite3', 'type': 'static_library', + 'dependencies': ['action_before_build'], + 'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'], 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/'], - 'dependencies': [ - 'action_before_build', - ], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c', - ], 'direct_dependent_settings': { 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/'], }, - 'cflags_cc': [ - '-Wno-unused-value', + 'cflags': [ + '-std=c99', ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-std=c99', + ], + }, 'defines': [ 'SQLITE_THREADSAFE=0', 'SQLITE_DEFAULT_MEMSTATUS=0', @@ -107,9 +72,6 @@ 'SQLITE_DEFAULT_FOREIGN_KEYS=1', 'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1', ], - 'export_dependent_settings': [ - 'action_before_build', - ], }, ], }