Skip to content

Commit

Permalink
finished cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottThomasMiller committed May 12, 2024
1 parent 322c29c commit ba868be
Show file tree
Hide file tree
Showing 34 changed files with 364 additions and 436 deletions.
35 changes: 34 additions & 1 deletion docs/BuildBrainFlow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,40 @@ Rust
Swift
-------

You can build Swift binding for BrainFlow using xcode. Before that you need to compile C/C++ code :ref:`compilation-label` and ensure that native libraries are properly placed. Keep in mind that currently it supports only MacOS.
You can build the Swift bindings for BrainFlow using Xcode. Before that you need to compile C/C++ code :ref:`compilation-label` and ensure that native libraries are properly placed. Keep in mind that currently it supports only MacOS.

To compile your Swift app with the BrainFlow bindings, first copy all of the .swift files from swift_package/BrainFlow/Sources/BrainFlowBindings into your Xcode project:

- Right click on your project in the Project Navigator window, and then select "Add Files to ...".
- A file dialog will open in Xcode. In the file dialog select the swift_package/BrainFlow/Sources/BrainFlowBindings folder. Make sure the "Copy items if needed" box is checked, as well as the box next to your target in the "Add to targets" section.
- Click the Add button.

Next add the umbrella header file to your project and configure the project settings so that Xcode can find the BrainFlow headers:

- In the project navigator right click on the BrainFlowBindings folder and select "Add Files to BrainFlowBindings".
In the file dialog select the swift_package/BrainFlow/BrainFlow.h file.
- Click the Add button.
- Click on your project in the project navigator.
- Click on your target in the target list.
- Select "Build Settings" and then search for the word "bridging".
- Open the "Objective-C Bridging Header" setting and add the value "${PROJECT_DIR}/BrainFlowBindings/BrainFlow.h".
- Search for the "Header Search Paths" setting.
- Open the "Header Search Paths" setting. Click the + button and then enter the full path to the brainflow/src directory. You may use an absolute or a relative path.
- To the right of the header search path entry select "recursive".

Next add the BrainFlow dylibs to your project:

- From the Finder, drag and drop the dylibs into your Xcode project, under the "Frameworks" group.
- A dialog will open in Xcode. Make sure the "Copy items if needed" box is checked, and check the box next to your target in the "Add to targets" section of the dialog.
- Click the "Finish" button.
- Click on your project in the project navigator.
- Click on your target in the target list.
- Select "General" and then scroll down to the "Frameworks, Libraries and Embedded Content" section.
- Make sure "Embed & Sign" or "Embed Without Signing" is selected for each of the added dylibs.

Finally, before you build, clean the build folder by clicking on the "Product" menu and selecting "Clean Build Folder...".

Enjoy!

Docker Image
--------------
Expand Down
1 change: 0 additions & 1 deletion src/board_controller/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ 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}/swift_package/BrainFlow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/${BOARD_CONTROLLER_COMPILED_NAME}"
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}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
Expand Down
2 changes: 0 additions & 2 deletions src/board_controller/gtec/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ endif (MSVC)
if (UNIX AND NOT APPLE AND NOT ANDROID)
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unicorn/lib/libunicorn_raspberry.so" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/")
Expand Down
2 changes: 0 additions & 2 deletions src/board_controller/muse/muse_bglib/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ if (UNIX AND NOT ANDROID)
add_custom_command (TARGET ${MUSE_BLED_LIB} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/BrainFlowCI/Frameworks/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/${MUSE_BLED_LIB_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${MUSE_BLED_LIB_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/${MUSE_BLED_LIB_NAME}"
Expand Down
1 change: 0 additions & 1 deletion src/board_controller/neuromd/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ endif (MSVC)
if (APPLE)
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/third_party/neurosdk/lib/lib${NEUROSDK_LIB_NAME}.dylib" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/")
Expand Down
1 change: 0 additions & 1 deletion src/data_handler/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ endif (MSVC)
if (UNIX AND NOT ANDROID)
add_custom_command (TARGET ${DATA_HANDLER_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${DATA_HANDLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/${DATA_HANDLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${DATA_HANDLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/${DATA_HANDLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${DATA_HANDLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${DATA_HANDLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${DATA_HANDLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/${DATA_HANDLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${DATA_HANDLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${DATA_HANDLER_COMPILED_NAME}"
Expand Down
1 change: 0 additions & 1 deletion src/ml/onnx/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ endif (APPLE)
if (NOT ANDROID)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlow/lib/)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/swift_package/BrainFlowCI/Frameworks/)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/)
file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/)
Expand Down
33 changes: 0 additions & 33 deletions swift_package/BrainFlow/Package.swift

This file was deleted.

4 changes: 0 additions & 4 deletions swift_package/BrainFlow/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions swift_package/BrainFlow/Sources/BrainFlow/dummy.swift

This file was deleted.

11 changes: 0 additions & 11 deletions swift_package/BrainFlow/Tests/BrainFlowTests/BrainFlowTests.swift

This file was deleted.

File renamed without changes.
Loading

0 comments on commit ba868be

Please sign in to comment.