Skip to content

Commit

Permalink
Remove socket code from PIEEGBoard and restructure periphery inclusion
Browse files Browse the repository at this point in the history
- Removed socket-related code from PIEEGBoard to adhere to high-level API usage for data streaming.
- Moved the c_periphery library to the third_party folder.
- Updated CMakeLists and build.cmake to conditionally include and link periphery only when needed.
- Removed unnecessary 'c' and 'm' libraries from the target_link_libraries.
- Removed the emulator script and unnecessary examples from the PR.
  • Loading branch information
nickgamb committed May 31, 2024
1 parent 29e575b commit 587c0e5
Show file tree
Hide file tree
Showing 51 changed files with 17 additions and 322 deletions.
26 changes: 0 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,6 @@ set(TARGETS_EXPORT_NAME brainflowTargets)
set(PACKAGE_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
set(PACKAGE_INC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/inc)

# Set the Android NDK path
if(DEFINED ENV{ANDROID_NDK_HOME})
set(ANDROID_NDK_HOME $ENV{ANDROID_NDK_HOME})
endif()

if(ANDROID)
if(NOT DEFINED ANDROID_ABI)
message(FATAL_ERROR "ANDROID_ABI is not set")
endif()
set(CMAKE_ANDROID_ARCH_ABI ${ANDROID_ABI})
message(STATUS "Building for Android ABI: ${ANDROID_ABI}")
endif()

list(LENGTH ANDROID_ABI ABI_COUNT)
if(ABI_COUNT GREATER 1)
message(FATAL_ERROR "ANDROID_ABI should only contain one architecture at a time: ${ANDROID_ABI}")
endif()

if(ANDROID)
set(CMAKE_TOOLCHAIN_FILE ${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake)
endif()

option(USE_LIBFTDI "USE_LIBFTDI" OFF)
option(USE_OPENMP "USE_OPENMP" OFF)
option(WARNINGS_AS_ERRORS "WARNINGS_AS_ERRORS" OFF)
Expand All @@ -61,10 +39,6 @@ if(WARNINGS_AS_ERRORS)
endif()
endif()

add_subdirectory(src/board_controller/pieeg/inc/periphery)


# Include other components
include(${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/build.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/data_handler/build.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/ml/build.cmake)
Expand Down
79 changes: 0 additions & 79 deletions emulator/brainflow_emulator/pieeg_emulator.py

This file was deleted.

4 changes: 1 addition & 3 deletions python_package/brainflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
from brainflow.exit_codes import *
from brainflow.data_filter import *
from brainflow.ml_model import *
from brainflow.utils import *

__version__ = "0.0.1"
from brainflow.utils import *
83 changes: 0 additions & 83 deletions python_package/examples/tests/pieeg_client.py

This file was deleted.

90 changes: 0 additions & 90 deletions python_package/examples/tests/pieeg_sever.py

This file was deleted.

34 changes: 16 additions & 18 deletions src/board_controller/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ if (BUILD_OYMOTION_SDK)
include (${CMAKE_CURRENT_SOURCE_DIR}/third_party/gForceSDKCXX/build.cmake)
endif (BUILD_OYMOTION_SDK)

# Link standard libraries conditionally
if (BUILD_BLUETOOTH)
if (!ANDROID)
if (NOT ANDROID)
include (${CMAKE_CURRENT_SOURCE_DIR}/src/utils/bluetooth/build.cmake)
endif (!ANDROID)
endif (NOT ANDROID)
endif (BUILD_BLUETOOTH)

if (BUILD_BLE)
Expand Down Expand Up @@ -150,27 +149,27 @@ target_include_directories (
target_compile_definitions(${BOARD_CONTROLLER_NAME} PRIVATE NOMINMAX BRAINFLOW_VERSION=${BRAINFLOW_VERSION})

set_target_properties (${BOARD_CONTROLLER_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/compiled
)

find_package(Threads REQUIRED)

if (ANDROID)
target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE log android c m dl)
find_library(log-lib log)
target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE ${log-lib})
else()
target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE pthread dl)
endif(ANDROID)

target_compile_definitions(BoardController PRIVATE USE_PERIPHERY)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/pieeg/inc/periphery)

set_target_properties(periphery PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/pieeg/inc/periphery/libperiphery.a)
endif (ANDROID)

target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE periphery c m ${CMAKE_THREAD_LIBS_INIT} dl)
if (BUILD_PERIPHERY)
target_compile_definitions(BoardController PRIVATE USE_PERIPHERY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/periphery)
set_target_properties(periphery PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/third_party/periphery/libperiphery.a)
target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE periphery ${CMAKE_THREAD_LIBS_INIT} dl)
endif (BUILD_PERIPHERY)

if (USE_LIBFTDI)
find_package (LibFTDI1 NO_MODULE)
Expand Down Expand Up @@ -207,7 +206,6 @@ if (MSVC)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/src/utils/inc/brainflow_constants.h" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/inc/brainflow_constants.h"
)
endif (MSVC)

if (UNIX AND NOT ANDROID)
add_custom_command (TARGET ${BOARD_CONTROLLER_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
Expand Down Expand Up @@ -251,7 +249,7 @@ if (ANDROID)
endif (ANDROID)

if (UNIX AND NOT ANDROID)
target_link_libraries (${BOARD_CONTROLLER_NAME} PRIVATE pthread dl m c)
target_link_libraries (${BOARD_CONTROLLER_NAME} PRIVATE pthread dl)
endif (UNIX AND NOT ANDROID)

install (
Expand Down
Loading

0 comments on commit 587c0e5

Please sign in to comment.