Skip to content

Commit

Permalink
attempt 2: add leveldb cmake patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mangini committed Aug 2, 2024
1 parent 7d143b0 commit 8f0343d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/bcny-firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
-D FIREBASE_INCLUDE_FUNCTIONS=YES `
-D FIREBASE_INCLUDE_STORAGE=YES `
-D FIREBASE_USE_BORINGSSL=YES `
-D CMAKE_C_FLAGS="/D_HAS_EXCEPTIONS=0 /EHsc- /DSNAPPY_HAVE_BMI2=0" `
-D CMAKE_CXX_FLAGS="/D_HAS_EXCEPTIONS=0 /EHsc- /DSNAPPY_HAVE_BMI2=0" `
-D MSVC_RUNTIME_LIBRARY_STATIC=NO `
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
Expand Down Expand Up @@ -141,11 +143,11 @@ jobs:
Write-Host "Checking for BMI2 instructions on Snappy.lib..."
$output = dumpbin /DISASM "${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/windows/snappy.lib" | Select-String -Pattern "bzhi"
if ($output) {
Write-Error "The instruction 'bzhi' was found in the disassembly."
Write-Error $output
Write-Host $output
Write-Error "ERROR: The instruction 'bzhi' was found in snappy.lib."
exit 1
} else {
Write-Output "Success! The instruction 'bzhi' was not found in the disassembly."
Write-Output "Success! The instruction 'bzhi' was not found in snappy.lib."
}
- uses: actions/upload-artifact@v3
Expand Down
5 changes: 4 additions & 1 deletion cmake/external/leveldb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ endif()
set(patch_file
${CMAKE_CURRENT_LIST_DIR}/../../scripts/git/patches/leveldb/0001-leveldb-1.23-windows-paths.patch)

set(patch_file_nobmi2
${CMAKE_CURRENT_LIST_DIR}/../../scripts/git/patches/leveldb/0002-leveldb-1.23-windows-nobmi2.patch)

# This version must be kept in sync with the version in firestore.patch.txt.
# If this version ever changes then make sure to update the version in
# firestore.patch.txt accordingly.
Expand All @@ -40,5 +43,5 @@ ExternalProject_Add(
INSTALL_COMMAND ""
TEST_COMMAND ""
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
PATCH_COMMAND git apply ${patch_file} && git gc --aggressive
PATCH_COMMAND git apply ${patch_file} ${patch_file_nobmi2} && git gc --aggressive
)
16 changes: 16 additions & 0 deletions scripts/git/patches/leveldb/0002-leveldb-1.23-windows-nobmi2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fda9e01..898587a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,11 @@ check_include_file("unistd.h" HAVE_UNISTD_H)

include(CheckLibraryExists)
check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
-check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
+if (WIN32)
+ add_definitions(-DHAVE_SNAPPY=0)
+else (WIN32)
+ check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
+endif (WIN32)
check_library_exists(zstd zstd_compress "" HAVE_ZSTD)
check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)

0 comments on commit 8f0343d

Please sign in to comment.