Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.61k stars 1.39k forks source link

Support build WCDB.framework from CMake on Apple platform #1078

Closed watergear closed 3 months ago

watergear commented 3 months ago

to support #1073 Now it is able to build WCDB.framework if run command cmake .. -GXcode.

Here is a testing sample. test_fixed_wcdb_framework.zip

Run this to build libWCDB.dylib

cd test_wcdb_framework
git submodule update --init --recursive
mkdir build && cd build
cmake .. && cmake --build .
./test_dep_wcdb_framework

Output

create wcdb database successful!

Run this to build WCDB.framework

cd test_wcdb_framework
git submodule update --init --recursive
mkdir buildx && cd buildx
cmake .. -GXcode && cmake --build .
./Debug/test_dep_wcdb_framework

Output

create wcdb database successful!

After running test_dep_wcdb_framework, if the result is correct, you can see that the database file sample.db has been created. Also you can use otool -l ./Debug/test_dep_wcdb_framework to see dependent libraries. Should be

... Load command 13 cmd LC_LOAD_DYLIB cmdsize 72 name @rpath/WCDB.framework/Versions/2.1.2/WCDB (offset 24) time stamp 2 Thu Jan 1 08:00:02 1970 current version 0.0.0 compatibility version 0.0.0 ...