Skip to content

Commit 2c2d73f

Browse files
committed
Enable CMake workflows for Windows/Linux x64/arm64
1 parent eb4d40e commit 2c2d73f

3 files changed

Lines changed: 50 additions & 125 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 36 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name: Build
33
on:
44
push:
55
branches:
6-
- master
6+
- rewrite
77
pull_request:
88
branches:
9-
- master
9+
- rewrite
1010
workflow_dispatch:
1111

12-
env:
13-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
12+
env:
1413
BUILD_TYPE: RelWithDebInfo
1514

1615
jobs:
@@ -21,24 +20,31 @@ jobs:
2120
include:
2221
- os: ubuntu-24.04
2322
arch: x64
24-
binary_path: build/SonyHeadphonesClient
23+
binary_path: build/client/SonyHeadphonesClient
2524
artifact_name: "SonyHeadphonesClient-linux-x64"
26-
script: "sudo apt-get update && sudo apt-get install libbluetooth-dev libdbus-1-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules xorg-dev"
25+
script: "sudo apt-get update && sudo apt-get install -y libbluetooth-dev libdbus-1-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules xorg-dev llvm-18-dev libclang-18-dev libcurl4-openssl-dev"
2726
gcc: 14
27+
# ARM Linux runners currently has availablity issues.
28+
# TODO: Enable these once these are fixed.
29+
# https://github.com/actions/partner-runner-images/issues/132
30+
# https://github.com/actions/partner-runner-images/issues/65
31+
# - os: ubuntu-24.04-arm64
32+
# arch: arm64
33+
# binary_path: build/client/SonyHeadphonesClient
34+
# artifact_name: "SonyHeadphonesClient-linux-arm64"
35+
# script: "sudo apt-get update && sudo apt-get install -y libbluetooth-dev libdbus-1-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules xorg-dev llvm-18-dev libclang-18-dev libcurl4-openssl-dev"
36+
# gcc: 14
2837
- os: windows-latest
2938
arch: x64
30-
binary_path: build/RelWithDebInfo/SonyHeadphonesClient.exe
39+
binary_path: build/client/RelWithDebInfo/SonyHeadphonesClient.exe
3140
artifact_name: "SonyHeadphonesClient-win-x64"
3241
script: ""
3342
- os: windows-latest
34-
arch: ARM64
35-
binary_path: build/RelWithDebInfo/SonyHeadphonesClient.exe
43+
arch: arm64
44+
binary_path: build/client/RelWithDebInfo/SonyHeadphonesClient.exe
3645
artifact_name: "SonyHeadphonesClient-win-arm64"
3746
script: ""
38-
- os: macos-latest
39-
arch: universal
40-
binary_path: build/SonyHeadphonesClient.zip
41-
artifact_name: "SonyHeadphonesClient-macOS"
47+
4248
runs-on: ${{ matrix.os }}
4349

4450
steps:
@@ -54,128 +60,35 @@ jobs:
5460
# We'll use this as our working directory for all subsequent commands
5561
run: cmake -E make_directory ${{github.workspace}}/build
5662

57-
- name: Configure CMake
58-
# Use a bash shell so we can use the same syntax for environment variable
59-
# access regardless of the host operating system
60-
shell: bash
61-
working-directory: ${{github.workspace}}/build
62-
# Note the current convention is to use the -S and -B options here to specify source
63-
# and build directories, but this is only available with CMake 3.13 and higher.
64-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
65-
run: |
66-
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
67-
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -A ${{ matrix.arch }}
68-
else
69-
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
70-
fi
71-
72-
- name: Configure CMake (macOS)
73-
if: runner.os == 'macOS'
74-
# Use a bash shell so we can use the same syntax for environment variable
75-
# access regardless of the host operating system
76-
shell: bash
77-
working-directory: ${{github.workspace}}/build
78-
# Note the current convention is to use the -S and -B options here to specify source
79-
# and build directories, but this is only available with CMake 3.13 and higher.
80-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
81-
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
82-
63+
- name: Configure CMake (Windows)
64+
working-directory: ${{github.workspace}}/build
65+
if: runner.os == 'Windows'
66+
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -A ${{ matrix.arch }}
67+
68+
- name: Configure CMake (Linux)
69+
env:
70+
CC: gcc-${{ matrix.gcc }}
71+
CXX: g++-${{ matrix.gcc }}
72+
working-directory: ${{github.workspace}}/build
73+
if: runner.os == 'Linux'
74+
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
75+
8376
- name: Build
8477
working-directory: ${{github.workspace}}/build
8578
shell: bash
8679
# Execute the build. You can specify a specific target with "--target <NAME>"
87-
run: cmake --build . --config $BUILD_TYPE
88-
89-
- name: Zip the App Bundle (macOS)
90-
if: runner.os == 'macOS'
91-
working-directory: ${{github.workspace}}/build
92-
# Zip the application for easier downloading
93-
run: zip -r SonyHeadphonesClient.zip SonyHeadphonesClient.app
80+
run: cmake --build . --config $BUILD_TYPE --target SonyHeadphonesClient
9481

9582
- name: Strip Symbols (Linux)
9683
if: runner.os == 'Linux'
97-
working-directory: ${{github.workspace}}/build
84+
working-directory: ${{github.workspace}}
9885
# Strip symbols from the binary to reduce size
99-
run: strip --strip-unneeded SonyHeadphonesClient
86+
run: strip --strip-unneeded ${{matrix.binary_path}}
10087

10188
- name: Upload a Build Artifact
10289
uses: actions/upload-artifact@v4
10390
with:
10491
# Artifact name
10592
name: ${{ matrix.artifact_name }}
10693
# A file, directory or wildcard pattern that describes what to upload
107-
path: ${{github.workspace}}/${{matrix.binary_path}}
108-
# The desired behavior if no files are found using the provided path.
109-
110-
release:
111-
name: Release
112-
if: "contains(github.event.head_commit.message, 'Version')"
113-
needs: ["build"]
114-
runs-on: ubuntu-latest
115-
116-
steps:
117-
- name : Get Version
118-
id : get_version
119-
run : |
120-
version=$(echo "${{ github.event.head_commit.message }}" | awk 'NR==1' | awk '{print $2}')
121-
echo "::set-output name=version::$version"
122-
123-
- uses: actions/checkout@v3
124-
125-
- name: Create Release
126-
id: create_release
127-
uses: actions/create-release@v1
128-
env:
129-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130-
with:
131-
tag_name: ${{ steps.get_version.outputs.version }}
132-
release_name: Version ${{ steps.get_version.outputs.version }}
133-
134-
- uses: actions/download-artifact@v4
135-
with:
136-
path: ${{github.workspace}}/artifacts
137-
138-
- name: Display structure of downloaded files
139-
run: ls -R ${{github.workspace}}/artifacts
140-
141-
- uses: actions/upload-release-asset@v1.0.1
142-
env:
143-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144-
with:
145-
upload_url: ${{ steps.create_release.outputs.upload_url }}
146-
asset_path: ${{github.workspace}}/artifacts/SonyHeadphonesClient-linux-x64/SonyHeadphonesClient
147-
asset_name: SonyHeadphonesClient-linux-x64
148-
asset_content_type: application/octet-stream
149-
150-
- uses: actions/upload-release-asset@v1.0.1
151-
env:
152-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153-
with:
154-
upload_url: ${{ steps.create_release.outputs.upload_url }}
155-
asset_path: ${{github.workspace}}/artifacts/SonyHeadphonesClient-win-x64/SonyHeadphonesClient.exe
156-
asset_name: SonyHeadphonesClient-win-x64.exe
157-
asset_content_type: application/vnd.microsoft.portable-executable
158-
159-
- uses: actions/upload-release-asset@v1.0.1
160-
env:
161-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162-
with:
163-
upload_url: ${{ steps.create_release.outputs.upload_url }}
164-
asset_path: ${{github.workspace}}/artifacts/SonyHeadphonesClient-win-arm64/SonyHeadphonesClient.exe
165-
asset_name: SonyHeadphonesClient-win-arm64.exe
166-
asset_content_type: application/vnd.microsoft.portable-executable
167-
168-
- uses: actions/upload-release-asset@v1.0.1
169-
env:
170-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
171-
with:
172-
upload_url: ${{ steps.create_release.outputs.upload_url }}
173-
asset_path: ${{github.workspace}}/artifacts/SonyHeadphonesClient-macOS/SonyHeadphonesClient.zip
174-
asset_name: SonyHeadphonesClient-macOS.zip
175-
asset_content_type: application/zip
176-
177-
- uses: eregon/publish-release@v1
178-
env:
179-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180-
with:
181-
release_id: ${{ steps.create_release.outputs.id }}
94+
path: ${{github.workspace}}/${{matrix.binary_path}}

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ SonyHeadphonesClient
33

44
A spiritual successor to [Plutoberth's original SonyHeadphonesClient](https://github.com/Plutoberth/SonyHeadphonesClient) - now with standardized support for newer devices and more platforms.
55

6+
There's no release build yet - but you can always grab the latest [nightly builds](https://nightly.link/mos9527/SonyHeadphonesClient/workflows/cmake/rewrite?preview), or use the [Web Version](#notes-on-web-platform).
7+
8+
[![Build](https://github.com/mos9527/sonyheadphonesclient/actions/workflows/cmake.yml/badge.svg)](https://github.com/mos9527/SonyHeadphonesClient/actions/workflows/cmake.yml)
9+
[![Nightly Builds](https://img.shields.io/badge/rewrite-builds-cyan)](https://nightly.link/mos9527/SonyHeadphonesClient/workflows/cmake/rewrite?preview)
10+
11+
## Roadmap
12+
This brach is expected to be merged once the following features have been implemented.
13+
- [ ] Support for legacy (`v1` protocol) devices, e.g. WH-1000XM4, WH-1000XM3
14+
- [ ] Native macOS platform support
15+
616
## Compatiblity
717

818
The following platforms (applies to `libmdr`, `client`) are *natively* supported with first-party effort.
@@ -29,6 +39,8 @@ As always, status reports are welcome - please do submit an Issue if your browse
2939

3040
We have extensive documentations available in the source files. Moreover, refer to the respective README files in each source folder to understand what they do!
3141

42+
A C++20 compliant compiler is required. GCC 14, Clang 21 and MSVC 19 has been used for development and are guanrateed to be supported.
43+
3244
### Building (Regular CMake)
3345
This is no different from your regular CMake projects.
3446
Dependencies are managed by CMake's `FetchContent` and are always statically linked, so no worries - Expect things to *just work*.

libmdr/src/Platform/Linux/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ file(
1212
add_library(mdr_PlatformLinux ${SOURCES} ${INCLUDES})
1313
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
1414
find_package(DBus REQUIRED)
15-
message(STATUS "Found DBus: ${DBus_INCLUDE_DIRS}")
15+
message(STATUS "Found DBus: ${DBus_INCLUDE_DIRS} ${DBus_LIBRARIES}")
1616

17-
target_link_libraries(mdr_PlatformLinux PRIVATE mdr-c fmt::fmt ${DBUS_LIBRARIES} bluetooth)
17+
target_link_libraries(mdr_PlatformLinux PRIVATE mdr-c fmt::fmt ${DBus_LIBRARIES} bluetooth)
1818
target_include_directories(mdr_PlatformLinux PRIVATE ${DBus_INCLUDE_DIRS})

0 commit comments

Comments
 (0)