From 9826361c18fbde9070e0d79813acab4faada6970 Mon Sep 17 00:00:00 2001 From: LY <51789698+Young-Lord@users.noreply.github.com> Date: Tue, 28 May 2024 13:22:23 +0800 Subject: [PATCH] add back dynamically linked build --- .github/workflows/build-windows.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index ce4858a..df54d16 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -17,7 +17,8 @@ jobs: name: Build runs-on: ${{ matrix.os }} env: - VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch == 'Win32' && 'x86' || matrix.arch == 'Win64' && 'x64' }}-windows + VCPKG_DYNAMIC_TRIPLET: ${{ matrix.arch == 'Win32' && 'x86' || matrix.arch == 'Win64' && 'x64' }}-windows + VCPKG_STATIC_TRIPLET: ${{ matrix.arch == 'Win32' && 'x86' || matrix.arch == 'Win64' && 'x64' }}-windows-static SQLCIPHER_NMAKE_VARS: USE_AMALGAMATION=1 NO_TCL=1 SQLITE3DLL=sqlcipher.dll SQLITE3LIB=sqlcipher.lib SQLITE3EXE=sqlcipher.exe SQLCIPHER_NMAKE_OPT_FEATURE_FLAGS: -DSQLITE_TEMP_STORE=2 -DSQLITE_HAS_CODEC=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_RTREE=1 -DSQLCIPHER_CRYPTO_OPENSSL=1 -DSQLITE_MAX_ATTACHED=125 permissions: @@ -46,7 +47,7 @@ jobs: - name: Setup OpenSSL run: | - vcpkg install openssl:${{ env.VCPKG_DEFAULT_TRIPLET }}-static --binarysource="clear;x-gha,readwrite" + vcpkg install openssl:${{ env.VCPKG_DYNAMIC_TRIPLET }} openssl:${{ env.VCPKG_STATIC_TRIPLET }} --binarysource="clear;x-gha,readwrite" - name: Init folders continue-on-error: true @@ -66,13 +67,28 @@ jobs: # ref: https://github.com/actions/runner-images/blob/main/images/windows/scripts/build/Install-OpenSSL.ps1#L12 # ref: https://blog.hamaluik.ca/posts/statically-linking-sqlcipher-on-windows run: | + mkdir -p sqlcipher\static nmake /f Makefile.msc clean - nmake /f Makefile.msc ${{ env.SQLCIPHER_NMAKE_VARS }} LTLINKOPTS="`"$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DEFAULT_TRIPLET }}-static\lib\libcrypto.lib`"" TCCOPTS="`"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DEFAULT_TRIPLET }}-static\include`"" RCCOPTS="`"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DEFAULT_TRIPLET }}-static\include`"" LTLIBPATHS="`"/LIBPATH:$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DEFAULT_TRIPLET }}-static\lib`"" OPT_FEATURE_FLAGS="${{ env.SQLCIPHER_NMAKE_OPT_FEATURE_FLAGS }} `"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DEFAULT_TRIPLET }}-static\include`"" LTLIBS="libcrypto.lib libssl.lib WS2_32.Lib Gdi32.Lib AdvAPI32.Lib Crypt32.Lib User32.Lib" + nmake /f Makefile.msc ${{ env.SQLCIPHER_NMAKE_VARS }} LTLINKOPTS="`"$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_STATIC_TRIPLET }}\lib\libcrypto.lib`"" TCCOPTS="`"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_STATIC_TRIPLET }}\include`"" RCCOPTS="`"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_STATIC_TRIPLET }}\include`"" LTLIBPATHS="`"/LIBPATH:$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_STATIC_TRIPLET }}\lib`"" OPT_FEATURE_FLAGS="${{ env.SQLCIPHER_NMAKE_OPT_FEATURE_FLAGS }} `"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_STATIC_TRIPLET }}\include`"" LTLIBS="libcrypto.lib libssl.lib WS2_32.Lib Gdi32.Lib AdvAPI32.Lib Crypt32.Lib User32.Lib" copy sqlcipher.exe sqlcipher-${{ matrix.arch == 'Win32' && 'x86' || matrix.arch == 'Win64' && 'x64' }}.exe - copy sqlcipher.exe sqlcipher - copy sqlite3.c,sqlite3.h,sqlcipher.dll,sqlcipher.lib sqlcipher + copy sqlite3.c,sqlite3.h,sqlcipher.dll,sqlcipher.lib,sqlcipher.exe sqlcipher\static working-directory: C:\dev\SQLCipher-${{ matrix.arch }} + - name: Build SQLCipher (dynamically linked + amalgamation) + # ref: https://github.com/actions/runner-images/blob/main/images/windows/scripts/build/Install-OpenSSL.ps1#L12 + run: | + mkdir -p sqlcipher\dynamic + nmake /f Makefile.msc clean + nmake /f Makefile.msc ${{ env.SQLCIPHER_NMAKE_VARS }} LTLINKOPTS="`"$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DYNAMIC_TRIPLET }}\lib\libcrypto.lib`"" OPT_FEATURE_FLAGS="${{ env.SQLCIPHER_NMAKE_OPT_FEATURE_FLAGS }} `"-I$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DYNAMIC_TRIPLET }}\include`"" + copy sqlcipher.exe,"$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DYNAMIC_TRIPLET }}\libcrypto-*" sqlcipher + copy sqlite3.c,sqlite3.h,sqlcipher.dll,sqlcipher.lib,sqlcipher.exe,"$env:VCPKG_INSTALLATION_ROOT\packages\openssl_${{ env.VCPKG_DYNAMIC_TRIPLET }}\libcrypto-*" sqlcipher + working-directory: C:\dev\SQLCipher-${{ matrix.arch }} + + # - name: Copy SQLCipher amalgamation + # run: | + # copy sqlite3.c,sqlite3.h sqlcipher + # working-directory: C:\dev\SQLCipher-${{ matrix.arch }} + - name: Copy LICENSE run: | copy LICENSE* C:\dev\SQLCipher-${{ matrix.arch }}\sqlcipher