Unverified Commit e7fec04f authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1305 from jcarpent/support-msvc-v142

Support msvc v142 compiler
parents aa39638f d4246081
Pipeline #11574 passed with stage
in 196 minutes and 21 seconds
name: Build Pinocchio for Windows via Conda
name: Build Pinocchio for Windows (CLANG) via Conda
on:
pull_request:
push:
......
name: Build Pinocchio for Windows (v142) via Conda
on:
pull_request:
push:
branches:
- master
- devel
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [windows-latest]
include:
- name: windows-latest
os: windows-2019
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: pinocchio
environment-file: .github/workflows/conda/conda-env.yml
python-version: 3.7
- name: Install cmake and update conda
run: |
conda install cmake -c main
- name: Build Pinocchio
shell: cmd /C CALL {0}
run: |
:: unset extra Boost envs
set Boost_ROOT=
set BOOST_ROOT_1_69_0=
set BOOST_ROOT_1_72_0=
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
:: Create build directory
mkdir build
pushd build
:: Configure
cmake ^
-G "Visual Studio 16 2019" -T "v142" -DCMAKE_GENERATOR_PLATFORM=x64 ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DBUILD_WITH_URDF_SUPPORT=ON ^
-DBUILD_PYTHON_INTERFACE=OFF ^
-DBUILD_WITH_COLLISION_SUPPORT=OFF ^
..
:: Build
cmake --build . --config Release --target install
:: Testing
set PATH=%PATH%;%CONDA_PREFIX%\Lib\site-packages\pinocchio
ctest --output-on-failure -C Release -V
# :: Test Python import
# cd ..
# python -c "import pinocchio"
......@@ -103,7 +103,9 @@ IF(BUILD_PYTHON_INTERFACE)
# Do not report:
# -Wconversion as the BOOST_PYTHON_FUNCTION_OVERLOADS implicitly converts.
# -Wcomment as latex equations have multi-line comments.
TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE -Wno-conversion -Wno-comment)
IF(NOT WIN32)
TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE -Wno-conversion -Wno-comment)
ENDIF(NOT WIN32)
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES VERSION ${PROJECT_VERSION})
IF(BUILD_WITH_COMMIT_VERSION)
......
......@@ -34,9 +34,9 @@ BOOST_PYTHON_MODULE(pinocchio_pywrap)
_PyWarnings_Init();
#endif
if(not register_symbolic_link_to_registered_type<Eigen::Quaterniond>())
if(! register_symbolic_link_to_registered_type<Eigen::Quaterniond>())
eigenpy::exposeQuaternion();
if(not register_symbolic_link_to_registered_type<Eigen::AngleAxisd>())
if(! register_symbolic_link_to_registered_type<Eigen::AngleAxisd>())
eigenpy::exposeAngleAxis();
StdContainerFromPythonList< std::vector<std::string> >::register_converter();
......
......@@ -19,6 +19,10 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${CURRENT_COMPILE_DEFINITIONS})
IF(MSVC)
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC "/bigobj")
ENDIF()
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
IF(BUILD_WITH_COMMIT_VERSION)
TAG_LIBRARY_VERSION(${PROJECT_NAME})
......
......@@ -412,7 +412,7 @@ namespace pinocchio
PINOCCHIO_CHECK_INPUT_ARGUMENT(data.mass[rootSubtreeId] > 0., "The mass of the subtree is not positive.");
const Scalar mass_inv_subtree = Scalar(1)/data.mass[rootSubtreeId];
typename Data::Vector3 & com_subtree = data.com[rootSubtreeId];
if(not computeSubtreeComs)
if(!computeSubtreeComs)
com_subtree *= mass_inv_subtree;
if(rootSubtreeId == 0)
......
......@@ -863,7 +863,7 @@ namespace pinocchio
*
*/
template<typename LieGroup_t, typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorIn1, typename ConfigVectorIn2>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
const Eigen::MatrixBase<ConfigVectorIn1> & lowerLimits,
const Eigen::MatrixBase<ConfigVectorIn2> & upperLimits);
......@@ -884,7 +884,7 @@ namespace pinocchio
*/
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorIn1, typename ConfigVectorIn2>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
const Eigen::MatrixBase<ConfigVectorIn1> & lowerLimits,
const Eigen::MatrixBase<ConfigVectorIn2> & upperLimits)
......@@ -907,7 +907,7 @@ namespace pinocchio
*
*/
template<typename LieGroup_t, typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model);
/**
......@@ -925,7 +925,7 @@ namespace pinocchio
*
*/
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model)
{
return randomConfiguration<LieGroupMap,Scalar,Options,JointCollectionTpl>(model);
......
......@@ -389,19 +389,19 @@ namespace pinocchio
}
template<typename LieGroup_t,typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorIn1, typename ConfigVectorIn2>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
const Eigen::MatrixBase<ConfigVectorIn1> & lowerLimits,
const Eigen::MatrixBase<ConfigVectorIn2> & upperLimits)
{
typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType)) ReturnType;
typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType)) ReturnType;
ReturnType q(model.nq);
randomConfiguration<LieGroup_t,Scalar,Options,JointCollectionTpl,ConfigVectorIn1,ConfigVectorIn2,ReturnType>(model, lowerLimits.derived(), upperLimits.derived(), q);
return q;
}
template<typename LieGroup_t,typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
typename PINOCCHIO_EIGEN_PLAIN_TYPE((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
typename PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS((typename ModelTpl<Scalar,Options,JointCollectionTpl>::ConfigVectorType))
randomConfiguration(const ModelTpl<Scalar,Options,JointCollectionTpl> & model)
{
typedef ModelTpl<Scalar,Options,JointCollectionTpl> Model;
......
......@@ -101,7 +101,7 @@ namespace pinocchio
void loadLib(const bool generate_if_not_exist = true)
{
if(not existLib() && generate_if_not_exist)
if(!existLib() && generate_if_not_exist)
compileLib();
const auto it = dynamicLibManager_ptr->getOptions().find("dlOpenMode");
......
......@@ -9,6 +9,7 @@
/// \brief Macro giving access to the equivalent plain type of D
#define PINOCCHIO_EIGEN_PLAIN_TYPE(D) Eigen::internal::plain_matrix_type< typename pinocchio::helper::argument_type<void(D)>::type >::type
#define PINOCCHIO_EIGEN_PLAIN_TYPE_NO_PARENS(D) Eigen::internal::plain_matrix_type< typename pinocchio::helper::argument_type<void D>::type >::type
/// \brief Similar to macro PINOCCHIO_EIGEN_PLAIN_TYPE but with guaranty to provite a column major type
#define PINOCCHIO_EIGEN_PLAIN_COLUMN_MAJOR_TYPE(D) pinocchio::helper::handle_return_type_without_typename<D,Eigen::internal::plain_matrix_type_column_major>::type
......
//
// Copyright (c) 2017-2019 CNRS INRIA
// Copyright (c) 2017-2020 CNRS INRIA
//
#ifndef __pinocchio_macros_hpp__
#define __pinocchio_macros_hpp__
#if __cplusplus >= 201103L
#define PINOCCHIO_WITH_CXX11_SUPPORT
// On Windows, __cplusplus is not necessarily set to the C++ version being used.
// See https://docs.microsoft.com/fr-fr/cpp/build/reference/zc-cplusplus?view=vs-2019 for further information.
#if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703))
#define PINOCCHIO_WITH_CXX17_SUPPORT
#endif
#if __cplusplus >= 201403L
#if (__cplusplus >= 201403L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201403))
#define PINOCCHIO_WITH_CXX14_SUPPORT
#endif
#if __cplusplus >= 201703L
#define PINOCCHIO_WITH_CXX17_SUPPORT
#if (__cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103))
#define PINOCCHIO_WITH_CXX11_SUPPORT
#endif
#define PINOCCHIO_STRING_LITERAL(string) #string
......
......@@ -11,7 +11,7 @@
namespace pinocchio
{
#if __cplusplus >= 201103L
#ifdef PINOCCHIO_WITH_CXX11_SUPPORT
constexpr int SELF = 0;
#else
enum { SELF = 0 };
......
......@@ -181,7 +181,8 @@ namespace pinocchio
Matrix3 I3 (mc_cross * mc_cross);
I3 /= mass();
I3 += I6.template block<3,3>(ANGULAR,ANGULAR);
inertia() = Symmetric3(I3);
const Symmetric3 S3(I3);
inertia() = S3;
}
InertiaTpl(Scalar mass, const Vector3 & com, const Symmetric3 & rotational_inertia)
......
......@@ -28,10 +28,9 @@ namespace pinocchio
public:
Symmetric3Tpl(): m_data() {}
template<typename Sc,int N,int Opt>
explicit Symmetric3Tpl(const Eigen::Matrix<Sc,N,N,Opt> & I)
template<typename Sc,int Opt>
explicit Symmetric3Tpl(const Eigen::Matrix<Sc,3,3,Opt> & I)
{
EIGEN_STATIC_ASSERT(N==3,THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
assert( (I-I.transpose()).isMuchSmallerThan(I) );
m_data(0) = I(0,0);
m_data(1) = I(1,0); m_data(2) = I(1,1);
......
......@@ -111,7 +111,9 @@ ADD_PINOCCHIO_UNIT_TEST(constraint)
ADD_PINOCCHIO_UNIT_TEST(compute-all-terms)
ADD_PINOCCHIO_UNIT_TEST(energy)
ADD_PINOCCHIO_UNIT_TEST(frames)
ADD_PINOCCHIO_UNIT_TEST(joint-configurations)
IF(NOT MSVC AND NOT MSVC_VERSION)
ADD_PINOCCHIO_UNIT_TEST(joint-configurations)
ENDIF()
ADD_PINOCCHIO_UNIT_TEST(explog)
ADD_PINOCCHIO_UNIT_TEST(finite-differences)
ADD_PINOCCHIO_UNIT_TEST(visitor)
......
......@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(test_quaternion)
quat_value.coeffs() = Eigen::Map<Eigen::Vector4d>(static_cast< std::vector<double> >(quat_res).data());
BOOST_CHECK(pinocchio::quaternion::defineSameRotation(quat_value,quat_ref));
// if(not quat_value.coeffs().isApprox(quat_ref.coeffs()))
// if(! quat_value.coeffs().isApprox(quat_ref.coeffs()))
// {
// std::cout << "quat_value: " << quat_value.coeffs().transpose() << std::endl;
// std::cout << "quat_ref: " << quat_ref.coeffs().transpose() << std::endl;
......
......@@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(test_matrix_matrix_product)
const Eigen::DenseIndex m = 20, n = 100;
MatrixXd M1(MatrixXd::Ones(m,n)), M2(MatrixXd::Ones(n,m));
MatrixMatrixProduct<MatrixXd,MatrixXd>::type res = M1 * M2;
BOOST_CHECK(not res.eval().isZero());
BOOST_CHECK(!res.eval().isZero());
}
BOOST_AUTO_TEST_CASE(test_scalar_matrix_product)
......
......@@ -28,8 +28,8 @@ BOOST_AUTO_TEST_CASE(test_version)
BOOST_CHECK(checkVersionAtLeast(0,0,0));
BOOST_CHECK(checkVersionAtLeast(PINOCCHIO_MAJOR_VERSION,PINOCCHIO_MINOR_VERSION,PINOCCHIO_PATCH_VERSION));
BOOST_CHECK(not checkVersionAtLeast(PINOCCHIO_MAJOR_VERSION,PINOCCHIO_MINOR_VERSION,PINOCCHIO_PATCH_VERSION+1));
BOOST_CHECK(not checkVersionAtLeast(99,0,0));
BOOST_CHECK(!checkVersionAtLeast(PINOCCHIO_MAJOR_VERSION,PINOCCHIO_MINOR_VERSION,PINOCCHIO_PATCH_VERSION+1));
BOOST_CHECK(!checkVersionAtLeast(99,0,0));
}
BOOST_AUTO_TEST_SUITE_END()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment