Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入sqlcipher #76

Closed
yugaoxiang opened this issue Feb 20, 2022 · 5 comments
Closed

加入sqlcipher #76

yugaoxiang opened this issue Feb 20, 2022 · 5 comments

Comments

@yugaoxiang
Copy link

你好 我想要把sqlcipher也打包进去,所以我模仿你下载cppjieba,在外层makelist里加入

OPTION(SIMPLE_WITH_SQLCIPHER "Option to build with sqlcipher" ON) if(SIMPLE_WITH_SQLCIPHER) #set(CMAKE_CXX_FLAGS SQLITE_HAS_CODEC) #set(SQLITE_TEMP_STORE=2) endif()

然后在src的makelist加入

` if(SIMPLE_WITH_SQLCIPHER)
#openssl
include(ExternalProject)
ExternalProject_Add(
openssl
PREFIX ${CMAKE_BINARY_DIR}/openssl
GIT_REPOSITORY https://github.com/openssl/openssl.git
CONFIGURE_COMMAND ""
BUILD_COMMAND cmake -E echo "Skipping build openssl."
INSTALL_COMMAND cmake -E echo "Skipping install openssl."
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property(openssl source_dir)
#openssl

#include(ExternalProject)
ExternalProject_Add(
sqlcipher
PREFIX ${CMAKE_BINARY_DIR}/sqlcipher
GIT_REPOSITORY https://github.com/sqlcipher/sqlcipher.git
CONFIGURE_COMMAND ""
BUILD_COMMAND cmake -E echo "Skipping build sqlcipher."
INSTALL_COMMAND cmake -E echo "Skipping install sqlcipher."
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property(sqlcipher source_dir)
endif()`

`if(SIMPLE_WITH_SQLCIPHER)
add_dependencies(simple openssl)

add_dependencies(simple sqlcipher)
include_directories(${SQLITE3_HEADERS_DIR} ${source_dir}/include ${source_dir}/deps)
target_include_directories(simple INTERFACE ${SQLITE3_HEADERS_DIR} ${source_dir}/include ${source_dir}/deps)

for tests only

add_custom_command(TARGET simple PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${source_dir}/dict/ $<TARGET_FILE_DIR:simple>/../test/dict/)
INSTALL(DIRECTORY ${source_dir}/dict/ DESTINATION bin/dict FILES_MATCHING PATTERN "*.utf8")
else()
include_directories(${SQLITE3_HEADERS_DIR})
target_include_directories(simple INTERFACE ${SQLITE3_HEADERS_DIR})
endif()`

最后运行bulid-ios.sh 报错 CMake Error at src/cmake_install.cmake:78 (file): file INSTALL cannot find "/Users/xxx/Downloads/simple-master 2/build-ios/src/Release-iphoneos/libsimple.a": No such file or directory. Call Stack (most recent call first): cmake_install.cmake:62 (include) 不知道为什么?我在网上查的ExternalProject_Add这个函数后面几个参数不写也没什么,如果方便的可以帮我加一个sqlcipher吗?

@wangfenjin
Copy link
Owner

sqlcipher 跟这个库没关系,sqlcipher 是改了 sqlite 的源码,编译进 sqlite.so 的;这个库是一个 sqlite 的扩展,编译成独立的 so。

你想要 sqlcipher 去 https://github.com/sqlcipher/sqlcipher 它们的代码库看怎么编译,这个库编译的时候跟 sqlcipher 没有任何关系

@yugaoxiang
Copy link
Author

sqlcipher 跟这个库没关系,sqlcipher 是改了 sqlite 的源码,编译进 sqlite.so 的;这个库是一个 sqlite 的扩展,编译成独立的 so。

你想要 sqlcipher 去 https://github.com/sqlcipher/sqlcipher 它们的代码库看怎么编译,这个库编译的时候跟 sqlcipher 没有任何关系

好的,那这个库有把sqlite打进去吗?如果没有那我就不用把sqlcipher打进去了,因为sqlcipher是修改过的sqlite,所以我有这个疑问

@wangfenjin
Copy link
Owner

这个库编译了 sqlite 只是自己测试用,没有打包到扩展里面。你在用的时候只要把 libsimple 和 dict/ 加进去就能用了,可以自己编译 sqlcipher 或者 sqlite

@yugaoxiang
Copy link
Author

好的,谢谢! 我试一下,libsimple.a和libPINYIN_TEXT.a在加上包含sqlcipher的sqlite看能用不

@wangfenjin
Copy link
Owner

没问题我先关掉了,有问题欢迎讨论

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants