Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ jobs:
echo "DYLD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$DYLD_LIBRARY_PATH" | tee -a $GITHUB_ENV
fi
echo "LD_LIBRARY_PATH=$WORKSPACE_ARTIFACT_PATH/lib:$SOFA_ROOT/lib:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
# Add execution right on the tests
chmod +x $WORKSPACE_BUILD_PATH/PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}


- name: Check environment for tests
shell: bash
run: |
Expand All @@ -109,8 +107,10 @@ jobs:
if: always()
shell: bash
run: |
# Add execution right on the tests
chmod +x $WORKSPACE_BUILD_PATH/bin/PluginExample_test${{ steps.sofa.outputs.exe }}
cd $WORKSPACE_BUILD_PATH
./PluginExample_test/PluginExample_test${{ steps.sofa.outputs.exe }}
./bin/PluginExample_test${{ steps.sofa.outputs.exe }}

deploy:
name: Deploy artifacts
Expand Down
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ project(PluginExample 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
find_package(Sofa.Framework 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.GUI.Common QUIET REQUIRED) # Dependency to SofaGuiQt

# List all files
set(PLUGINEXAMPLE_SRC_DIR src/PluginExample)
Expand All @@ -32,7 +31,9 @@ set(README_FILES
README.md
)

if(Qt5Core_FOUND AND SofaGui_FOUND)
sofa_find_package(Sofa.GUI.Qt QUIET)

if(Sofa.GUI.Common_FOUND AND Sofa.GUI.Qt_FOUND)
message(STATUS "GUI components have been detected, enable GUI-related components")
list(APPEND HEADER_FILES_TO_MOC
${PLUGINEXAMPLE_SRC_DIR}/MyDataWidgetUnsigned.h
Expand All @@ -43,19 +44,22 @@ if(Qt5Core_FOUND AND SofaGui_FOUND)

# [Qt] Create moc code.
qt5_wrap_cpp(MOCCED_HEADER_FILES ${HEADER_FILES_TO_MOC})

endif()


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

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

if(Sofa.GUI.Common_FOUND AND Sofa.GUI.Qt_FOUND)
# Link with the optional GUI dependencies.
target_link_libraries(${PROJECT_NAME} Sofa.GUI.Qt)
endif()


# Create package Config, Version & Target files.
# Deploy the headers, resources, scenes & examples.
# Set the plugin 'relocatable' if built within SOFA.
Expand Down
10 changes: 6 additions & 4 deletions PluginExampleConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
@PACKAGE_GUARD@
@PACKAGE_INIT@

set(PLUGINEXAMPLE_HAVE_SOFAGUI @PLUGINEXAMPLE_HAVE_SOFAGUI@)
set(PLUGINEXAMPLE_HAVE_SOFAGUIQT @PLUGINEXAMPLE_HAVE_SOFAGUIQT@)
set(PLUGINEXAMPLE_HAVE_QT5CORE @PLUGINEXAMPLE_HAVE_QT5CORE@)

find_package(SofaBase QUIET REQUIRED)
find_package(Sofa.Framework QUIET REQUIRED) # Dependency to SofaBaseVisual
find_package(Sofa.GUI.Common QUIET REQUIRED) # Dependency to SofaGuiQt

if(PLUGINEXAMPLE_HAVE_SOFAGUI)
find_package(SofaGui QUIET REQUIRED)
if(PLUGINEXAMPLE_HAVE_SOFAGUIQT)
find_package(Sofa.GUI.Qt QUIET REQUIRED)
endif()

if(PLUGINEXAMPLE_HAVE_QT5CORE)
find_package(Qt5 COMPONENTS Core QUIET REQUIRED)
endif()
Expand Down