Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
316e17d
WIP: XLink server as separate library
themarpe May 25, 2022
acfdb75
Reverted separate server library and combined into one. Fixed server …
themarpe May 30, 2022
b28e6ee
Added KB platform (tmp) and exposed discovery state
themarpe May 31, 2022
f3d7b00
Added XLinkWrite2 - multipart message sending functionality
themarpe Jun 1, 2022
5b8fa8b
Fixed multipart write function
themarpe Jun 13, 2022
a1647b0
Added additional logging for not being able to retrieve USB handle by…
themarpe Jun 16, 2022
3c7b655
Merge branch 'develop' into develop_server
themarpe Jul 13, 2022
0762e11
Added KeemBay platform and Gate state with new discovery message
themarpe Jul 30, 2022
4cb7c9c
Fixed enum underlying type specifier
themarpe Aug 1, 2022
38a4126
Added new discovery command and callback on link down
themarpe Aug 1, 2022
e3bd353
Fixed wrong pointer being sent to DispatcherStart
themarpe Aug 1, 2022
fae3d20
Merge remote-tracking branch 'origin/develop' into develop_server
themarpe Aug 1, 2022
1aad358
Added GATE_BOOTED state
themarpe Sep 10, 2022
4104fff
Merge branch 'develop' into develop_server
themarpe Nov 14, 2022
c059f22
Refactored Device Discovery and added Windows support
themarpe Nov 19, 2022
b14a3c0
Further improvements and fixes after merge
themarpe Nov 19, 2022
624b1a8
Added missing <atomic> include
themarpe Nov 19, 2022
d1dda6e
Removed unnecessary prints
themarpe Nov 19, 2022
a555e38
Added another example and added all build folders to gitignore
themarpe Dec 3, 2022
a2416aa
Fixed device discovery
themarpe Dec 4, 2022
bc69651
Added another server example
themarpe Dec 4, 2022
73854b1
Renamed some enums
themarpe Dec 7, 2022
8fe202c
Merge branch 'develop_server' of github.com:luxonis/XLink into develo…
themarpe Dec 7, 2022
27d2ebe
Added a print for the recv errno
themarpe Jan 6, 2023
ee1d299
Aliased FLASH_BOOTED to BOOTED_NON_EXCLUSIVE, removed GATE_BOOTED
themarpe Jan 13, 2023
81eb803
Reverted back removal of GATE_BOOTED state
themarpe Jan 13, 2023
8c62def
Merge branch 'develop' into develop_server
themarpe Feb 8, 2023
b647b55
Added platform based filtering for TCP protocol
themarpe Feb 22, 2023
8bc779b
Merge branch 'develop' into develop_server
themarpe May 16, 2023
33b4f58
Merge remote-tracking branch 'origin/develop' into develop_server
themarpe May 29, 2023
cc852cb
Addressed Server shutdown, improved error handling, and added TCP_QUI…
themarpe May 30, 2023
4767a26
Fixed some issues and warnings
themarpe May 30, 2023
2dd6c7f
Added RVC3 discovery and find_device example
themarpe May 30, 2023
71191dd
Fix the device discovery for RVC3
Jul 24, 2023
1329ef4
Merge remote-tracking branch 'origin/develop' into develop_server_merge
Dec 14, 2023
8ec315a
Add initial RVC4 support
Jan 5, 2024
19e6c45
Merge pull request #75 from luxonis/develop_server_rvc4
moratom Jan 6, 2024
ffdc77f
Added ability to get send time from XLinkWriteData call
asahtik Jan 17, 2024
960966a
Change api to use struct timespec instead of XLinkTimespec
asahtik Jan 18, 2024
164fd93
Formatting
asahtik Jan 18, 2024
c1a1af6
Revert "Change api to use struct timespec instead of XLinkTimespec"
asahtik Jan 18, 2024
6cae006
Merge pull request #76 from luxonis/rvc3_timesync_improvements
asahtik Feb 7, 2024
0617093
erge remote-tracking branch 'origin/develop_server_merge' into develo…
Feb 9, 2024
9f17ea0
Added X_LINK_LOCAL_SHDMEM protocol skeleton
TheMutta Jun 11, 2024
c4d4c45
Examples added.
TheMutta Jun 11, 2024
03539a3
Added checks for shdmem functions to compile only in Linux system
TheMutta Jun 12, 2024
283bbdc
Removed #warning directive.
TheMutta Jun 12, 2024
5562d45
Using correct FD for socket and not including headears on non-unix fu…
TheMutta Jun 12, 2024
3faa07c
Added XLINK_READ_FD and XLINK_WRITE_FD operations
TheMutta Jun 12, 2024
8aa655b
Removed binary files.
TheMutta Jun 12, 2024
bdbc176
Revert "Removed binary files."
TheMutta Jun 12, 2024
4cc25ab
Revert "Added XLINK_READ_FD and XLINK_WRITE_FD operations"
TheMutta Jun 12, 2024
4603388
Added XLINK_WRITE_FD_REQ with XLinkWriteFd function to send over FDs
TheMutta Jun 12, 2024
685245b
Adding include files with definitions for XLINK_WRITE_FD_REQ with XLi…
TheMutta Jun 12, 2024
43e39d6
Working examples
TheMutta Jun 12, 2024
011eab6
Fixed naming convention in the examples.
TheMutta Jun 12, 2024
706eea4
Added examples to CMakeLists.txt
TheMutta Jun 12, 2024
c3f6f3c
Added XLINK_WRITE_FD_RESP
TheMutta Jun 12, 2024
204f070
Finalized examples.
TheMutta Jun 12, 2024
4ce854b
SHDMEM protocol output reworked and finalized.
TheMutta Jun 12, 2024
c082504
Transferring fd through streamPacket
TheMutta Jun 13, 2024
0fb3d9a
Preparations for streaming files over the connection when XLinkWriteF…
TheMutta Jun 13, 2024
3a3c15a
Updated examples.
TheMutta Jun 13, 2024
ffbda08
Implemented file streaming on XLinkPlatformWriteFd
TheMutta Jun 13, 2024
43d2ced
Fixed broken CMakeLists.txt
TheMutta Jun 13, 2024
8c33a71
Automatic localhost detection and change to LOCAL_SHDMEM when using T…
TheMutta Jun 14, 2024
aa45e40
Updated examples
TheMutta Jun 14, 2024
48b6af8
Fixed typo in XLinkPlatformConnect
TheMutta Jun 19, 2024
9fb7537
Set fixed size for fd in streamPacketDesc_t at uint32_t
TheMutta Jun 19, 2024
0878b3b
Implemented XLinkWriteFdData, akin to XLinkWriteData2
TheMutta Jun 19, 2024
13a02ab
Changed fd to int32_t to allow for negative error values
TheMutta Jun 19, 2024
0a3444a
Fixed typo with dataBuffer instead of dataSize.
TheMutta Jun 19, 2024
fa9bfd9
shmem functions now returning byte count.
TheMutta Jun 20, 2024
05c8f0c
Examples enhanced for more comprehensive showcase of shdmem
TheMutta Jun 20, 2024
3c8d502
Server accepting data from all connections.
TheMutta Jun 20, 2024
7fb600a
Added extra parameters for completness
TheMutta Jun 25, 2024
f87dd85
Fixed xLinkEventType enum
TheMutta Jun 27, 2024
58a7eb1
Aded XLINK_WRITE_FD_RESP in TypeToStr in XLinkDispatcher
TheMutta Jun 27, 2024
53cb90c
Fixed writeFdEventMultipart
TheMutta Jun 27, 2024
77cbf61
Added size parameters to check wether the stream has enough space for…
TheMutta Jun 27, 2024
0e972c8
Passing FDs by value and not by reference
TheMutta Jun 28, 2024
cd96e6e
Removed binary files.
TheMutta Jun 28, 2024
e783d55
Revert "Added size parameters to check wether the stream has enough s…
TheMutta Jun 28, 2024
d35a4ef
Merge branch 'shdmem-merge' into shared-memory-on-localhost
TheMutta Jun 28, 2024
92f17cb
Added MSG_WAITALL flag to reads.
TheMutta Jun 28, 2024
7ab1388
Smart detection for shared memory protocol in TCP/IP
TheMutta Jul 1, 2024
629691f
Using multiple threads and cond var to connect to TCP/IP or SHDMEM
TheMutta Jul 2, 2024
ec429c3
Added conditional compilation for shdmemPlatform close
TheMutta Jul 2, 2024
89a4c13
Fixed flags for Windows.
TheMutta Jul 2, 2024
4e77fc1
Made certain example UNIX only
TheMutta Jul 2, 2024
741aff6
Removed tcpipIsLocalhost function from tcpip_host.cpp
TheMutta Jul 4, 2024
a0b71c4
Removed tcpipIsLocalhost function from tcpip_host.h
TheMutta Jul 4, 2024
fe25ef9
Added the custom X_LINK_TCP_IP_OR_LOCAL_SHDMEM protocol
TheMutta Jul 4, 2024
f017c1a
Merge branch 'shared-memory-on-localhost' of github.com:luxonis/XLink…
TheMutta Jul 4, 2024
5e89479
Made sure not to alter the first few event types for legacy systems, …
TheMutta Jul 5, 2024
62909dc
Conditional example compilation only for unix
TheMutta Jul 5, 2024
ddfc42c
Merge pull request #82 from luxonis/shared-memory-on-localhost
TheMutta Jul 5, 2024
2b4ff47
Added SHDMEM device discovery
TheMutta Jul 10, 2024
084a8e0
Removed binary files
TheMutta Jul 10, 2024
c7e2a98
Functional discovery for LOCAL_MEMSHD
TheMutta Jul 11, 2024
9c698b7
Removed unused fdSize from XLinkWriteFdData
TheMutta Jul 11, 2024
89095e5
Added conditional compilation for discovery
TheMutta Jul 11, 2024
585a38f
Merge pull request #83 from luxonis/fix-discovery-shared-memory
TheMutta Jul 12, 2024
3c89e42
Fixed shdmem bugs and handled fd streaming
TheMutta Jul 16, 2024
9aab222
Added conditional compilation.
TheMutta Jul 16, 2024
188bce9
Conditional compilation for escluding some examples on MacOS
TheMutta Jul 16, 2024
6615e07
Merge pull request #85 from luxonis/shared-memory-fixes
TheMutta Jul 19, 2024
72132e2
Add a custom timeout option the the device discovery
Feb 24, 2025
33f7a29
Update the examples to the new function
Feb 25, 2025
7f5633a
Add X_LINK_GATE_SETUP state
Mar 14, 2025
84d17d2
Remove hunter
Apr 16, 2025
8778582
Support installing public interface only
May 12, 2025
e6f7b24
Added gadgets
Jul 1, 2025
58edff5
Removed binary files
Jul 1, 2025
f486e90
Merge branch 'develop_server' into develop_gadget
Jul 1, 2025
30093ee
Added comments for EPs offsets
Jul 1, 2025
6dbba16
Set correct offsets.
Jul 1, 2025
0de2e87
Merge pull request #91 from luxonis/develop_gadget
TheMutta Jul 1, 2025
1958f31
Merge branch 'develop_server' into no_hunter
Jul 1, 2025
7538a46
Added discovery
Jul 2, 2025
6ab310d
Recognition of the USB EP interface via strings
Jul 2, 2025
5c220ed
Set correct PRODUCT_ID in USB EP
Jul 3, 2025
ca49e53
Using first unused device in USB EP.
Jul 3, 2025
d20978d
Finalised USB EPs
Jul 10, 2025
30f184d
Merge pull request #92 from luxonis/develop_gadget
TheMutta Jul 10, 2025
1f1ade0
Merge branch 'develop_server' into no_hunter
Jul 10, 2025
0e2e7d1
Initialising usb ctx.
Jul 10, 2025
8423b90
Fixed wrong protocol in discovery for USB EP
Jul 10, 2025
11538f3
Set priority for USB_EP during discovery
Jul 11, 2025
fdc7ca6
Removed ctx deinitialisation
Jul 11, 2025
9909f6d
Brainstorm
themarpe Jul 15, 2025
077bb1c
Merge remote-tracking branch 'origin/usb_ep_discovery' into develop_g…
Jul 15, 2025
4891a88
Added GATE read and write functions.
Jul 16, 2025
e519b86
Changed XLinkGateReadData to behave like XLinkReadMoveData
Jul 16, 2025
4e42afb
Set state to gate
Jul 16, 2025
aa476c7
Revert "Set state to gate"
Jul 16, 2025
5968190
Revert "Set state to gate"
Jul 16, 2025
fd7e65f
Reapply "Set state to gate"
Jul 16, 2025
1b68e19
Merge branch 'develop_gadget' into no_hunter
Jul 16, 2025
4126554
Set gate state.
Jul 16, 2025
7d9d6b9
Changed XLinkPlatformGate functions to not require device handle
Jul 16, 2025
d46c049
Removed dispatched implementation.
Jul 16, 2025
563bdb5
update libusb errors on windows when opening a USB port
lnotspotl Jul 23, 2025
54a697d
Merge remote-tracking branch 'origin/master' into v3_develop
Jul 28, 2025
58c5cb8
Added conditional compilation for windows for usb_host_ep
Aug 5, 2025
674b295
Added wrapper for XLinkPlatformGate functions
Aug 5, 2025
7ad1ed8
Merge pull request #94 from luxonis/lnotspotl/fix_windows_usb_errors2
lnotspotl Aug 27, 2025
8afcfee
remove overriding the default CMAKE_INSTALL_PREFIX value
lnotspotl Aug 27, 2025
798a74e
Getting state from gate
Sep 3, 2025
c72e670
Made sure the response in usbepGetDevices isn't larger than the struct
Sep 11, 2025
5ee4702
Do not look for libusb if disabled
asahtik Sep 11, 2025
1379028
Merge pull request #97 from luxonis/bugfix/libusb_not_found_when_disa…
asahtik Sep 12, 2025
8ddeb2b
Separated the bytes transferred variable in bulk transfer for device …
Sep 12, 2025
2f5db2d
usb_host_ep: Added checks in Gate functions
Sep 17, 2025
3606f51
Fixed string size calculation.
Sep 18, 2025
d5abd87
usb_host_ep: Fixed typo
Sep 18, 2025
57b192b
usb_host_ep: Corrected dynamic platform assignment.
Sep 18, 2025
085e25d
usb_host_ep: Reinstated timeout
Sep 23, 2025
c8fb130
usb_host_ep: Using async transfers.
Sep 23, 2025
551b333
usb_host_ep: Fixed use after free.
Sep 23, 2025
c856a76
usb_host_ep: Async fixes in handling, buffers and volatile.
Sep 23, 2025
80e5394
usb_host_ep: Added usb disconnection/reconnection callback
Sep 23, 2025
3010d2a
usb_host_ep: Setup gate_ctx for gate transfers.
Sep 23, 2025
cc65c5e
Removed file.
Sep 23, 2025
647dcc4
usb_host_ep: Initialising gate only once.
Sep 24, 2025
9262cc1
usb_host_ep: Removed references to libusb_exit for gate_ctx
Sep 24, 2025
7f30c51
Gate: added explicit timeout.
Sep 25, 2025
6cc5e92
Gate: instated correct error handling.
Sep 25, 2025
24d0be0
XLinkData: fixed missing semicolon.
Sep 25, 2025
85502ee
Merging usb_host_ep into usb_host: fixing discovery.
Sep 29, 2025
2fc723a
Merging usb_host_ep into usb_host: added read/write/gate read/gate write
Sep 29, 2025
0988394
Merging usb_host_ep into usb_host: merged final quirks and added usb …
Oct 1, 2025
dcc9a91
Removed file.
Oct 1, 2025
a4cc70a
Merge branch 'discovery_gate_usb_ep' into no_hunter_discovery_gate_us…
Oct 1, 2025
2ca735d
usb_ep: Removed references to usb_host_ep
Oct 1, 2025
87e1e75
usb_ep: Removed references to usb_host_ep v2
Oct 1, 2025
62d8c43
Merge branch 'discovery_gate_usb_ep' into no_hunter_discovery_gate_us…
Oct 1, 2025
bc8afd1
usb_host: Fixed bug in discovery for USB EPs
Oct 1, 2025
4daffea
usb_ep: Fixed platform assignment from gate.
Oct 1, 2025
871076f
usb_ep: removed unused function is PlatformGate functions.
Oct 1, 2025
4dc7073
usb_host: Reinstated old Gate functions.
Oct 1, 2025
52f2419
usb_host: Fixed naming in EP functions
Oct 1, 2025
aa7da88
Try fixing device bad state, from previous interrupted bootup attempt
alex-luxonis Aug 6, 2025
f4dc80b
usb_host: Added lock in usb link opening.
Oct 1, 2025
a24a3e3
usb_host: Added mutext usb checks.
Oct 2, 2025
2814d66
usb_host: Removed excess mutex locks.
Oct 6, 2025
7cf6eb7
usb_host: Added correct handling in Read/Write for VSC/EP
Oct 6, 2025
68a9933
usb_host: Remove read/write mutexes for testing.
Oct 6, 2025
cdeb969
usb_host: Added server setting for EPs.
Oct 6, 2025
2164106
usb_host: Disabled mutex in read/write due to scheduler.
Oct 6, 2025
9c0193b
Whitespace tweaks
themarpe Oct 6, 2025
4e33b55
usb_host: Formatting changes.
Oct 6, 2025
18d6dee
usb_host: Added explicit dev path for Gate Read/Write
Oct 7, 2025
72e6b7e
usb_host: Fixed missing else case.
Oct 7, 2025
deaedf5
usb_host: Explicit ep assignment in read/write
Oct 7, 2025
79d268b
usb_host: Reset VIDPID to pre-testing.
Oct 7, 2025
e8c3654
usb_host: Fixed formatting.
Oct 7, 2025
8db8777
usb_host: Fixed serial.
Oct 7, 2025
eadd24d
Fixed formatting.
Oct 7, 2025
b83a8c3
Fixed formatting.
Oct 7, 2025
7958fec
usb_boot: enable watchdog prior to booting
alex-luxonis Oct 7, 2025
7ea6780
Rearranged some format & fixed an if statement misassignment bug
themarpe Oct 8, 2025
b5f63da
usb_host: Added atomic bool for isServer.
Oct 8, 2025
03b94f9
Merge branch 'v3_develop' into discovery_gate_usb_ep
Oct 8, 2025
e56ec8a
usb_host: Added missing bracket.
Oct 8, 2025
cc7fed5
macOS - broadcast improvements, bind to specific interface
themarpe Oct 9, 2025
ffe0f85
Fixed CI and find libusb when system libusb is used
themarpe Oct 9, 2025
c19f995
Set TCP_NODELAY on server side
Dec 12, 2025
468878c
Added libusb_unref_device when opening usb link
aljazdu Jan 13, 2026
0958262
Fixed overflowing inside of COMBINE_IDS macro
aljazdu Jan 12, 2026
c3c3851
Update include/XLink/XLinkPrivateFields.h
aljazdu Jan 28, 2026
38d0f08
Merge pull request #103 from luxonis/fix/asan_ubsan_sanitizing
aljazdu Jan 28, 2026
fccbec0
usb_host: cleanup a few whitespaces
alex-luxonis Feb 2, 2026
d061873
usb_host: USB_EP adapt to latest RVC4 OS USB interfaces
alex-luxonis Feb 2, 2026
6949d8d
Merge 'origin/v3_develop' into discovery_gate_usb_ep
alex-luxonis Feb 2, 2026
32fefff
Rename /dev/usb-ffs/xlink -> /dev/usb-ffs/device
alex-luxonis Feb 2, 2026
618523d
usb_host: fix build on Windows, guard XLink server read()/write()
alex-luxonis Feb 8, 2026
b897d2e
usb_host: fix large transfers (16MiB+), chunk by 15MiB
alex-luxonis Feb 8, 2026
ae988ab
usb_host: fix build on Windows, use of designated initializers
alex-luxonis Feb 9, 2026
53b20ae
Fix interface selection on Windows, composite device with multiple Wi…
alex-luxonis Feb 23, 2026
f001d71
Merge pull request #96 from luxonis/discovery_gate_usb_ep
alex-luxonis Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 97 additions & 64 deletions .github/workflows/.dev.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,91 +3,124 @@ name: Dev Workflow
on:
push:
branches-ignore:
- xlink_upstream
[xlink_upstream]
pull_request:
branches-ignore:
- xlink_upstream
[xlink_upstream]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
compiler: [default, clang]
libusb: [ON, OFF]
include:
- os: windows-latest
compiler: mingw
libusb: ON
- os: windows-latest
compiler: mingw
libusb: OFF
enable-libusb: [ON, OFF]
libusb-system: [ON, OFF]
exclude:
# libusb-system is only valid on macOS & Ubuntu
- os: windows-latest
libusb-system: ON
# clang is only valid on macOS & Ubuntu
- os: windows-latest
compiler: clang
# Prevent meaningless combos where libusb-system ON but libusb disabled
- enable-libusb: OFF
libusb-system: ON

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install libusb
if: matrix.os == 'macos-latest' && matrix.libusb == 'ON'
# Install system libusb only when requested AND on supported OSes
- name: Install libusb (macOS)
if: matrix.os == 'macos-latest' && matrix['libusb-system'] == 'ON'
run: |
brew install libusb

- name: Install libusb
if: matrix.os == 'ubuntu-latest' && matrix.libusb == 'ON'
- name: Install libusb (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix['libusb-system'] == 'ON'
run: |
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libusb-1.0-0

- name: Setup MinGW compiler
if: matrix.compiler == 'mingw'
run: |
choco install mingw
choco upgrade mingw

- name: Install Clang on macOS
if: matrix.os == 'macos-latest' && matrix.compiler == 'clang'
run: |
brew install llvm
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH

- name: Install Clang on Ubuntu
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang'
run: |
sudo apt-get install clang

- name: Install Clang on Windows
if: matrix.os == 'windows-latest' && matrix.compiler == 'clang'
run: |
choco install llvm
echo "C:\Program Files\LLVM\bin" >> $env:GITHUB_PATH

- name: Install Ninja on macOS
if: matrix.os == 'macos-latest'
run: |
brew install ninja

- name: Install Ninja on Ubuntu
if: matrix.os == 'ubuntu-latest'
# --- Local libusb when SYSTEM_LIBUSB=OFF but libusb is enabled ---
- name: Build & install local libusb (all OSes)
if: matrix['enable-libusb'] == 'ON' && matrix['libusb-system'] == 'OFF'
shell: bash
run: |
sudo apt-get install ninja-build
set -euxo pipefail
# Where to install local libusb
PREFIX="${GITHUB_WORKSPACE}/.local/libusb"
mkdir -p "${PREFIX}"

# Get libusb (shallow)
git clone --depth=1 https://github.com/luxonis/libusb.git --branch cmake-android-mainline
cmake -S libusb -B build-libusb \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DWITH_UDEV=OFF \
-DBUILD_SHARED_LIBS=ON
cmake --build build-libusb --config Release --parallel
cmake --build build-libusb --config Release --target install

# Export usb-1.0_DIR for later CMake configure
# (CMake package config is placed here by libusb)
echo "USB1_DIR=${PREFIX}/lib/cmake/usb-1.0" >> "$GITHUB_ENV"

- name: Install Ninja on Windows
if: matrix.os == 'windows-latest'
- name: Setup MinGW compiler
if: matrix.compiler == 'mingw'
run: |
choco install ninja

- name: configure
if: matrix.compiler == 'default'
run: cmake . -Bbuild -DXLINK_BUILD_EXAMPLES=ON -DXLINK_BUILD_TESTS=ON -DXLINK_ENABLE_LIBUSB=${{ matrix.libusb }}

- name: configure
choco install -y mingw
choco upgrade -y mingw

# Configure (Debug)
- name: configure (Debug) - default/clang
if: matrix.compiler == 'default' || matrix.compiler == 'clang'
shell: bash
run: >
cmake . -Bbuild
-DXLINK_BUILD_EXAMPLES=ON
-DXLINK_BUILD_TESTS=ON
-DXLINK_ENABLE_LIBUSB=${{ matrix['enable-libusb'] }}
-DXLINK_LIBUSB_SYSTEM=${{ matrix['libusb-system'] }}
-D"usb-1.0_DIR=$USB1_DIR"

- name: configure (Debug) - MinGW
if: matrix.compiler == 'mingw'
run: cmake . -Bbuild -DXLINK_BUILD_EXAMPLES=ON -DXLINK_BUILD_TESTS=ON -DXLINK_ENABLE_LIBUSB=${{ matrix.libusb }} -G"MinGW Makefiles"

- name: configure
if: matrix.compiler == 'clang'
run: cmake . -Bbuild -DXLINK_BUILD_EXAMPLES=ON -DXLINK_BUILD_TESTS=ON -DXLINK_ENABLE_LIBUSB=${{ matrix.libusb }} -G"Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++

- name: build
run: cmake --build build --parallel
shell: bash
run: >
cmake . -Bbuild
-DXLINK_BUILD_EXAMPLES=ON
-DXLINK_BUILD_TESTS=ON
-DXLINK_ENABLE_LIBUSB=${{ matrix['enable-libusb'] }}
-DXLINK_LIBUSB_SYSTEM=${{ matrix['libusb-system'] }}
-D"usb-1.0_DIR=$USB1_DIR"
-G "MinGW Makefiles"

- name: build (Debug)
run: cmake --build build --parallel --config Debug

- name: test (Debug)
shell: bash
run: ctest --test-dir build -C Debug --output-on-failure

- name: reconfigure (Release)
shell: bash
run: >
cmake . -Bbuild
-DCMAKE_BUILD_TYPE=Release
-DXLINK_BUILD_EXAMPLES=ON
-DXLINK_BUILD_TESTS=ON
-DXLINK_ENABLE_LIBUSB=${{ matrix['enable-libusb'] }}
-DXLINK_LIBUSB_SYSTEM=${{ matrix['libusb-system'] }}
-D"usb-1.0_DIR=$USB1_DIR"

- name: build (Release)
run: cmake --build build --parallel --config Release

- name: test (Release)
shell: bash
run: ctest --test-dir build -C Release --output-on-failure
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ build/
build*/
.cache*

#clangd
.cache/*

#git
*.orig
*_REMOTE_*
Expand Down
49 changes: 12 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

cmake_minimum_required(VERSION 3.10)

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
SHA1 "16cc954aa723bccd16ea45fc91a858d0c5246376"
LOCAL # Local config for dependencies
)

### Constants
set(TARGET_NAME "XLink")
Expand All @@ -20,21 +14,14 @@ project(${TARGET_NAME} LANGUAGES C CXX)

set(PROJECT_EXPORT_GROUP "${PROJECT_NAME}Targets")

# Set default installation directory
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
endif()

# Compile with USB protocol capabilities
option(XLINK_ENABLE_LIBUSB "Enable USB protocol which requires libusb library" ON)
# Build examples
option(XLINK_BUILD_EXAMPLES "Build XLink examples" OFF)
# Build tests
option(XLINK_BUILD_TESTS "Build XLink tests" OFF)
# Debug option
set(XLINK_LIBUSB_LOCAL "" CACHE STRING "Path to local libub source to use instead of Hunter")
# Debug option
option(XLINK_LIBUSB_SYSTEM "Use system libusb library instead of Hunter" OFF)
# Install headers only (skip binary lib in install tree)
option(XLINK_INSTALL_PUBLIC_ONLY "Install only header interface target (XLinkPublic)" OFF)

# Specify exporting all symbols on Windows
if(WIN32 AND BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -65,6 +52,7 @@ get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d")
endif()

# Define export header to support shared library on Windows
include(GenerateExportHeader)
generate_export_header(${TARGET_NAME}
Expand All @@ -89,13 +77,12 @@ if(XLINK_ENABLE_LIBUSB)
else()
# Link to CMake libusb
target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0)
if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(WIN32 AND NOT MINGW)
target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib)
# workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20022
target_link_options(${TARGET_NAME} PUBLIC "$<LINK_ONLY:/DELAYLOAD:libusb-1.0$<$<CONFIG:Debug>:d>.dll>")
endif()
endif()

if(WIN32 AND NOT MINGW)
target_link_libraries(${TARGET_NAME} PRIVATE Pathcch.lib)
endif()
Expand Down Expand Up @@ -157,15 +144,9 @@ target_compile_definitions(${TARGET_NAME}
USE_TCP_IP
)

if (ENABLE_MYRIAD_NO_BOOT)
target_compile_definitions(${TARGET_NAME}
PRIVATE
NO_BOOT)
endif()

# Set C99 standard
# Set C99 and C++11 standard
set_property(TARGET ${TARGET_NAME} PROPERTY C_STANDARD 99)
# Set compiler features (c++11), and disables extensions (g++11)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -220,17 +201,18 @@ endif()

include(GNUInstallDirs)

# Handle public-only install option
set(_XLINK_INSTALL_TARGETS ${TARGET_PUBLIC_NAME})
if(NOT XLINK_INSTALL_PUBLIC_ONLY)
list(APPEND _XLINK_INSTALL_TARGETS ${TARGET_NAME})
endif()

# Export targets (capability to import current build directory)
export(TARGETS ${TARGET_NAME} ${TARGET_PUBLIC_NAME} FILE "${PROJECT_NAME}Targets.cmake")

# Dependencies file
configure_file("cmake/${PROJECT_NAME}Dependencies.cmake" ${PROJECT_NAME}Dependencies.cmake COPYONLY)

# Configure config file (one for exporting build directory, one for installation)
if(${HUNTER_INSTALL_PREFIX})
file(RELATIVE_PATH XLINK_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}")
endif()

configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)

# Config for installation
Expand All @@ -239,7 +221,7 @@ configure_file(cmake/${PROJECT_NAME}Config.cmake.in _install/${PROJECT_NAME}Conf

# Install targets
install(
TARGETS ${TARGET_NAME} ${TARGET_PUBLIC_NAME}
TARGETS ${_XLINK_INSTALL_TARGETS}
EXPORT ${PROJECT_EXPORT_GROUP}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand All @@ -252,13 +234,6 @@ install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XLink
)

# Install Hunter dependencies
if(XLINK_ENABLE_LIBUSB)
if(NOT XLINK_LIBUSB_LOCAL AND NOT XLINK_LIBUSB_SYSTEM)
install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies")
endif()
endif()
# Install export group (information about targets)
install(EXPORT ${PROJECT_EXPORT_GROUP}
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
Expand Down
11 changes: 0 additions & 11 deletions cmake/Hunter/config.cmake

This file was deleted.

Loading
Loading