Skip to content

Commit f6d6ee2

Browse files
authored
Override build settings to specify /Z7 instead of /Zi for embedded PDBs in the BCNY windows build (#20)
* [windows][build] add a helper script to adjust MSVC debug flags to be Z7 instead of Zi * [bcny][gh workflow] build firebase with /Z7 for embedded debug information on windows * roll back to the mainline branch
1 parent dece3ca commit f6d6ee2

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/bcny-firebase.yml

+33
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ jobs:
5656
- name: Build flatc
5757
run: cmake --build ${{ github.workspace }}/BinaryCache/flatbuffers --config Release --target flatc
5858

59+
- name: Adjust cmake build settings for debugging
60+
run: powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/CMakeLists.txt
61+
5962
- name: Configure firebase
6063
run:
6164
cmake -B ${{ github.workspace }}/BinaryCache/firebase `
@@ -76,6 +79,36 @@ jobs:
7679
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
7780
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
7881
-D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe
82+
83+
- name: Adjust external project build settings for debugging
84+
run: |
85+
$names = Get-ChildItem -Path "${{ github.workspace }}/BinaryCache/firebase" -File -Recurse -Filter CMakeLists.txt
86+
foreach ($name in $names) {
87+
$fullName = $name.FullName
88+
powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 $fullName
89+
Write-Host "... fixed up debug options for ${fullName}"
90+
}
91+
92+
- name: Configure firebase after build setting adjustments
93+
run:
94+
cmake -B ${{ github.workspace }}/BinaryCache/firebase `
95+
-D BUILD_SHARED_LIBS=NO `
96+
-D CMAKE_BUILD_TYPE=Release `
97+
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr `
98+
-G "Visual Studio 17 2022" `
99+
-A ${{ matrix.platform }} `
100+
-S ${{ github.workspace }}/SourceCache/firebase-cpp-sdk `
101+
-D FLATBUFFERS_BUILD_FLATC=NO `
102+
-D FIREBASE_CPP_BUILD_PACKAGE=YES `
103+
-D FIREBASE_GITHUB_ACTION_BUILD=YES `
104+
-D FIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF `
105+
-D FIREBASE_INCLUDE_AUTH=YES `
106+
-D FIREBASE_INCLUDE_FIRESTORE=YES `
107+
-D FIREBASE_USE_BORINGSSL=YES `
108+
-D MSVC_RUNTIME_LIBRARY_STATIC=NO `
109+
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
110+
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
111+
-D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe
79112
- name: Build firebase
80113
run: cmake --build ${{ github.workspace }}/BinaryCache/firebase --config RelWithDebInfo
81114
- name: Install firebase
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Path to the CMakeLists.txt file
2+
$filePath = $args[0]
3+
4+
# Lines to add after the line starting with "cmake_minimum_required"
5+
$newLines = @(
6+
'string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")',
7+
'string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")',
8+
'string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")',
9+
'string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")'
10+
)
11+
12+
# Read the content of the file
13+
$content = Get-Content -Path $filePath
14+
15+
# New content holder
16+
$newContent = @()
17+
18+
# Flag to check if lines are added
19+
$linesAdded = $false
20+
21+
foreach ($line in $content) {
22+
# Add the current line to new content
23+
$newContent += $line
24+
25+
# Check if the line starts with "cmake_minimum_required" and add new lines after it
26+
if ($line -match '^cmake_minimum_required' -and -not $linesAdded) {
27+
$newContent += $newLines
28+
$linesAdded = $true
29+
}
30+
}
31+
32+
# Write the new content back to the file
33+
$newContent | Set-Content -Path $filePath

0 commit comments

Comments
 (0)