Skip to content

Commit

Permalink
enabled sqlite debug flags while testing
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaWise committed Sep 16, 2018
1 parent 3e2a45a commit a97398d
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 97 deletions.
19 changes: 4 additions & 15 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand All @@ -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'],
},
],
}
51 changes: 31 additions & 20 deletions deps/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
},
},
Expand Down
86 changes: 24 additions & 62 deletions deps/sqlite3.gyp
Original file line number Diff line number Diff line change
@@ -1,97 +1,62 @@
{
'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
},
},
},
'Release': {
'defines': [
'NDEBUG',
],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
},
},
},
},
'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',
Expand All @@ -107,9 +72,6 @@
'SQLITE_DEFAULT_FOREIGN_KEYS=1',
'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1',
],
'export_dependent_settings': [
'action_before_build',
],
},
],
}

0 comments on commit a97398d

Please sign in to comment.