Skip to content

Commit

Permalink
Merge branch '6.13/build_mode_flag'
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Mar 24, 2024
2 parents 2437749 + ce0fca3 commit a5b2b79
Show file tree
Hide file tree
Showing 41 changed files with 516 additions and 413 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DART Changelog

## DART 6

### [DART 6.14.0 (TBD)](https://github.com/dartsim/dart/milestone/73?closed=1)
Expand All @@ -14,6 +16,20 @@

* Removed planning component

### [DART 6.13.2 (2024-03-17)](https://github.com/dartsim/dart/milestone/75?closed=1)

* Tested Platforms

* Linux
* Ubuntu 22.04 LTS on amd64 / GCC 11.2 / amd64
* Ubuntu 24.04 LTS on amd64 / GCC 13.2 / amd64
* macOS 12 (Monterey) / AppleClang 14 / amd64
* Windows / MSVC 19.38 / amd64

* Build

* Fixed build with GCC >= 13: [#1793](https://github.com/dartsim/dart/pull/1793)

### [DART 6.13.1 (2024-01-04)](https://github.com/dartsim/dart/milestone/74?closed=1)

* Tested Platforms
Expand Down
22 changes: 12 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,17 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)

set(BUILD_TYPE_DEBUG FALSE)
set(BUILD_TYPE_RELEASE FALSE)
set(BUILD_TYPE_RELWITHDEBINFO FALSE)
set(BUILD_TYPE_MINSIZEREL FALSE)
set(DART_BUILD_MODE_DEBUG FALSE)
set(DART_BUILD_MODE_RELEASE FALSE)

if("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "DEBUG")
set(BUILD_TYPE_DEBUG TRUE)
set(DART_BUILD_MODE_DEBUG TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELEASE")
set(BUILD_TYPE_RELEASE TRUE)
set(DART_BUILD_MODE_RELEASE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELWITHDEBINFO")
set(BUILD_TYPE_RELWITHDEBINFO TRUE)
set(DART_BUILD_MODE_RELEASE TRUE)
elseif("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "MINSIZEREL")
set(BUILD_TYPE_MINSIZEREL TRUE)
set(DART_BUILD_MODE_RELEASE TRUE)
else()
message(WARNING "CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} unknown. Valid options are: Debug | Release | RelWithDebInfo | MinSizeRel")
endif()
Expand All @@ -192,14 +190,14 @@ endif()
# - ERROR: To enable log with DART_ERROR() and below
# - FATAL: To enable log with DART_FATAL()
# - OFF: To turn off all the logs
if(BUILD_TYPE_DEBUG)
if(DART_BUILD_MODE_DEBUG)
set(DART_ACTIVE_LOG_LEVEL "DEBUG" CACHE STRING "Compile time active log level to enable")
else()
set(DART_ACTIVE_LOG_LEVEL "INFO" CACHE STRING "Compile time active log level to enable")
endif()
set_property(CACHE DART_ACTIVE_LOG_LEVEL PROPERTY STRINGS TRACE DEBUG INFO WARN ERROR FATAL OFF)

if(BUILD_TYPE_DEBUG)
if(DART_BUILD_MODE_DEBUG)
option(DART_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
else()
option(DART_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" ON)
Expand Down Expand Up @@ -291,6 +289,10 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
# TODO: These warnings should be properly addressed and these compiler options removed
add_compile_options(-Wno-overloaded-virtual -Wno-alloc-size-larger-than -Wno-dangling-pointer)
endif()
if(GCC_VERSION VERSION_GREATER_EQUAL 13.2.0)
# TODO: These warnings should be properly addressed and these compiler options removed
add_compile_options(-Wno-overloaded-virtual -Wno-alloc-size-larger-than -Wno-dangling-pointer)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fno-omit-frame-pointer -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls")
if(DART_FAST_DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion dart/common/FreeListAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void FreeListAllocator::MemoryBlockHeader::merge(MemoryBlockHeader* other)
}

//==============================================================================
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
bool FreeListAllocator::MemoryBlockHeader::isValid() const
{
if (mPrev != nullptr && mPrev->mNext != this) {
Expand Down
2 changes: 1 addition & 1 deletion dart/common/FreeListAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class FreeListAllocator : public MemoryAllocator
/// Merges this memory block with the given memory block
void merge(MemoryBlockHeader* other);

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
/// [Debug only] Returns whether this memory block is valid
bool isValid() const;
#endif
Expand Down
10 changes: 5 additions & 5 deletions dart/common/MemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "dart/common/MemoryManager.hpp"

#ifndef NDEBUG // debug
#if DART_BUILD_MODE_DEBUG
#include "dart/common/Logging.hpp"
#endif

Expand All @@ -49,7 +49,7 @@ MemoryManager& MemoryManager::GetDefault()
MemoryManager::MemoryManager(MemoryAllocator& baseAllocator)
: mBaseAllocator(baseAllocator),
mFreeListAllocator(mBaseAllocator),
#ifdef NDEBUG
#if DART_BUILD_MODE_RELEASE
mPoolAllocator(mFreeListAllocator)
#else
mPoolAllocator(mFreeListAllocator.getInternalAllocator())
Expand All @@ -73,7 +73,7 @@ MemoryAllocator& MemoryManager::getBaseAllocator()
//==============================================================================
FreeListAllocator& MemoryManager::getFreeListAllocator()
{
#ifdef NDEBUG
#if DART_BUILD_MODE_RELEASE
return mFreeListAllocator;
#else
return mFreeListAllocator.getInternalAllocator();
Expand All @@ -83,7 +83,7 @@ FreeListAllocator& MemoryManager::getFreeListAllocator()
//==============================================================================
PoolAllocator& MemoryManager::getPoolAllocator()
{
#ifdef NDEBUG
#if DART_BUILD_MODE_RELEASE
return mPoolAllocator;
#else
return mPoolAllocator.getInternalAllocator();
Expand Down Expand Up @@ -144,7 +144,7 @@ void MemoryManager::deallocateUsingPool(void* pointer, size_t bytes)
deallocate(Type::Pool, pointer, bytes);
}

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
//==============================================================================
bool MemoryManager::hasAllocated(void* pointer, size_t size) const noexcept
{
Expand Down
8 changes: 4 additions & 4 deletions dart/common/MemoryManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#ifndef DART_COMMON_MEMORYMANAGER_HPP_
#define DART_COMMON_MEMORYMANAGER_HPP_

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
#include <mutex>
#endif
#include <dart/common/FreeListAllocator.hpp>
Expand Down Expand Up @@ -151,7 +151,7 @@ class MemoryManager final
template <typename T>
void destroyUsingPool(T* pointer) noexcept;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
/// Returns true if a pointer is allocated by the internal allocator.
[[nodiscard]] bool hasAllocated(void* pointer, size_t size) const noexcept;
#endif
Expand All @@ -164,10 +164,10 @@ class MemoryManager final
std::ostream& os, const MemoryManager& memoryManager);

private:
/// The base allocator to allocate memory chunck.
/// The base allocator to allocate memory chunk.
MemoryAllocator& mBaseAllocator;

#ifdef NDEBUG
#if DART_BUILD_MODE_RELEASE
/// The free list allocator.
FreeListAllocator mFreeListAllocator;

Expand Down
7 changes: 3 additions & 4 deletions dart/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@
#define DART_COMPILER_MSVC
#endif

#cmakedefine01 BUILD_TYPE_DEBUG
#cmakedefine01 BUILD_TYPE_RELEASE
#cmakedefine01 BUILD_TYPE_RELWITHDEBINFO
#cmakedefine01 BUILD_TYPE_MINSIZEREL
// Indicates the build mode used for compiling
#cmakedefine01 DART_BUILD_MODE_DEBUG
#cmakedefine01 DART_BUILD_MODE_RELEASE

#cmakedefine01 HAVE_NLOPT
#cmakedefine01 HAVE_IPOPT
Expand Down
6 changes: 3 additions & 3 deletions dart/constraint/BoxedLcpConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "dart/constraint/BoxedLcpConstraintSolver.hpp"

#include <cassert>
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
#include <iomanip>
#include <iostream>
#endif
Expand Down Expand Up @@ -149,7 +149,7 @@ void BoxedLcpConstraintSolver::solveConstrainedGroup(ConstrainedGroup& group)
return;

const int nSkip = dPAD(n);
#ifdef NDEBUG // release
#if DART_BUILD_MODE_RELEASE
mA.resize(n, nSkip);
#else // debug
mA.setZero(n, nSkip);
Expand Down Expand Up @@ -295,7 +295,7 @@ void BoxedLcpConstraintSolver::solveConstrainedGroup(ConstrainedGroup& group)
}

//==============================================================================
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
bool BoxedLcpConstraintSolver::isSymmetric(std::size_t n, double* A)
{
std::size_t nSkip = dPAD(n);
Expand Down
4 changes: 2 additions & 2 deletions dart/constraint/BoxedLcpConstraintSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ class BoxedLcpConstraintSolver : public ConstraintSolver
/// Cache data for boxed LCP formulation
Eigen::VectorXi mOffset;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
private:
/// Return true if the matrix is symmetric
bool isSymmetric(std::size_t n, double* A);

/// Return true if the diagonla block of matrix is symmetric
/// Return true if the diagonal block of matrix is symmetric
bool isSymmetric(
std::size_t n, double* A, std::size_t begin, std::size_t end);

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/BoxedLcpSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class BoxedLcpSolver : public common::Castable<BoxedLcpSolver>
bool earlyTermination = false)
= 0;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
virtual bool canSolve(int n, const double* A) = 0;
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/ConstrainedGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void ConstrainedGroup::removeAllConstraints()
}

//==============================================================================
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
bool ConstrainedGroup::containConstraint(
const ConstConstraintBasePtr& _constraint) const
{
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/ConstrainedGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ConstrainedGroup
friend class ConstraintSolver;

private:
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
/// Return true if _constraint is contained
bool containConstraint(const ConstConstraintBasePtr& _constraint) const;
#endif
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/DantzigBoxedLcpSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool DantzigBoxedLcpSolver::solve(
n, A, x, b, nullptr, 0, lo, hi, findex, earlyTermination);
}

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
//==============================================================================
bool DantzigBoxedLcpSolver::canSolve(int /*n*/, const double* /*A*/)
{
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/DantzigBoxedLcpSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DantzigBoxedLcpSolver : public BoxedLcpSolver
int* findex,
bool earlyTermination) override;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
// Documentation inherited.
bool canSolve(int n, const double* A) override;
#endif
Expand Down
6 changes: 3 additions & 3 deletions dart/constraint/DantzigLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "dart/constraint/DantzigLCPSolver.hpp"

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
#include <iomanip>
#include <iostream>
#endif
Expand Down Expand Up @@ -79,7 +79,7 @@ void DantzigLCPSolver::solve(ConstrainedGroup* _group)
int* findex = new int[n];

// Set w to 0 and findex to -1
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
std::memset(A, 0.0, n * nSkip * sizeof(double));
#endif
std::memset(w, 0.0, n * sizeof(double));
Expand Down Expand Up @@ -182,7 +182,7 @@ void DantzigLCPSolver::solve(ConstrainedGroup* _group)
}

//==============================================================================
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
bool DantzigLCPSolver::isSymmetric(std::size_t _n, double* _A)
{
std::size_t nSkip = dPAD(_n);
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/DantzigLCPSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DantzigLCPSolver : public LCPSolver
// Documentation inherited
void solve(ConstrainedGroup* _group) override;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
private:
/// Return true if the matrix is symmetric
bool isSymmetric(std::size_t _n, double* _A);
Expand Down
10 changes: 6 additions & 4 deletions dart/constraint/JointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ void JointConstraint::getInformation(ConstraintInfo* lcp)
if (!mActive[i])
continue;

#ifndef NDEBUG // debug
if (std::abs(lcp->w[index]) > 1e-6) {
#if DART_BUILD_MODE_DEBUG
if (std::abs(lcp->w[index]) > 1e-6)
{
dterr << "Invalid " << index
<< "-th slack variable. Expected: 0.0. Actual: " << lcp->w[index]
<< ".\n";
Expand All @@ -387,8 +388,9 @@ void JointConstraint::getInformation(ConstraintInfo* lcp)
lcp->lo[index] = mImpulseLowerBound[i];
lcp->hi[index] = mImpulseUpperBound[i];

#ifndef NDEBUG // debug
if (lcp->findex[index] != -1) {
#if DART_BUILD_MODE_DEBUG
if (lcp->findex[index] != -1)
{
dterr << "Invalid " << index
<< "-th friction index. Expected: -1. Actual: "
<< lcp->findex[index] << ".\n";
Expand Down
6 changes: 3 additions & 3 deletions dart/constraint/PGSLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "dart/constraint/PGSLCPSolver.hpp"

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
#include <iomanip>
#include <iostream>
#endif
Expand Down Expand Up @@ -72,7 +72,7 @@ void PGSLCPSolver::solve(ConstrainedGroup* _group)
int* findex = new int[n];

// Set w to 0 and findex to -1
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
std::memset(A, 0.0, n * nSkip * sizeof(double));
#endif
std::memset(w, 0.0, n * sizeof(double));
Expand Down Expand Up @@ -178,7 +178,7 @@ void PGSLCPSolver::solve(ConstrainedGroup* _group)
}

//==============================================================================
#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
bool PGSLCPSolver::isSymmetric(std::size_t _n, double* _A)
{
std::size_t nSkip = dPAD(_n);
Expand Down
4 changes: 2 additions & 2 deletions dart/constraint/PGSLCPSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace dart {
namespace constraint {

/// \deprecated This header has been deprecated in DART 6.7. Please include
/// PgsBoxedLcpSolver.hpp intead.
/// PgsBoxedLcpSolver.hpp instead.
///
/// PGSLCPSolver
class PGSLCPSolver : public LCPSolver
Expand All @@ -58,7 +58,7 @@ class PGSLCPSolver : public LCPSolver
// Documentation inherited
void solve(ConstrainedGroup* _group) override;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
private:
/// Return true if the matrix is symmetric
bool isSymmetric(std::size_t _n, double* _A);
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/PgsBoxedLcpSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bool PgsBoxedLcpSolver::solve(
return possibleToTerminate;
}

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
//==============================================================================
bool PgsBoxedLcpSolver::canSolve(int n, const double* A)
{
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/PgsBoxedLcpSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class PgsBoxedLcpSolver : public BoxedLcpSolver
int* findex,
bool earlyTermination) override;

#ifndef NDEBUG
#if DART_BUILD_MODE_DEBUG
// Documentation inherited.
bool canSolve(int n, const double* A) override;
#endif
Expand Down
Loading

0 comments on commit a5b2b79

Please sign in to comment.