Skip to content

Commit

Permalink
add win32 lib
Browse files Browse the repository at this point in the history
disable build for linux
  • Loading branch information
yecq committed Jan 14, 2025
1 parent 314a68c commit 3df9ab9
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option (USE_LIBFTDI "USE_LIBFTDI" OFF)
option (USE_OPENMP "USE_OPENMP" OFF)
option (WARNINGS_AS_ERRORS "WARNINGS_AS_ERRORS" OFF)
option (BUILD_OYMOTION_SDK "BUILD_OYMOTION_SDK" OFF)
option (BUILD_SYNCHRONI_SDK "BUILD_SYNCHRONI_SDK" ON)
option (BUILD_SYNCHRONI_SDK "BUILD_SYNCHRONI_SDK" OFF)
option (BUILD_BLUETOOTH "BUILD_BLUETOOTH" OFF)
option (BUILD_BLE "BUILD_BLE" OFF)
option (BUILD_ONNX "BUILD_ONNX" OFF)
Expand Down
45 changes: 34 additions & 11 deletions third_party/synchroni/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
else ()
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME "SynchroniLib.dll")
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME_DOT_LIB "SynchroniLib.lib")
SET (SYNCHRONI_SDK_LINK_NAME_LIB "sensor")
SET (SYNCHRONI_SDK_LINK_NAME_DOT_LIB "sensor.lib")
SET (SYNCHRONI_SDK_ARCH "Win64")
endif (APPLE)
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (APPLE)
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME "libSynchroniLib.dylib")
elseif (UNIX)
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME "libSynchroniLib.so")
else ()
SET (SYNCHRONI_SDK_WRAPPER_NAME "SynchroniLib32")
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME "SynchroniLib32.dll")
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME_DOT_LIB "SynchroniLib32.lib")
SET (SYNCHRONI_SDK_LINK_NAME_LIB "sensor32")
SET (SYNCHRONI_SDK_LINK_NAME_DOT_LIB "sensor32.lib")
SET (SYNCHRONI_SDK_ARCH "Win32")
endif (APPLE)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)

Expand All @@ -36,9 +43,9 @@ add_library (
if (APPLE)
target_link_libraries (${SYNCHRONI_SDK_WRAPPER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/mac/sensor.xcframework)
elseif (UNIX)
SET (SYNCHRONI_SDK_WRAPPER_COMPILED_NAME "libSynchroniLib.so")
target_link_libraries (${SYNCHRONI_SDK_WRAPPER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/linux/x86_64/For$<CONFIG>/libsensor.so)
else ()
target_link_libraries (${SYNCHRONI_SDK_WRAPPER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/For$<CONFIG>/sensor.lib)
target_link_libraries (${SYNCHRONI_SDK_WRAPPER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_DOT_LIB})
endif (APPLE)


Expand Down Expand Up @@ -72,13 +79,13 @@ if (MSVC)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/${SYNCHRONI_SDK_WRAPPER_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/${SYNCHRONI_SDK_WRAPPER_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/${SYNCHRONI_SDK_WRAPPER_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/For$<CONFIG>/${SYNCHRONI_SDK_NAME}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/lib/${SYNCHRONI_SDK_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/lib/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll"
)
endif (MSVC)

Expand All @@ -91,6 +98,13 @@ if (UNIX)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/lib/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/lib/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/nodejs_package/brainflow/lib/libsensor.so"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/lib/linux/x86_64/For$<CONFIG>/libsensor.so" "${CMAKE_CURRENT_SOURCE_DIR}/rust_package/brainflow/lib/libsensor.so"
)
endif (UNIX)

Expand All @@ -99,19 +113,28 @@ if (MSVC)
install (
FILES
${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/SynchroniLib.dll
${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/For$<CONFIG>/sensor.dll
${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll
DESTINATION lib
)
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
install (
FILES
${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/SynchroniLib32.dll
${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/For$<CONFIG>/sensor32.dll
${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/windows/${SYNCHRONI_SDK_ARCH}/For$<CONFIG>/${SYNCHRONI_SDK_LINK_NAME_LIB}.dll
DESTINATION lib
)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
endif (MSVC)

if (UNIX)
install (
FILES
${CMAKE_CURRENT_SOURCE_DIR}/compiled/$<CONFIG>/${SYNCHRONI_SDK_WRAPPER_COMPILED_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/lib/linux/x86_64/For$<CONFIG>/libsensor.so
DESTINATION lib
)
endif(UNIX)

install (
TARGETS ${SYNCHRONI_SDK_WRAPPER_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
Expand Down
2 changes: 1 addition & 1 deletion third_party/synchroni/inc/SensorProfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <memory>
#include <functional>
#include <mutex>
#include "sensorData.hpp"
#include "SensorData.hpp"

namespace sensor {

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 10 additions & 4 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def prepare_args():
parser.add_argument(
'--no-oymotion', dest='oymotion', action='store_false')
parser.set_defaults(oymotion=False)

parser.add_argument('--synchroni', dest='synchroni', action='store_true')
parser.add_argument('--no-synchroni', dest='synchroni', action='store_false')
parser.set_defaults(synchroni='store_false')

parser.add_argument('--msvc-runtime', type=str, choices=[
'static', 'dynamic'],
help='how to link MSVC runtime', required=False, default='static')
Expand Down Expand Up @@ -180,6 +185,11 @@ def prepare_args():
parser.add_argument('--cmake-osx-deployment-target', type=str,
help='min supported version of osx', required=False, default='10.15')
parser.add_argument('--use-libftdi', action='store_true')

parser.add_argument('--synchroni', dest='synchroni', action='store_true')
parser.add_argument('--no-synchroni', dest='synchroni', action='store_false')
parser.set_defaults(synchroni='store_false')

try:
output = subprocess.check_output(['ninja', '--version'])
print(output)
Expand Down Expand Up @@ -216,10 +226,6 @@ def prepare_args():
parser.add_argument('--no-ble', dest='ble', action='store_false')
parser.set_defaults(ble=ble_default)

parser.add_argument('--synchroni', dest='synchroni', action='store_true')
parser.add_argument('--no-synchroni', dest='synchroni', action='store_false')
parser.set_defaults(synchroni='store_false')

parser.add_argument('--tests', dest='tests', action='store_true')
parser.add_argument('--no-tests', dest='tests', action='store_false')
parser.set_defaults(tests=tests_default)
Expand Down

0 comments on commit 3df9ab9

Please sign in to comment.