git clone https://github.com/Microsoft/vcpkg.git cd vcpkg PS> .\bootstrap-vcpkg.bat # Then, to hook up user-wide integration, run (note: requires admin on first use) PS> .\vcpkg integrate install PS> .\vcpkg install openssl:x64-windows-static # or x86 PS> .\vcpkg install openssl:x86-windows-static # This will take a bit of time, but once done, you can find the resulting include and lib files at Downloads\vcpkg\packages\openssl-windows_x64-windows-static (for x64, Downloads\vcpkg\packages\openssl-windows_x86-windows-static for 32-bit).
# extra command # To remove the integration for your user, you can use .\vcpkg integrate remove. # CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake" # Install any packages with PS> .\vcpkg install sdl2 curl
编辑 sqlcipher
git clone https://github.com/sqlcipher/sqlcipher.git cd sqlcipher # copying the openssl-windows_x64-windows-static and openssl-windows_x86-windows-static folders into the SQLCipher folder # Now open Makefile.msc in a text editor and replace the lines: # Flags controlling use of the in memory btree implementation # # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to # default to file, 2 to default to memory, and 3 to force temporary # tables to always be in memory. # TCC = $(TCC) -DSQLITE_TEMP_STORE=1 RCC = $(RCC) -DSQLITE_TEMP_STORE=1 # into # Flags controlling use of the in memory btree implementation # # SQLITE_TEMP_STORE is 0 to force temporary tables to be in a file, 1 to # default to file, 2 to default to memory, and 3 to force temporary # tables to always be in memory. # TCC = $(TCC) -DSQLITE_TEMP_STORE=2 RCC = $(RCC) -DSQLITE_TEMP_STORE=2
Basically, what this replacement does is: it changes SQLITE_TEMP_STORE to default to store temporary files in memory rather than files (a requirement for SQLCipher); it tells SQLite that there is a codec (again, a requirement for SQLCipher); and then includes the OpenSSL static libraries we obtained earlier. The additional librares (WS2_32.Lib, etc) are included because OpenSSL requires them, see OpenSSL / Linking your application for more details.
Compile SQLCipher
With our additions to the makefile we can now compile SQLCipher. To do so, launch the Visual Studio Native Tools command prompt from your start menu: either VS2019 x64 Native Tools Command Prompt (for 64-bit) or VS2019 x86 Native Tools Command Prompt (for 32-bit), then navigate to the SQLCipher folder. Finally, make it: