sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
934 stars 312 forks source link

Sofa_add_Subdirectory cannot be recognized in versions prior to Sofa v21.12 #4941

Closed zhanglepy closed 3 months ago

zhanglepy commented 3 months ago

May I ask, when compiling Sofa v21.12 and previous versions, there was an issue where plugins could not be used, but after Sofa v22 version, this problem no longer exists. Currently, I need to use the Optimus plugin (compatible with Sofa v21.12), so how can I solve this problem for all the experts?

cmake_minimum_required(VERSION 2.8.12) find_package(SofaFramework) sofa_add_subdirectory(plugin STLIB/ STLIB VERSION 3.0)

CMake Error at //path/to/SOFA/ext_plugin_repo/CMakeLists.txt:5 (sofa_add_subdirectory): sofa_add_subdirectory Macro invoked with incorrect arguments for macro named: sofa_add_subdirectory

Before Sofa v21.12, it seems that Sofa_add_Subdirectory cannot be recognized. Could you please modify it to something that can recognize it??

Thank you all!

zhanglepy commented 3 months ago

I'm quite anxious, thank you!

bakpaul commented 3 months ago

Hello @zhanglepy, I am really sorry but this release is not supported anymore. This means that not only we don't compile it anymore but also any other issue you'll face when using it will be resolved as 'This is not supported anymore'. If new version are released every 6 months it is because we are fixing such issue commit after commit, so if you face anything in this old version, it is certainly already fixed in recent releases... So my first advice would be to update SOFA and try to compile Optimus with the new SOFA, this will be cumbersome for sure, but at the end, you'll get better support. If Optimus is not up to date it is because no one is using it since this release.

Anyway, I'll quickly try to compile it on my computer. I won't promise anything, if the issue takes too much time I'll certainly not try to fix it for this old release. I'll keep you updated !

bakpaul commented 3 months ago

Ok, I've just tried to compile SOFA v21.12 with Optimus v21.12 and STLIB v21.12. I've cleanly cloned them three and configured cmake with the following : cmake /path/to/sofa -DSOFA_EXTERNAL_DIRECTORIES=/path/to/Optimus;/path/to/STLIB and cmake works like a charm. Didn't compile it though, but the cmake shouldn't crash at least. So I suggest you to delete your cloned repositories and clone them again and then directly checkout v21.12.

Your issue is due to the fact that you are adding the project using this macro sofa_add_subdirectory which didn't exist at the time. I think the closes one was sofa_add_plugin. But using this macro is not mandatory, you can add such plugins with SOFA_EXTERNAL_DIRECTORIES if you don't have to much of them...

Sometimes, cloning first master then switching branch can generate issues, if so you can use this command line instead git clone -b v21.12 --single-branch git@github.com:sofa-framework/sofa.git

From now, I won't provide more help on this old release, if you face anything else, I highly suggest you to update your SOFA version.

zhanglepy commented 3 months ago

Thank you for your prompt response and provided solution!