diff options
Diffstat (limited to 'vcpkg/ports/nrf-ble-driver')
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/001-arm64-support.patch | 14 | ||||
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/add-include-chrono.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/gcc-11.2.0-compilation.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/portfile.cmake | 66 | ||||
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/support-arm64-osx.diff | 78 | ||||
| -rw-r--r-- | vcpkg/ports/nrf-ble-driver/vcpkg.json | 22 |
6 files changed, 214 insertions, 0 deletions
diff --git a/vcpkg/ports/nrf-ble-driver/001-arm64-support.patch b/vcpkg/ports/nrf-ble-driver/001-arm64-support.patch new file mode 100644 index 0000000..2c97053 --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/001-arm64-support.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 99daa24..9a18ee5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -259,6 +259,9 @@ endforeach(SD_API_VER) + # Additional special linkage libraries + foreach(SD_API_VER ${SD_API_VERS}) + if(WIN32) ++ # arm64-windows support ++ target_link_libraries(${NRF_BLE_DRIVER_${SD_API_VER}_STATIC_LIB} PRIVATE "advapi32") ++ target_link_libraries(${NRF_BLE_DRIVER_${SD_API_VER}_SHARED_LIB} PRIVATE "advapi32") + elseif(APPLE) + target_link_libraries(${NRF_BLE_DRIVER_${SD_API_VER}_STATIC_LIB} PRIVATE "-framework CoreFoundation" "-framework IOKit") + target_link_libraries(${NRF_BLE_DRIVER_${SD_API_VER}_SHARED_LIB} PRIVATE "-framework CoreFoundation" "-framework IOKit") diff --git a/vcpkg/ports/nrf-ble-driver/add-include-chrono.patch b/vcpkg/ports/nrf-ble-driver/add-include-chrono.patch new file mode 100644 index 0000000..55d0b6c --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/add-include-chrono.patch @@ -0,0 +1,12 @@ +diff --git a/src/common/transport/serialization_transport.cpp b/src/common/transport/serialization_transport.cpp +index f916961..5ab0f3a 100644 +--- a/src/common/transport/serialization_transport.cpp ++++ b/src/common/transport/serialization_transport.cpp +@@ -43,6 +43,7 @@ + + #include "ble_common.h" + ++#include <chrono> + #include <iterator> + #include <memory> + #include <sstream> diff --git a/vcpkg/ports/nrf-ble-driver/gcc-11.2.0-compilation.patch b/vcpkg/ports/nrf-ble-driver/gcc-11.2.0-compilation.patch new file mode 100644 index 0000000..5fc659e --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/gcc-11.2.0-compilation.patch @@ -0,0 +1,22 @@ +From 00791acc7c23ac2421102edd42a7fa562cc98bfd Mon Sep 17 00:00:00 2001 +From: Krzysztof Rosinski <krzysiek@jrdltd.co.uk> +Date: Wed, 29 Dec 2021 09:47:40 +0100 +Subject: [PATCH] fix compilation issue (gcc-11.2.0) + +error: 'sleep_for' is not a member of 'std::this_thread' +--- + src/common/transport/uart_transport.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/common/transport/uart_transport.cpp b/src/common/transport/uart_transport.cpp +index 1f063ff2..96e045fb 100644 +--- a/src/common/transport/uart_transport.cpp ++++ b/src/common/transport/uart_transport.cpp +@@ -45,6 +45,7 @@ + #include <mutex> + #include <sstream> + #include <system_error> ++#include <thread> + + #if defined(__APPLE__) + #include <IOKit/serial/ioss.h> diff --git a/vcpkg/ports/nrf-ble-driver/portfile.cmake b/vcpkg/ports/nrf-ble-driver/portfile.cmake new file mode 100644 index 0000000..ca18789 --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/portfile.cmake @@ -0,0 +1,66 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") + message( +"${PORT} currently requires the following libraries from the system package manager: + libudev-dev +These can be installed on Ubuntu systems via sudo apt install libudev-dev" + ) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO NordicSemiconductor/pc-ble-driver + REF v${VERSION}-hex + SHA512 1e8b5882aa3754a29a8f0ec11b8e70390db7ddf7bc50e1318adaaf4cd1ba2b787129d8003f8076ad39c35ec887ef3aeadbcb23fa5100b2be24956d118370cb84 + HEAD_REF master + PATCHES + 001-arm64-support.patch + support-arm64-osx.diff # from https://github.com/NordicSemiconductor/pc-ble-driver/pull/271 + gcc-11.2.0-compilation.patch # from https://github.com/NordicSemiconductor/pc-ble-driver/pull/272 + add-include-chrono.patch +) + +# Ensure that git is found within CMakeLists.txt by appending vcpkg's git executable dirpath to $PATH. +# Git should always be available as it is downloaded during the bootstrap phase. +# Append instead of prepend to $PATH to honor the user's git executable as a general rule. +vcpkg_find_acquire_program(GIT) +get_filename_component(GIT_EXE_PATH "${GIT}" DIRECTORY) +vcpkg_add_to_path("${GIT_EXE_PATH}") + +set(OPTIONS) +if (VCPKG_TARGET_IS_OSX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(OPTIONS "-DARCH=${VCPKG_TARGET_ARCHITECTURE}") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DDISABLE_EXAMPLES=ON + -DDISABLE_TESTS=ON + -DNRF_BLE_DRIVER_VERSION=${VERSION} + -DCONNECTIVITY_VERSION=${VERSION} + ${OPTIONS} + MAYBE_UNUSED_VARIABLES + DISABLE_EXAMPLES + DISABLE_TESTS +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup() + +# Copy hex files into shared folder for package +foreach(HEX_DIR IN ITEMS "sd_api_v2" "sd_api_v3" "sd_api_v5" "sd_api_v6") + set(TARGET_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}/hex/${HEX_DIR}") + file(MAKE_DIRECTORY "${TARGET_DIRECTORY}") + file(INSTALL "${SOURCE_PATH}/hex/${HEX_DIR}" DESTINATION "${TARGET_DIRECTORY}/..") +endforeach() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/nrf-ble-driver/support-arm64-osx.diff b/vcpkg/ports/nrf-ble-driver/support-arm64-osx.diff new file mode 100644 index 0000000..37e22bc --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/support-arm64-osx.diff @@ -0,0 +1,78 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ec7b4d2d7..16c136958 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -298,7 +298,17 @@ include (cmake/clang-dev-tools.cmake) + set(ARCH_SUFFIX "unknown") + + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") +- set(ARCH_SUFFIX "x86_64") ++ if(APPLE) ++ if(${ARCH} STREQUAL not_set OR ${ARCH} STREQUAL x86_64) ++ set(ARCH_SUFFIX "x86_64") ++ elseif(${ARCH} STREQUAL arm64) ++ set(ARCH_SUFFIX "arm64") ++ else() ++ message(FATAL_ERROR "Invalid ARCH_SUFFIX: ARCH=${ARCH}.") ++ endif() ++ else() ++ set(ARCH_SUFFIX "x86_64") ++ endif() + else() + set(ARCH_SUFFIX "x86_32") + endif() +diff --git a/cmake/apple.cmake b/cmake/apple.cmake +index c413cfa7e..cef762cf1 100644 +--- a/cmake/apple.cmake ++++ b/cmake/apple.cmake +@@ -1,4 +1,13 @@ +-set(CMAKE_OSX_ARCHITECTURES "x86_64") ++if(${ARCH} STREQUAL not_set) ++ message(STATUS "macOS Architecture not set, using x86_64 as default.") ++ SET(CMAKE_OSX_ARCHITECTURES "x86_64") ++else() ++ if(${ARCH} STREQUAL x86_64 OR ${ARCH} STREQUAL arm64) ++ set(CMAKE_OSX_ARCHITECTURES "${ARCH}") ++ else() ++ message(FATAL_ERROR "Invalid CMAKE_OSX_ARCHITECTURES: ARCH=${ARCH}.") ++ endif() ++endif() + + set(CMAKE_SKIP_BUILD_RPATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +diff --git a/cmake/nrf-ble-driver.cmake b/cmake/nrf-ble-driver.cmake +index d81608c72..467afd0e9 100644 +--- a/cmake/nrf-ble-driver.cmake ++++ b/cmake/nrf-ble-driver.cmake +@@ -8,7 +8,7 @@ math(EXPR COMPILER_ARCH_BITS "8*${CMAKE_SIZEOF_VOID_P}") + # Default to compiler architecture + set(ARCH_BITS ${COMPILER_ARCH_BITS}) + +-SET(ARCH not_set CACHE STRING "Architecture (x86_32 or x86_64)") ++SET(ARCH not_set CACHE STRING "Architecture (x86_32, x86_64, arm or arm64)") + string(TOLOWER "${ARCH}" ARCH) + + if(${ARCH} STREQUAL not_set) +@@ -16,17 +16,19 @@ if(${ARCH} STREQUAL not_set) + else() + if(MSVC) + message(FATAL_ERROR "ARCH not available with MSVC. Use -G \"Visual Studio XX <Win64>\" instead.") +- elseif(APPLE) +- message(FATAL_ERROR "ARCH not available on macOS / OS X. Universal 32 and 64-bit binaries will be built.") + endif() + if(${ARCH} STREQUAL x86_32) + set(ARCH_BITS 32) + elseif(${ARCH} STREQUAL x86_64) + set(ARCH_BITS 64) ++ elseif(${ARCH} STREQUAL arm) ++ set(ARCH_BITS 32) ++ elseif(${ARCH} STREQUAL arm64) ++ set(ARCH_BITS 64) + else() + message(FATAL_ERROR "Invalid architecture: ARCH=${ARCH}.") + endif() +- message(STATUS "Building ${ARCH_BITS}-bit targets with ${COMPILER_ARCH_BITS}-bit toolchain.") ++ message(STATUS "Building ${ARCH} ${ARCH_BITS}-bit targets with ${COMPILER_ARCH_BITS}-bit toolchain.") + endif() + + if(NOT MSVC) diff --git a/vcpkg/ports/nrf-ble-driver/vcpkg.json b/vcpkg/ports/nrf-ble-driver/vcpkg.json new file mode 100644 index 0000000..5f341cd --- /dev/null +++ b/vcpkg/ports/nrf-ble-driver/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "nrf-ble-driver", + "version": "4.1.4", + "port-version": 2, + "description": "BLE driver is a library for Bluetooth Low Energy communication using Nordic Semiconductor development kits.", + "homepage": "https://github.com/NordicSemiconductor/pc-ble-driver", + "license": "BSD-3-Clause", + "supports": "!uwp", + "dependencies": [ + "asio", + "cli11", + "spdlog", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |