Skip to content

Commit

Permalink
Allow user to override AUTODIFF_DEVICE_FUNC
Browse files Browse the repository at this point in the history
This also removes the hard dependency on Eigen introduced in PR #309, as
long as the user defines AUTODIFF_DEVICE_FUNC before including any
autodiff headers.
  • Loading branch information
yut23 authored and allanleal committed Feb 7, 2024
1 parent d97e7cf commit 6514c03
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions autodiff/common/meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,24 @@

// C++ includes
#include <cstddef>
#include <tuple>
#include <type_traits>

#ifndef AUTODIFF_DEVICE_FUNC
#ifdef EIGEN_CORE_MODULE_H
#include <Eigen/src/Core/util/Macros.h>
#else
#define EIGEN_CORE_MODULE_H
#include <Eigen/src/Core/util/Macros.h>
#undef EIGEN_CORE_MODULE_H
#endif
#include <tuple>
#include <type_traits>

#define AUTODIFF_DEVICE_FUNC EIGEN_DEVICE_FUNC
#endif

namespace autodiff {
namespace detail {

#define AUTODIFF_DEVICE_FUNC EIGEN_DEVICE_FUNC

template<bool value>
using EnableIf = std::enable_if_t<value>;

Expand Down

0 comments on commit 6514c03

Please sign in to comment.