diff --git a/binding/python3/CMakeLists.txt b/binding/python3/CMakeLists.txt index a8dcc586..d3f2eb4c 100644 --- a/binding/python3/CMakeLists.txt +++ b/binding/python3/CMakeLists.txt @@ -17,8 +17,15 @@ set_property(SOURCE ${I_SOURCE_FILE} PROPERTY CPLUSPLUS ON) SWIG_ADD_LIBRARY(${PROJECT_NAME} TYPE MODULE LANGUAGE python SOURCES ${I_SOURCE_FILE}) swig_link_libraries(${PROJECT_NAME} ${PROJECT_NAME} ${PYTHON_LIBRARIES} ${NUMPY_LIBRARIES}) -SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES INSTALL_RPATH ${${PROJECT_NAME}_BIN_FOLDER}) -SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) +if(APPLE) + SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES SUFFIX ".so" INSTALL_RPATH ${${PROJECT_NAME}_BIN_FOLDER}) + SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) + set_property(TARGET _${PROJECT_NAME} APPEND PROPERTY LINK_FLAGS "-flat_namespace -undefined suppress") +else() + SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES INSTALL_RPATH ${${PROJECT_NAME}_BIN_FOLDER}) + SET_TARGET_PROPERTIES(_${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) +endif() + # Install to the proper directories INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.py diff --git a/binding/python3/__init__.py b/binding/python3/__init__.py index c88608d7..d8b87dbd 100644 --- a/binding/python3/__init__.py +++ b/binding/python3/__init__.py @@ -170,8 +170,10 @@ def write(self, path): raise ValueError("Number of frames in the data set must match the analog rate X point frame") nb_analog_subframes = int(nb_analog_frames / nb_point_frames) - self._storage['parameters']['ANALOG']['RATE']['value'][0] = nb_analog_subframes * \ - self._storage['parameters']['POINT']['RATE']['value'][0] + self._storage['parameters']['ANALOG']['RATE']['value'] = ( + nb_analog_subframes + * self._storage['parameters']['POINT']['RATE']['value'][0], + ) nb_frames = nb_point_frames else: nb_frames = nb_analog_frames @@ -187,7 +189,7 @@ def write(self, path): # Fill the parameters groups = self._storage['parameters'] - # Update some important stuff (names of markers and analogs) + # Update some important stuff (names of points and analogs) point_labels = groups['POINT']['LABELS']['value'] for point_label in point_labels: new_c3d.point(point_label) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 2bb05af1..154e0ac5 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -14,11 +14,15 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug") else() SET(${MASTER_PROJECT_NAME}_LIB_NAME ${MASTER_PROJECT_NAME}) endif() -if (UNIX) +if (APPLE) + string(CONCAT ${MASTER_PROJECT_NAME}_LIB_NAME "lib" ${${MASTER_PROJECT_NAME}_LIB_NAME} ".dylib") +elseif(UNIX) string(CONCAT ${MASTER_PROJECT_NAME}_LIB_NAME "lib" ${${MASTER_PROJECT_NAME}_LIB_NAME} ".so") elseif(WIN32) - message("Compilation won't work on Windows, to be corrected later...") + message("Compilation won't work on Windows, to be corrected later...") string(CONCAT ${MASTER_PROJECT_NAME}_LIB_NAME ${${MASTER_PROJECT_NAME}_LIB_NAME} ".dll") +else() + message(FATAL_ERROR "Unrecognized system") endif() set(${MASTER_PROJECT_NAME}_LIBRARY ${CMAKE_BINARY_DIR}/${${MASTER_PROJECT_NAME}_LIB_NAME}) target_link_libraries(${PROJECT_NAME} ${${MASTER_PROJECT_NAME}_LIBRARY})