Skip to content

Commit

Permalink
Merge pull request #59 from kkraus14/fix_constexpr_nvcc
Browse files Browse the repository at this point in the history
Add patch to fix nvcc
  • Loading branch information
rongou committed Oct 16, 2023
2 parents f9448de + 41546b8 commit 8464348
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 70 deletions.
5 changes: 0 additions & 5 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 8 additions & 45 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channel_targets:
cxx_compiler:
- clangxx
cxx_compiler_version:
- '15'
- '16'
fmt:
- '10'
macos_machine:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channel_targets:
cxx_compiler:
- clangxx
cxx_compiler_version:
- '15'
- '16'
fmt:
- '10'
macos_machine:
Expand Down
9 changes: 4 additions & 5 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .scripts/logging_utils.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ source:
url: https://github.com/gabime/{{ name|lower }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
patches:
- fix.patch
- patches/fix.patch
- patches/0001-Match-SPDLOG_CONSTEXPR_FUNC-to-FMT_CONSTEXPR-2901.patch

build:
number: 1
number: 2
run_exports:
- {{ pin_subpackage('spdlog', max_pin='x.x') }}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From a3a499b19dfba55ae9a995de181eac7921c13bf3 Mon Sep 17 00:00:00 2001
From: Keith Kraus <[email protected]>
Date: Fri, 13 Oct 2023 03:00:00 -0400
Subject: [PATCH] Match SPDLOG_CONSTEXPR_FUNC to FMT_CONSTEXPR (#2901)

* Modify the condition of SPDLOG_CONSTEXPR_FUNC to match that of fmt
---
include/spdlog/common.h | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/spdlog/common.h b/include/spdlog/common.h
index 0a262eb2..29ef2324 100644
--- a/include/spdlog/common.h
+++ b/include/spdlog/common.h
@@ -62,17 +62,26 @@

// visual studio up to 2013 does not support noexcept nor constexpr
#if defined(_MSC_VER) && (_MSC_VER < 1900)
-# define SPDLOG_NOEXCEPT _NOEXCEPT
-# define SPDLOG_CONSTEXPR
-# define SPDLOG_CONSTEXPR_FUNC inline
+ #define SPDLOG_NOEXCEPT _NOEXCEPT
+ #define SPDLOG_CONSTEXPR
#else
-# define SPDLOG_NOEXCEPT noexcept
-# define SPDLOG_CONSTEXPR constexpr
-# if __cplusplus >= 201402L
-# define SPDLOG_CONSTEXPR_FUNC constexpr
-# else
-# define SPDLOG_CONSTEXPR_FUNC inline
-# endif
+ #define SPDLOG_NOEXCEPT noexcept
+ #define SPDLOG_CONSTEXPR constexpr
+#endif
+
+// If building with std::format, can just use constexpr, otherwise if building with fmt
+// SPDLOG_CONSTEXPR_FUNC needs to be set the same as FMT_CONSTEXPR to avoid situations where
+// a constexpr function in spdlog could end up calling a non-constexpr function in fmt
+// depending on the compiler
+// If fmt determines it can't use constexpr, we should inline the function instead
+#ifdef SPDLOG_USE_STD_FORMAT
+ #define SPDLOG_CONSTEXPR_FUNC constexpr
+#else // Being built with fmt
+ #if FMT_USE_CONSTEXPR
+ #define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
+ #else
+ #define SPDLOG_CONSTEXPR_FUNC inline
+ #endif
#endif

#if defined(__GNUC__) || defined(__clang__)
--
2.42.0

File renamed without changes.

0 comments on commit 8464348

Please sign in to comment.