From d78c3286ee371fe544f93bc2c2040d550da18685 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 7 Jan 2023 18:10:13 -0800 Subject: [PATCH] Enable shared lib build with MSVC --- .github/workflows/ci_windows.yml | 5 ++- CMakeLists.txt | 6 +++ cmake/DARTMacros.cmake | 14 +++++++ dart/CMakeLists.txt | 1 + dart/collision/Empty.hpp | 41 +++++++++++++++++++ dart/collision/empty.cpp | 41 +++++++++++++++++++ dart/common/Stopwatch.hpp | 2 +- dart/common/detail/Cloneable.hpp | 1 + dart/dynamics/BalanceConstraint.cpp | 1 + dart/dynamics/BallJoint.hpp | 2 +- dart/dynamics/Branch.hpp | 2 +- dart/dynamics/CMakeLists.txt | 2 + dart/dynamics/CollisionGroup.hpp | 3 ++ dart/dynamics/ConstraintBase.cpp | 1 + dart/dynamics/DegreeOfFreedom.cpp | 1 + dart/dynamics/FixedJacobianNode.hpp | 2 + dart/dynamics/FreeJoint.hpp | 2 +- dart/dynamics/InverseKinematics.hpp | 26 ++++++------ dart/dynamics/JacobianNode.hpp | 2 + dart/dynamics/Linkage.hpp | 6 +-- dart/dynamics/Node.hpp | 2 + dart/dynamics/SharedLibraryIkFast.cpp | 1 + dart/dynamics/SimpleFrame.cpp | 1 + dart/dynamics/Skeleton.hpp | 2 +- dart/dynamics/TemplatedJacobianNode.hpp | 2 + dart/dynamics/TranslationalJoint.hpp | 2 +- dart/dynamics/WeldJoint.hpp | 2 +- dart/dynamics/ode/OdeCollisionObject.hpp | 2 +- dart/dynamics/ode/detail/OdeHeightmap.cpp | 2 +- dart/gui/glut/CMakeLists.txt | 2 + dart/gui/osg/DefaultEventHandler.cpp | 3 ++ dart/gui/osg/DragAndDrop.cpp | 1 + dart/gui/osg/GridVisual.cpp | 4 ++ dart/gui/osg/ImGuiHandler.cpp | 5 +++ dart/gui/osg/ImGuiViewer.cpp | 6 +++ dart/gui/osg/ImGuiWidget.cpp | 7 ++++ dart/gui/osg/RealTimeWorldNode.cpp | 3 ++ dart/gui/osg/SupportPolygonVisual.cpp | 5 +++ dart/gui/osg/Viewer.cpp | 2 + dart/gui/osg/WorldNode.cpp | 2 + dart/gui/osg/detail/CameraModeCallback.cpp | 5 +++ dart/io/urdf/DartLoader.cpp | 5 +++ dart/io/urdf/DartLoader.hpp | 2 +- dart/optimization/MultiObjectiveSolver.hpp | 2 +- dart/optimization/Solver.hpp | 2 +- .../pagmo/PagmoMultiObjectiveSolver.hpp | 4 +- dart/simulation/Recording.cpp | 2 - dart/simulation/World.cpp | 2 - tests/CMakeLists.txt | 6 ++- tests/integration/CMakeLists.txt | 33 +++++++++------ 50 files changed, 231 insertions(+), 49 deletions(-) create mode 100644 dart/collision/Empty.hpp diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index 53e25c5c5524e..845056745c05c 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -12,14 +12,14 @@ on: jobs: build_2022: - name: ${{ matrix.build_type }} + name: shared=${{ matrix.build_shared_libs }}.${{ matrix.build_type }} runs-on: windows-2022 strategy: fail-fast: false matrix: toolset: [""] build_type: [Release] - build_shared_libs: [OFF] # TODO(JS): Add ON once shared lib build is resolved + build_shared_libs: [ON, OFF] build_dartpy: [OFF] # Build tests and dartpy exclusively # and building dartpy is disabled for now due to the lack of sufficient disk space in the CI env: @@ -50,6 +50,7 @@ jobs: -DDART_MSVC_DEFAULT_OPTIONS=ON ^ -DDART_VERBOSE=ON ^ -DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} ^ + -DDART_BUILD_COMP_gui=OFF ^ -DDART_IN_CI=ON cmake --build . --config %BUILD_TYPE% --target tests --parallel ctest --rerun-failed --output-on-failure -C %BUILD_TYPE% diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b3ce203eda2f..0c2b1a6b0b8ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,13 +239,19 @@ if(MSVC) add_compile_options(/wd4267) add_compile_options(/wd4305) add_compile_options(/wd4334) + add_compile_options(/wd4506) add_compile_options(/wd4838) add_compile_options(/wd4996) + add_compile_options(/bigobj) # Enable multi-threaded compilation. add_compile_options(/MP) + add_link_options(/OPT:NOREF /FORCE:MULTIPLE) + + set(CMAKE_INSTALL_UCRT_LIBRARIES ON) + elseif(CMAKE_COMPILER_IS_GNUCXX) add_compile_options(-Wall -Wextra -fPIC) diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake index 7799fd93a53ae..b639be8c65bfd 100644 --- a/cmake/DARTMacros.cmake +++ b/cmake/DARTMacros.cmake @@ -152,6 +152,18 @@ function(dart_generate_export_header) "#define ${base_name}_API \\\n" " DETAIL_${base_name}_API\n" "\n" + "#ifdef _MSC_VER\n" + " #define ${base_name}_TEMPL_INST_DECL_API\n" + "#else\n" + " #define ${base_name}_TEMPL_INST_DECL_API ${base_name}_API\n" + "#endif\n" + "\n" + "#ifdef _MSC_VER\n" + " #define ${base_name}_TEMPL_INST_DEF_API ${base_name}_API\n" + "#else\n" + " #define ${base_name}_TEMPL_INST_DEF_API\n" + "#endif\n" + "\n" "#include \"detail/${_ARG_EXPORT_FILE_NAME}\"\n" ) @@ -920,6 +932,8 @@ function(dart_build_tests) target_link_libraries(${target_name} PRIVATE ${dart_lib}) endforeach() + set_target_properties (${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${DART_BINARY_DIR}/bin) + if(dart_build_tests_TEST_LIST) list(APPEND ${dart_build_tests_TEST_LIST} ${target_name}) endif() diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 3fb8fe889e508..08735867ac71f 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/bin") #=============================================================================== # Components: (dependency component), {external dependency}, [optional external dependency] diff --git a/dart/collision/Empty.hpp b/dart/collision/Empty.hpp new file mode 100644 index 0000000000000..e710ee9c045d3 --- /dev/null +++ b/dart/collision/Empty.hpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2011-2023, The DART development contributors + * All rights reserved. + * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include + +namespace dart::collision { + +DART_COLLISION_API void empty(); + +} // namespace dart diff --git a/dart/collision/empty.cpp b/dart/collision/empty.cpp index e69de29bb2d1d..f093602c472ff 100644 --- a/dart/collision/empty.cpp +++ b/dart/collision/empty.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2011-2023, The DART development contributors + * All rights reserved. + * + * The list of contributors can be found at: + * https://github.com/dartsim/dart/blob/master/LICENSE + * + * This file is provided under the following "BSD-style" License: + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "dart/collision/Empty.hpp" + +namespace dart::collision { + +void empty() { + // Do nothing +} + +} // namespace dart diff --git a/dart/common/Stopwatch.hpp b/dart/common/Stopwatch.hpp index 747c7b0af85c3..6c7489e215e5d 100644 --- a/dart/common/Stopwatch.hpp +++ b/dart/common/Stopwatch.hpp @@ -44,7 +44,7 @@ namespace dart::common { template < typename UnitType, typename ClockType = std::chrono::high_resolution_clock> -class DART_COMMON_API Stopwatch final +class Stopwatch final { public: /// Constructor diff --git a/dart/common/detail/Cloneable.hpp b/dart/common/detail/Cloneable.hpp index 65ee2ab58f8a3..486e299a8ea33 100644 --- a/dart/common/detail/Cloneable.hpp +++ b/dart/common/detail/Cloneable.hpp @@ -119,6 +119,7 @@ MakeCloneable& MakeCloneable::operator=( MakeCloneable&& other) { static_cast(*this) = std::move(static_cast(other)); + return *this; } //============================================================================== diff --git a/dart/dynamics/BalanceConstraint.cpp b/dart/dynamics/BalanceConstraint.cpp index da6b39d98066f..cad2fa2927e4b 100644 --- a/dart/dynamics/BalanceConstraint.cpp +++ b/dart/dynamics/BalanceConstraint.cpp @@ -32,6 +32,7 @@ #include "dart/dynamics/BalanceConstraint.hpp" +#include "dart/dynamics/BodyNode.hpp" #include "dart/dynamics/EndEffector.hpp" #include "dart/dynamics/Skeleton.hpp" diff --git a/dart/dynamics/BallJoint.hpp b/dart/dynamics/BallJoint.hpp index c3f65dd36b1b8..459daf48122e0 100644 --- a/dart/dynamics/BallJoint.hpp +++ b/dart/dynamics/BallJoint.hpp @@ -49,7 +49,7 @@ class DART_DYNAMICS_API BallJoint : public GenericJoint using Base = GenericJoint; - struct Properties : Base::Properties + struct DART_DYNAMICS_API Properties : Base::Properties { DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(Properties) diff --git a/dart/dynamics/Branch.hpp b/dart/dynamics/Branch.hpp index 0f3021ae81cb2..bb58b6f555fe9 100644 --- a/dart/dynamics/Branch.hpp +++ b/dart/dynamics/Branch.hpp @@ -45,7 +45,7 @@ namespace dynamics { class DART_DYNAMICS_API Branch : public Linkage { public: - struct Criteria + struct DART_DYNAMICS_API Criteria { /// Constructor. Requires a starting BodyNode. Criteria(BodyNode* _start); diff --git a/dart/dynamics/CMakeLists.txt b/dart/dynamics/CMakeLists.txt index 9315443d4446a..1c64c235049b7 100644 --- a/dart/dynamics/CMakeLists.txt +++ b/dart/dynamics/CMakeLists.txt @@ -28,6 +28,8 @@ dart_add_component( assimp octomap TARGET_LINK_LIBRARIES_PUBLIC assimp octomap + TARGET_LINK_LIBRARIES_PRIVATE + ${PROJECT_NAME}${DART_MAJOR_VERSION}-external-odelcpsolver TARGET_COMPILE_FEATURES_PUBLIC cxx_std_17 SUB_DIRECTORIES diff --git a/dart/dynamics/CollisionGroup.hpp b/dart/dynamics/CollisionGroup.hpp index 6f7d3734f0e79..7c37ee5a741a4 100644 --- a/dart/dynamics/CollisionGroup.hpp +++ b/dart/dynamics/CollisionGroup.hpp @@ -404,6 +404,9 @@ class DART_DYNAMICS_API CollisionGroup // (e.g., by world cloning). private: + CollisionGroup& operator=(const CollisionGroup&) = delete; + CollisionGroup(const CollisionGroup&) = delete; + /// This class watches when ShapeFrames get deleted so that they can be safely /// removes from the CollisionGroup. We cannot have a weak_ptr to a ShapeFrame /// because some are managed by std::shared_ptr while others are managed by diff --git a/dart/dynamics/ConstraintBase.cpp b/dart/dynamics/ConstraintBase.cpp index a07c8b15cefda..05be66c903e67 100644 --- a/dart/dynamics/ConstraintBase.cpp +++ b/dart/dynamics/ConstraintBase.cpp @@ -32,6 +32,7 @@ #include "dart/dynamics/ConstraintBase.hpp" +#include "dart/dynamics/BodyNode.hpp" #include "dart/dynamics/Skeleton.hpp" namespace dart { diff --git a/dart/dynamics/DegreeOfFreedom.cpp b/dart/dynamics/DegreeOfFreedom.cpp index 42dc585591b63..8e988297468b3 100644 --- a/dart/dynamics/DegreeOfFreedom.cpp +++ b/dart/dynamics/DegreeOfFreedom.cpp @@ -32,6 +32,7 @@ #include "dart/dynamics/DegreeOfFreedom.hpp" +#include "dart/dynamics/BodyNode.hpp" #include "dart/dynamics/Joint.hpp" #include "dart/dynamics/Skeleton.hpp" diff --git a/dart/dynamics/FixedJacobianNode.hpp b/dart/dynamics/FixedJacobianNode.hpp index 3da895cbb45f8..775a18a67f443 100644 --- a/dart/dynamics/FixedJacobianNode.hpp +++ b/dart/dynamics/FixedJacobianNode.hpp @@ -109,6 +109,8 @@ class DART_DYNAMICS_API FixedJacobianNode /// \} protected: + FixedJacobianNode() = default; + /// Constructor FixedJacobianNode(BodyNode* parent, const Eigen::Isometry3d& transform); diff --git a/dart/dynamics/FreeJoint.hpp b/dart/dynamics/FreeJoint.hpp index 5fee98b2af767..dbd0944485dd3 100644 --- a/dart/dynamics/FreeJoint.hpp +++ b/dart/dynamics/FreeJoint.hpp @@ -51,7 +51,7 @@ class DART_DYNAMICS_API FreeJoint : public GenericJoint using Base = GenericJoint; - struct Properties : Base::Properties + struct DART_DYNAMICS_API Properties : Base::Properties { DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(Properties) diff --git a/dart/dynamics/InverseKinematics.hpp b/dart/dynamics/InverseKinematics.hpp index cb6b003273591..30c1e3dd1df5e 100644 --- a/dart/dynamics/InverseKinematics.hpp +++ b/dart/dynamics/InverseKinematics.hpp @@ -488,7 +488,7 @@ typedef InverseKinematics IK; /// InverseKinematics module that it belongs to gets cloned. Any Function /// classes in the Problem that do not inherit InverseKinematics::Function /// will just be copied over by reference. -class InverseKinematics::Function +class DART_DYNAMICS_API InverseKinematics::Function { public: /// Enable this function to be cloned to a new IK module. @@ -501,7 +501,7 @@ class InverseKinematics::Function //============================================================================== /// ErrorMethod is a base class for different ways of computing the error of /// an InverseKinematics module. -class InverseKinematics::ErrorMethod : public common::Subject +class DART_DYNAMICS_API InverseKinematics::ErrorMethod : public common::Subject { public: typedef std::pair Bounds; @@ -766,10 +766,10 @@ class InverseKinematics::TaskSpaceRegion : public ErrorMethod //============================================================================== /// GradientMethod is a base class for different ways of computing the /// gradient of an InverseKinematics module. -class InverseKinematics::GradientMethod : public common::Subject +class DART_DYNAMICS_API InverseKinematics::GradientMethod : public common::Subject { public: - struct Properties + struct DART_DYNAMICS_API Properties { /// The component-wise clamp for this GradientMethod double mComponentWiseClamp; @@ -904,10 +904,10 @@ class InverseKinematics::GradientMethod : public common::Subject /// damping helps with this), and each cycle might take more time to compute /// than the JacobianTranspose method (although the JacobianDLS method will /// usually converge in fewer cycles than JacobianTranspose). -class InverseKinematics::JacobianDLS : public GradientMethod +class DART_DYNAMICS_API InverseKinematics::JacobianDLS : public GradientMethod { public: - struct UniqueProperties + struct DART_DYNAMICS_API UniqueProperties { /// Damping coefficient double mDamping; @@ -916,7 +916,7 @@ class InverseKinematics::JacobianDLS : public GradientMethod UniqueProperties(double damping = DefaultIKDLSCoefficient); }; - struct Properties : GradientMethod::Properties, UniqueProperties + struct DART_DYNAMICS_API Properties : GradientMethod::Properties, UniqueProperties { /// Default constructor Properties( @@ -962,7 +962,7 @@ class InverseKinematics::JacobianDLS : public GradientMethod /// very smooth but imprecise, requiring more iterations before converging /// and being less precise in general. This method is suitable for animations /// where smoothness is prefered over precision. -class InverseKinematics::JacobianTranspose : public GradientMethod +class DART_DYNAMICS_API InverseKinematics::JacobianTranspose : public GradientMethod { public: /// Constructor @@ -995,7 +995,7 @@ class InverseKinematics::JacobianTranspose : public GradientMethod /// counter-productive for analytical methods which do not typically rely on /// convergence; analytical methods can usually solve the entire error vector /// directly. -class InverseKinematics::Analytical : public GradientMethod +class DART_DYNAMICS_API InverseKinematics::Analytical : public GradientMethod { public: /// Bitwise enumerations that are used to describe some properties of each @@ -1036,7 +1036,7 @@ class InverseKinematics::Analytical : public GradientMethod }; // TODO(JS): Change to enum class? - struct Solution + struct DART_DYNAMICS_API Solution { /// Default constructor Solution( @@ -1058,7 +1058,7 @@ class InverseKinematics::Analytical : public GradientMethod const InverseKinematics* _ik)> QualityComparison; - struct UniqueProperties + struct DART_DYNAMICS_API UniqueProperties { /// Flag for how to use the extra DOFs in the IK module. ExtraDofUtilization mExtraDofUtilization; @@ -1084,7 +1084,7 @@ class InverseKinematics::Analytical : public GradientMethod void resetQualityComparisonFunction(); }; - struct Properties : GradientMethod::Properties, UniqueProperties + struct DART_DYNAMICS_API Properties : GradientMethod::Properties, UniqueProperties { // Default constructor Properties( @@ -1314,7 +1314,7 @@ class InverseKinematics::Objective final : public Function, /// instantiated by a user. Call InverseKinematics::resetProblem() to set the /// first equality constraint of the module's Problem to an /// InverseKinematics::Constraint. -class InverseKinematics::Constraint final : public Function, +class DART_DYNAMICS_API InverseKinematics::Constraint final : public Function, public optimization::Function { public: diff --git a/dart/dynamics/JacobianNode.hpp b/dart/dynamics/JacobianNode.hpp index 97a6fcd7212ba..a97306f1dd703 100644 --- a/dart/dynamics/JacobianNode.hpp +++ b/dart/dynamics/JacobianNode.hpp @@ -273,6 +273,8 @@ class DART_DYNAMICS_API JacobianNode : public virtual Frame, public Node void dirtyJacobianDeriv(); protected: + JacobianNode() = default; + /// Constructor JacobianNode(BodyNode* bn); diff --git a/dart/dynamics/Linkage.hpp b/dart/dynamics/Linkage.hpp index a1d4fa5aaca72..d12cbb6be70e9 100644 --- a/dart/dynamics/Linkage.hpp +++ b/dart/dynamics/Linkage.hpp @@ -56,7 +56,7 @@ class DART_DYNAMICS_API Linkage : public ReferentialSkeleton { public: /// The Criteria class is used to specify how a Linkage should be constructed - struct Criteria + struct DART_DYNAMICS_API Criteria { /// The ExpansionPolicy indicates how the collection of BodyNodes should /// expand from the starting BodyNode (mStart) @@ -77,7 +77,7 @@ class DART_DYNAMICS_API Linkage : public ReferentialSkeleton /// This structure defines targets for the expansion criteria and the /// desired behavior for those targets - struct Target + struct DART_DYNAMICS_API Target { /// Default constructor for Target Target( @@ -116,7 +116,7 @@ class DART_DYNAMICS_API Linkage : public ReferentialSkeleton /// in the Linkage. If mInclusive is set to false, then mTerminal will not /// be included in the Linkage. Note that the BodyNode of mStart may be /// included as an inclusive terminal, but NOT as an exclusive terminal. - struct Terminal + struct DART_DYNAMICS_API Terminal { /// Default constructor for Terminal Terminal(BodyNode* _terminal = nullptr, bool _inclusive = true); diff --git a/dart/dynamics/Node.hpp b/dart/dynamics/Node.hpp index 63d544c8c008e..55a2bb3725819 100644 --- a/dart/dynamics/Node.hpp +++ b/dart/dynamics/Node.hpp @@ -190,6 +190,8 @@ class DART_DYNAMICS_API Node : public virtual common::Subject, /// Allow your Node implementation to be cloned into a new BodyNode virtual Node* cloneNode(BodyNode* bn) const = 0; + Node() = default; + /// Constructor Node(BodyNode* _bn); diff --git a/dart/dynamics/SharedLibraryIkFast.cpp b/dart/dynamics/SharedLibraryIkFast.cpp index 7a19a161830d5..2df30598f20a2 100644 --- a/dart/dynamics/SharedLibraryIkFast.cpp +++ b/dart/dynamics/SharedLibraryIkFast.cpp @@ -34,6 +34,7 @@ #include "dart/common/Console.hpp" #include "dart/common/SharedLibrary.hpp" +#include "dart/dynamics/BodyNode.hpp" #include "dart/dynamics/Skeleton.hpp" #include diff --git a/dart/dynamics/SimpleFrame.cpp b/dart/dynamics/SimpleFrame.cpp index edfc74afd0662..4ccce63aece1f 100644 --- a/dart/dynamics/SimpleFrame.cpp +++ b/dart/dynamics/SimpleFrame.cpp @@ -33,6 +33,7 @@ #include "dart/dynamics/SimpleFrame.hpp" #include "dart/common/Console.hpp" +#include "dart/dynamics/BodyNode.hpp" #include "dart/math/Geometry.hpp" namespace dart { diff --git a/dart/dynamics/Skeleton.hpp b/dart/dynamics/Skeleton.hpp index bb3f2a7980fcb..8dd02dbf28193 100644 --- a/dart/dynamics/Skeleton.hpp +++ b/dart/dynamics/Skeleton.hpp @@ -94,7 +94,7 @@ class DART_DYNAMICS_API Skeleton /// the number of degrees of freedom in the Skeleton or it must be zero. We /// assume that any Eigen::VectorXd member with zero entries should be /// ignored. - struct Configuration + struct DART_DYNAMICS_API Configuration { Configuration( const Eigen::VectorXd& positions = Eigen::VectorXd(), diff --git a/dart/dynamics/TemplatedJacobianNode.hpp b/dart/dynamics/TemplatedJacobianNode.hpp index 7a02eb5e95092..8439c2d5ac463 100644 --- a/dart/dynamics/TemplatedJacobianNode.hpp +++ b/dart/dynamics/TemplatedJacobianNode.hpp @@ -116,6 +116,8 @@ class TemplatedJacobianNode : public JacobianNode const Frame* _inCoordinatesOf = Frame::World()) const override final; protected: + TemplatedJacobianNode() = default; + /// Constructor TemplatedJacobianNode(BodyNode* bn); }; diff --git a/dart/dynamics/TranslationalJoint.hpp b/dart/dynamics/TranslationalJoint.hpp index e654553a41cb7..727b99cecdd0a 100644 --- a/dart/dynamics/TranslationalJoint.hpp +++ b/dart/dynamics/TranslationalJoint.hpp @@ -49,7 +49,7 @@ class DART_DYNAMICS_API TranslationalJoint : public GenericJoint using Base = GenericJoint; - struct Properties : Base::Properties + struct DART_DYNAMICS_API Properties : Base::Properties { DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(Properties) diff --git a/dart/dynamics/WeldJoint.hpp b/dart/dynamics/WeldJoint.hpp index fb11cd6a73bba..dacd3945d37df 100644 --- a/dart/dynamics/WeldJoint.hpp +++ b/dart/dynamics/WeldJoint.hpp @@ -49,7 +49,7 @@ class DART_DYNAMICS_API WeldJoint : public ZeroDofJoint public: friend class Skeleton; - struct Properties : ZeroDofJoint::Properties + struct DART_DYNAMICS_API Properties : ZeroDofJoint::Properties { DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(Properties) diff --git a/dart/dynamics/ode/OdeCollisionObject.hpp b/dart/dynamics/ode/OdeCollisionObject.hpp index 064ec231e4b18..199026a0ad8da 100644 --- a/dart/dynamics/ode/OdeCollisionObject.hpp +++ b/dart/dynamics/ode/OdeCollisionObject.hpp @@ -47,7 +47,7 @@ namespace detail { class OdeGeom; } // namespace detail -class DART_COLLISION_API OdeCollisionObject : public CollisionObject +class DART_DYNAMICS_API OdeCollisionObject : public CollisionObject { public: friend class OdeCollisionDetector; diff --git a/dart/dynamics/ode/detail/OdeHeightmap.cpp b/dart/dynamics/ode/detail/OdeHeightmap.cpp index 564090499df3a..27e992d61920b 100644 --- a/dart/dynamics/ode/detail/OdeHeightmap.cpp +++ b/dart/dynamics/ode/detail/OdeHeightmap.cpp @@ -34,6 +34,6 @@ namespace dart::collision::detail { -DART_TEMPLATE_CLASS_SOURCE(COLLISION, OdeHeightmap); +DART_TEMPLATE_CLASS_SOURCE(DYNAMICS, OdeHeightmap); } // namespace dart::collision::detail diff --git a/dart/gui/glut/CMakeLists.txt b/dart/gui/glut/CMakeLists.txt index 7ab3a29aa2770..2dbae12c208c1 100644 --- a/dart/gui/glut/CMakeLists.txt +++ b/dart/gui/glut/CMakeLists.txt @@ -6,6 +6,8 @@ # # This file is provided under the "BSD-style" License +message("[DEBUG] GLUT_LIBRARIES: ${GLUT_LIBRARIES}") + dart_add_component_sub_directory( DEPENDENT_PACKAGES_REQUIRED GLUT diff --git a/dart/gui/osg/DefaultEventHandler.cpp b/dart/gui/osg/DefaultEventHandler.cpp index 3d419770682fe..c4a392452d362 100644 --- a/dart/gui/osg/DefaultEventHandler.cpp +++ b/dart/gui/osg/DefaultEventHandler.cpp @@ -38,9 +38,12 @@ #include "dart/gui/osg/ShapeFrameNode.hpp" #include "dart/gui/osg/Utils.hpp" #include "dart/gui/osg/Viewer.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include "dart/gui/osg/render/ShapeNode.hpp" #include +#include #include diff --git a/dart/gui/osg/DragAndDrop.cpp b/dart/gui/osg/DragAndDrop.cpp index b4418a15557f3..839e483e5c190 100644 --- a/dart/gui/osg/DragAndDrop.cpp +++ b/dart/gui/osg/DragAndDrop.cpp @@ -42,6 +42,7 @@ #include "dart/gui/osg/MouseEventHandler.hpp" #include "dart/gui/osg/Viewer.hpp" #include "dart/math/Helpers.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" namespace dart { namespace gui { diff --git a/dart/gui/osg/GridVisual.cpp b/dart/gui/osg/GridVisual.cpp index fa10ec23a59df..e611f859de7cc 100644 --- a/dart/gui/osg/GridVisual.cpp +++ b/dart/gui/osg/GridVisual.cpp @@ -36,10 +36,14 @@ #include "dart/dynamics/SimpleFrame.hpp" #include "dart/dynamics/Skeleton.hpp" #include "dart/dynamics/SphereShape.hpp" +#include "dart/gui/osg/DefaultEventHandler.hpp" #include "dart/gui/osg/Utils.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include "dart/math/Helpers.hpp" #include +#include namespace dart { namespace gui { diff --git a/dart/gui/osg/ImGuiHandler.cpp b/dart/gui/osg/ImGuiHandler.cpp index fe66544589da0..553a6f81e5936 100644 --- a/dart/gui/osg/ImGuiHandler.cpp +++ b/dart/gui/osg/ImGuiHandler.cpp @@ -41,10 +41,15 @@ #include "dart/common/Console.hpp" #include "dart/external/imgui/imgui.h" #include "dart/external/imgui/imgui_impl_opengl2.h" +#include "dart/gui/osg/DefaultEventHandler.hpp" #include "dart/gui/osg/ImGuiWidget.hpp" +#include "dart/gui/osg/ShapeFrameNode.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include #include +#include #include diff --git a/dart/gui/osg/ImGuiViewer.cpp b/dart/gui/osg/ImGuiViewer.cpp index a892c0c435175..e3cfbc51f7214 100644 --- a/dart/gui/osg/ImGuiViewer.cpp +++ b/dart/gui/osg/ImGuiViewer.cpp @@ -32,8 +32,14 @@ #include "dart/gui/osg/ImGuiViewer.hpp" +#include "dart/gui/osg/DefaultEventHandler.hpp" #include "dart/gui/osg/ImGuiHandler.hpp" #include "dart/gui/osg/ImGuiWidget.hpp" +#include "dart/gui/osg/ShapeFrameNode.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" + +#include namespace dart { namespace gui { diff --git a/dart/gui/osg/ImGuiWidget.cpp b/dart/gui/osg/ImGuiWidget.cpp index ee7db4de1bf89..4b5d9d8aa2bae 100644 --- a/dart/gui/osg/ImGuiWidget.cpp +++ b/dart/gui/osg/ImGuiWidget.cpp @@ -39,6 +39,13 @@ #include "dart/gui/osg/ImGuiWidget.hpp" #include "dart/external/imgui/imgui.h" +#include "dart/gui/osg/DefaultEventHandler.hpp" +#include "dart/gui/osg/ImGuiHandler.hpp" +#include "dart/gui/osg/ShapeFrameNode.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" + +#include namespace dart { namespace gui { diff --git a/dart/gui/osg/RealTimeWorldNode.cpp b/dart/gui/osg/RealTimeWorldNode.cpp index d41a4a5098a83..1102742d59608 100644 --- a/dart/gui/osg/RealTimeWorldNode.cpp +++ b/dart/gui/osg/RealTimeWorldNode.cpp @@ -33,8 +33,11 @@ #include "dart/gui/osg/RealTimeWorldNode.hpp" #include "dart/common/Console.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include "dart/simulation/World.hpp" +#include + namespace dart { namespace gui { namespace osg { diff --git a/dart/gui/osg/SupportPolygonVisual.cpp b/dart/gui/osg/SupportPolygonVisual.cpp index b22964b731584..4fb51365b7e38 100644 --- a/dart/gui/osg/SupportPolygonVisual.cpp +++ b/dart/gui/osg/SupportPolygonVisual.cpp @@ -36,8 +36,13 @@ #include "dart/dynamics/SimpleFrame.hpp" #include "dart/dynamics/Skeleton.hpp" #include "dart/dynamics/SphereShape.hpp" +#include "dart/gui/osg/DefaultEventHandler.hpp" +#include "dart/gui/osg/WorldNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include "dart/math/Helpers.hpp" +#include + namespace dart { namespace gui { namespace osg { diff --git a/dart/gui/osg/Viewer.cpp b/dart/gui/osg/Viewer.cpp index c3b56812b59e0..72da6288b5c3f 100644 --- a/dart/gui/osg/Viewer.cpp +++ b/dart/gui/osg/Viewer.cpp @@ -37,6 +37,7 @@ #include "dart/dynamics/SimpleFrame.hpp" #include "dart/gui/osg/DefaultEventHandler.hpp" #include "dart/gui/osg/DragAndDrop.hpp" +#include "dart/gui/osg/ShapeFrameNode.hpp" #include "dart/gui/osg/TrackballManipulator.hpp" #include "dart/gui/osg/Utils.hpp" #include "dart/gui/osg/WorldNode.hpp" @@ -45,6 +46,7 @@ #include #include +#include #include diff --git a/dart/gui/osg/WorldNode.cpp b/dart/gui/osg/WorldNode.cpp index d0ba51cb37422..d1e69a774413c 100644 --- a/dart/gui/osg/WorldNode.cpp +++ b/dart/gui/osg/WorldNode.cpp @@ -34,7 +34,9 @@ #include "dart/dynamics/BodyNode.hpp" #include "dart/dynamics/Skeleton.hpp" +#include "dart/gui/osg/DefaultEventHandler.hpp" #include "dart/gui/osg/ShapeFrameNode.hpp" +#include "dart/gui/osg/detail/CameraModeCallback.hpp" #include "dart/simulation/World.hpp" #include diff --git a/dart/gui/osg/detail/CameraModeCallback.cpp b/dart/gui/osg/detail/CameraModeCallback.cpp index 0e2a67ea877e6..381195080543f 100644 --- a/dart/gui/osg/detail/CameraModeCallback.cpp +++ b/dart/gui/osg/detail/CameraModeCallback.cpp @@ -34,7 +34,12 @@ #include "dart/common/Logging.hpp" #include "dart/common/Macros.hpp" +#include "dart/gui/osg/DefaultEventHandler.hpp" +#include "dart/gui/osg/ShapeFrameNode.hpp" #include "dart/gui/osg/Utils.hpp" +#include "dart/gui/osg/WorldNode.hpp" + +#include namespace dart::gui::osg::detail { diff --git a/dart/io/urdf/DartLoader.cpp b/dart/io/urdf/DartLoader.cpp index d1f3f9122e982..0d2a9cf11cb7d 100644 --- a/dart/io/urdf/DartLoader.cpp +++ b/dart/io/urdf/DartLoader.cpp @@ -49,6 +49,11 @@ #include "dart/io/urdf/urdf_world_parser.hpp" #include "dart/simulation/World.hpp" +// TODO(JS): Remove once near and far is removed from urdfdom_header +#if defined(_WIN32) + #undef near + #undef far +#endif #include #include diff --git a/dart/io/urdf/DartLoader.hpp b/dart/io/urdf/DartLoader.hpp index 88d954ab6d862..899be05046518 100644 --- a/dart/io/urdf/DartLoader.hpp +++ b/dart/io/urdf/DartLoader.hpp @@ -93,7 +93,7 @@ class DART_IO_API DartLoader }; /// Options to be used in parsing URDF files. - struct Options + struct DART_IO_API Options { /// Resource retriever. LocalResourceRetriever is used if it's nullptr. common::ResourceRetrieverPtr mResourceRetriever; diff --git a/dart/optimization/MultiObjectiveSolver.hpp b/dart/optimization/MultiObjectiveSolver.hpp index 77bfc39bbe536..10e0768df948e 100644 --- a/dart/optimization/MultiObjectiveSolver.hpp +++ b/dart/optimization/MultiObjectiveSolver.hpp @@ -61,7 +61,7 @@ class DART_OPTIMIZATION_API MultiObjectiveSolver /// are common to all MultiObjectiveSolver types. Most (but not necessarily /// all) Solvers will make use of these parameters, and these parameters can /// be directly copied or transferred between all Solver types. - struct Properties + struct DART_OPTIMIZATION_API Properties { /// Multi-objective optimization problem to be solved std::shared_ptr mProblem; diff --git a/dart/optimization/Solver.hpp b/dart/optimization/Solver.hpp index be20bb2b205e7..8ea0f72938ce9 100644 --- a/dart/optimization/Solver.hpp +++ b/dart/optimization/Solver.hpp @@ -58,7 +58,7 @@ class DART_OPTIMIZATION_API Solver /// to all Solver types. Most (but not necessarily all) Solvers will make use /// of these parameters, and these parameters can be directly copied or /// transferred between all Solver types. - struct Properties + struct DART_OPTIMIZATION_API Properties { /// Nonlinear optimization Problem to be solved std::shared_ptr mProblem; diff --git a/dart/optimization/pagmo/PagmoMultiObjectiveSolver.hpp b/dart/optimization/pagmo/PagmoMultiObjectiveSolver.hpp index 99cb59a627095..ca481a79113bd 100644 --- a/dart/optimization/pagmo/PagmoMultiObjectiveSolver.hpp +++ b/dart/optimization/pagmo/PagmoMultiObjectiveSolver.hpp @@ -60,7 +60,7 @@ class DART_OPTIMIZATION_API PagmoMultiObjectiveSolver Global_NSGA2, }; - struct UniqueProperties + struct DART_OPTIMIZATION_API UniqueProperties { /// Algorithm to be used by the pagmo Algorithm mAlgorithm; @@ -69,7 +69,7 @@ class DART_OPTIMIZATION_API PagmoMultiObjectiveSolver explicit UniqueProperties(Algorithm algorithm = Algorithm::Global_NSGA2); }; - struct Properties : MultiObjectiveSolver::Properties, UniqueProperties + struct DART_OPTIMIZATION_API Properties : MultiObjectiveSolver::Properties, UniqueProperties { Properties( const MultiObjectiveSolver::Properties& solverProperties diff --git a/dart/simulation/Recording.cpp b/dart/simulation/Recording.cpp index 5c1d3dbee3a2f..431713f0e98fd 100644 --- a/dart/simulation/Recording.cpp +++ b/dart/simulation/Recording.cpp @@ -40,8 +40,6 @@ #include "dart/dynamics/Skeleton.hpp" -#include - namespace dart { namespace simulation { diff --git a/dart/simulation/World.cpp b/dart/simulation/World.cpp index 48e9dd309f62c..8fcb3faf90d9f 100644 --- a/dart/simulation/World.cpp +++ b/dart/simulation/World.cpp @@ -45,8 +45,6 @@ #include "dart/dynamics/Skeleton.hpp" #include "dart/math/SemiImplicitEulerIntegrator.hpp" -#include -#include #include namespace dart { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7f3ad0b53c083..caef68702708b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -86,7 +86,7 @@ function(dart_add_test test_type target_name) # ARGN for source files endif() add_executable(${target_name} ${sources}) - add_test(${target_name} ${target_name}) + add_test(NAME ${target_name} COMMAND $) target_link_libraries(${target_name} ${PROJECT_NAME}${DART_MAJOR_VERSION}-common ${PROJECT_NAME}${DART_MAJOR_VERSION}-math @@ -95,6 +95,10 @@ function(dart_add_test test_type target_name) # ARGN for source files gtest gtest_main ) + + set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${DART_BINARY_DIR}/bin) + + dart_property_add(DART_${test_type}_TESTS ${target_name}) dart_format_add(${sources}) diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index d6aa5e87b1baa..79888f5ecffdf 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -20,7 +20,7 @@ if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-dynamics) ) # TODO(JS): Fix the test case on macOS 12 - if(DART_IN_CI) + if(DART_IN_CI OR MSVC) list(REMOVE_ITEM sources test_Aspect.cpp) endif() @@ -64,26 +64,35 @@ endif() if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-io) + set(sources + test_CompositeResourceRetriever.cpp + test_DartResourceRetriever.cpp + test_FileInfoWorld.cpp + test_InverseKinematics.cpp + test_MjcfParser.cpp + test_PackageResourceRetriever.cpp + test_SdfParser.cpp + test_SkelParser.cpp + test_VskParser.cpp + ) + + # TODO(JS): Fix the test + if(DART_IN_CI OR MSVC) + list(REMOVE_ITEM sources test_VskParser.cpp) + endif() + dart_build_tests( TYPE integration LINK_LIBRARIES ${PROJECT_NAME}${DART_MAJOR_VERSION}-io ${PROJECT_NAME}${DART_MAJOR_VERSION}-test-io SOURCES - test_CompositeResourceRetriever.cpp - test_DartResourceRetriever.cpp - test_FileInfoWorld.cpp - test_InverseKinematics.cpp - test_MjcfParser.cpp - test_PackageResourceRetriever.cpp - test_SdfParser.cpp - test_SkelParser.cpp - test_VskParser.cpp + ${sources} ) endif() -if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-io) +if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-io AND NOT MSVC) if(NOT MSVC) dart_add_test("integration" test_DartLoader) target_link_libraries(test_DartLoader ${PROJECT_NAME}${DART_MAJOR_VERSION}-io) @@ -111,7 +120,7 @@ dart_format_add( SharedLibraryWamIkFast.cpp ) -if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-io) +if(TARGET ${PROJECT_NAME}${DART_MAJOR_VERSION}-io AND NOT MSVC) dart_add_test("integration" test_Collision) target_link_libraries(test_Collision ${PROJECT_NAME}${DART_MAJOR_VERSION}-io)