Skip to content

Commit

Permalink
[tests] adds missing find_package
Browse files Browse the repository at this point in the history
  • Loading branch information
EulalieCoevoet committed Jan 9, 2024
1 parent 767eb30 commit 0dcb7e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ sofa_create_package_with_targets(
install(DIRECTORY docs DESTINATION .)
install(FILES "README.md" "LICENSE.AGPLV3.txt" "LICENSE.AGPLV3.Clause11.txt" "CHANGELOG" DESTINATION .)

option(SOFTROBOTSINVERSE_BUILD_TESTS "Build unit tests" ON)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SOFTROBOTSINVERSE_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SOFTROBOTSINVERSE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

Expand Down
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0048 NEW)

project(SoftRobots.Inverse_test VERSION 1.0)
find_package(Sofa.Testing REQUIRED)

set(SOURCE_FILES )
set(HEADER_FILES )
Expand All @@ -15,7 +16,7 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${RC_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE "${SoftRobots_INCLUDE_DIRS}")

target_link_libraries(${PROJECT_NAME} Sofa.Testing SoftRobots.Inverse)
add_definitions("-DSOFTROBOTS_TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"")
add_definitions("-DSOFTROBOTSINVERSE_TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"")

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})

2 changes: 1 addition & 1 deletion tests/component/solver/QPInverseProblemSolverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct QPInverseProblemSolverTest : public BaseTest,
/// Load the scene
string sceneName = "Finger.scn";

string fileName = string(SOFTROBOTS_TEST_DIR) + "/component/solver/scenes/" + sceneName;
string fileName = string(SOFTROBOTSINVERSE_TEST_DIR) + "/component/solver/scenes/" + sceneName;

m_root = core::objectmodel::SPtr_dynamic_cast<simulation::Node>( sofa::simulation::node::load(fileName.c_str()));

Expand Down

0 comments on commit 0dcb7e5

Please sign in to comment.