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

[All] CMake and includes massive clean #1397

Merged
merged 101 commits into from
Jun 24, 2020

Conversation

guparan
Copy link
Contributor

@guparan guparan commented May 27, 2020

Hard to do some cleaning in CMakeLists without touching all SOFA files!

This PR contains:


Default properties for targets calling sofa_generate_package or sofa_install_targets

  • include_directories:
    • BUILD_INTERFACE: the directory given in INCLUDE_SOURCE_DIR or "${CMAKE_CURRENT_SOURCE_DIR}/.." (bad but necessary for old modules)
    • BUILD_INTERFACE: "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}"
    • INSTALL_INTERFACE: "install" (if relocatable plugin) or "install/${PROJECT_NAME}"
  • DEBUG_POSTFIX: "_d"
  • VERSION: Sofa_VERSION

Cleaning of config.h mechanism (consistency with all other SOFA modules)

  • deprecate headers not following the "config.h" naming convention
    • sofa/core/core.h -> sofa/core/config.h
    • sofa/defaulttype/defaulttype.h -> sofa/defaulttype/config.h
    • sofa/helper/helper.h -> sofa/helper/config.h
    • sofa/simulation/simulationcore.h -> sofa/simulation/config.h
    • SofaSimulationCommon/common.h -> SofaSimulationCommon/config.h
    • SofaSimulationGraph/graph.h -> SofaSimulationGraph/config.h
    • SofaSimulationTree/tree.h -> SofaSimulationTree/config.h
    • sofa/gui/SofaGUI.h -> sofa/gui/config.h
    • sofa/gui/qt/SofaGuiQt.h -> sofa/gui/qt/config.h
  • centralize config.h call chain on sofa/config.h
    • sofa/helper/system/config.h is now useless
      -> WARNING: maybe not a good idea, review needed here
  • dispatch all SOFA_BUILD_* macros from packages' config.h towards modules' config.h (good for future modularizations)

Moving SofaGui modules into "modules" directory + cleaning their source trees


Every package is now also a library. Work started by @fredroy in #1314, 3 packages remained

  • SofaFramework
  • SofaGui
  • SofaSimulation

Cleaning source trees to eliminate some ".." include directories
(files move but includes stay the same)

  • SofaExporter
  • SofaGuiCommon
  • SofaGuiQt
  • SofaHeadlessRecorder
  • SofaMiscCollision

Fix #1395 by removing "relocatable" attribute from SofaNonUniformFem, SofaValidation, SofaDenseSolver.


- Add default target_include_directories
-
- Add a SofaFramework library (collection)
- Clean SofaFramework source tree
- Clean and consistent config.h for SofaCore, SofaDefaultType, SofaHelper, SofaSimulationCore
  -> core.h, defaulttype.h, helper.h and simulationcore.h are kept for backward compatibility
- Add a SofaSimulation library (collection)
- Clean SofaSimulation source tree
- Clean and consistent config.h for SofaSimulationCommon, SofaSimulationGraph, SofaSimulationTree
  -> common.h, graph.h and tree.h are kept for backward compatibility
- Add a SofaGui library (collection)
- Clean SofaGui source tree
- Add default target_include_directories for BUILD_INTERFACE and INSTALL_INTERFACE
- Add default target_compile_definitions for SOFA_BUILD_SOFAMODULENAME + SOFA_BUILD_MODULE_NAME (legacy)
@@ -22,7 +23,5 @@ set(SOURCE_FILES

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC SofaSimulationCommon)
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_SIMULATION_TREE")
Copy link
Contributor

Choose a reason for hiding this comment

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

normal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup that's the point of this PR 👍

# if(NOT "${include_source_root}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/..")
# get_target_property(target_include_dirs ${target} "INCLUDE_DIRECTORIES")
# message("${target}: target_include_directories: ${target_include_dirs}")
# endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

commented ?

@guparan guparan 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 Jun 17, 2020
@guparan
Copy link
Contributor Author

guparan commented Jun 17, 2020

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

@guparan guparan 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 Jun 19, 2020
@hugtalbot
Copy link
Contributor

hugtalbot commented Jun 19, 2020

The CI does not look happy, but I think it's nothing:

for Linux: some permission error at CMake phase

and Windows:

  • 139 - see BUILD_URL/artifact/parent_dir/build/scene-tests/archive/applications/plugins/SensableEmulation/examples/SimpleBox-Method2.scn/output.txt
  • 3 - see BUILD_URL/artifact/parent_dir/build/scene-tests/archive/examples/Components/topology/TopologicalModifiers/HexahedronForceFieldTopologyChangeHandling.scn/output.txt
  • scenes not working:
    HexahedronCompositeFEMMapping.scn
    HexahedronCompositeFEMForceFieldAndMass.scn

@hugtalbot hugtalbot 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 Jun 24, 2020
@hugtalbot hugtalbot merged commit 4900646 into sofa-framework:master Jun 24, 2020
@guparan guparan added this to the v20.06 milestone Jun 25, 2020
@guparan guparan mentioned this pull request Jul 10, 2020
6 tasks
@guparan guparan deleted the cmake_massive_clean branch October 29, 2021 08:26
alxbilger pushed a commit to alxbilger/sofa that referenced this pull request Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: breaking Change possibly inducing a compilation error pr: clean Cleaning the code pr: do not squash To merge instead of squash a pull-request pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relocated plugins path is not included in installation RPATH
2 participants