Skip to content

Commit

Permalink
PlayerOne cameras: update to SDK version V3.7.1
Browse files Browse the repository at this point in the history
 * Merge prior work on PlayerOne cameras with Ethan's
 * format source files with clang-format
 * tested on Mac and Windows
  • Loading branch information
agalasso committed Jan 2, 2025
1 parent 6b2676b commit 772c130
Show file tree
Hide file tree
Showing 32 changed files with 296 additions and 212 deletions.
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ set(cam_SRC
${phd_src_dir}/cam_openssag.h
${phd_src_dir}/cam_OSPL130.cpp
${phd_src_dir}/cam_OSPL130.h
${phd_src_dir}/cam_poa.cpp
${phd_src_dir}/cam_poa.h
${phd_src_dir}/cam_playerone.cpp
${phd_src_dir}/cam_playerone.h
${phd_src_dir}/cam_qguide.cpp
${phd_src_dir}/cam_qguide.h
${phd_src_dir}/cam_qhy.cpp
Expand Down Expand Up @@ -725,6 +725,20 @@ if(APPLE)
)
endif()

if(playerone)
set_source_files_properties(${playerone} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
add_custom_command(
TARGET phd2
POST_BUILD
COMMAND install_name_tool -change libPlayerOneCamera.3.dylib
@executable_path/../Frameworks/libPlayerOneCamera.dylib $<TARGET_FILE:phd2>
COMMAND install_name_tool -change @loader_path/libusb-1.0.0.dylib
@executable_path/../Frameworks/libusb_openphd.dylib
$<TARGET_FILE_DIR:phd2>/../Frameworks/libPlayerOneCamera.dylib
COMMENT "Updating dylib path for libPlayerOneCamera.dylib"
)
endif()

add_custom_command(
TARGET phd2
POST_BUILD
Expand Down
72 changes: 72 additions & 0 deletions build/unpack_playerone_sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

# usage: unpack_playerone_sdk \
# PlayerOne_Camera_SDK_MacOS_V3.6.3.tar.gz \
# PlayerOne_Camera_SDK_Windows_V3.6.3.zip \
# PlayerOne_Camera_SDK_Linux_V3.6.3.tar.gz

die () {
echo "Error: $*" >&2
exit 1
}

# === main ===

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
SCRIPT_NAME=${BASH_SOURCE[0]##*/}

set -x
set -e
set -o pipefail

linux=
mac=
win=

for file in "$@"; do
case $file in
*PlayerOne*_Linux_*) linux=$file ;;
*PlayerOne*_MacOS_*) mac=$file ;;
*PlayerOne*_Windows_*) win=$file ;;
esac
done

if [[ ! -f $linux || ! -f $mac || ! -f $win ]]; then
echo "usage: $SCRIPT_NAME LINUX_SDK MAC_SDK WINDOWS_SDK" >&2
exit 1
fi

top=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel)
dest=$top/cameras/playerone

TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT

# linux + include
tar xf "$linux" -C "$TMP"
(
cd "$TMP"/*_Linux_*
install -d -m 0755 "$dest"/include/ "$dest"/linux
install -m 0644 include/PlayerOneCamera.h "$dest"/include/
cd lib
# include shared lib symlinks
tar cf - . | tar xf - -C "$dest"/linux
)

# mac
tar xf "$mac" -C "$TMP"
(
cd "$TMP"/*_MacOS_*
install -d -m 0755 "$dest"/mac
install -m 0755 lib/libPlayerOneCamera.dylib "$dest"/mac/
)

# windows
mkdir "$TMP/win"
unzip -d "$TMP/win" "$win"
(
cd "$TMP"/win
install -d -m 0755 "$dest"/win
install -m 0644 lib/x86/PlayerOneCamera.lib "$dest"/win/
install -m 0755 lib/x86/PlayerOneCamera.dll "$dest"/win/
)
Binary file removed cameras/PlayerOneCamera.lib
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file renamed WinLibs/PlayerOneCamera.dll → cameras/playerone/win/PlayerOneCamera.dll
100644 → 100755
Binary file not shown.
Binary file added cameras/playerone/win/PlayerOneCamera.lib
Binary file not shown.
1 change: 0 additions & 1 deletion cameras/poalibs/mac/libPlayerOneCamera.3.7.dylib

This file was deleted.

1 change: 0 additions & 1 deletion cameras/poalibs/mac/libPlayerOneCamera.3.dylib

This file was deleted.

1 change: 0 additions & 1 deletion cameras/poalibs/mac/libPlayerOneCamera.dylib

This file was deleted.

Loading

0 comments on commit 772c130

Please sign in to comment.