-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from thegecko/simple-ble
Simple BLE
- Loading branch information
Showing
37 changed files
with
4,433 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
build | ||
dist | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
|
||
updates: | ||
# Maintain dependencies for the JavaScript package | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: yarn install --ignore-scripts | ||
- run: yarn build:ts |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: yarn install --ignore-scripts | ||
- run: yarn build:ts | ||
- name: Deploy to gh-pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs | ||
enable_jekyll: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: prebuild | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
prebuild: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: darwin | ||
os: macos-latest | ||
node: x64 | ||
- name: win32-x86 | ||
os: windows-latest | ||
node: x86 | ||
- name: win32-x64 | ||
os: windows-latest | ||
node: x64 | ||
- name: linux-x64 | ||
os: ubuntu-latest | ||
node: x64 | ||
name: Build ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- if: matrix.node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
architecture: ${{ matrix.node }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- if: contains(matrix.os, 'ubuntu') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libdbus-1-dev | ||
- if: contains(matrix.os, 'macos') | ||
uses: jwlawson/actions-setup-cmake@v1.12 | ||
with: | ||
cmake-version: '3.21.x' | ||
- if: contains(matrix.os, 'windows') | ||
uses: microsoft/setup-msbuild@v1.0.2 | ||
- run: yarn install --ignore-scripts | ||
- run: yarn prebuild | ||
- run: tar -zcvf ${{ matrix.name }}.tar.gz -C prebuilds . | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.name }} | ||
path: ${{ matrix.name }}.tar.gz | ||
retention-days: 1 | ||
release: | ||
needs: prebuild | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts | ||
- uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: artifacts/*/*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.DS_Store | ||
node_modules | ||
build | ||
prebuilds | ||
dist | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "SimpleBLE"] | ||
path = SimpleBLE | ||
url = https://github.com/OpenBluetoothToolbox/SimpleBLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
cmake_policy(SET CMP0091 NEW) | ||
cmake_policy(SET CMP0042 NEW) | ||
|
||
project(webbluetooth) | ||
|
||
if (APPLE) | ||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "macOS architecture" FORCE) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "macOS target" FORCE) | ||
elseif(WIN32) | ||
set(CMAKE_SYSTEM_VERSION "10.0.22000.0" CACHE STRING "Windows version" FORCE) | ||
endif() | ||
|
||
add_subdirectory(SimpleBLE/simpleble) | ||
|
||
# Add Node bindings. | ||
execute_process(COMMAND node -p "require('node-addon-api').include_dir" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE NODE_ADDON_API_DIR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
add_library(simpleble-node SHARED | ||
lib/adapter.h | ||
lib/adapter.cpp | ||
lib/bindings.cpp | ||
lib/peripheral.h | ||
lib/peripheral.cpp | ||
${CMAKE_JS_SRC} | ||
) | ||
target_include_directories(simpleble-node PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/lib | ||
${CMAKE_JS_INC} | ||
${NODE_ADDON_API_DIR} | ||
) | ||
target_link_libraries(simpleble-node PRIVATE simpleble-c ${CMAKE_JS_LIB}) | ||
target_compile_definitions(simpleble-node PRIVATE NAPI_VERSION=6) | ||
set_target_properties(simpleble-node PROPERTIES | ||
OUTPUT_NAME "simpleble" | ||
CXX_STANDARD 17 | ||
PREFIX "" | ||
SUFFIX ".node" | ||
) | ||
|
||
if (MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) | ||
# Generate node.lib | ||
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) | ||
endif() |
Oops, something went wrong.