Skip to content

Commit 6509d0f

Browse files
committed
Added static build for protobuf for portable release
1 parent e0363f0 commit 6509d0f

10 files changed

+321
-139
lines changed

.github/workflows/ubuntu_gcc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
- name: Configure CMake
3939
shell: bash
40-
run: cmake -B build -G "Unix Makefiles"
40+
run: cmake -B build -G "Unix Makefiles" -DSHADER_GEN_BUILD_TESTS=ON
4141

4242
- name: Build project
4343
shell: bash
@@ -52,4 +52,4 @@ jobs:
5252
5353
- name: Run tests
5454
shell: bash
55-
run: ctest --test-dir build --parallel $(nproc) --output-on-failure --verbose -C Debug
55+
run: ctest --test-dir build --parallel $(nproc) --output-on-failure --verbose -C Debug -D Experimental

.github/workflows/windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Configure CMake
4747
shell: pwsh
48-
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="$env:Qt6_DIR;${{ github.workspace }}\protobuf-lib\lib\cmake"
48+
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="$env:Qt6_DIR;${{ github.workspace }}\protobuf-lib\lib\cmake" -DSHADER_GEN_BUILD_TESTS=ON
4949

5050
- name: Build project
5151
shell: pwsh
@@ -59,4 +59,4 @@ jobs:
5959
6060
- name: Run tests
6161
shell: pwsh
62-
run: ctest --test-dir build --parallel $env:NUMBER_OF_PROCESSORS --output-on-failure --verbose -C Debug
62+
run: ctest --test-dir build --parallel $env:NUMBER_OF_PROCESSORS --output-on-failure --verbose -C Debug -D Experimental

.github/workflows/windows_gcc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
- name: Configure CMake
3939
shell: msys2 {0}
40-
run: cmake -B build -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make
40+
run: cmake -B build -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DSHADER_GEN_BUILD_TESTS=ON
4141

4242
- name: Build project
4343
shell: msys2 {0}
@@ -55,4 +55,4 @@ jobs:
5555

5656
- name: Run tests
5757
shell: msys2 {0}
58-
run: ctest --test-dir build --parallel $(nproc) --output-on-failure --verbose -C Debug
58+
run: ctest --test-dir build --parallel $(nproc) --output-on-failure --verbose -C Debug -D Experimental

.github/workflows/windows_gcc_build_release.yml

+16-11
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,37 @@ jobs:
2828
install: >-
2929
mingw-w64-x86_64-gcc
3030
mingw-w64-x86_64-qt6-base
31-
mingw-w64-x86_64-protobuf
3231
mingw-w64-x86_64-make
3332
mingw-w64-x86_64-cmake
33+
34+
- name: Build Protobuf
35+
shell: msys2 {0}
36+
run: |
37+
mkdir -p "${{ github.workspace }}/protobuf-lib-static"
38+
echo "Protobuf: '${{ github.workspace }}/protobuf-lib-static'"
39+
chmod +x ./CI/build_static_protobuf.sh
40+
sudo ./CI/build_static_protobuf.sh "${{ github.workspace }}/protobuf-lib-static"
3441
3542
- name: Configure CMake
3643
shell: msys2 {0}
37-
run: cmake -B build -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make
44+
run: cmake -B build -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ github.workspace }}/protobuf-lib-static/lib/cmake"
3845

3946
- name: Build project
4047
shell: msys2 {0}
4148
run: |
42-
cmake --build build --config Debug --parallel $(nproc)
49+
cmake --build build --config Release --parallel $(nproc)
4350
echo "Dependencies for shader-gen.exe"
4451
ldd build/shader-gen
45-
46-
echo "Dependencies for shader-gen-tests.exe"
47-
ldd build/shader-gen-tests
4852
49-
- name: Package executable
53+
- name: Create portable package
5054
shell: msys2 {0}
5155
run: |
52-
cpack --config build/CPackConfig.cmake -G NSIS
56+
cpack --config CPackConfig.cmake -G ZIP --verbose -C Release
57+
working-directory: build
5358

54-
- name: Upload artifact
59+
- name: Upload portable package
5560
uses: actions/upload-artifact@v4
5661
with:
57-
name: ShaderGen-Package
58-
path: build/*.exe
62+
name: ShaderGen-Portable
63+
path: build/*.zip
5964

CI/build_static_protobuf.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Check for the install prefix argument
5+
if [ $# -ne 1 ]; then
6+
echo "Usage: $0 INSTALL_PREFIX"
7+
exit 1
8+
fi
9+
10+
INSTALL_PREFIX=$1
11+
12+
# Fetch the latest tags
13+
PROTOBUF_LATEST_TAG=$(git ls-remote --tags https://github.com/protocolbuffers/protobuf.git | tail -n1 | awk '{print $2}' | awk -F/ '{print $3}' | cut -d^ -f1)
14+
15+
# Build and install Protobuf
16+
echo "Installing Protobuf $PROTOBUF_LATEST_TAG..."
17+
git clone --depth 1 -b "$PROTOBUF_LATEST_TAG" https://github.com/protocolbuffers/protobuf.git
18+
cd protobuf
19+
20+
git submodule update --init --recursive
21+
22+
mkdir build && cd build
23+
24+
cmake .. -G "Unix Makefiles" \
25+
-Dprotobuf_BUILD_TESTS=OFF \
26+
-Dprotobuf_BUILD_CONFORMANCE=OFF \
27+
-Dprotobuf_BUILD_EXAMPLES=OFF \
28+
-Dprotobuf_ABSL_PROVIDER=module \
29+
-DCMAKE_BUILD_TYPE=Release \
30+
-DCMAKE_CXX_STANDARD=17 \
31+
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
32+
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
33+
\
34+
-DABSL_PROPAGATE_CXX_STD=ON \
35+
-DBUILD_TESTING=OFF \
36+
-DABSL_BUILD_TESTING=OFF \
37+
-DABSL_USE_GOOGLETEST_HEAD=OFF \
38+
-DABSL_ENABLE_INSTALL=ON \
39+
-DBUILD_SHARED_LIBS=OFF \
40+
-DABSL_BUILD_MONOLITHIC_SHARED_LIBS=OFF \
41+
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined"
42+
43+
make -j$(nproc)
44+
45+
sudo make install
46+
47+
cd "$GITHUB_WORKSPACE"

0 commit comments

Comments
 (0)