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

[SofaExporter] FIX: out-of-tree include of SofaExporter header files #975

Merged

Conversation

marques-bruno
Copy link
Member

Trying to include the SofaExporter module in an external project (out-of-tree build of a plugin || test) was not functional since include directories were not exposed properly.

I took inspiration from CImgPlugin for this PR, which uses CMAKE_CURRENT_SOURCE_DIR to expose the target's include directory.. but I believe this is actually wrong as this corresponds to the path to the sources (/home/bruno/dev/sofa/modules/SofaExporter/src/ in my case for instance) and not to the installed include directory, (which should be /home/bruno/dev/sofa/build/install/include/SofaExporter/src/SofaExporter on my machine)

I took a look at other plugins & pluginized modules & they all seem to do this, so Idk if it's a mistake or done on purpose..?


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

@marques-bruno marques-bruno added the pr: status to review To notify reviewers to review this pull-request label Mar 29, 2019
@marques-bruno marques-bruno self-assigned this Mar 29, 2019
@marques-bruno
Copy link
Member Author

[ci-build][with-all-tests]

@guparan
Copy link
Contributor

guparan commented Apr 3, 2019

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

@guparan guparan added pr: fix Fix a bug pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Apr 3, 2019
@marques-bruno marques-bruno added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Apr 4, 2019
@@ -8,4 +8,6 @@ if(NOT TARGET SofaExporter)
include("${CMAKE_CURRENT_LIST_DIR}/SofaExporterTargets.cmake")
endif()

# set(@PROJECT_NAME@_INCLUDE_DIRS @CMAKE_CURRENT_SOURCE_DIR@/src/)
Copy link
Contributor

Choose a reason for hiding this comment

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

commented ?

@marques-bruno marques-bruno added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Apr 15, 2019
@@ -99,7 +99,9 @@ target_compile_options(${PROJECT_NAME} PRIVATE "-DSOFA_BUILD_CIMGPLUGIN")
target_link_libraries(${PROJECT_NAME} SofaCore ${EXTERNAL_LIBS})
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>/include")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it kind of is:
There's .h & .cpp files present directly in CImgPlugin dir, so if, from external code, you want to include CImgPlugin.h for instance, by typing: #include <CImgPlugin/CImgPlugin.h> you'd have to include ../ no?

@guparan guparan added pr: status to review To notify reviewers to review this pull-request pr: status wip Development in the pull-request is still in progress and removed pr: status ready Approved a pull-request, ready to be squashed pr: status to review To notify reviewers to review this pull-request labels Apr 17, 2019
@marques-bruno
Copy link
Member Author

@guparan:
/media/jenkins/sofa-ci-dev/workspace/sofa-framework/PR-975/ubuntu_gcc-5.4_options_release/src/applications/plugins/image/extlibs/DiffusionSolver/DiffusionSolver.h:4:33: fatal error: CImgPlugin/SOFACImg.h: Aucun fichier ou dossier de ce type compilation terminated.

Looks like it's used also that way in the SOFA codebase. How should I proceed? should I put back the include of CImgPlugin/../ and remove the include of CImgPlugin + cleanup the codebase of all direct inclusions? Or do the opposite..?
Or should I just revert my previous commit?...

@marques-bruno marques-bruno added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Apr 24, 2019
@hugtalbot hugtalbot added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Apr 24, 2019
@guparan guparan added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status wip Development in the pull-request is still in progress labels Apr 26, 2019
@guparan
Copy link
Contributor

guparan commented Apr 26, 2019

Let me know if my latest commit broke something.
Otherwise, wait for CI then ready to merge!

@damienmarchal damienmarchal merged commit dac8de9 into sofa-framework:master Apr 27, 2019
@guparan guparan added this to the v19.06 milestone Jun 20, 2019
@damienmarchal damienmarchal deleted the fix_SofaExporter_includes branch August 25, 2020 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants