Skip to content

Commit ae87a35

Browse files
committed
Use LLVM binutils to package Windows binaries
Fixes #793.
1 parent 86198bb commit ae87a35

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Diff for: .github/workflows/cpp-packaging.yml

+10-19
Original file line numberDiff line numberDiff line change
@@ -122,34 +122,32 @@ jobs:
122122
mkdir -p packaging-tools
123123
cp -af /tmp/binutils-output/bin/* packaging-tools
124124
125-
- name: Cache LLVM (Mac only)
126-
if: matrix.tools_platform == 'darwin'
125+
- name: Cache LLVM
127126
id: cache_llvm
128127
uses: actions/cache@v3
129128
with:
130129
path: llvm-src/llvm/build/bin
131-
key: llvm-bin-${{matrix.tools_platform}}-${{env.xcodeVersion}}-${{env.llvmVer}}
130+
key: llvm-bin-${{matrix.tools_platform}}${{matrix.tools_platform == 'darwin' && format('-{0}', env.xcodeVersion) || ''}}-${{env.llvmVer}}
132131

133-
- name: Fetch LLVM source (Mac only)
132+
- name: Fetch LLVM source
134133
# Only fetch LLVM if we don't already have binaries from the cache.
135-
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
134+
if: ${{ !steps.cache_llvm.outputs.cache-hit }}
136135
uses: actions/checkout@v3
137136
with:
138137
repository: llvm/llvm-project
139138
path: llvm-src
140139
ref: ${{ env.llvmVer }}
141140

142-
- name: Build LLVM (Mac only)
141+
- name: Build LLVM
143142
# Only build LLVM if we don't already have binaries from the cache.
144-
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
143+
if: ${{ !steps.cache_llvm.outputs.cache-hit }}
145144
run: |
146145
mkdir llvm-src/llvm/build
147146
cd llvm-src/llvm/build
148147
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release ..
149148
cmake --build . -j 3 --target llvm-objcopy --target llvm-nm --target llvm-ar
150149
151-
- name: Package LLVM output (Mac only)
152-
if: matrix.tools_platform == 'darwin'
150+
- name: Package LLVM output
153151
run: |
154152
mkdir -p packaging-tools
155153
cp -af llvm-src/llvm/build/bin/* packaging-tools
@@ -555,17 +553,10 @@ jobs:
555553
# determine the build variant based on the artifact filename
556554
variant=$(sdk-src/build_scripts/desktop/get_variant.sh "${pkg}")
557555
additional_flags=(${verbose_flag})
558-
# Several build targets require explicitly-set binutils format to be passed
559-
# to package.sh (and thus, to merge_libraries), or use LLVM binutils.
560-
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
561-
# MacOS: use LLVM binutils for both X64 and ARM64
556+
# Several build targets require to use LLVM binutils.
557+
if [[ "${{ matrix.sdk_platform }}" == "darwin" || ${{ matrix.sdk_platform }}" == "windows" ]]; then
558+
# MacOS/Windows: use LLVM binutils for all architectures
562559
additional_flags+=(-L)
563-
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x64/"* ]]; then
564-
# Windows x64: force input and output target format
565-
additional_flags+=(-f pe-x86-64,pe-bigobj-x86-64)
566-
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x86/"* ]]; then
567-
# Windows x86: force input and output target format
568-
additional_flags+=(-f pe-i386,pe-bigobj-i386)
569560
fi
570561
sdk-src/build_scripts/desktop/package.sh -b ${pkg} -o firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package -p ${{ matrix.sdk_platform }} -t bin -d ${variant} -P python3 -j ${additional_flags[*]}
571562
done

0 commit comments

Comments
 (0)