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

[packages] Move all SofaComponent* + rename SofaAllCommonComponents #1155

Merged
merged 19 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
88300eb
[CMake] Export SOFA*_TARGETS for each meta-package
guparan Sep 17, 2019
29bb5c2
[SofaComponentMain] Remove unused package
guparan Sep 17, 2019
c7881bf
[SofaComponent*] MOVE all SofaComponent* packages out of modules
guparan Sep 17, 2019
ba3e691
[All] RENAME SofaAllCommonComponents into SofaComponentAll
guparan Sep 17, 2019
1a3776f
[CMake] CLEAN packages CMakeLists
guparan Sep 18, 2019
0a15a50
[SofaHelper] FIX #include order
guparan Sep 18, 2019
1b1c2fe
[SofaPreconditionner] FIX missing HAVE_SOFASPARSESOLVER in config.h
guparan Sep 19, 2019
5b3d1c4
[SofaMacros] FIX regex invalid sequence errors
guparan Sep 19, 2019
e8c8540
[SofaExporter] FIX undefined classes if no Python
guparan Sep 19, 2019
575648d
[SofaSparseSolver] CLEAN PrecomputedLinearSolver template instanciation
guparan Sep 19, 2019
adf0f53
[CMake] FIX missing find_package(SofaComponent*)
guparan Sep 19, 2019
28cfc0e
[packages] Pluginize all packages + rename into "collections"
guparan Sep 19, 2019
72b9065
[SofaMacros] ADD sofa_add_collection macro for better consistency
guparan Sep 19, 2019
2479ac4
[SofaMacros] Print lower case type in sofa_add_*
guparan Sep 19, 2019
bef730a
Revert "[SofaMacros] FIX regex invalid sequence errors"
guparan Sep 27, 2019
38bc0e4
Merge remote-tracking branch 'sofa-framework/master' into refactor_So…
guparan Sep 30, 2019
24154a5
Merge remote-tracking branch 'sofa-framework/master' into refactor_So…
guparan Oct 16, 2019
da8340d
[SofaComponentAll] ADD backward compatibility for SofaAllCommonCompon…
guparan Oct 17, 2019
c65f13e
[SofaComponentAll] Improve initExternalModule
guparan Oct 17, 2019
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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ add_subdirectory(SofaGeneral)
add_subdirectory(SofaAdvanced)
add_subdirectory(SofaMisc)

## Packages
add_subdirectory(applications/collections)

# This is all the applications GUI stuff. As there is a dependency to this one
# In scene creator and SofaPython...it is located here.
add_subdirectory(SofaGui)
Expand Down Expand Up @@ -278,9 +281,6 @@ endif()
## Plugins
add_subdirectory(applications/plugins)

## Packages
add_subdirectory(applications/packages)

## Applications
add_subdirectory(applications/projects)

Expand Down
2 changes: 1 addition & 1 deletion SofaAdvanced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(SOFAADVANCED_TARGETS
SofaNonUniformFem
)

foreach(TARGET ${SOFAADVANCED_TARGETS} SofaComponentAdvanced)
foreach(TARGET ${SOFAADVANCED_TARGETS})
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand Down
6 changes: 4 additions & 2 deletions SofaAdvanced/SofaAdvancedConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

@PACKAGE_INIT@

set(SOFAADVANCED_TARGETS @SOFAADVANCED_TARGETS@)

find_package(SofaGeneral REQUIRED)

foreach(target @SOFAADVANCED_TARGETS@ SofaComponentAdvanced)
foreach(target ${SOFAADVANCED_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaAdvancedTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFAADVANCED_TARGETS@ SofaComponentAdvanced)
check_required_components(${SOFAADVANCED_TARGETS})
7 changes: 0 additions & 7 deletions SofaAdvanced/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,4 @@
# define SOFA_NON_UNIFORM_FEM_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_COMPONENT_ADVANCED
# define SOFA_TARGET SofaComponentAdvanced
# define SOFA_COMPONENT_ADVANCED_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_COMPONENT_ADVANCED_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#endif
2 changes: 1 addition & 1 deletion SofaGeneral/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(Newmat_FOUND)
endif()
sofa_set_01(SOFAGENERAL_HAVE_SOFADENSESOLVER VALUE ${Newmat_FOUND})

foreach(TARGET ${SOFAGENERAL_TARGETS} SofaComponentGeneral)
foreach(TARGET ${SOFAGENERAL_TARGETS})
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand Down
6 changes: 4 additions & 2 deletions SofaGeneral/SofaGeneralConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

@PACKAGE_INIT@

set(SOFAGENERAL_TARGETS @SOFAGENERAL_TARGETS@)

set(SOFAGENERAL_HAVE_SOFADENSESOLVER @SOFAGENERAL_HAVE_SOFADENSESOLVER@)
set(SOFADENSESOLVER_HAVE_NEWMAT @SOFADENSESOLVER_HAVE_NEWMAT@)
set(SOFAGENERALLOADER_HAVE_ZLIB @SOFAGENERALLOADER_HAVE_ZLIB@)
Expand All @@ -15,11 +17,11 @@ if(SOFAGENERALLOADER_HAVE_ZLIB)
find_package(ZLIB QUIET REQUIRED)
endif()

foreach(target @SOFAGENERAL_TARGETS@ SofaComponentGeneral)
foreach(target ${SOFAGENERAL_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaGeneralTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFAGENERAL_TARGETS@ SofaComponentGeneral)
check_required_components(${SOFAGENERAL_TARGETS})
7 changes: 0 additions & 7 deletions SofaGeneral/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,6 @@
# define SOFA_BOUNDARY_CONDITION_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_COMPONENT_GENERAL
# define SOFA_TARGET SofaComponentGeneral
# define SOFA_COMPONENT_GENERAL_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_COMPONENT_GENERAL_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_GENERAL_LINEAR_SOLVER
# define SOFA_TARGET SofaGeneralLinearSolver
# define SOFA_GENERAL_LINEAR_SOLVER_API SOFA_EXPORT_DYNAMIC_LIBRARY
Expand Down
6 changes: 4 additions & 2 deletions SofaGui/SofaGuiConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

@PACKAGE_INIT@

set(SOFAGUI_TARGETS @SOFAGUI_TARGETS@)

set(SOFAGUI_HAVE_SOFAHEADLESSRECORDER @SOFAGUI_HAVE_SOFAHEADLESSRECORDER@)
set(SOFAGUI_HAVE_SOFAGUIQT @SOFAGUI_HAVE_SOFAGUIQT@)
set(SOFAGUIQT_HAVE_QTVIEWER @SOFAGUIQT_HAVE_QTVIEWER@)
Expand Down Expand Up @@ -29,11 +31,11 @@ if(SOFAGUI_HAVE_SOFAGUIQT)
endif()
endif()

foreach(target @SOFAGUI_TARGETS@)
foreach(target ${SOFAGUI_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaGuiTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFAGUI_TARGETS@)
check_required_components(${SOFAGUI_TARGETS})
2 changes: 1 addition & 1 deletion SofaKernel/SofaBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(SOFABASE_TARGETS
SofaBaseVisual
)

foreach(TARGET ${SOFABASE_TARGETS} SofaComponentBase)
foreach(TARGET ${SOFABASE_TARGETS})
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand Down
6 changes: 4 additions & 2 deletions SofaKernel/SofaBase/SofaBaseConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

@PACKAGE_INIT@

set(SOFABASE_TARGETS @SOFABASE_TARGETS@)

find_package(SofaSimulation REQUIRED)

foreach(target @SOFABASE_TARGETS@ SofaComponentBase)
foreach(target ${SOFABASE_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaBaseTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFABASE_TARGETS@)
check_required_components(${SOFABASE_TARGETS})
7 changes: 0 additions & 7 deletions SofaKernel/SofaBase/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,4 @@
# define SOFA_BASE_VISUAL_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_COMPONENT_BASE
# define SOFA_TARGET SofaComponentBase
# define SOFA_COMPONENT_BASE_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_COMPONENT_BASE_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#endif
2 changes: 1 addition & 1 deletion SofaKernel/SofaCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(SOFACOMMON_TARGETS
SofaEigen2Solver
)

foreach(TARGET ${SOFACOMMON_TARGETS} SofaComponentCommon)
foreach(TARGET ${SOFACOMMON_TARGETS})
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand Down
6 changes: 4 additions & 2 deletions SofaKernel/SofaCommon/SofaCommonConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

@PACKAGE_INIT@

set(SOFACOMMON_TARGETS @SOFACOMMON_TARGETS@)

find_package(SofaBase REQUIRED SofaComponentBase)

foreach(target @SOFACOMMON_TARGETS@ SofaComponentCommon)
foreach(target ${SOFACOMMON_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaCommonTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFACOMMON_TARGETS@)
check_required_components(${SOFACOMMON_TARGETS})
7 changes: 0 additions & 7 deletions SofaKernel/SofaCommon/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,5 @@
# define SOFA_EIGEN2_SOLVER_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_COMPONENT_COMMON
# define SOFA_TARGET SofaComponentCommon
# define SOFA_COMPONENT_COMMON_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_COMPONENT_COMMON_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif


#endif
16 changes: 10 additions & 6 deletions SofaKernel/SofaFramework/SofaMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ endmacro()
macro(sofa_add_generic directory name type)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${directory}" AND IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${directory}")
string(TOUPPER ${type}_${name} option)
string(TOLOWER ${type} type_lower)

# optional parameter to activate/desactivate the option
# e.g. sofa_add_application( path/MYAPP MYAPP APPLICATION ON)
Expand All @@ -104,9 +105,9 @@ macro(sofa_add_generic directory name type)
endif()
endif()

option(${option} "Build the ${name} ${type}." ${active})
option(${option} "Build the ${name} ${type_lower}." ${active})
if(${option})
message("Adding ${type} ${name}")
message("Adding ${type_lower} ${name}")
add_subdirectory(${directory})
#Check if the target has been successfully added
if(TARGET ${name})
Expand All @@ -131,22 +132,23 @@ macro(sofa_add_generic directory name type)
set_property(GLOBAL APPEND PROPERTY __GlobalTargetNameList__ ${option})
endif()
else()
message("${type} ${name} (${CMAKE_CURRENT_LIST_DIR}/${directory}) does not exist and will be ignored.")
message("The ${type_lower} ${name} (${CMAKE_CURRENT_LIST_DIR}/${directory}) does not exist and will be ignored.")
endif()
endmacro()

macro(sofa_add_collection directory name)
sofa_add_generic( ${directory} ${name} "Collection" ${ARGV2} )
endmacro()

macro(sofa_add_plugin directory plugin_name)
sofa_add_generic( ${directory} ${plugin_name} "Plugin" ${ARGV2} )
endmacro()


macro(sofa_add_plugin_experimental directory plugin_name)
sofa_add_generic( ${directory} ${plugin_name} "Plugin" ${ARGV2} )
message("-- ${plugin_name} is an experimental feature, use it at your own risk.")
endmacro()


macro(sofa_add_module directory module_name)
sofa_add_generic( ${directory} ${module_name} "Module" ${ARGV2} )
endmacro()
Expand Down Expand Up @@ -186,6 +188,8 @@ function(sofa_add_generic_external directory name type)
return()
endif()

string(TOLOWER ${type} type_lower)

# Default value for fetch activation and for plugin activation (if adding a plugin)
set(active OFF)
set(optional_argv3 "${ARGV3}")
Expand All @@ -202,7 +206,7 @@ function(sofa_add_generic_external directory name type)

# Fetch
if(${fetch_enabled})
message("Fetching ${type} ${name}")
message("Fetching ${type_lower} ${name}")

if(NOT EXISTS ${fetched_dir})
file(MAKE_DIRECTORY ${fetched_dir})
Expand Down
6 changes: 4 additions & 2 deletions SofaKernel/SofaSimulation/SofaSimulationConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

@PACKAGE_INIT@

set(SOFASIMULATION_TARGETS @SOFASIMULATION_TARGETS@)

find_package(SofaFramework REQUIRED)

foreach(target @SOFASIMULATION_TARGETS@)
foreach(target ${SOFASIMULATION_TARGETS})
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaSimulationTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFASIMULATION_TARGETS@)
check_required_components(${SOFASIMULATION_TARGETS})
4 changes: 2 additions & 2 deletions SofaKernel/framework/sofa/helper/system/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#ifndef SOFA_HELPER_SYSTEM_GL_H
#define SOFA_HELPER_SYSTEM_GL_H

#include <sofa/helper/system/config.h>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is a fix that has nothing to do with my PR.
Still, it is needed when SOFA_NO_OPENGL is ON.


#ifndef SOFA_NO_OPENGL

#include <sofa/helper/helper.h>
#include <sofa/helper/system/config.h>
#include <string>

# include <GL/glew.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DiagonalMass_test : public BaseTest

void SetUp() override
{
sofa::simpleapi::importPlugin("SofaAllCommonComponents") ;
sofa::simpleapi::importPlugin("SofaComponentAll") ;

component::initBaseMechanics();
simulation::setSimulation(simulation = new simulation::graph::DAGSimulation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct UniformMassTest : public BaseTest

virtual void SetUp()
{
sofa::simpleapi::importPlugin("SofaAllCommonComponents") ;
sofa::simpleapi::importPlugin("SofaComponentAll") ;

todo = true ;
initBaseMechanics();
Expand Down
20 changes: 0 additions & 20 deletions SofaKernel/modules/SofaComponentCommon/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RestStiffSpringsForceField_test::~RestStiffSpringsForceField_test()

sofa::Node::SPtr RestStiffSpringsForceField_test::createScene(const std::string& type)
{
importPlugin("SofaAllCommonComponents");
importPlugin("SofaComponentAll");
auto theSimulation = createSimulation();
auto theRoot = createRootNode(theSimulation, "root");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.1)

project(SofaFrameworkExtra_test)

find_package(SofaComponentBase REQUIRED)

set(SOURCE_FILES
core/TrackedData_test.cpp
core/objectmodel/Base_test.cpp
Expand All @@ -14,6 +16,6 @@ set(SOURCE_FILES

add_executable(${PROJECT_NAME} ${SOURCE_FILES})
add_definitions("-DSOFAFRAMEWORKEXTRA_TEST_SCENES_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/scenes\"")
target_link_libraries(${PROJECT_NAME} SofaGTestMain SofaHelper)
target_link_libraries(${PROJECT_NAME} SofaGTestMain SofaHelper SofaComponentBase)

add_test(NAME SofaFrameworkExtra_test COMMAND SofaFrameworkExtra_test)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BaseContext_test: public BaseSimulationTest
void testGetObjects()
{
EXPECT_MSG_NOEMIT(Error, Warning) ;
importPlugin("SofaAllCommonComponents") ;
importPlugin("SofaComponentAll") ;
std::stringstream scene ;
scene << "<?xml version='1.0'?>"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NodeContext_test: public BaseSimulationTest

NodeContext_test()
{
importPlugin("SofaAllCommonComponents") ;
importPlugin("SofaComponentAll") ;
}

void testGetNodeObjects()
Expand Down
2 changes: 1 addition & 1 deletion SofaMisc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(SOFAMISC_TARGETS
SofaMiscTopology
)

foreach(TARGET ${SOFAMISC_TARGETS} SofaComponentMisc)
foreach(TARGET ${SOFAMISC_TARGETS})
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand Down
Loading