From ebf4fa56bc139f66fe908fbb069dd2af22edbd82 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 17 Dec 2021 08:31:46 +0000 Subject: [PATCH] Fix build and clean workflow (#5) * Clean workflow * Merge branch 'v21.06' into clean_workflow * CLEAN CMakeLists.txt * [CI] Remove build with SOFA v21.06 master branch is not compatible with SOFA v21.06 anymore --- .github/workflows/ci.yml | 4 ++-- CMakeLists.txt | 18 +++++++----------- cmake/environment.cmake | 18 +++++++++--------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd93a32a3..7d4d7edbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, macos-10.15, windows-2019] - sofa_branch: [v21.12,master] + sofa_branch: [master, v21.12] steps: - name: Setup SOFA and environment @@ -22,7 +22,7 @@ jobs: with: sofa_root: ${{ github.workspace }}/sofa sofa_version: ${{ matrix.sofa_branch }} - sofa_scope: 'full' + sofa_scope: 'standard' - name: Checkout source code uses: actions/checkout@v2 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 2460245bd..43c103a70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,6 @@ find_package(SofaFramework REQUIRED) find_package(SofaBaseMechanics REQUIRED) find_package(SofaConstraint REQUIRED) find_package(SofaUserInteraction REQUIRED) -find_package(SofaImplicitField REQUIRED) find_package(Sofa.GL REQUIRED) find_package(SofaImplicitField QUIET) @@ -51,7 +50,6 @@ set(HEADER_FILES ${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.h ${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.inl - ${BEAMADAPTER_SRC}/utils/deprecatedcomponent.h ) @@ -78,9 +76,6 @@ set(SOURCE_FILES ${BEAMADAPTER_SRC}/component/mapping/MultiAdaptiveBeamMapping.cpp ) - -set(README_FILE "README.md" ) - if(SofaImplicitField_FOUND) set(HEADER_FILES ${HEADER_FILES} ${BEAMADAPTER_SRC}/component/constraint/ImplicitSurfaceAdaptiveConstraint.h @@ -90,7 +85,6 @@ if(SofaImplicitField_FOUND) set(SOURCE_FILES ${SOURCE_FILES} ${BEAMADAPTER_SRC}/component/constraint/ImplicitSurfaceAdaptiveConstraint.cpp ) - endif() if(SofaAdvancedConstraint_FOUND) @@ -115,7 +109,6 @@ if(SofaAdvancedConstraint_FOUND) #cuda_add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES}) endif() - add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES}) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_BEAMADAPTER") @@ -123,7 +116,13 @@ set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_BEA target_include_directories(${PROJECT_NAME} PUBLIC "$") target_include_directories(${PROJECT_NAME} PUBLIC "$") -target_link_libraries(${PROJECT_NAME} Sofa.Helper Sofa.Core SofaConstraint SofaBaseMechanics SofaUserInteraction SofaImplicitField Sofa.GL) +target_link_libraries(${PROJECT_NAME} Sofa.Helper Sofa.Core SofaConstraint SofaBaseMechanics SofaUserInteraction Sofa.GL) +if(SofaImplicitField_FOUND) + target_link_libraries(${PROJECT_NAME} SofaImplicitField) +endif() +if(SofaAdvancedConstraint_FOUND) + target_link_libraries(${PROJECT_NAME} SofaAdvancedConstraint) +endif() sofa_create_package_with_targets( PACKAGE_NAME ${PROJECT_NAME} @@ -148,10 +147,7 @@ endif() #set(LINKER_DEPENDENCIES SofaAdvancedConstraint) #endif() -# # Organize projects into folders -# - SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "plugins") diff --git a/cmake/environment.cmake b/cmake/environment.cmake index 5f0952e2e..c24e22c99 100644 --- a/cmake/environment.cmake +++ b/cmake/environment.cmake @@ -1,17 +1,17 @@ # CMake modules path, for our FindXXX.cmake modules list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/extlibs) +list(APPEND CMAKE_PREFIX_PATH ${PROJECT_BINARY_DIR}) +list(APPEND CMAKE_PREFIX_PATH ${PROJECT_BINARY_DIR}/extlibs) ## Default build type -if(NOT CMAKE_BUILD_TYPE) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Release") endif() -## Change default install prefix -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install/${PROJECT_NAME} CACHE PATH "Install path prefix, prepended onto install directories." FORCE) +## Force default install prefix +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT "${PROJECT_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install/${PROJECT_NAME}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) endif() message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") @@ -23,9 +23,9 @@ if(WIN32) else() set(LIBRARY_OUTPUT_DIRECTORY ${ARCHIVE_OUTPUT_DIRECTORY}) endif() -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ARCHIVE_OUTPUT_DIRECTORY}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${RUNTIME_OUTPUT_DIRECTORY}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIBRARY_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${ARCHIVE_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${RUNTIME_OUTPUT_DIRECTORY}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBRARY_OUTPUT_DIRECTORY}) ## RPATH if(UNIX)