From 6118b37aa0758f6c81371e13527d3703a1194445 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 11 Aug 2015 11:04:20 -0400 Subject: [PATCH 01/12] Use more reliable Windows macro: WIN32 --> _WIN32 --- dart/common/Timer.cpp | 12 ++++++------ dart/common/Timer.h | 6 +++--- dart/gui/GlutWindow.cpp | 4 ++-- dart/gui/GraphWindow.cpp | 4 ++-- dart/gui/LoadGlut.h | 2 +- dart/gui/SimWindow.cpp | 4 ++-- dart/lcpsolver/error.cpp | 4 ++-- dart/math/Helpers.h | 4 ++-- dart/renderer/LoadOpengl.h | 2 +- unittests/testCommon.cpp | 4 ++-- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dart/common/Timer.cpp b/dart/common/Timer.cpp index 6fd026167a955..bd96d21609353 100644 --- a/dart/common/Timer.cpp +++ b/dart/common/Timer.cpp @@ -55,7 +55,7 @@ Timer::Timer(const std::string& _name) mName(_name), mIsStarted(false) { -#if WIN32 +#ifdef _WIN32 mTimer.start.QuadPart = 0; mTimer.stop.QuadPart = 0; QueryPerformanceFrequency(&mFrequency); @@ -71,7 +71,7 @@ Timer::~Timer() } //============================================================================== -#if WIN32 +#ifdef _WIN32 double Timer::_convLIToSecs(const LARGE_INTEGER& _L) { return (static_cast(_L.QuadPart) @@ -84,7 +84,7 @@ void Timer::start() { mIsStarted = true; mCount++; -#if WIN32 +#ifdef _WIN32 QueryPerformanceCounter(&mTimer.start); #else gettimeofday(&mTimeVal, nullptr); @@ -96,7 +96,7 @@ void Timer::start() void Timer::stop() { mIsStarted = false; -#if WIN32 +#ifdef _WIN32 QueryPerformanceCounter(&mTimer.stop); LARGE_INTEGER time; time.QuadPart = mTimer.stop.QuadPart - mTimer.start.QuadPart; @@ -112,7 +112,7 @@ void Timer::stop() //============================================================================== double Timer::getElapsedTime() { -#if WIN32 +#ifdef _WIN32 LARGE_INTEGER timenow; QueryPerformanceCounter(&timenow); LARGE_INTEGER time; @@ -166,7 +166,7 @@ void Timer::print() //============================================================================== double Timer::getWallTime() { -#if WIN32 +#ifdef _WIN32 LARGE_INTEGER ticksPerSecond; LARGE_INTEGER ticks; QueryPerformanceFrequency(&ticksPerSecond); diff --git a/dart/common/Timer.h b/dart/common/Timer.h index d317f69fe995e..e482f28c72a48 100644 --- a/dart/common/Timer.h +++ b/dart/common/Timer.h @@ -39,7 +39,7 @@ #include -#if WIN32 +#ifdef _WIN32 #ifdef NOMINMAX #include #else @@ -100,7 +100,7 @@ class Timer private: int mCount; -#if WIN32 +#ifdef _WIN32 stopWatch mTimer; #else timeval mTimeVal; @@ -113,7 +113,7 @@ class Timer std::string mName; bool mIsStarted; -#if WIN32 +#ifdef _WIN32 LARGE_INTEGER mFrequency; double _convLIToSecs(const LARGE_INTEGER& _L); #endif diff --git a/dart/gui/GlutWindow.cpp b/dart/gui/GlutWindow.cpp index acd66fed779ea..1d2dd34b21374 100644 --- a/dart/gui/GlutWindow.cpp +++ b/dart/gui/GlutWindow.cpp @@ -37,7 +37,7 @@ #include "dart/gui/GlutWindow.h" -#ifndef WIN32 +#ifndef _WIN32 #include #endif #include @@ -153,7 +153,7 @@ bool GlutWindow::screenshot() { char fileBase[32] = "frames/Capture"; char fileName[64]; // png -#ifdef WIN32 +#ifdef _WIN32 _snprintf(fileName, sizeof(fileName), "%s%.4d.png", fileBase, count++); #else std::snprintf(fileName, sizeof(fileName), "%s%.4d.png", fileBase, count++); diff --git a/dart/gui/GraphWindow.cpp b/dart/gui/GraphWindow.cpp index d044d4c933257..7c3ffa7cd1a21 100644 --- a/dart/gui/GraphWindow.cpp +++ b/dart/gui/GraphWindow.cpp @@ -91,7 +91,7 @@ void GraphWindow::draw() { while (xPos < 1.0) { char buff[64]; int v = xPos * nPoints; -#ifdef WIN32 +#ifdef _WIN32 _snprintf(buff, sizeof(buff), "%d", v); #else std::snprintf(buff, sizeof(buff), "%d", v); @@ -106,7 +106,7 @@ void GraphWindow::draw() { while (yPos < 1.0) { char buff[64]; double v = yPos * (upperBound - lowerBound) + lowerBound; -#ifdef WIN32 +#ifdef _WIN32 _snprintf(buff, sizeof(buff), "%.2e", v); #else std::snprintf(buff, sizeof(buff), "%.2e", v); diff --git a/dart/gui/LoadGlut.h b/dart/gui/LoadGlut.h index bc184dee6c62f..147eac5ee6b48 100644 --- a/dart/gui/LoadGlut.h +++ b/dart/gui/LoadGlut.h @@ -37,7 +37,7 @@ #ifndef DART_GUI_LOADGLUT_H_ #define DART_GUI_LOADGLUT_H_ -#if WIN32 +#ifdef _WIN32 #include // To disable glut::exit() function #include #elif defined(__linux__) diff --git a/dart/gui/SimWindow.cpp b/dart/gui/SimWindow.cpp index 8a04d38445d1f..43478206ddb7b 100644 --- a/dart/gui/SimWindow.cpp +++ b/dart/gui/SimWindow.cpp @@ -163,13 +163,13 @@ void SimWindow::draw() { // display the frame count in 2D text char buff[64]; if (!mSimulating) -#ifdef WIN32 +#ifdef _WIN32 _snprintf(buff, sizeof(buff), "%d", mPlayFrame); #else std::snprintf(buff, sizeof(buff), "%d", mPlayFrame); #endif else -#ifdef WIN32 +#ifdef _WIN32 _snprintf(buff, sizeof(buff), "%d", mWorld->getSimFrames()); #else std::snprintf(buff, sizeof(buff), "%d", mWorld->getSimFrames()); diff --git a/dart/lcpsolver/error.cpp b/dart/lcpsolver/error.cpp index 715deb8079a03..596f561c11e97 100644 --- a/dart/lcpsolver/error.cpp +++ b/dart/lcpsolver/error.cpp @@ -81,7 +81,7 @@ static void printMessage (int num, const char *msg1, const char *msg2, //**************************************************************************** // unix -#ifndef WIN32 +#ifndef _WIN32 extern "C" void dError (int num, const char *msg, ...) { @@ -117,7 +117,7 @@ extern "C" void dMessage (int num, const char *msg, ...) //**************************************************************************** // windows -#ifdef WIN32 +#ifdef _WIN32 // isn't cygwin annoying! #ifdef CYGWIN diff --git a/dart/math/Helpers.h b/dart/math/Helpers.h index e58cd3d56f5e7..effc18681c375 100644 --- a/dart/math/Helpers.h +++ b/dart/math/Helpers.h @@ -153,7 +153,7 @@ inline bool isInt(double _x) { /// \brief Returns whether _v is a NaN (Not-A-Number) value inline bool isNan(double _v) { -#ifdef WIN32 +#ifdef _WIN32 return _isnan(_v); #else return std::isnan(_v); @@ -173,7 +173,7 @@ inline bool isNan(const Eigen::MatrixXd& _m) { /// \brief Returns whether _v is an infinity value (either positive infinity or /// negative infinity). inline bool isInf(double _v) { -#ifdef WIN32 +#ifdef _WIN32 return !_finite(_v); #else return std::isinf(_v); diff --git a/dart/renderer/LoadOpengl.h b/dart/renderer/LoadOpengl.h index 3f07d511a3915..55c768226bafd 100644 --- a/dart/renderer/LoadOpengl.h +++ b/dart/renderer/LoadOpengl.h @@ -37,7 +37,7 @@ #ifndef DART_RENDERER_LOADOPENGL_H_ #define DART_RENDERER_LOADOPENGL_H_ -#if WIN32 +#ifdef _WIN32 #ifdef NOMINMAX #include #else diff --git a/unittests/testCommon.cpp b/unittests/testCommon.cpp index b0199292e8708..7db4966c00c10 100644 --- a/unittests/testCommon.cpp +++ b/unittests/testCommon.cpp @@ -51,7 +51,7 @@ TEST(Common, Timer) for (int i = 0; i < 1e+3; ++i) { timer2.start(); -#ifdef WIN32 +#ifdef _WIN32 Sleep(2); // 2 milliseconds #else usleep(2000); // 2 milliseconds @@ -64,7 +64,7 @@ TEST(Common, Timer) timer2.print(); // Both timer should have counted more than 2 seconds -#ifdef WIN32 +#ifdef _WIN32 // On Windows, Sleep(2) takes less than exact 2 milliseconds.. EXPECT_GE(timer1.getTotalElapsedTime(), 1.99); EXPECT_GE(timer2.getTotalElapsedTime(), 1.99); From 9c07b19589f1b30dbef71f2afcfe32c306480689 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 11 Aug 2015 11:09:57 -0400 Subject: [PATCH 02/12] Disable use of GL_MULTISAMPLE for Windows (see #411) --- dart/gui/GlutWindow.cpp | 4 ++++ dart/gui/Win3D.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dart/gui/GlutWindow.cpp b/dart/gui/GlutWindow.cpp index 1d2dd34b21374..40e8cf3d43d58 100644 --- a/dart/gui/GlutWindow.cpp +++ b/dart/gui/GlutWindow.cpp @@ -99,7 +99,11 @@ void GlutWindow::initWindow(int _w, int _h, const char* _name) { // glutTimerFunc(mDisplayTimeout, refreshTimer, 0); // glutTimerFunc(mDisplayTimeout, runTimer, 0); +#ifndef _WIN32 glDisable(GL_MULTISAMPLE); +#endif + // TODO: Disabled use of GL_MULTISAMPLE for Windows. Please see #411 for the + // detail. } void GlutWindow::reshape(int _w, int _h) { diff --git a/dart/gui/Win3D.cpp b/dart/gui/Win3D.cpp index 2cdab4d012577..439eb4536cee0 100644 --- a/dart/gui/Win3D.cpp +++ b/dart/gui/Win3D.cpp @@ -97,10 +97,14 @@ void Win3D::keyboard(unsigned char _key, int _x, int _y) { case 'c': case 'C': // screen capture mCapture = !mCapture; +#ifndef _WIN32 if (mCapture) glEnable(GL_MULTISAMPLE); else glDisable(GL_MULTISAMPLE); +#endif + // TODO: Disabled use of GL_MULTISAMPLE for Windows. Please see #411 for + // the detail. break; case 27: // ESC exit(0); From 32ee5a3a7ec8835660006dcaad9a3280f357ba77 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 11 Aug 2015 11:15:41 -0400 Subject: [PATCH 03/12] Check OS macros in consistent way --- dart/gui/LoadGlut.h | 2 +- dart/renderer/LoadOpengl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dart/gui/LoadGlut.h b/dart/gui/LoadGlut.h index 147eac5ee6b48..e21e6cbbff54e 100644 --- a/dart/gui/LoadGlut.h +++ b/dart/gui/LoadGlut.h @@ -37,7 +37,7 @@ #ifndef DART_GUI_LOADGLUT_H_ #define DART_GUI_LOADGLUT_H_ -#ifdef _WIN32 +#if defined(_WIN32) #include // To disable glut::exit() function #include #elif defined(__linux__) diff --git a/dart/renderer/LoadOpengl.h b/dart/renderer/LoadOpengl.h index 55c768226bafd..7303d591cf79a 100644 --- a/dart/renderer/LoadOpengl.h +++ b/dart/renderer/LoadOpengl.h @@ -37,7 +37,7 @@ #ifndef DART_RENDERER_LOADOPENGL_H_ #define DART_RENDERER_LOADOPENGL_H_ -#ifdef _WIN32 +#if defined(_WIN32) #ifdef NOMINMAX #include #else From 2bfb8a9ffa78b6c10ddccfa41a9f4d4e9a32d425 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 01:15:55 -0400 Subject: [PATCH 04/12] Change default run-time library option from /MT to /MD for Visual Studio --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d74e64c1c77cb..198c023c5d341 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ message(STATUS "============================================") option(ENABLE_OPENMP "Build with OpenMP parallaization enabled" ON) option(BUILD_CORE_ONLY "Build only the core of DART" OFF) if(MSVC) - set(DART_RUNTIME_LIBRARY "/MT" CACHE STRING "BaseName chosen by the user at CMake configure time") + set(DART_RUNTIME_LIBRARY "/MD" CACHE STRING "BaseName chosen by the user at CMake configure time") set_property(CACHE DART_RUNTIME_LIBRARY PROPERTY STRINGS /MD /MT) else() option(BUILD_SHARED_LIBS "Build shared libraries" ON) From 6d74c3af3c9b7ffffd0a33c4b07aa2700b3fe60e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 01:24:27 -0400 Subject: [PATCH 05/12] Add ccd libraries and include directories to CMakeLists.txt --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 198c023c5d341..96062b6a78e6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,7 +332,8 @@ endif() #=============================================================================== # DART dependency variable settings #=============================================================================== -set(DART_CORE_DEPENDENCIES ${FCL_LIBRARIES} +set(DART_CORE_DEPENDENCIES ${CCD_LIBRARIES} + ${FCL_LIBRARIES} ${ASSIMP_LIBRARIES} ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} @@ -364,6 +365,7 @@ endif() #=============================================================================== include_directories(BEFORE ${PROJECT_SOURCE_DIR}) include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS}) +include_directories(SYSTEM ${CCD_INCLUDE_DIRS}) include_directories(SYSTEM ${FCL_INCLUDE_DIRS}) include_directories(SYSTEM ${ASSIMP_INCLUDE_DIRS}) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) From f9dd64624d490b0faf098359b6e452537dab2e15 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 01:25:21 -0400 Subject: [PATCH 06/12] Set CMP0053 to suppress a warning on Windows. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96062b6a78e6c..4249c7adb4526 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,13 @@ if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() +# Simplify variable reference and escape sequence evaluation. This was added in +# CMake 3.1. Explicitly setting this policy is necessary to suppress a warning +# in CMake 3.1 and above. +if(POLICY CMP0053) + cmake_policy(SET CMP0053 NEW) +endif() + # Disables a warning about a change in Cygwin Cmake set(CMAKE_LEGACY_CYGWIN_WIN32 0) set(CMAKE_CXX_WARNING_LEVEL 4) From c89e5835ccea051e7036943a33b1a29d1627b0e3 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 17:28:28 -0400 Subject: [PATCH 07/12] Workaround for MSVC bug on template function specialization with default argument (#487) --- dart/dynamics/BodyNode.h | 114 ++++++++++++++++++++++++++++++++------- dart/dynamics/Skeleton.h | 33 ++++++++++-- 2 files changed, 123 insertions(+), 24 deletions(-) diff --git a/dart/dynamics/BodyNode.h b/dart/dynamics/BodyNode.h index a31f7c5126fc0..d8897d2f91659 100644 --- a/dart/dynamics/BodyNode.h +++ b/dart/dynamics/BodyNode.h @@ -329,6 +329,22 @@ class BodyNode : public Frame, public SkeletonRefCountingBase /// version. bool moveTo(const SkeletonPtr& _newSkeleton, BodyNode* _newParent); +#ifdef _WIN32 + template + static typename JointType::Properties createJointProperties() + { + return typename JointType::Properties(); + } + + template + static typename NodeType::Properties createBodyNodeProperties() + { + return typename NodeType::Properties(); + } +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail + /// A version of moveTo(BodyNode*) that also changes the Joint type of the /// parent Joint of this BodyNode. This function returns the pointer to the /// newly created Joint. The original parent Joint will be deleted. @@ -339,16 +355,30 @@ class BodyNode : public Frame, public SkeletonRefCountingBase /// changed. template JointType* moveTo(BodyNode* _newParent, - const typename JointType::Properties& _joint = - typename JointType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties()); +#else + const typename JointType::Properties& _joint + = typename JointType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// A version of moveTo(SkeletonPtr, BodyNode*) that also changes the Joint /// type of the parent Joint of this BodyNode. This function returns the /// pointer to the newly created Joint. The original Joint will be deleted. template JointType* moveTo(const SkeletonPtr& _newSkeleton, BodyNode* _newParent, - const typename JointType::Properties& _joint = - typename JointType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties()); +#else + const typename JointType::Properties& _joint + = typename JointType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Remove this BodyNode and all of its children (recursively) from their /// current Skeleton and move them into a newly created Skeleton. The newly @@ -366,8 +396,15 @@ class BodyNode : public Frame, public SkeletonRefCountingBase /// the parent Joint of this BodyNode. template SkeletonPtr split(const std::string& _skeletonName, - const typename JointType::Properties& _joint = - typename JointType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties()); +#else + const typename JointType::Properties& _joint + = typename JointType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Change the Joint type of this BodyNode's parent Joint. /// @@ -375,8 +412,15 @@ class BodyNode : public Frame, public SkeletonRefCountingBase /// BodyNodes and Joints in the Skeleton. template JointType* changeParentJointType( - const typename JointType::Properties& _joint = - typename JointType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties()); +#else + const typename JointType::Properties& _joint + = typename JointType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Create clones of this BodyNode and all of its children recursively (unless /// _recursive is set to false) and attach the clones to the specified @@ -408,18 +452,32 @@ class BodyNode : public Frame, public SkeletonRefCountingBase template std::pair copyTo( BodyNode* _newParent, - const typename JointType::Properties& _joint = - typename JointType::Properties(), - bool _recursive=true); +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties(), +#else + const typename JointType::Properties& _joint + = typename JointType::Properties(), +#endif + bool _recursive = true); + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// A version of copyTo(Skeleton*,BodyNode*) that also changes the Joint type /// of the parent Joint of this BodyNode. template std::pair copyTo( const SkeletonPtr& _newSkeleton, BodyNode* _newParent, - const typename JointType::Properties& _joint = - typename JointType::Properties(), - bool _recursive=true) const; +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties(), +#else + const typename JointType::Properties& _joint + = typename JointType::Properties(), +#endif + bool _recursive = true) const; + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Create clones of this BodyNode and all of its children (recursively) and /// create a new Skeleton with the specified name to attach them to. @@ -431,9 +489,16 @@ class BodyNode : public Frame, public SkeletonRefCountingBase template SkeletonPtr copyAs( const std::string& _skeletonName, - const typename JointType::Properties& _joint = - typename JointType::Properties(), +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties(), +#else + const typename JointType::Properties& _joint + = typename JointType::Properties(), +#endif bool _recursive=true) const; + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Return the parent Joint of this BodyNode Joint* getParentJoint(); @@ -450,10 +515,19 @@ class BodyNode : public Frame, public SkeletonRefCountingBase /// Create a Joint and BodyNode pair as a child of this BodyNode template std::pair createChildJointAndBodyNodePair( - const typename JointType::Properties& _jointProperties = - typename JointType::Properties(), - const typename NodeType::Properties& _bodyProperties = - typename NodeType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _jointProperties + = BodyNode::createJointProperties(), + const typename NodeType::Properties& _bodyProperties + = BodyNode::createBodyNodeProperties()); +#else + const typename JointType::Properties& _jointProperties + = typename JointType::Properties(), + const typename NodeType::Properties& _bodyProperties + = typename NodeType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail /// Return the number of child BodyNodes size_t getNumChildBodyNodes() const; diff --git a/dart/dynamics/Skeleton.h b/dart/dynamics/Skeleton.h index 125a3492e1b82..cc638e3cebf23 100644 --- a/dart/dynamics/Skeleton.h +++ b/dart/dynamics/Skeleton.h @@ -181,15 +181,40 @@ class Skeleton : public MetaSkeleton /// \{ \name Structural Properties //---------------------------------------------------------------------------- +#ifdef _WIN32 + template + static typename JointType::Properties createJointProperties() + { + return typename JointType::Properties(); + } + + template + static typename NodeType::Properties createBodyNodeProperties() + { + return typename NodeType::Properties(); + } +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail + /// Create a Joint and child BodyNode pair of the given types. When creating /// a root (parentless) BodyNode, pass in nullptr for the _parent argument. template std::pair createJointAndBodyNodePair( BodyNode* _parent = nullptr, - const typename JointType::Properties& _jointProperties = - typename JointType::Properties(), - const typename NodeType::Properties& _bodyProperties = - typename NodeType::Properties()); +#ifdef _WIN32 + const typename JointType::Properties& _jointProperties + = Skeleton::createJointProperties(), + const typename NodeType::Properties& _bodyProperties + = Skeleton::createBodyNodeProperties()); +#else + const typename JointType::Properties& _jointProperties + = typename JointType::Properties(), + const typename NodeType::Properties& _bodyProperties + = typename NodeType::Properties()); +#endif + // TODO: Workaround for MSVC bug on template function specialization with + // default argument. Please see #487 for detail // Documentation inherited size_t getNumBodyNodes() const override; From d0f11cfb0c0fbf4e0376ac145780c3cb535af047 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 17:55:42 -0400 Subject: [PATCH 08/12] Apply the workaround in the previous commit to testJoint --- unittests/testJoints.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/unittests/testJoints.cpp b/unittests/testJoints.cpp index 301ddeba2bc03..028a99ed28d53 100644 --- a/unittests/testJoints.cpp +++ b/unittests/testJoints.cpp @@ -67,9 +67,23 @@ using namespace dart::simulation; class JOINTS : public testing::Test { public: +#ifdef _WIN32 template - void kinematicsTest(const typename JointType::Properties& _properties = - typename JointType::Properties()); + static typename JointType::Properties createJointProperties() + { + return typename JointType::Properties(); + } +#endif + + template + void kinematicsTest( +#ifdef _WIN32 + const typename JointType::Properties& _joint + = BodyNode::createJointProperties()); +#else + const typename JointType::Properties& _joint + = typename JointType::Properties()); +#endif }; //============================================================================== From e81dcec571d2e7bcafafe9e75a9d8ab031e17f53 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 23:27:43 -0400 Subject: [PATCH 09/12] Update appveyor scripts --- appveyor.yml | 33 +++++++++++++-------------------- ci/appveyor_install.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 20 deletions(-) create mode 100755 ci/appveyor_install.sh diff --git a/appveyor.yml b/appveyor.yml index fa58938d24696..51588cc8e7e75 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ version: "{build}" # Operating system (build VM template) -os: Previous Windows Server 2012 R2 # using previous worker images since default worker has problem installing DART-Prerequisites.msi +os: Visual Studio 2015 # build platform, i.e. Win32 (instead of x86), x64, Any CPU. This setting is optional. platform: @@ -11,14 +11,14 @@ platform: # specify custom environment variables environment: - BOOST_ROOT: c:\Libraries\boost - BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib + BOOST_ROOT: C:\Libraries\boost + BOOST_LIBRARYDIR: C:\Libraries\boost\stage\lib + BUILD_EXAMPLES: OFF # don't build examples to not exceed allowed build time (40 min) matrix: - BUILD_CORE_ONLY: ON - # Diabled since we don't have binaries of DART prerequisites build on Visual Studio 2013 (/MT) yet (See #270) - # - BUILD_CORE_ONLY: OFF + - BUILD_CORE_ONLY: OFF -# build Configuration, i.e. Debug, Release, etc. +# build configuration, i.e. Debug, Release, etc. configuration: - Debug - Release @@ -42,10 +42,8 @@ branches: # scripts that run after cloning repository install: - - cmd: cd C:\projects - - ps: Start-FileDownload 'http://www.prism.gatech.edu/~tkunz3/DART-Prerequisites.msi' - - cmd: C:\projects\DART-Prerequisites.msi - # - cmd: choco install doxygen.install + - ps: cd "C:\projects\dart\ci" + - ps: .\appveyor_install.ps1 # scripts to run before build before_build: @@ -55,17 +53,12 @@ before_build: # We generate project files for Visual Studio 12 because the boost binaries installed on the test server are for Visual Studio 12. - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 12 - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 12 Win64 - - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" .. + - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DDART_BUILD_EXAMPLES="%BUILD_EXAMPLES%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" .. build: - project: C:\projects\dart\build\dart.sln - - # enable MSBuild parallel builds - parallel: true - - # MSBuild verbosity level (quiet|minimal|normal|detailed) - verbosity: detailed + project: C:\projects\dart\build\dart.sln # path to Visual Studio solution or project + parallel: true # enable MSBuild parallel builds + verbosity: minimal # MSBuild verbosity level (quiet|minimal|normal|detailed) test_script: - - cmd: ctest -C Release -VV - - cmd: ctest -C Debug -VV + - cmd: ctest --build-config %configuration% --extra-verbose --output-on-failure diff --git a/ci/appveyor_install.sh b/ci/appveyor_install.sh new file mode 100755 index 0000000000000..4df7be14ed93e --- /dev/null +++ b/ci/appveyor_install.sh @@ -0,0 +1,35 @@ +function ExecuteCommand($command, $command_args) +{ + Write-Host $command $command_args + Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru +} + +function InstallPrerequisites($work_dir, $install_dir) +{ + $old_dir = $pwd + cd $work_dir + + $msi = "dart-prerequisites.msi" + $uri = "https://github.com/dartsim/dart-prerequisites-windows/raw/bfb42e9e8271bc99f8b070715bd407cb5988c322/DART%205.0-prerequisites-msvc12-md-32bit.msi" + Invoke-WebRequest $uri -OutFile $msi + + $install_command = "msiexec.exe" + $install_args = "/qn /log log.txt /i $msi TARGETDIR=$install_dir" + ExecuteCommand $install_command $install_args + + cd $old_dir +} + +function main() +{ + try + { + InstallPrerequisites "C:/projects" "C:/Golems" + } + catch + { + throw + } +} + +main \ No newline at end of file From 484e829dc60585e803695dacffeae12dcc81f7c0 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 13 Aug 2015 23:33:57 -0400 Subject: [PATCH 10/12] Rename appveyor_install.sh --> appveyor_install.ps1 --- ci/{appveyor_install.sh => appveyor_install.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ci/{appveyor_install.sh => appveyor_install.ps1} (100%) diff --git a/ci/appveyor_install.sh b/ci/appveyor_install.ps1 similarity index 100% rename from ci/appveyor_install.sh rename to ci/appveyor_install.ps1 From b5c32be441a14fea4dfb3afedfec0168f0f3cdf7 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 14 Aug 2015 05:11:18 -0400 Subject: [PATCH 11/12] Disable build for x64 machine ... until x64 version of dart-prerequisites is ready --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 51588cc8e7e75..e6e1141aa2dc5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ os: Visual Studio 2015 # build platform, i.e. Win32 (instead of x86), x64, Any CPU. This setting is optional. platform: - Win32 - - x64 + #- x64 Disable build for x64 machine until x64 version of dart-prerequisites is ready # specify custom environment variables environment: From f16d6ad257be6e785e9a89b2c94276bf293ff220 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 16 Aug 2015 03:59:48 -0400 Subject: [PATCH 12/12] Disable part of TEST(Skeleton, Linkage) for Windows (#489) --- unittests/testSkeleton.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unittests/testSkeleton.cpp b/unittests/testSkeleton.cpp index 072ba50f99624..bcb45d4ab443b 100644 --- a/unittests/testSkeleton.cpp +++ b/unittests/testSkeleton.cpp @@ -829,6 +829,11 @@ TEST(Skeleton, Linkage) skel->getBodyNode("c1b3"), Chain::IncludeBoth, "downstreamFreeJoint"); checkForBodyNodes(downstreamFreeJoint, skel, true, "c1b1"); +#ifdef _WIN32 + dtmsg << "Aborting test for Windows. Please see #489.\n"; + return; +#endif + ChainPtr emptyChain = Chain::create(skel->getBodyNode("c1b1"), skel->getBodyNode("c1b3"), "emptyChain"); checkForBodyNodes(emptyChain, skel, true);