From fa355c35612f80a10a63f878f42eb240a3930076 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 5 Mar 2024 07:30:09 -0800 Subject: [PATCH 1/3] [windows][build] add a helper script to adjust MSVC debug flags to be Z7 instead of Zi --- .../windows/fix_cmake_debugflags.ps1 | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 build_scripts/windows/fix_cmake_debugflags.ps1 diff --git a/build_scripts/windows/fix_cmake_debugflags.ps1 b/build_scripts/windows/fix_cmake_debugflags.ps1 new file mode 100644 index 0000000000..d2591d65a0 --- /dev/null +++ b/build_scripts/windows/fix_cmake_debugflags.ps1 @@ -0,0 +1,33 @@ +# Path to the CMakeLists.txt file +$filePath = $args[0] + +# Lines to add after the line starting with "cmake_minimum_required" +$newLines = @( + 'string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")', + 'string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")', + 'string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")', + 'string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")' +) + +# Read the content of the file +$content = Get-Content -Path $filePath + +# New content holder +$newContent = @() + +# Flag to check if lines are added +$linesAdded = $false + +foreach ($line in $content) { + # Add the current line to new content + $newContent += $line + + # Check if the line starts with "cmake_minimum_required" and add new lines after it + if ($line -match '^cmake_minimum_required' -and -not $linesAdded) { + $newContent += $newLines + $linesAdded = $true + } +} + +# Write the new content back to the file +$newContent | Set-Content -Path $filePath From 222440d5e3e12a7b28bbf0c66e82bf75d6e35002 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 5 Mar 2024 07:42:46 -0800 Subject: [PATCH 2/3] [bcny][gh workflow] build firebase with /Z7 for embedded debug information on windows --- .github/workflows/bcny-firebase.yml | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bcny-firebase.yml b/.github/workflows/bcny-firebase.yml index 735dacc65a..531eacb6e2 100644 --- a/.github/workflows/bcny-firebase.yml +++ b/.github/workflows/bcny-firebase.yml @@ -28,7 +28,7 @@ jobs: with: fetch-depth: 1 path: ${{ github.workspace }}/SourceCache/firebase-cpp-sdk - ref: refs/heads/compnerd/swift + ref: refs/heads/eng/z7build repository: thebrowsercompany/firebase-cpp-sdk - uses: compnerd/gha-setup-vsdevenv@main @@ -56,6 +56,9 @@ jobs: - name: Build flatc run: cmake --build ${{ github.workspace }}/BinaryCache/flatbuffers --config Release --target flatc + - name: Adjust cmake build settings for debugging + run: powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/CMakeLists.txt + - name: Configure firebase run: cmake -B ${{ github.workspace }}/BinaryCache/firebase ` @@ -76,6 +79,36 @@ jobs: -D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded ` -D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} ` -D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe + + - name: Adjust external project build settings for debugging + run: | + $names = Get-ChildItem -Path "${{ github.workspace }}/BinaryCache/firebase" -File -Recurse -Filter CMakeLists.txt + foreach ($name in $names) { + $fullName = $name.FullName + powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 $fullName + Write-Host "... fixed up debug options for ${fullName}" + } + + - name: Configure firebase after build setting adjustments + run: + cmake -B ${{ github.workspace }}/BinaryCache/firebase ` + -D BUILD_SHARED_LIBS=NO ` + -D CMAKE_BUILD_TYPE=Release ` + -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr ` + -G "Visual Studio 17 2022" ` + -A ${{ matrix.platform }} ` + -S ${{ github.workspace }}/SourceCache/firebase-cpp-sdk ` + -D FLATBUFFERS_BUILD_FLATC=NO ` + -D FIREBASE_CPP_BUILD_PACKAGE=YES ` + -D FIREBASE_GITHUB_ACTION_BUILD=YES ` + -D FIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF ` + -D FIREBASE_INCLUDE_AUTH=YES ` + -D FIREBASE_INCLUDE_FIRESTORE=YES ` + -D FIREBASE_USE_BORINGSSL=YES ` + -D MSVC_RUNTIME_LIBRARY_STATIC=NO ` + -D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded ` + -D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} ` + -D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe - name: Build firebase run: cmake --build ${{ github.workspace }}/BinaryCache/firebase --config RelWithDebInfo - name: Install firebase From 107c9141bdc708ef31de344ea5b88d2778261773 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 5 Mar 2024 13:40:49 -0800 Subject: [PATCH 3/3] roll back to the mainline branch --- .github/workflows/bcny-firebase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bcny-firebase.yml b/.github/workflows/bcny-firebase.yml index 531eacb6e2..7a7d47bdfb 100644 --- a/.github/workflows/bcny-firebase.yml +++ b/.github/workflows/bcny-firebase.yml @@ -28,7 +28,7 @@ jobs: with: fetch-depth: 1 path: ${{ github.workspace }}/SourceCache/firebase-cpp-sdk - ref: refs/heads/eng/z7build + ref: refs/heads/compnerd/swift repository: thebrowsercompany/firebase-cpp-sdk - uses: compnerd/gha-setup-vsdevenv@main