Skip to content

Commit 2d380b8

Browse files
committed
changes to CMake and run.py to add Linux/macOS compatibility
1 parent 011a7c7 commit 2d380b8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

pybind/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ project(BrainflowSpO2Algorithm VERSION 4.1 LANGUAGES C CXX) # Project name becom
55
# GoogleTest requires at least C++17
66
set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
89

910
# Set Arduino directory variable
1011
IF (WIN32)
@@ -77,4 +78,4 @@ pybind11_add_module(BrainflowSpO2Algorithm "${CMAKE_CURRENT_SOURCE_DIR}/bindings
7778

7879
target_link_libraries(BrainflowSpO2Algorithm PUBLIC
7980
lib
80-
)
81+
)

pybind/run.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import sys
22
import os
33
cur_dir = os.path.dirname(__file__)
4+
5+
# Add build directory to sys.path (linux/macOS .so files end up in build directory)
6+
pyd_dir = os.path.join(cur_dir, 'build')
7+
sys.path.append(os.path.abspath(pyd_dir))
8+
9+
# For Windows, the .pyd files end up in build/Release directory
410
pyd_dir = os.path.join(cur_dir, 'build/Release')
511
sys.path.append(os.path.abspath(pyd_dir))
612

0 commit comments

Comments
 (0)