-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiplatform opalkelly SDK files, got mac working, committing so…
… i can work on linux
- Loading branch information
1 parent
982fe41
commit 209b560
Showing
24 changed files
with
11,638 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# OpalKelly FPGA SDK | ||
|
||
See documentation here: https://docs.opalkelly.com/fpsdk/frontpanel-api/programming-languages/ | ||
|
||
## Files | ||
|
||
The Python API distribution includes the files listed below: | ||
|
||
- `ok.py` | ||
- `_ok.pyd` – Windows, architecture-specific for 32-bit/64-bit | ||
- `_ok.so` – Linux, Mac OS, architecture-specific for 32-bit/64-bit | ||
- `okFrontPanel.dll` – Windows, architecture-specific for 32-bit/64-bit | ||
- `libokFrontPanel.so` – Linux, Mac OS, architecture-specific for 32-bit/64-bit | ||
- `okimpl_fpoip.dll` – (optional) Windows, architecture-specifc DLL used to provide FPoIP functionality | ||
- `okimpl_fpoip.so` – (optional) Linux, architecture-specifc DLL used to provide FPoIP functionality | ||
|
||
## Changes | ||
|
||
### Mac | ||
|
||
The documentation suggests that all one needs to do is add the folders to | ||
`DYLD_LIBRARY_PATH`, but unfortunately that doesn't work because they have hard-coded | ||
the location to search for the dylib as `@rpath/libokFrontPanel.dylib` and | ||
then set `rpath` to some weird directory on their build server. | ||
|
||
So instead we modify the import location in `_ok.so` like: | ||
|
||
```bash | ||
install_name_tool -change \ | ||
@rpath/libokFrontPanel.dylib \ | ||
@loader_path/libokFrontPanel.dylib \ | ||
miniscope_io/vendor/opalkelly/mac/_ok.so | ||
``` |
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 @@ | ||
import pdb | ||
import sys | ||
from pathlib import Path | ||
import os | ||
import subprocess | ||
|
||
def patch_env_path(name:str, value:str): | ||
val = os.environ.get(name, None) | ||
if val is None: | ||
val = value | ||
else: | ||
val = ':'.join([val, value]) | ||
os.environ[name] = val | ||
|
||
base_path = Path(__file__).parent.resolve() | ||
if sys.platform == 'darwin': | ||
from miniscope_io.vendor.opalkelly.mac.ok import * | ||
|
||
elif sys.platform.startswith('linux'): | ||
# Linux | ||
pass | ||
elif sys.platform.startswith('win'): | ||
# Windows | ||
pass | ||
else: | ||
raise ImportError('Dont know what operating system you are on, cant use OpalKelly') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.