Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/cppcmake-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
NIGHTLY:
default: false
type: boolean
secrets:
SIGNPATH_API_TOKEN:
required: false
SIGNPATH_ORGANIZATION_ID:
required: false
workflow_dispatch:

jobs:
Expand All @@ -21,6 +26,8 @@ jobs:
GH_TOKEN: ${{ github.token }}
OPENSSL_VERSION: 1.1.1.2100
QT_VERSION: 5.15.2
SIGNPATH_API_TOKEN: ${{ secrets.SIGNPATH_API_TOKEN || '' }}
SIGNPATH_ORGANIZATION_ID: ${{ secrets.SIGNPATH_ORGANIZATION_ID || '' }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -141,7 +148,7 @@ jobs:
mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-${{ matrix.arch }}.msi"
}

- if: github.event_name != 'pull_request'
- if: github.event_name != 'pull_request' && env.SIGNPATH_API_TOKEN != '' && env.SIGNPATH_ORGANIZATION_ID != ''
name: Upload artifacts for code signing with SignPath
id: unsigned-artifacts
uses: actions/upload-artifact@v6
Expand All @@ -150,7 +157,7 @@ jobs:
path: installer\windows\DB.Browser.for.SQLite-*.msi

# Change the signing-policy-slug when you release an RC, RTM or stable release.
- if: github.event_name != 'pull_request'
- if: github.event_name != 'pull_request' && env.SIGNPATH_API_TOKEN != '' && env.SIGNPATH_ORGANIZATION_ID != ''
name: Code signing with SignPath
uses: signpath/github-action-submit-signing-request@v2
with:
Expand All @@ -177,6 +184,16 @@ jobs:
} else {
move target\System64\* "target\DB Browser for SQLite\"
}
$simpleExtSource = Join-Path "${{ github.workspace }}" "release-sqlcipher\Release\extensions\simple.dll"
$simpleExtDestDir = "target\DB Browser for SQLite\extensions"
if (-not (Test-Path $simpleExtDestDir)) {
New-Item -ItemType Directory -Path $simpleExtDestDir | Out-Null
}
if (Test-Path $simpleExtSource) {
Copy-Item -Path $simpleExtSource -Destination $simpleExtDestDir -Force
} else {
Write-Host "simple.dll not found at $simpleExtSource"
}
Compress-Archive -Path "target\DB Browser for SQLite\*" -DestinationPath $FILENAME_FORMAT

- if: github.event_name != 'pull_request' && github.workflow != 'Build (Windows)'
Expand Down
41 changes: 40 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@ sqlitebrowser.pro.user
.qmake.stash
CMakeLists.txt.user
CMakeFiles
*.cmake
*.cxx_parameters

# ignore any build folders
build*/
# folder with temporary test data
testdata/

# CMake (in-source build artifacts)
CMakeCache.txt
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
Testing/
DartConfiguration.tcl
_CPack_Packages/
CPackConfig.cmake
CPackSourceConfig.cmake

# Ninja
.ninja_*
build.ninja
rules.ninja

src/.ui/
src/sqlitebrowser
src/Makefile*
Expand All @@ -35,5 +51,28 @@ libs/*/*/release/
libs/*/*.a
libs/*/*/*.a

# IDEs / editors
.idea/
.vscode/
.vs/
*.swp
*.swo

# Qt Creator
*.pro.user*
*.qbs.user*
*.qtc_clangd/

# Local/vendor worktrees
simple-master/

# Python
__pycache__/
*.pyc
.pytest_cache/

# Ignore .DS_Store files on OSX
.DS_Store
*.dSYM/
*.dmg
*.pkg
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AGENTS.md

## Project
DB Browser for SQLite is a C++ (C++14+) / Qt application built with CMake.

## Build (out-of-source)
Prefer an out-of-source build directory.

```sh
cmake -S . -B build
cmake --build build
```

Resulting binaries are typically under `build/src/` (e.g. `build/src/sqlitebrowser`).

## Unit tests
Unit tests live in `src/tests` and are enabled via `ENABLE_TESTING`.

```sh
cmake -S . -B build-test -DENABLE_TESTING=ON
cmake --build build-test
ctest --test-dir build-test -V
```

## Common CMake options
- `-DENABLE_TESTING=ON`: build unit tests
- `-Dsqlcipher=1`: build with SQLCipher support (if dependencies are available)
- `-DFORCE_INTERNAL_QSCINTILLA=ON`: use bundled QScintilla if system packages cause issues

## Repo conventions (for agents)
- Keep diffs minimal and focused; avoid drive-by refactors and mass reformatting.
- Prefer modifying `src/` over vendored code in `libs/` unless explicitly required.
- For `.ui` files, prefer Qt Designer edits; avoid hand-reformatting generated XML.
- Don’t update `src/translations/*.ts` unless the change is explicitly about translations.
- When changing build behavior, also update `BUILDING.md` (and `README.md` when user-facing).
9 changes: 9 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ cmake --build .
mv DB\ Browser\ for\ SQLite.app /Applications
```

If you see “may be damaged or incomplete” when launching the app, check that
`/Applications/DB Browser for SQLite.app/Contents/Info.plist` has a
`CFBundleExecutable` that matches the file in `Contents/MacOS/`. If the app was
copied from another machine and got quarantined, clear it with:

```bash
xattr -dr com.apple.quarantine /Applications/DB\ Browser\ for\ SQLite.app
```

> If you want to build universal binary, change the `cmake` command to<br>
> `cmake -DcustomTap=1 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ..`<br>
> Of course, this requires you to have an Apple Silicon Mac.
Expand Down
80 changes: 79 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
project(sqlitebrowser
VERSION 3.13.99
DESCRIPTION "GUI editor for SQLite databases"
LANGUAGES CXX
LANGUAGES C CXX
)

include(GNUInstallDirs)
Expand Down Expand Up @@ -60,6 +60,11 @@ endif()

include(config/platform.cmake)

if(APPLE)
set_source_files_properties(src/macapp.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
target_sources(${PROJECT_NAME} PRIVATE src/macapp.icns)
endif()

find_package(${QT_MAJOR} REQUIRED COMPONENTS Concurrent Gui LinguistTools Network PrintSupport Test Widgets Xml)
set(QT_LIBS
${QT_MAJOR}::Gui
Expand Down Expand Up @@ -94,6 +99,79 @@ else()
set(LIBSQLITE_NAME SQLite::SQLite3)
endif()

if(APPLE OR WIN32)
set(SIMPLE_TOKENIZER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/libs/simple_tokenizer/simple_extension.c
${CMAKE_CURRENT_SOURCE_DIR}/libs/simple_tokenizer/simple_tokenizer.c
${CMAKE_CURRENT_SOURCE_DIR}/libs/simple_tokenizer/jieba_query.c
)

add_library(simple_tokenizer MODULE ${SIMPLE_TOKENIZER_SOURCES})
# This is a plain SQLite extension (C code). Don't run Qt's automoc/uic/rcc on it.
set_target_properties(simple_tokenizer PROPERTIES
AUTOMOC OFF
AUTOUIC OFF
AUTORCC OFF
)
set(SIMPLE_TOKENIZER_INCLUDE_DIRS)
if(DEFINED SQLite3_INCLUDE_DIRS)
list(APPEND SIMPLE_TOKENIZER_INCLUDE_DIRS ${SQLite3_INCLUDE_DIRS})
endif()
if(sqlcipher)
list(APPEND SIMPLE_TOKENIZER_INCLUDE_DIRS ${SQLCIPHER_INCLUDE_DIR} ${SQLCIPHER_INCLUDE_DIR}/sqlcipher)
endif()

target_include_directories(simple_tokenizer PRIVATE ${SIMPLE_TOKENIZER_INCLUDE_DIRS})
target_link_libraries(simple_tokenizer PRIVATE ${LIBSQLITE_NAME})
target_compile_definitions(simple_tokenizer PRIVATE SQLITE_ENABLE_FTS5 SQLITE_CORE)

if(APPLE)
# Ensure the entry point symbols are exported even with aggressive dead-stripping,
# otherwise sqlite3_load_extension() cannot find them via dlsym().
target_link_options(simple_tokenizer PRIVATE
"-Wl,-exported_symbol,_sqlite3_extension_init"
"-Wl,-exported_symbol,_sqlite3_simple_init"
)

set(SIMPLE_EXT_OUTPUT_DIR "${CMAKE_BINARY_DIR}/extensions")
set_target_properties(simple_tokenizer PROPERTIES
PREFIX ""
OUTPUT_NAME "simple"
LIBRARY_OUTPUT_DIRECTORY "${SIMPLE_EXT_OUTPUT_DIR}"
)
else()
set(SIMPLE_EXT_OUTPUT_DIR "${CMAKE_BINARY_DIR}/$<CONFIG>/extensions")
set_target_properties(simple_tokenizer PROPERTIES
PREFIX ""
OUTPUT_NAME "simple"
LIBRARY_OUTPUT_DIRECTORY "${SIMPLE_EXT_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${SIMPLE_EXT_OUTPUT_DIR}"
)
foreach(CONFIG_NAME IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
set_property(TARGET simple_tokenizer PROPERTY LIBRARY_OUTPUT_DIRECTORY_${CONFIG_NAME} "${CMAKE_BINARY_DIR}/${CONFIG_NAME}/extensions")
set_property(TARGET simple_tokenizer PROPERTY RUNTIME_OUTPUT_DIRECTORY_${CONFIG_NAME} "${CMAKE_BINARY_DIR}/${CONFIG_NAME}/extensions")
endforeach()
endif()

install(TARGETS simple_tokenizer
LIBRARY DESTINATION Extensions
RUNTIME DESTINATION extensions
)

# Make local macOS builds usable without running installer scripts:
# copy the built tokenizer extension into the app bundle so it can be auto-loaded.
if(APPLE)
add_dependencies(${PROJECT_NAME} simple_tokenizer)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_BUNDLE_DIR:${PROJECT_NAME}>/Contents/Extensions"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:simple_tokenizer>"
"$<TARGET_BUNDLE_DIR:${PROJECT_NAME}>/Contents/Extensions/simple.dylib"
VERBATIM
)
endif()
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
Expand Down
12 changes: 12 additions & 0 deletions config/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ if(NOT WIN32 AND NOT APPLE)
)
endif()

if(APPLE)
if(TARGET simple_tokenizer)
install(FILES $<TARGET_FILE:simple_tokenizer> DESTINATION Extensions)
endif()
endif()

if(WIN32)
if(TARGET simple_tokenizer)
install(FILES $<TARGET_FILE:simple_tokenizer> DESTINATION extensions)
endif()
endif()

if(UNIX)
install(FILES src/icons/${PROJECT_NAME}.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/256x256/apps/
Expand Down
1 change: 1 addition & 0 deletions config/platform_apple.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
BUNDLE True
OUTPUT_NAME "DB Browser for SQLite"
MACOSX_BUNDLE_ICON_FILE "macapp.icns"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/app.plist
)
Loading
Loading