Skip to content

Commit

Permalink
Fix and clean CMake and dependencies (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger authored Aug 6, 2024
1 parent 091ca9b commit 78f12b9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 59 deletions.
32 changes: 8 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ cmake_minimum_required(VERSION 3.12)
project(Shell VERSION 1.0 LANGUAGES CXX)

# Find and load CMake configuration of packages containing this plugin's dependencies
## Mandatory dependencies
find_package(SofaBase REQUIRED) # Dependency to SofaBaseVisual
## Optional dependencies
sofa_find_package(SofaGui) # Dependency to SofaGuiQt
sofa_find_package(Qt5 COMPONENTS Core) # Dependency to Qt5Core (needed for qt5_wrap_cpp)
find_package(Sofa.Component.Controller REQUIRED)
sofa_find_package(Sofa.Component.StateContainer REQUIRED)


# List all files
set(SHELL_SRC_DIR src/Shell)
Expand All @@ -19,29 +17,23 @@ set(HEADER_FILES
${SHELL_SRC_DIR}/engine/JoinMeshPoints.inl
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.h
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.inl
)
set(HEADER_FILES_TO_MOC
)
)
set(SOURCE_FILES
${SHELL_SRC_DIR}/initShell.cpp
${SHELL_SRC_DIR}/controller/MeshChangedEvent.cpp
${SHELL_SRC_DIR}/controller/MeshInterpolator.cpp
${SHELL_SRC_DIR}/engine/JoinMeshPoints.cpp
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.cpp
)
)
set(README_FILES
README.md
)
)

# Create the plugin library.
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES_TO_MOC} ${MOCCED_HEADER_FILES} ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})

# Link the plugin library to its dependency(ies).
target_link_libraries(${PROJECT_NAME} SofaBaseVisual SofaUserInteraction)
# Link with the optional GUI dependencies.
if(Qt5Core_FOUND AND SofaGui_FOUND)
target_link_libraries(${PROJECT_NAME} SofaGuiQt)
endif()
target_link_libraries(${PROJECT_NAME} Sofa.Component.Controller Sofa.Component.StateContainer)

# Create package Config, Version & Target files.
# Deploy the headers, resources, scenes & examples.
Expand All @@ -55,11 +47,3 @@ sofa_create_package_with_targets(
INCLUDE_INSTALL_DIR ${PROJECT_NAME}
RELOCATABLE "plugins"
)

# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SHELL_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SHELL_BUILD_TESTS)
enable_testing()
add_subdirectory(Shell_test)
endif()
13 changes: 2 additions & 11 deletions ShellConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@
@PACKAGE_GUARD@
@PACKAGE_INIT@

set(SHELL_HAVE_SOFAGUI @SHELL_HAVE_SOFAGUI@)
set(SHELL_HAVE_QT5CORE @SHELL_HAVE_QT5CORE@)

find_package(SofaBase QUIET REQUIRED)

if(SHELL_HAVE_SOFAGUI)
find_package(SofaGui QUIET REQUIRED)
endif()
if(SHELL_HAVE_QT5CORE)
find_package(Qt5 COMPONENTS Core QUIET REQUIRED)
endif()
find_package(Sofa.Component.Controller QUIET REQUIRED)
find_package(Sofa.Component.StateContainer QUIET REQUIRED)

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
Expand Down
15 changes: 0 additions & 15 deletions Shell_test/CMakeLists.txt

This file was deleted.

5 changes: 0 additions & 5 deletions src/Shell/forcefield/TriangularBendingFEMForceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
******************************************************************************/
#pragma once

#if !defined(__GNUC__) || (__GNUC__ > 3 || (_GNUC__ == 3 && __GNUC_MINOR__ > 3))
#pragma once
#endif


#include <sofa/core/behavior/ForceField.h>
#include <sofa/core/behavior/MechanicalState.h>
#include <sofa/core/objectmodel/Data.h>
Expand Down
5 changes: 1 addition & 4 deletions src/Shell/forcefield/TriangularBendingFEMForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#pragma once

#include <sofa/core/behavior/ForceField.inl>
#include <sofa/gl/template.h>
#include <sofa/gl/gl.h>
#include <sofa/helper/system/thread/debug.h>
#include <fstream> // for reading the file
#include <iostream> //for debugging
Expand All @@ -34,7 +32,6 @@
#include <map>
#include <utility>
#include <sofa/core/topology/TopologyData.inl>
#include <sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.h>

#include <sofa/core/visual/VisualParams.h>
#include <sofa/simulation/AnimateEndEvent.h>
Expand All @@ -49,7 +46,7 @@
namespace shell::forcefield
{
using namespace sofa::type;
using namespace sofa::component::topology;
// using namespace sofa::component::topology;



Expand Down

0 comments on commit 78f12b9

Please sign in to comment.