Skip to content

Commit b0036cf

Browse files
feat: add boost
1 parent e0d5524 commit b0036cf

9 files changed

Lines changed: 1560 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,27 @@ 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:
35+
name: # these are ordered by average build time, longest first
36+
# ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
37+
- FreeBSD-aarch64
38+
- FreeBSD-amd64
39+
- Windows-AMD64
40+
- Windows-ARM64
41+
- Darwin-arm64
42+
- Darwin-x86_64
43+
- Linux-aarch64
44+
- Linux-ppc64le
45+
- Linux-x86_64
46+
build:
47+
- BOOST
48+
- FFMPEG
3849
include:
39-
- name: Linux-x86_64 # ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
50+
- name: Linux-x86_64
4051
os: ubuntu-22.04
4152
arch: x86_64
4253
generator: "Unix Makefiles"
@@ -91,6 +102,9 @@ jobs:
91102
bsd_release: '14.3'
92103
generator: "Unix Makefiles"
93104
shell: freebsd {0}
105+
exclude:
106+
- name: Linux-ppc64le # https://github.com/boostorg/context/issues/311
107+
build: BOOST
94108
defaults:
95109
run:
96110
shell: ${{ matrix.shell }}
@@ -327,6 +341,7 @@ jobs:
327341
"diffutils"
328342
"git"
329343
"make"
344+
"patch"
330345
"pkg-config"
331346
"mingw-w64-${TOOLCHAIN}-binutils"
332347
"mingw-w64-${TOOLCHAIN}-cmake"
@@ -489,6 +504,8 @@ jobs:
489504
-B build \
490505
-S . \
491506
-G "${{ matrix.generator }}" \
507+
-DBUILD_ALL=OFF \
508+
-DBUILD_${{ matrix.build }}=ON \
492509
-DCMAKE_TOOLCHAIN_FILE=${{ env.CMAKE_TOOLCHAIN_FILE }} \
493510
-DCMAKE_INSTALL_PREFIX="${{ env.ROOT_PATH }}/build/dist" \
494511
-DPARALLEL_BUILDS=${{ steps.processor_count.outputs.PROCESSOR_COUNT || 1 }}
@@ -506,7 +523,9 @@ jobs:
506523
${{ env.MAKE_CMD }} -C build install
507524
508525
- name: Debug logs
509-
if: always()
526+
if: >-
527+
always() &&
528+
matrix.build == 'FFMPEG'
510529
shell: bash
511530
run: |
512531
echo "::group::x264 config.log"
@@ -529,13 +548,15 @@ jobs:
529548

530549
- name: Cleanup
531550
shell: bash
532-
run: rm -f -r ./build/dist/share
551+
run: |
552+
rm -f -r ./build/dist/share
553+
rm -f -r ./build/dist/lib/cmake
533554
534555
- name: Upload Artifacts
535556
uses: actions/upload-artifact@v4
536557
with:
537558
if-no-files-found: error
538-
name: ${{ matrix.name }}
559+
name: ${{ matrix.name }}-${{ matrix.build }}
539560
path: ./build/dist
540561

541562
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)