commit something which idk when i write them

This commit is contained in:
2026-04-21 22:33:21 +08:00
parent 5c18e2ccbc
commit d3fd3c2b0d
6 changed files with 25 additions and 19 deletions

View File

@@ -1,15 +1,23 @@
if (WIN32) if (WIN32)
# In Windows, we use custom way to import SQLite # In Windows, we use custom way to import SQLite.
# Before using this CMake file in Windows, you should do following steps first.
# 1. Get SQLite SDK (amalgamation) and binaries (sqlite-dll) from http://www.sqlite.org/
# 2. Extract SQLite SDK and binaries to your preferred directory.
# 3. Open Developer Command Prompt for Visual Studio (embedded with Visual Studio installation)
# 4. Use `cd` command to switch work directory to the directory where you extract binaries.
# 5. Execute `lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x86` (`x86` is the architecture of your SQLite3, you may change it according to your requirement).
# 6. Now you have a generated LIB file for MSVC linking.
# Check variables# Check YYCC path variable # Check SQLite path variable
if (NOT DEFINED SQLITE_AMALGAMATION_PATH) if (NOT DEFINED SQLITE_AMALGAMATION_PATH)
message(FATAL_ERROR "You must set SQLITE_AMALGAMATION_PATH variable to the header of SQLite library.") message(FATAL_ERROR "You must set SQLITE_AMALGAMATION_PATH to the directory where the SQLite3 header file locate.")
endif() endif()
if (NOT DEFINED SQLITE_DLL_PATH) if (NOT DEFINED SQLITE_DLL_PATH)
message(FATAL_ERROR "You must set SQLITE_DLL_PATH variable the directory containing generated linking LIB file.") message(FATAL_ERROR "You must set SQLITE_DLL_PATH to the directory where the generated SQLite3 LIB file locate for linking.")
endif() endif()
# Add imported library # Add imported library
add_library(SQLite3 INTERFACE IMPORTED) add_library(SQLite3 INTERFACE IMPORTED)
# Add alias for it to let it has the same behavior with CMake imported SQLite3.
add_library(SQLite3::SQLite3 ALIAS SQLite3) add_library(SQLite3::SQLite3 ALIAS SQLite3)
# Setup header files # Setup header files
set_target_properties(SQLite3 PROPERTIES set_target_properties(SQLite3 PROPERTIES
@@ -22,6 +30,6 @@ if (WIN32)
"${SQLITE_DLL_PATH}/sqlite3.lib" "${SQLITE_DLL_PATH}/sqlite3.lib"
) )
else () else ()
# In non-Windows, we import SQLite from CMake # In non-Windows, we simply import SQLite3 from CMake preset.
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
endif () endif ()

View File

@@ -1,9 +1,15 @@
# Check YYCC path variable
# Check YYCC path environment variable
if (NOT DEFINED YYCC_PATH) if (NOT DEFINED YYCC_PATH)
message(FATAL_ERROR "You must set YYCC_PATH variable to one of CMake distribution of YYCC installation path.") message(FATAL_ERROR "You must set YYCC_PATH variable to one of YYCC CMake distribution installation path.")
endif() endif()
# Find YYCC library # Find YYCC library
find_package(YYCCommonplace REQUIRED # It will produce YYCC::YYCCommonplace target for including and linking.
HINTS ${YYCC_PATH} NO_DEFAULT_PATH #
) # Please note we MUST set CMake variable YYCCommonplace_ROOT to make sure CMake can found YYCC in out given path.
# The cache status of YYCCommonplace_ROOT is doesn't matter.
# CMake will throw error if we use HINTS feature in find_package to find YYCC.
set(YYCCommonplace_ROOT ${YYCC_PATH} CACHE PATH
"The path to YYCC CMake distribution installation path.")
find_package(YYCCommonplace REQUIRED)

View File

@@ -17,9 +17,6 @@ FILES
target_include_directories(VSWDecorator target_include_directories(VSWDecorator
PUBLIC PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
YYCC::YYCCommonplace
SQLite3::SQLite3
VSWShared
) )
# Setup linked library # Setup linked library
target_link_libraries(VSWDecorator target_link_libraries(VSWDecorator

View File

@@ -54,10 +54,6 @@ FILES
target_include_directories(VSWMaterializer target_include_directories(VSWMaterializer
PRIVATE PRIVATE
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
YYCC::YYCCommonplace
SQLite3::SQLite3
VirtoolsSDK
VSWShared
) )
# Setup linked library # Setup linked library
target_link_libraries(VSWMaterializer target_link_libraries(VSWMaterializer

View File

@@ -37,7 +37,7 @@ sqlite3_reset(stmt);
failed: throw std::runtime_error("fail to bind value for prepared statement."); failed: throw std::runtime_error("fail to bind value for prepared statement.");
#define REVEAL_ENUM(enum_val) static_cast<std::underlying_type_t<decltype(enum_val)>>(enum_val) #define REVEAL_ENUM(enum_val) static_cast<std::underlying_type_t<decltype(enum_val)>>(enum_val)
#define REVEAL_U8STR(u8_str) YYCC::EncodingHelper::ToOrdinary(u8_str.c_str()), -1, SQLITE_TRANSIENT #define REVEAL_U8STR(u8_str) YYCC::EncodingHelper::ToOrdinary((u8_str).c_str()), -1, SQLITE_TRANSIENT
#define REVEAL_BLOB(blob_val) (blob_val).ptr, (blob_val).length, SQLITE_TRANSIENT #define REVEAL_BLOB(blob_val) (blob_val).ptr, (blob_val).length, SQLITE_TRANSIENT
#define REVEAL_BOOL(bool_val) ((bool_val) ? 1 : 0) #define REVEAL_BOOL(bool_val) ((bool_val) ? 1 : 0)

View File

@@ -18,7 +18,6 @@ FILES
target_include_directories(VSWShared target_include_directories(VSWShared
PUBLIC PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
YYCC::YYCCommonplace
) )
# Setup linked library # Setup linked library
target_link_libraries(VSWShared target_link_libraries(VSWShared