Skip to content

Commit 015e2ee

Browse files
feat: add boost (#476)
1 parent e0d5524 commit 015e2ee

File tree

9 files changed

+1570
-18
lines changed

9 files changed

+1570
-18
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,70 +27,85 @@ env:
2727

2828
jobs:
2929
build:
30-
name: Build (${{ matrix.name }})
30+
name: Build ${{ matrix.build }} (${{ matrix.name }})
3131
runs-on: ${{ matrix.os }}
32-
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
33-
# https://trac.ffmpeg.org/wiki/CompilationGuide/macOS
34-
# https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW
3532
strategy:
36-
fail-fast: false # false to test all, true to fail entire job if any fail
33+
fail-fast: false
3734
matrix:
3835
include:
39-
- name: Linux-x86_64 # ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
36+
# name: ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
37+
- name: Linux-x86_64
4038
os: ubuntu-22.04
4139
arch: x86_64
4240
generator: "Unix Makefiles"
4341
shell: bash
42+
build: ALL
4443
- name: Linux-aarch64
4544
os: ubuntu-22.04
4645
arch: aarch64
4746
generator: "Unix Makefiles"
4847
shell: bash
4948
target: aarch64-linux-gnu
49+
build: ALL
5050
- name: Linux-ppc64le
5151
os: ubuntu-22.04
5252
arch: powerpc64le
5353
generator: "Unix Makefiles"
5454
shell: bash
5555
target: powerpc64le-linux-gnu
56+
build: FFMPEG # https://github.com/boostorg/context/issues/311
5657
- name: Darwin-x86_64
5758
os: macos-13
5859
arch: x86_64
5960
generator: "Unix Makefiles"
6061
shell: bash
6162
target: x86_64-apple-macosx
63+
build: ALL
6264
- name: Darwin-arm64
6365
os: macos-14
6466
arch: aarch64
6567
generator: "Unix Makefiles"
6668
shell: bash
6769
target: arm64-apple-macosx
70+
build: ALL
6871
- name: Windows-AMD64
6972
os: windows-2022
7073
arch: x86_64
7174
generator: "MSYS Makefiles"
7275
shell: msys2 {0}
7376
msystem: ucrt64
7477
toolchain: ucrt-x86_64
78+
build: BOOST
79+
- name: Windows-AMD64
80+
os: windows-2022
81+
arch: x86_64
82+
generator: "MSYS Makefiles"
83+
shell: msys2 {0}
84+
msystem: ucrt64
85+
toolchain: ucrt-x86_64
86+
build: FFMPEG
7587
- name: Windows-ARM64
7688
os: windows-11-arm
7789
arch: aarch64
7890
generator: "MSYS Makefiles"
7991
shell: msys2 {0}
8092
msystem: clangarm64
8193
toolchain: clang-aarch64
94+
build: ALL
8295
- name: FreeBSD-amd64
8396
os: ubuntu-latest
8497
arch: x86_64
8598
bsd_release: '14.3'
8699
generator: "Unix Makefiles"
87100
shell: freebsd {0}
101+
build: ALL
88102
- name: FreeBSD-aarch64
89103
os: ubuntu-latest # ubuntu-24.04-arm is slower with the FreeBSD VM
90104
arch: aarch64
91105
bsd_release: '14.3'
92106
generator: "Unix Makefiles"
93107
shell: freebsd {0}
108+
build: ALL
94109
defaults:
95110
run:
96111
shell: ${{ matrix.shell }}
@@ -327,6 +342,7 @@ jobs:
327342
"diffutils"
328343
"git"
329344
"make"
345+
"patch"
330346
"pkg-config"
331347
"mingw-w64-${TOOLCHAIN}-binutils"
332348
"mingw-w64-${TOOLCHAIN}-cmake"
@@ -489,6 +505,8 @@ jobs:
489505
-B build \
490506
-S . \
491507
-G "${{ matrix.generator }}" \
508+
-DBUILD_ALL=OFF \
509+
-DBUILD_${{ matrix.build }}=ON \
492510
-DCMAKE_TOOLCHAIN_FILE=${{ env.CMAKE_TOOLCHAIN_FILE }} \
493511
-DCMAKE_INSTALL_PREFIX="${{ env.ROOT_PATH }}/build/dist" \
494512
-DPARALLEL_BUILDS=${{ steps.processor_count.outputs.PROCESSOR_COUNT || 1 }}
@@ -506,7 +524,9 @@ jobs:
506524
${{ env.MAKE_CMD }} -C build install
507525
508526
- name: Debug logs
509-
if: always()
527+
if: >-
528+
always() &&
529+
matrix.build == 'FFMPEG'
510530
shell: bash
511531
run: |
512532
echo "::group::x264 config.log"
@@ -529,15 +549,26 @@ jobs:
529549

530550
- name: Cleanup
531551
shell: bash
532-
run: rm -f -r ./build/dist/share
552+
run: |
553+
rm -f -r ./build/dist/share
554+
rm -f -r ./build/dist/lib/cmake
533555
534556
- name: Upload Artifacts
535557
uses: actions/upload-artifact@v4
536558
with:
537559
if-no-files-found: error
538-
name: ${{ matrix.name }}
560+
name: ${{ matrix.name }}-${{ matrix.build }}
539561
path: ./build/dist
540562

563+
conclusion:
564+
name: Conclusion
565+
needs: build
566+
runs-on: ubuntu-latest
567+
steps:
568+
# this job is simply used for branch protection rules so we don't have to add every matrix combination
569+
- name: Check build status
570+
run: echo "Build succeeded"
571+
541572
update_dist:
542573
# only the commit is conditional, so the rest of the job can be verified on PRs
543574
name: Update dist

CMakeLists.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ project(build-deps
77

88
# Main options
99
option(BUILD_ALL "Build all dependencies" ON)
10-
option(BUILD_ALL_SUNSHINE "Build all Sunshine dependencies" ON)
10+
option(BUILD_ALL_LIBDISPLAYDEVICE "Build all libdisplaydevice dependencies" OFF)
11+
option(BUILD_ALL_SUNSHINE "Build all Sunshine dependencies" OFF)
12+
13+
# Boost options
14+
option(BUILD_BOOST "Build Boost" OFF)
15+
option(BUILD_BOOST_LIBDISPLAYDEVICE "Build boost for libdisplaydevice" ON)
16+
option(BUILD_BOOST_SUNSHINE "Build boost for Sunshine" ON)
1117

1218
# FFmpeg options
13-
option(BUILD_FFMPEG "Build FFmpeg" ON)
19+
option(BUILD_FFMPEG "Build FFmpeg" OFF)
1420
option(BUILD_FFMPEG_ALL_PATCHES "Apply FFmpeg patches" ON)
1521
option(BUILD_FFMPEG_AMF "Build FFmpeg AMF" ON)
1622
option(BUILD_FFMPEG_AMF_PATCHES "Apply FFmpeg AMF patches" ON)
@@ -33,6 +39,10 @@ option(BUILD_FFMPEG_X265_PATCHES "Apply FFmpeg x265 patches" ON)
3339
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/apply_git_patch.cmake)
3440
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/unix_path.cmake)
3541

42+
# CPM
43+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpm/CPM.cmake)
44+
CPMUsePackageLock(package-lock.cmake)
45+
3646
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
3747
set(FREEBSD ON)
3848
endif()
@@ -200,6 +210,15 @@ message(STATUS "Detected system name: ${CMAKE_SYSTEM_NAME}")
200210
message(STATUS "Detected architecture: ${CMAKE_SYSTEM_PROCESSOR}")
201211
message(STATUS "CI Matrix name should be: '${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}'")
202212

213+
# boost
214+
# TODO: boost build fails on Windows due to NASM errors during configure?
215+
# https://github.com/Orphis/boost-cmake/issues/42
216+
# https://github.com/libsdl-org/SDL/issues/10250
217+
if(BUILD_ALL OR BUILD_ALL_LIBDISPLAYDEVICE OR BUILD_ALL_SUNSHINE OR BUILD_BOOST)
218+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/_main.cmake)
219+
endif()
220+
221+
# FFmpeg
203222
if(BUILD_ALL OR BUILD_ALL_SUNSHINE OR BUILD_FFMPEG)
204223
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ffmpeg/_main.cmake)
205224
endif()

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
This is a common set of pre-compiled dependencies for [LizardByte/Sunshine](https://github.com/LizardByte/Sunshine).
66

7+
- [Boost](https://www.boost.org)
78
- [FFmpeg](https://ffmpeg.org)
89

910
## Usage
@@ -17,13 +18,6 @@ This is a common set of pre-compiled dependencies for [LizardByte/Sunshine](http
1718
checkout dist
1819
```
1920

20-
## Plans
21-
22-
- [ ] Add more dependencies
23-
- [ ] boost
24-
- [ ] cuda (developer toolkit)
25-
- [ ] build linux dependencies in Docker (to more closely align with target environments)
26-
2721
## License
2822

2923
This repo is licensed under the MIT License, but this does not cover submodules or patches.
@@ -159,6 +153,7 @@ pacman -S \
159153
diffutils \
160154
git \
161155
make \
156+
patch \
162157
pkg-config \
163158
mingw-w64-ucrt-x86_64-binutils \
164159
mingw-w64-ucrt-x86_64-cmake \
@@ -179,6 +174,7 @@ pacman -S \
179174
diffutils \
180175
git \
181176
make \
177+
patch \
182178
pkg-config \
183179
mingw-w64-clang-aarch64-binutils \
184180
mingw-w64-clang-aarch64-cmake \

cmake/boost/_main.cmake

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
CPMGetPackage(Boost)
2+
3+
if(BUILD_BOOST_SUNSHINE)
4+
set(BUILD_BOOST_LIBDISPLAYDEVICE ON)
5+
endif()
6+
7+
list(APPEND BOOST_COMPONENTS_BASE
8+
asio
9+
crc
10+
format
11+
process
12+
property_tree
13+
)
14+
15+
if(BUILD_BOOST_LIBDISPLAYDEVICE)
16+
list(APPEND BOOST_COMPONENTS
17+
algorithm
18+
preprocessor
19+
scope
20+
uuid
21+
)
22+
endif()
23+
if(BUILD_BOOST_SUNSHINE)
24+
list(APPEND BOOST_COMPONENTS
25+
filesystem
26+
locale
27+
log
28+
program_options
29+
system
30+
)
31+
endif()
32+
33+
set(BOOST_ENABLE_CMAKE ON) # Use experimental superproject to pull library dependencies recursively
34+
set(BOOST_INCLUDE_LIBRARIES ${BOOST_COMPONENTS_BASE} ${BOOST_COMPONENTS})
35+
set(BOOST_SKIP_INSTALL_RULES OFF) # disabled to allow installation of Boost libraries
36+
set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103
37+
38+
message(STATUS "Boost_BINARY_DIR: ${Boost_BINARY_DIR}")
39+
message(STATUS "Boost_SOURCE_DIR: ${Boost_SOURCE_DIR}")
40+
41+
if(WIN32)
42+
# Windows build is failing to create header file in this directory
43+
file(MAKE_DIRECTORY ${Boost_BINARY_DIR}/libs/log/src/windows)
44+
endif()
45+
46+
add_subdirectory(${Boost_SOURCE_DIR} ${Boost_BINARY_DIR} SYSTEM)

cmake/cpm/.cmake-lint-ignore

Whitespace-only changes.

0 commit comments

Comments
 (0)