pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/cmake cmake: specifically test for some C++17 fe...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0d23b27f2e01
branches:  trunk
changeset: 392305:0d23b27f2e01
user:      maya <maya%pkgsrc.org@localhost>
date:      Wed Feb 27 13:18:01 2019 +0000

description:
cmake: specifically test for some C++17 features.

In case the compiler used advertises C++17 but uses a C++ library that
lacks some features, we'll need specific testing.

Unbreaks the build for: libstdc++ from 5.4 and clang 7.0
Submitted upstream: https://gitlab.kitware.com/cmake/cmake/merge_requests/3030/diffs
(No response yet)

>From wizermil.

diffstat:

 devel/cmake/Makefile                                          |   5 +-
 devel/cmake/distinfo                                          |   5 +-
 devel/cmake/files/Source_Checks_cm_cxx_cbegin.cxx             |   7 +
 devel/cmake/files/Source_Checks_cm_cxx_cend.cxx               |   7 +
 devel/cmake/files/Source_Checks_cm_cxx_size_t.cxx             |   6 +
 devel/cmake/patches/patch-Source_Checks_cm_cxx_features.cmake |  28 +++++-
 devel/cmake/patches/patch-Source_cmAlgorithms.h               |  53 +++++++++++
 7 files changed, 106 insertions(+), 5 deletions(-)

diffs (173 lines):

diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/Makefile
--- a/devel/cmake/Makefile      Wed Feb 27 12:17:08 2019 +0000
+++ b/devel/cmake/Makefile      Wed Feb 27 13:18:01 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.159 2019/01/15 09:02:28 adam Exp $
+# $NetBSD: Makefile,v 1.160 2019/02/27 13:18:01 maya Exp $
 
 .include "Makefile.version"
 
@@ -52,6 +52,9 @@
 SUBST_VARS.cmake=      LOCALBASE X11BASE
 
 pre-configure:
+       ${CP} ${FILESDIR}/Source_Checks_cm_cxx_cbegin.cxx ${WRKSRC}/Source/Checks/cm_cxx_cbegin.cxx
+       ${CP} ${FILESDIR}/Source_Checks_cm_cxx_cend.cxx ${WRKSRC}/Source/Checks/cm_cxx_cend.cxx
+       ${CP} ${FILESDIR}/Source_Checks_cm_cxx_size_t.cxx ${WRKSRC}/Source/Checks/cm_cxx_size_t.cxx
        ${RM} -f ${WRKSRC}/Modules/*.orig ${WRKSRC}/Modules/Compiler/*.orig ${WRKSRC}/Modules/Platform/*.orig
        ${LN} -f ${WRKSRC}/Modules/Platform/OpenBSD.cmake ${WRKSRC}/Modules/Platform/MirBSD.cmake
 .for lang in C CXX Fortran
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/distinfo
--- a/devel/cmake/distinfo      Wed Feb 27 12:17:08 2019 +0000
+++ b/devel/cmake/distinfo      Wed Feb 27 13:18:01 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.135 2019/02/05 09:52:23 adam Exp $
+$NetBSD: distinfo,v 1.136 2019/02/27 13:18:01 maya Exp $
 
 SHA1 (cmake-3.13.4.tar.gz) = 242ac4986ab38ddb06c7bfb7eb950e4c1b1ca770
 RMD160 (cmake-3.13.4.tar.gz) = 6211b5315071015d2a949af077e4301c47e36fd4
@@ -16,7 +16,8 @@
 SHA1 (patch-Source_Checks_Curses_CMakeLists.txt) = 37d95c6162cc1f4c0e47b537ac8204cb9fe75b8c
 SHA1 (patch-Source_Checks_Curses_CheckCurses.c) = c86cae48f7b39fb735eba4788d4e9d595b2ccf3b
 SHA1 (patch-Source_Checks_cm__cxx17__check.cpp) = 35817b7ad4c43d8f82300c21a9fb76166325de97
-SHA1 (patch-Source_Checks_cm_cxx_features.cmake) = 3d6e3ac6ad25890d223601c15fb208b8e77ff77c
+SHA1 (patch-Source_Checks_cm_cxx_features.cmake) = 2ba746a927765361738914bf1d00ba191a2e849f
 SHA1 (patch-Source_CursesDialog_ccmake.cxx) = d7baafe6612b6ac9b0542ed10ffcf90cd8d1df87
+SHA1 (patch-Source_cmAlgorithms.h) = 9a9e997af5af78d004ff62d86cba5070cd5470ff
 SHA1 (patch-Utilities_KWIML_CMakeLists.txt) = e4bdf9fc58757e87bf7e3e3e195839eededbc796
 SHA1 (patch-bootstrap) = 9d99cfe9f9ae826250f94bc297f5a22b8de09e84
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/files/Source_Checks_cm_cxx_cbegin.cxx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/cmake/files/Source_Checks_cm_cxx_cbegin.cxx Wed Feb 27 13:18:01 2019 +0000
@@ -0,0 +1,7 @@
+#include <iterator>
+int main()
+{
+  int a[] = { 0, 1, 2 };
+  auto ai = std::cbegin(a);
+  return *ai;
+}
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/files/Source_Checks_cm_cxx_cend.cxx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/cmake/files/Source_Checks_cm_cxx_cend.cxx   Wed Feb 27 13:18:01 2019 +0000
@@ -0,0 +1,7 @@
+#include <iterator>
+int main()
+{
+  int a[] = { 2, 1, 0 };
+  auto ai = std::cend(a);
+  return *(ai - 1);
+}
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/files/Source_Checks_cm_cxx_size_t.cxx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/cmake/files/Source_Checks_cm_cxx_size_t.cxx Wed Feb 27 13:18:01 2019 +0000
@@ -0,0 +1,6 @@
+#include <cstddef>
+int main()
+{
+  std::size_t t = 0;
+  return static_cast<int>(t);
+}
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/patches/patch-Source_Checks_cm_cxx_features.cmake
--- a/devel/cmake/patches/patch-Source_Checks_cm_cxx_features.cmake     Wed Feb 27 12:17:08 2019 +0000
+++ b/devel/cmake/patches/patch-Source_Checks_cm_cxx_features.cmake     Wed Feb 27 13:18:01 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-Source_Checks_cm_cxx_features.cmake,v 1.2 2018/07/21 06:52:55 ryoon Exp $
+$NetBSD: patch-Source_Checks_cm_cxx_features.cmake,v 1.3 2019/02/27 13:18:01 maya Exp $
 
 Ignore warnings like ...
 
@@ -6,7 +6,12 @@
 
 ... caused by recent version of Xcode which break C++11 detection under macOS.
 
---- Source/Checks/cm_cxx_features.cmake.orig   2018-07-17 11:29:00.000000000 +0000
+
+Handle mismatch between C++ compiler and C++ library by checking for C++17 features
+(std::size, std::cend, std::cbegin)
+https://gitlab.kitware.com/cmake/cmake/merge_requests/3030/diffs
+
+--- Source/Checks/cm_cxx_features.cmake.orig   2019-02-01 13:35:27.000000000 +0000
 +++ Source/Checks/cm_cxx_features.cmake
 @@ -21,6 +21,7 @@ function(cm_check_cxx_feature name)
      string(REGEX REPLACE "[^\n]*warning:[^\n]*-Winvalid-command-line-argument[^\n]*" "" check_output "${check_output}")
@@ -16,3 +21,22 @@
      string(REGEX REPLACE "[^\n]*warning:[^\n]*object file compiled with -mlong-branch which is no longer needed[^\n]*" "" check_output "${check_output}")
      # Filter out xcodebuild warnings.
      string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}")
+@@ -51,3 +52,18 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE)
+   set(CMake_HAVE_CXX_UNIQUE_PTR 1)
+ endif()
+ cm_check_cxx_feature(unique_ptr)
++
++cm_check_cxx_feature(size_t)
++if(CMake_HAVE_CXX_SIZE_T)
++  set(CMake_HAVE_CXX_SIZE_T 1)
++endif()
++
++cm_check_cxx_feature(cbegin)
++if(CMake_HAVE_CXX_CBEGIN)
++  set(CMake_HAVE_CXX_CBEGIN 1)
++endif()
++
++cm_check_cxx_feature(cend)
++if(CMake_HAVE_CXX_CEND)
++  set(CMake_HAVE_CXX_CEND 1)
++endif()
diff -r 77218e152fa0 -r 0d23b27f2e01 devel/cmake/patches/patch-Source_cmAlgorithms.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/cmake/patches/patch-Source_cmAlgorithms.h   Wed Feb 27 13:18:01 2019 +0000
@@ -0,0 +1,53 @@
+$NetBSD: patch-Source_cmAlgorithms.h,v 1.1 2019/02/27 13:18:01 maya Exp $
+
+Handle mismatch between C++ compiler and C++ library by checking for C++17 features
+(std::size, std::cend, std::cbegin)
+https://gitlab.kitware.com/cmake/cmake/merge_requests/3030/diffs
+
+--- Source/cmAlgorithms.h.orig 2019-02-01 13:35:27.000000000 +0000
++++ Source/cmAlgorithms.h
+@@ -367,7 +367,8 @@ std::unique_ptr<T> make_unique(Args&&...
+ 
+ #endif
+ 
+-#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
++#if defined(CMake_HAVE_CXX_SIZE_T) ||                                         \
++  defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
+ 
+ using std::size;
+ 
+@@ -396,14 +397,14 @@ constexpr
+ 
+ #endif
+ 
+-#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
++#if defined(CMake_HAVE_CXX_CBEGIN) ||                                         \
++  defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
+ 
+ using std::cbegin;
+-using std::cend;
+ 
+ #else
+ 
+-// std::c{begin,end} backport from C++14
++// std::cbegin backport from C++14
+ template <class C>
+ #  if defined(_MSC_VER) && _MSC_VER < 1900
+ auto cbegin(C const& c)
+@@ -415,6 +416,16 @@ constexpr auto cbegin(C const& c) noexce
+   return std::begin(c);
+ }
+ 
++#endif
++
++#if defined(CMake_HAVE_CXX_CEND) ||                                           \
++  defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
++
++using std::cend;
++
++#else
++
++// std::cend backport from C++14
+ template <class C>
+ #  if defined(_MSC_VER) && _MSC_VER < 1900
+ auto cend(C const& c)



Home | Main Index | Thread Index | Old Index