Skip to content

Commit

Permalink
Test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sapd committed Feb 20, 2024
1 parent a5819e0 commit f0fcc88
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
Expand All @@ -25,7 +25,7 @@ jobs:
cd build
make test
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: headsetcontrol.exe
path: build/headsetcontrol.exe
31 changes: 10 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,20 @@ jobs:
include:
- os: ubuntu-latest
triplet: x64-linux
INSTALL_DEPS: sudo apt-get -y install libhidapi-dev
- os: macos-latest
triplet: x64-osx
INSTALL_DEPS: brew install hidapi
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest

- name: Install Dependencies
run: ${{ matrix.INSTALL_DEPS }}

- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
- name: Run CMake with Ninja
uses: lukka/run-cmake@v3
id: runcmake
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildWithCMakeArgs: '-- -v'
buildDirectory: ${{ env.buildDir }}

- name: Run test
run: cd ${{ env.buildDir }} && ctest
vcpkgGitCommitId: 'fba75d09065fcc76a25dcf386b1d00d33f5175af'

- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: 'release'
buildPreset: 'release-build'
testPreset: 'release-test'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ cmake-build-debug/
.vscode/*
*.code-workspace

vcpkg_installed/

.DS_Store
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ project(headsetcontrol LANGUAGES C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
set(CLANG_FORMAT_EXCLUDE_PATTERNS "build/")

set(HIDAPI_BUILD_PP_DATA_DUMP OFF)
set(HIDAPI_BUILD_HIDTEST OFF)

find_package(hidapi REQUIRED)

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -165,6 +168,15 @@ endif()
# ------------------------------------------------------------------------------

add_executable(headsetcontrol ${SOURCE_FILES})

if(APPLE)
# Link against CoreFoundation and IOKit frameworks on macOS
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
find_library(IOKIT_FRAMEWORK IOKit)
find_library(APPKIT_FRAMEWORK AppKit)
target_link_libraries(headsetcontrol ${CORE_FOUNDATION_FRAMEWORK} ${IOKIT_FRAMEWORK} ${APPKIT_FRAMEWORK})
endif()

target_link_libraries(headsetcontrol m ${HIDAPI_LIBRARIES})

install(TARGETS headsetcontrol DESTINATION bin)
Expand Down
71 changes: 71 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"hidden": true,
"description": "Use 'debug' or 'release' presets",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES"
}
},
{
"name": "debug",
"inherits": "default",
"description": "Configure for Debug build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "release",
"inherits": "default",
"description": "Configure for Release build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "default-build",
"hidden": true,
"configurePreset": "default"
},
{
"name": "debug-build",
"inherits": "default-build",
"configurePreset": "debug"
},
{
"name": "release-build",
"inherits": "default-build",
"configurePreset": "release"
}
],
"testPresets": [
{
"name": "default-test",
"hidden": true,
"configurePreset": "default"
},
{
"name": "debug-test",
"inherits": "default-test",
"configurePreset": "debug"
},
{
"name": "release-test",
"inherits": "default-test",
"configurePreset": "release"
}
]
}

7 changes: 7 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "headsetcontrol",
"version-string": "1.0.0",
"dependencies": [
"hidapi"
]
}

0 comments on commit f0fcc88

Please sign in to comment.