mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Fix build of sqlite3. Move sqlite3 defines to the top level so they are on all.
Signed-off-by: Frank Riley <fhriley@gmail.com>
This commit is contained in:
+10
-3
@@ -10,6 +10,14 @@ endif()
|
||||
# Put runtime output, i.e. pihole-FTL, in the root of the build dir
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
|
||||
# SQLITE_OMIT_LOAD_EXTENSION: This option omits the entire extension loading mechanism from SQLite, including sqlite3_enable_load_extension() and sqlite3_load_extension() interfaces. (needs -ldl linking option, otherwise)
|
||||
# SQLITE_DEFAULT_MEMSTATUS=0: This setting causes the sqlite3_status() interfaces that track memory usage to be disabled. This helps the sqlite3_malloc() routines run much faster, and since SQLite uses sqlite3_malloc() internally, this helps to make the entire library faster.
|
||||
# SQLITE_OMIT_DEPRECATED: Omitting deprecated interfaces and features will not help SQLite to run any faster. It will reduce the library footprint, however. And it is the right thing to do.
|
||||
# SQLITE_OMIT_PROGRESS_CALLBACK: The progress handler callback counter must be checked in the inner loop of the bytecode engine. By omitting this interface, a single conditional is removed from the inner loop of the bytecode engine, helping SQL statements to run slightly faster.
|
||||
# SQLITE_DEFAULT_FOREIGN_KEYS=1: This macro determines whether enforcement of foreign key constraints is enabled or disabled by default for new database connections.
|
||||
# SQLITE_DQS=0: This setting disables the double-quoted string literal misfeature.
|
||||
set(SQLITE_DEFINES "-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_MEMORYDB -DSQLITE_DEFAULT_FOREIGN_KEYS=1 -DSQLITE_DQS=0")
|
||||
|
||||
# Code hardening and debugging improvements
|
||||
# -fstack-protector-strong: The program will be resistant to having its stack overflowed
|
||||
# -Wp,-D_FORTIFY_SOURCE=2 and -O1 or higher: This causes certain unsafe glibc functions to be replaced with their safer counterparts
|
||||
@@ -75,7 +83,7 @@ endif()
|
||||
|
||||
# -FILE_OFFSET_BITS=64: used by stat(). Avoids problems with files > 2 GB on 32bit machines
|
||||
# We define HAVE_POLL_H as this is needed for the musl builds to succeed
|
||||
set(CMAKE_C_FLAGS "-pipe ${WARN_FLAGS} -D_FILE_OFFSET_BITS=64 ${HARDENING_FLAGS} ${DEBUG_FLAGS} ${CMAKE_C_FLAGS} -DHAVE_POLL_H")
|
||||
set(CMAKE_C_FLAGS "-pipe ${WARN_FLAGS} -D_FILE_OFFSET_BITS=64 ${HARDENING_FLAGS} ${DEBUG_FLAGS} ${CMAKE_C_FLAGS} -DHAVE_POLL_H ${SQLITE_DEFINES}")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
@@ -127,8 +135,6 @@ set(sources
|
||||
|
||||
set_source_files_properties(version.h PROPERTIES GENERATED TRUE)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_custom_target(
|
||||
gen_version ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -P ${CMAKE_CURRENT_SOURCE_DIR}/gen_version.cmake
|
||||
@@ -142,6 +148,7 @@ add_executable(pihole-FTL
|
||||
$<TARGET_OBJECTS:sqlite3>
|
||||
)
|
||||
target_compile_options(pihole-FTL PRIVATE ${EXTRAWARN})
|
||||
target_include_directories(pihole-FTL PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||
add_dependencies(pihole-FTL gen_version)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
|
||||
@@ -11,3 +11,4 @@ set(sources
|
||||
add_library(api OBJECT ${sources})
|
||||
add_dependencies(api gen_version)
|
||||
target_compile_options(api PRIVATE ${EXTRAWARN})
|
||||
target_include_directories(api PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
# SQLITE_OMIT_LOAD_EXTENSION: This option omits the entire extension loading mechanism from SQLite, including sqlite3_enable_load_extension() and sqlite3_load_extension() interfaces. (needs -ldl linking option, otherwise)
|
||||
# SQLITE_DEFAULT_MEMSTATUS=0: This setting causes the sqlite3_status() interfaces that track memory usage to be disabled. This helps the sqlite3_malloc() routines run much faster, and since SQLite uses sqlite3_malloc() internally, this helps to make the entire library faster.
|
||||
# SQLITE_OMIT_DEPRECATED: Omitting deprecated interfaces and features will not help SQLite to run any faster. It will reduce the library footprint, however. And it is the right thing to do.
|
||||
# SQLITE_OMIT_PROGRESS_CALLBACK: The progress handler callback counter must be checked in the inner loop of the bytecode engine. By omitting this interface, a single conditional is removed from the inner loop of the bytecode engine, helping SQL statements to run slightly faster.
|
||||
# SQLITE_DEFAULT_FOREIGN_KEYS=1: This macro determines whether enforcement of foreign key constraints is enabled or disabled by default for new database connections.
|
||||
# SQLITE_DQS=0: This setting disables the double-quoted string literal misfeature.
|
||||
set(SQLITE_DEFINES
|
||||
SQLITE_OMIT_LOAD_EXTENSION
|
||||
SQLITE_DEFAULT_MEMSTATUS=0
|
||||
SQLITE_OMIT_DEPRECATED
|
||||
SQLITE_OMIT_PROGRESS_CALLBACK
|
||||
SQLITE_OMIT_MEMORYDB
|
||||
SQLITE_DEFAULT_FOREIGN_KEYS=1
|
||||
SQLITE_DQS=0
|
||||
)
|
||||
|
||||
# This file has no dependencies on other code in the repo and takes a long time
|
||||
# to build. It is placed in its own target so that it does not include any other
|
||||
# headers in the build command and thus does not need to be rebuilt when headers
|
||||
# are modified.
|
||||
set(sqlite3_sources
|
||||
sqlite3.c
|
||||
sqlite3.h
|
||||
)
|
||||
|
||||
add_library(sqlite3 OBJECT ${sqlite3_sources})
|
||||
target_compile_definitions(sqlite3 PRIVATE ${SQLITE_DEFINES})
|
||||
target_compile_options(sqlite3 PRIVATE -Wno-implicit-fallthrough -Wno-cast-function-type)
|
||||
|
||||
set(database_sources
|
||||
@@ -36,9 +22,11 @@ set(database_sources
|
||||
network-table.h
|
||||
query-table.c
|
||||
query-table.h
|
||||
sqlite3.h
|
||||
sqlite3-ext.c
|
||||
sqlite3-ext.h
|
||||
)
|
||||
|
||||
add_library(database OBJECT ${database_sources})
|
||||
target_compile_options(database PRIVATE "${EXTRAWARN}")
|
||||
target_include_directories(database PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
@@ -51,3 +51,4 @@ set(sources
|
||||
add_library(dnsmasq OBJECT ${sources})
|
||||
target_compile_definitions(dnsmasq PRIVATE VERSION=\"${DNSMASQ_VERSION}\" HAVE_DNSSEC HAVE_DNSSEC_STATIC HAVE_IDN)
|
||||
target_compile_options(dnsmasq PRIVATE -Wno-maybe-uninitialized)
|
||||
target_include_directories(dnsmasq PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
Reference in New Issue
Block a user