Skip to content

Commit 17e41af

Browse files
committed
refactor(build): merge vxcore_db into vxcore library
Eliminates separate vxcore_db library by merging DB sources directly into vxcore. This fixes linker errors where sqlite_metadata_store.cpp couldn't access file_utils symbols due to circular dependency between libraries. - Move db/*.cpp sources into main vxcore library - Update test_db and test_metadata_store to compile DB sources directly - Remove src/db/CMakeLists.txt (no longer needed)
1 parent 61adfba commit 17e41af

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

src/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ set(VXCORE_SOURCES
2424
core/folder.cpp
2525
core/bundled_folder_manager.cpp
2626
core/raw_folder_manager.cpp
27+
db/db_manager.cpp
28+
db/file_db.cpp
29+
db/tag_db.cpp
30+
db/sync_manager.cpp
31+
db/sqlite_metadata_store.cpp
2732
search/search_manager.cpp
2833
search/search_query.cpp
2934
search/search_file_info.cpp
@@ -54,10 +59,7 @@ target_include_directories(vxcore
5459
${CMAKE_SOURCE_DIR}/src
5560
)
5661

57-
# Build database layer
58-
add_subdirectory(db)
59-
60-
target_link_libraries(vxcore PRIVATE nlohmann_json vxcore_db)
62+
target_link_libraries(vxcore PRIVATE nlohmann_json sqlite3)
6163

6264
if(WIN32)
6365
target_link_libraries(vxcore PRIVATE shell32)

src/db/CMakeLists.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,27 @@ target_include_directories(test_simple_search_backend PRIVATE ${CMAKE_SOURCE_DIR
3636
target_link_libraries(test_simple_search_backend PRIVATE nlohmann_json)
3737
add_test(NAME test_simple_search_backend COMMAND test_simple_search_backend)
3838

39-
add_executable(test_db test_db.cpp ${CMAKE_SOURCE_DIR}/src/utils/logger.cpp)
39+
add_executable(test_db test_db.cpp
40+
${CMAKE_SOURCE_DIR}/src/db/db_manager.cpp
41+
${CMAKE_SOURCE_DIR}/src/db/file_db.cpp
42+
${CMAKE_SOURCE_DIR}/src/db/tag_db.cpp
43+
${CMAKE_SOURCE_DIR}/src/db/sync_manager.cpp
44+
${CMAKE_SOURCE_DIR}/src/core/folder.cpp
45+
${CMAKE_SOURCE_DIR}/src/utils/logger.cpp
46+
${CMAKE_SOURCE_DIR}/src/utils/file_utils.cpp
47+
${CMAKE_SOURCE_DIR}/src/utils/utils.cpp)
4048
target_include_directories(test_db PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/third_party)
41-
target_link_libraries(test_db PRIVATE vxcore vxcore_db sqlite3)
49+
target_link_libraries(test_db PRIVATE sqlite3 nlohmann_json)
4250
add_test(NAME test_db COMMAND test_db)
4351

44-
add_executable(test_metadata_store test_metadata_store.cpp ${CMAKE_SOURCE_DIR}/src/utils/logger.cpp)
52+
add_executable(test_metadata_store test_metadata_store.cpp
53+
${CMAKE_SOURCE_DIR}/src/db/db_manager.cpp
54+
${CMAKE_SOURCE_DIR}/src/db/file_db.cpp
55+
${CMAKE_SOURCE_DIR}/src/db/tag_db.cpp
56+
${CMAKE_SOURCE_DIR}/src/db/sqlite_metadata_store.cpp
57+
${CMAKE_SOURCE_DIR}/src/utils/logger.cpp
58+
${CMAKE_SOURCE_DIR}/src/utils/file_utils.cpp)
4559
target_include_directories(test_metadata_store PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/third_party)
46-
target_link_libraries(test_metadata_store PRIVATE vxcore vxcore_db sqlite3)
60+
target_link_libraries(test_metadata_store PRIVATE sqlite3 nlohmann_json)
4761
add_test(NAME test_metadata_store COMMAND test_metadata_store)
4862

0 commit comments

Comments
 (0)