Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example now download c3d instead of having it in the repo #85

Merged
merged 1 commit into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ __pycache__
# Testing suite
Testing
test/c3dFiles/*
example/c3dFiles/*
29 changes: 26 additions & 3 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,29 @@ endif()
set(${MASTER_PROJECT_NAME}_LIBRARY ${CMAKE_BINARY_DIR}/${${MASTER_PROJECT_NAME}_LIB_NAME})
target_link_libraries(${PROJECT_NAME} ${${MASTER_PROJECT_NAME}_LIBRARY})

# Copy the c3d of the example
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/markers_analogs.c3d
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# Get the test suite from the pyomeca repository
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/example/c3dFiles/ezc3d-testFiles-master)
file(
DOWNLOAD https://github.com/pyomeca/ezc3d-testFiles/archive/master.zip
${CMAKE_SOURCE_DIR}/example/c3dFiles/ezc3d-testFiles-master.zip
TIMEOUT 60 # seconds
TLS_VERIFY ON
)
endif()

# Copy all c3d to the test folder
set(FILE ezc3d-testFiles-master.zip)
get_filename_component(FOLDER_NAME ${FILE} NAME_WE)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/example/c3dFiles/${FOLDER_NAME})
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/example/c3dFiles/${FOLDER_NAME})
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar -xf ../${FILE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/example/c3dFiles/${FOLDER_NAME}/
)
endif()
file(GLOB C3D_EXAMPLE_FILES ${CMAKE_SOURCE_DIR}/example/c3dFiles/${FOLDER_NAME}/*.c3d)
if (NOT C3D_EXAMPLE_FILES)
file(GLOB C3D_EXAMPLE_FILES ${CMAKE_SOURCE_DIR}/example/c3dFiles/${FOLDER_NAME}/${FOLDER_NAME}/*.c3d)
endif()
file(COPY ${C3D_EXAMPLE_FILES}
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/c3dExampleFiles/)
6 changes: 3 additions & 3 deletions example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ int main()
// Speed test
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < 50; ++i){
ezc3d::c3d c3d("markers_analogs.c3d");
ezc3d::c3d c3d("c3dExampleFiles/Vicon.c3d");
}
auto stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
std::cout << double(duration.count()) /1000/1000 << std::endl;
}

{
ezc3d::c3d c3d("markers_analogs.c3d");
ezc3d::c3d c3d("c3dExampleFiles/Vicon.c3d");

// Add two new points to the c3d (one filled with zeros, the other one with data)
c3d.point("new_point1"); // Add empty
Expand Down Expand Up @@ -162,7 +162,7 @@ int main()
int main()
{
{
ezc3d::c3d c3d("markers_analogs.c3d");
ezc3d::c3d c3d("c3dExampleFiles/Vicon.c3d");

// Add two new points to the c3d (one filled with zeros, the other one with data)
c3d.point("new_point1"); // Add empty
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ endif() #CMAKE_BUILD_TYPE STREQUAL "Coverage"

# Download and copy c3d test files from test suite of pyomeca
# Get the test suite from the pyomeca repository
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/test/c3dFiles/${FILE})
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/test/c3dFiles/ezc3d-testFiles-master)
file(
DOWNLOAD https://github.com/pyomeca/ezc3d-testFiles/archive/master.zip
${CMAKE_SOURCE_DIR}/test/c3dFiles/ezc3d-testFiles-master.zip
Expand Down