Skip to content

Commit

Permalink
Merge branch 'windows_workflow' into refresh_v2412
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Nov 28, 2024
2 parents a51576c + fb11b9f commit 8050cef
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
&& ccache -s

- name: Archive production
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4.4.0
with:
name: caribou_macos_${{ matrix.sofa_version }}
path: SofaCaribou.tar.gz
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
git config --global user.email "caribou@github.com"
git config --global user.name "Caribou Github"
git fetch origin
git rebase origin/master
git merge origin/master
- name: Install pybind11
if: ${{ matrix.PYBIND11_VERSION != '2.4' }}
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
&& ccache -s

- name: Archive production
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4.4.0
with:
name: caribou_${{ matrix.sofa_version }}
path: SofaCaribou.tar.gz
Expand Down
251 changes: 251 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: Windows

on:
pull_request:
branches:
- master
schedule:
# Runs every day at 23:15
- cron: '15 23 * * *'

jobs:
build:
name: Building with ${{ matrix.sofa_version }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sofa_version: [ master ]
include:
- sofa_version: master
PYTHON_VERSION: 3.8
EIGEN_VERSION: 3.4
PYBIND11_VERSION: 2.4.3
# - sofa_version: v21.12.00
# PYTHON_VERSION: 3.7
# EIGEN_VERSION: 3.3.7
# PYBIND11_VERSION: 2.4.3
env:
SOFA_VERSION: ${{ matrix.sofa_version }}
SOFA_ROOT: ${{ format('{0}/sofa', github.workspace) }}
PYBIND11_ROOT: ${{ format('{0}/pybind11', github.workspace) }}
PYBIND11_VERSION: ${{ matrix.PYBIND11_VERSION }}
QT_ROOT: ${{ format('{0}/qt', github.workspace) }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
BOOST_ROOT: ${{ format('{0}/boost', github.workspace) }}
EIGEN_ROOT: ${{ format('{0}/eigen', github.workspace) }}
EIGEN_VERSION: ${{ matrix.EIGEN_VERSION }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- run: |
git config --global user.email "caribou@github.com"
git config --global user.name "Caribou Github"
git fetch origin
git merge origin/master
# Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}

# Eigen3
- name: cache eigen
uses: actions/cache@v2
id: cache-eigen
with:
path: ${{ github.workspace }}/eigen
key: eigen-${{ matrix.EIGEN_VERSION }}-windows
- name: Install Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
shell: bash
run: |
git clone --depth 1 -b $EIGEN_VERSION https://gitlab.com/libeigen/eigen.git eigen_src
cmake -S eigen_src -B eigen_src/build -DCMAKE_BUILD_TYPE=Release -DEIGEN_BUILD_DOC=OFF -DCMAKE_INSTALL_PREFIX="$EIGEN_ROOT"
cmake --build eigen_src/build --target install
# PYBIND11
- name: Install pybind11
shell: bash
run: |
git clone --depth 1 -b v$PYBIND11_VERSION https://github.com/pybind/pybind11.git pybind11_src
cmake -S pybind11_src -B pybind11_src/build -DPYBIND11_TEST=OFF -DCMAKE_BUILD_TYPE=Release -DPYBIND11_FINDPYTHON=ON
cmake --install pybind11_src/build --prefix $PYBIND11_ROOT
rm -rf pybind11_src
# BOOST
- name: Cache Boost
id: cache-Boost
uses: actions/cache@v1
with:
path: ${{ format('{0}/boost', github.workspace) }}
key: boost-1.69.0-windows

- name: Install Boost
if: steps.cache-Boost.outputs.cache-hit != 'true'
run: |
$BOOST_MAJOR = 1
$BOOST_MINOR = 69
$BOOST_PATCH = 0
Invoke-WebRequest "https://boost.teeks99.com/bin/$($BOOST_MAJOR).$($BOOST_MINOR).$($BOOST_PATCH)/boost_$($BOOST_MAJOR)_$($BOOST_MINOR)_$($BOOST_PATCH)-msvc-14.1-64.exe" -OutFile boostinstaller.exe
./boostinstaller.exe /NORESTART /VERYSILENT /DIR="$($BOOST_ROOT)" | Out-Null
rm -Force boostinstaller.exe
# SOFA
- name: Download SOFA Release
shell: bash
run: |
if [ "$SOFA_VERSION" = "master" ]; then
curl --output sofa.zip -L "https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=master,CI_SCOPE=standard/lastSuccessfulBuild/artifact/Windows/*zip*/Windows.zip"
unzip sofa.zip -d temp
mv temp/Windows/`ls temp/Windows` sofa.zip
rm -rf temp
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
rm -rf temp
else
curl --output sofa.zip -L "https://github.com/sofa-framework/sofa/releases/download/$SOFA_VERSION/SOFA_"$SOFA_VERSION"_Win64.zip"
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
fi
# Patch SP3 absolute path
sed -i 's/C:\/pybind11\/[0-9].[0-9].[0-9]\/install\/include;//' $SOFA_ROOT/plugins/SofaPython3/lib/cmake/SofaPython3/PluginTargets.cmake
# SOFA DEPENDENCY PACK
- name: Download SOFA Dependency pack
shell: bash
run: |
curl --output sofa_dependency.zip -L "https://www.sofa-framework.org/download/WinDepPack/VS-2017/latest"
unzip sofa_dependency.zip -d temp
mv temp/`ls temp` $SOFA_ROOT/windows_dependency
rm -rf temp
# QT
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ format('{0}/qt', github.workspace) }}
key: qt-5.12.6-windows

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.12.6'
dir: ${{ format('{0}/qt', github.workspace) }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}
modules: 'qtcharts qtwebengine'

# CARIBOU
- name: Build caribou
shell: bash
run:
cmake -DCMAKE_BUILD_TYPE=Release
-Dpybind11_DIR=$PYBIND11_ROOT
-DEigen3_ROOT=$EIGEN_ROOT
-DCMAKE_INCLUDE_PATH=$SOFA_ROOT/windows_dependency/include
-DCMAKE_LIBRARY_PATH=$SOFA_ROOT/windows_dependency/lib/win64
-DQt5_ROOT=$QT_ROOT\5.12.5\msvc2017_64
-DCMAKE_INSTALL_PREFIX=$SOFA_ROOT/plugins/SofaCaribou
-DCARIBOU_WITH_PYTHON_3=OFF
.
&& cmake --build . --config Release
&& cmake --install .

# ZIP
- name: Zip production
run: Compress-Archive -LiteralPath "$($env:SOFA_ROOT)/plugins/SofaCaribou" -DestinationPath SofaCaribou.zip

# ARCHIVE
- name: Archive production
uses: actions/upload-artifact@v4.4.0
with:
name: caribou_win64_${{ matrix.sofa_version }}
path: SofaCaribou.zip

test:
name: Testing with ${{ matrix.sofa_version }}
needs: [build]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sofa_version: [ master ]
include:
- sofa_version: master
PYTHON_VERSION: 3.8.10
# - sofa_version: v21.12.00
# PYTHON_VERSION: 3.7
env:
SOFA_VERSION: ${{ matrix.sofa_version }}
SOFA_ROOT: ${{ format('{0}\sofa', github.workspace) }}
CARIBOU_ROOT: ${{ format('{0}\sofa\plugins\SofaCaribou', github.workspace) }}

steps:
# Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION }}

# PATH
- run: echo "${$env:SOFA_ROOT}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

# SOFA
- name: Download SOFA Release
shell: bash
run: |
if [ "$SOFA_VERSION" = "master" ]; then
curl --output sofa.zip -L "https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=master,CI_SCOPE=standard/lastSuccessfulBuild/artifact/Windows/*zip*/Windows.zip"
unzip sofa.zip -d temp
mv temp/Windows/`ls temp/Windows` sofa.zip
rm -rf temp
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
rm -rf temp
else
curl --output sofa.zip -L "https://github.com/sofa-framework/sofa/releases/download/$SOFA_VERSION/SOFA_"$SOFA_VERSION"_Win64.zip"
unzip sofa.zip -d temp
mv temp/`ls temp` $SOFA_ROOT
fi
# CARIBOU
- name: Download caribou
uses: actions/download-artifact@v4.1.7
with:
name: caribou_win64_${{ matrix.sofa_version }}
- name: Install caribou
run: Expand-Archive -Path SofaCaribou.zip -DestinationPath "${$env:SOFA_ROOT}\plugins"

- name: Caribou.unittests.Geometry
if: ${{ always() }}
shell: bash
run: |
export PATH="$SOFA_ROOT/bin:$PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Geometry.exe
- name: Caribou.unittests.Topology
if: ${{ always() }}
shell: bash
run: |
export PATH="$SOFA_ROOT/bin:$PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Topology.exe
- name: Caribou.unittests.Mechanics
if: ${{ always() }}
shell: bash
run: |
export PATH="$SOFA_ROOT/bin:$PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.Mechanics.exe
- name: Caribou.unittests.SofaCaribou
if: ${{ always() }}
shell: bash
run: |
export PATH="$SOFA_ROOT/bin:$PATH"
$CARIBOU_ROOT/bin/Caribou.unittests.SofaCaribou.exe
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)

# OPTIONS
option(CARIBOU_USE_FLOAT "Use float precision for floating point values." OFF)
option(CARIBOU_WITH_PYTHON_3 "Compile the plugin with python 3 support" OFF)
CMAKE_DEPENDENT_OPTION(CARIBOU_OPTIMIZE_FOR_NATIVE "Build with -march=native to allow msse support" ON "COMPILER_SUPPORTS_MARCH_NATIVE" OFF)

# SOFA option
Expand All @@ -59,7 +60,9 @@ CMAKE_DEPENDENT_OPTION(CARIBOU_WITH_SOFA "Compile the SofaCaribou library" ON "S
if (CARIBOU_WITH_SOFA)
list(APPEND CMAKE_PREFIX_PATH ${SOFA_MODULE_DIR})
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
find_package(SofaPython3 QUIET) # We need to do this first to setup the exact python version required
if (CARIBOU_WITH_PYTHON_3)
find_package(SofaPython3 QUIET) # We need to do this first to setup the exact python version required
endif()
endif()

# Tests
Expand Down Expand Up @@ -94,21 +97,27 @@ else()
endif()

# Python 3 option
if (CARIBOU_WITH_SOFA)
if (CARIBOU_WITH_SOFA AND CARIBOU_WITH_PYTHON_3)
sofa_find_package(SofaPython3 QUIET)
endif()
set(CMAKE_CXX_STANDARD 17)
set(PYBIND11_FINDPYTHON ON)
set(PYBIND11_PYTHON_VERSION 3)
set(Python_FIND_FRAMEWORK LAST)
find_package(SofaPython3 QUIET)
if (CARIBOU_WITH_SOFA AND CARIBOU_WITH_PYTHON_3)
find_package(SofaPython3 QUIET)
endif()
if (SofaPython3_FOUND)
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
set(PYBIND11_PYTHON_VERSION ${PYTHON_VERSION})
endif()
find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development QUIET)
find_package(pybind11 CONFIG QUIET)
CMAKE_DEPENDENT_OPTION(CARIBOU_WITH_PYTHON_3 "Compile the plugin with python 3 support" ON "Python_FOUND;pybind11_FOUND" OFF)
if (CARIBOU_WITH_PYTHON_3 AND (NOT Python_FOUND OR NOT pybind11_FOUND))
SET(CARIBOU_WITH_PYTHON_3 OFF)
message(ERROR "Caribou is set to be compiled with python support, but pybind11 cannot be resolved.")
endif()

if (CARIBOU_WITH_PYTHON_3)
message(STATUS "Caribou with Python support:
Version: ${Python_VERSION}
Expand Down
15 changes: 9 additions & 6 deletions cmake/FindSOFA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
# endif()
################################################################################

# In cases quotes were added to the SOFA_ROOT env variable
STRING(REPLACE "\"" "" SOFA_ROOT_ENV $ENV{SOFA_ROOT})

# Try to find SOFA's cmake module directory
find_package(SofaFramework CONFIG QUIET) # This defines SOFA_ROOT if SofaFrameworkConfig.cmake is found
find_package(Sofa.Framework CONFIG QUIET) # This defines SOFA_ROOT if SofaFrameworkConfig.cmake is found
find_path (
SOFA_MODULE_DIR SofaFramework/SofaFrameworkConfig.cmake
PATHS
${SOFA_ROOT}/lib/cmake
${SOFA_ROOT}/install/lib/cmake
${SOFA_ROOT}/build/install/lib/cmake
${SOFA_ROOT}/build/master/install/lib/cmake
$ENV{SOFA_ROOT}/lib/cmake
$ENV{SOFA_ROOT}/install/lib/cmake
$ENV{SOFA_ROOT}/build/install/lib/cmake
$ENV{SOFA_ROOT}/build/master/install/lib/cmake
${SOFA_ROOT_ENV}/lib/cmake
${SOFA_ROOT_ENV}/install/lib/cmake
${SOFA_ROOT_ENV}/build/install/lib/cmake
${SOFA_ROOT_ENV}/build/master/install/lib/cmake
)

if (SOFA_MODULE_DIR)
Expand Down Expand Up @@ -63,7 +66,7 @@ if (NOT SOFA_FIND_COMPONENTS)
endif()

# Compatibility layer
set(SOFA_VERSION ${SofaFramework_VERSION})
set(SOFA_VERSION ${Sofa.Framework_VERSION})
foreach(component ${SOFA_FIND_COMPONENTS})
if (SOFA_VERSION VERSION_LESS "22.06.99")
string(REGEX REPLACE "Sofa.Simulation.*" "SofaSimulation" component ${component})
Expand Down
17 changes: 1 addition & 16 deletions src/SofaCaribou/Algebra/EigenMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,8 @@

DISABLE_ALL_WARNINGS_BEGIN
#include <sofa/version.h>
#include <SofaCaribou/Algebra/BaseMatrixOperations.h>
DISABLE_ALL_WARNINGS_END

#if (defined(SOFA_VERSION) && SOFA_VERSION < 201200)
namespace sofa { using Size = unsigned int; }
#endif

#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600)
namespace sofa::type {
using Mat3x3d = ::sofa::defaulttype::Mat3x3d;
using Mat3x3f = ::sofa::defaulttype::Mat3x3f;
using Mat2x2d = ::sofa::defaulttype::Mat2x2d;
using Mat2x2f = ::sofa::defaulttype::Mat2x2f;
template <sofa::Size N, sofa::Size M, typename Real>
using Mat = ::sofa::defaulttype::Mat<N, M, Real>;
}
#endif
#include <SofaCaribou/Algebra/BaseMatrixOperations.h>


#include <Eigen/Core>
Expand Down
Loading

0 comments on commit 8050cef

Please sign in to comment.