[PATCH] gnu: cppdap: Add cppdap to debug.scm.

  • Done
  • quality assurance status badge
Details
2 participants
  • Daniel Ziltener
  • Zheng Junjie
Owner
unassigned
Submitted by
Daniel Ziltener
Severity
normal
D
D
Daniel Ziltener wrote on 15 Apr 16:23 +0200
(address . guix-patches@gnu.org)(address . dziltener@lyrion.ch)
922b1372b2b1e8b1ea642fe85d33e9fd@lyrion.ch
---
gnu/packages/debug.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 6d4567acc4..7865dc32f4 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -185,6 +185,37 @@ (define-public c-reduce
tools that process C/C++ code.")
(license license:ncsa)))
+(define-public cppdap
+ (package
+ (name "cppdap")
+ (version "1.58.0-a")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/google/cppdap")
+ (commit (string-append "dap-" version))))
+ (sha256
+ (base32
+ "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags #~(list "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")
+ #:phases #~(modify-phases %standard-phases
+ (delete 'check))))
+ (propagated-inputs
+ (list nlohmann-json))
+ (home-page "https://github.com/google/cppdap")
+ (synopsis "C++ library for the Debug Adapter Protocol")
+ (description
+ "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter Protocol,
+providing an API for implementing a DAP client or server.
+cppdap provides C++ type-safe structures for the full DAP specification, and provides
+ a simple way to add custom protocol messages.")
+ (license license:expat)))
+
(define-public c-vise
(package
(name "c-vise")
--
2.41.0
Z
Z
Zheng Junjie wrote on 15 Apr 18:26 +0200
[PATCH] gnu: Add cppdap.
(address . 70397@debbugs.gnu.org)(name . Daniel Ziltener)(address . dziltener@lyrion.ch)
5e9db8a53c3f429461c4e6012bbf09a948765e6f.1713198396.git.zhengjunjie@iscas.ac.cn
From: Daniel Ziltener <dziltener@lyrion.ch>

* gnu/packages/debug.scm (cppdap): New variable.
* gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch: New
patch.
* gnu/local.mk (dist_patch_DATA): Register it.

Signed-off-by: Zheng Junjie <zhengjunjie@iscas.ac.cn>
Change-Id: I328ca0c01787defcc9d18f4ccd7762c86412cca7
---
gnu/local.mk | 1 +
gnu/packages/debug.scm | 50 +++++++++
...dd-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch | 101 ++++++++++++++++++
3 files changed, 152 insertions(+)
create mode 100644 gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch

Toggle diff (191 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 64efee901f..a8cc5de803 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1078,6 +1078,7 @@ dist_patch_DATA = \
%D%/packages/patches/cool-retro-term-wctype.patch \
%D%/packages/patches/coreutils-gnulib-tests.patch \
%D%/packages/patches/cppcheck-disable-char-signedness-test.patch \
+ %D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\
%D%/packages/patches/cpuinfo-system-libraries.patch \
%D%/packages/patches/cpulimit-with-glib-2.32.patch \
%D%/packages/patches/crawl-upgrade-saves.patch \
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 6d4567acc4..7a7eafddab 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -46,6 +46,7 @@ (define-module (gnu packages debug)
#:use-module (gnu packages bash)
#:use-module (gnu packages bison)
#:use-module (gnu packages c)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages check)
#:use-module (gnu packages code)
#:use-module (gnu packages compression)
@@ -185,6 +186,55 @@ (define-public c-reduce
tools that process C/C++ code.")
(license license:ncsa)))
+(define-public cppdap
+ (package
+ (name "cppdap")
+ (version "1.58.0-a")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/google/cppdap")
+ (commit (string-append "dap-" version))))
+ (modules '((guix build utils)))
+ (snippet
+ '(delete-file-recursively "third_party"))
+ (patches (search-patches
+ "cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch"))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags
+ #~(list
+ "-DCPPDAP_BUILD_TESTS=ON"
+ "-DCPPDAP_USE_EXTERNAL_GTEST_PACKAGE=ON"
+ ;; Only one of the following three can be enabled at the same time
+ ;; "-DCPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE=ON"
+ ;; "-DCPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE=ON"
+ "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")))
+ (native-inputs
+ (list googletest))
+ ;; see lib/cmake/cppdap/cppdapConfig.cmake
+ (propagated-inputs
+ (list
+ ;; Only one of the following three can be enabled at the same time
+ ;; rapidjson
+ ;; jsoncpp
+ nlohmann-json))
+ (home-page "https://github.com/google/cppdap")
+ (synopsis "C++ library for the Debug Adapter Protocol")
+ (description
+ "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter
+Protocol, providing an API for implementing a DAP client or server. cppdap
+provides C++ type-safe structures for the full DAP specification, and provides a
+simple way to add custom protocol messages.")
+ (license license:expat)))
+
(define-public c-vise
(package
(name "c-vise")
diff --git a/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch b/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch
new file mode 100644
index 0000000000..62df0634ce
--- /dev/null
+++ b/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch
@@ -0,0 +1,101 @@
+From 40d9eaf3b6eca2ab8d5558e8935d56a75bd97183 Mon Sep 17 00:00:00 2001
+From: topazus <topazus@outlook.com>
+Date: Wed, 27 Dec 2023 19:56:49 +0800
+Subject: [PATCH] CMake: add CPPDAP_USE_EXTERNAL_GTEST_PACKAGE option
+
+---
+ CMakeLists.txt | 35 +++++++++++++++++++++++++----------
+ 1 file changed, 25 insertions(+), 10 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1b3c321..7292f3c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -40,6 +40,7 @@ option_if_not_defined(CPPDAP_INSTALL_VSCODE_EXAMPLES "Build and install dap exam
+ option_if_not_defined(CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE "Use nlohmann_json with find_package() instead of building internal submodule" OFF)
+ option_if_not_defined(CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE "Use RapidJSON with find_package()" OFF)
+ option_if_not_defined(CPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE "Use JsonCpp with find_package()" OFF)
++option_if_not_defined(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE "Use googletest with find_package()" OFF)
+
+ ###########################################################
+ # Directories
+@@ -59,7 +60,7 @@ set_if_not_defined(CPPDAP_GOOGLETEST_DIR ${CPPDAP_THIRD_PARTY_DIR}/googletest)
+ ###########################################################
+ # Submodules
+ ###########################################################
+-if(CPPDAP_BUILD_TESTS)
++if(CPPDAP_BUILD_TESTS AND NOT CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
+ if(NOT EXISTS ${CPPDAP_GOOGLETEST_DIR}/.git)
+ message(WARNING "third_party/googletest submodule missing.")
+ message(WARNING "Run: `git submodule update --init` to build tests.")
+@@ -161,7 +162,7 @@ function(cppdap_set_json_links target)
+ target_link_libraries(${target} PRIVATE JsonCpp::JsonCpp)
+ else()
+ target_include_directories(${target} PRIVATE "${CPPDAP_JSON_DIR}/include/")
+- endif()
++ endif()
+ endfunction(cppdap_set_json_links)
+
+ function(cppdap_set_target_options target)
+@@ -247,7 +248,7 @@ write_basic_package_version_file(
+ )
+ configure_package_config_file(
+ ${CPPDAP_CMAKE_CONFIG_TEMPLATE}
+- "${CPPDAP_CMAKE_PROJECT_CONFIG_FILE}"
++ "${CPPDAP_CMAKE_PROJECT_CONFIG_FILE}"
+ INSTALL_DESTINATION ${CPPDAP_CONFIG_INSTALL_DIR}
+ )
+
+@@ -276,6 +277,8 @@ DESTINATION ${CPPDAP_CONFIG_INSTALL_DIR})
+
+ # tests
+ if(CPPDAP_BUILD_TESTS)
++ enable_testing()
++
+ set(DAP_TEST_LIST
+ ${CPPDAP_SRC_DIR}/any_test.cpp
+ ${CPPDAP_SRC_DIR}/chan_test.cpp
+@@ -290,16 +293,24 @@ if(CPPDAP_BUILD_TESTS)
+ ${CPPDAP_SRC_DIR}/traits_test.cpp
+ ${CPPDAP_SRC_DIR}/typeinfo_test.cpp
+ ${CPPDAP_SRC_DIR}/variant_test.cpp
+- ${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
+ )
+
+- set(DAP_TEST_INCLUDE_DIR
+- ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/
+- ${CPPDAP_GOOGLETEST_DIR}/googletest/
+- ${CPPDAP_GOOGLETEST_DIR}/googletest/include/
+- )
++ if(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
++ find_package(GTest REQUIRED)
++ else()
++ list(APPEND DAP_TEST_LIST
++ ${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
++ )
++
++ set(DAP_TEST_INCLUDE_DIR
++ ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/
++ ${CPPDAP_GOOGLETEST_DIR}/googletest/
++ ${CPPDAP_GOOGLETEST_DIR}/googletest/include/
++ )
++ endif()
+
+ add_executable(cppdap-unittests ${DAP_TEST_LIST})
++ add_test(NAME cppdap-unittests COMMAND cppdap-unittests)
+
+ target_include_directories(cppdap-unittests PUBLIC ${DAP_TEST_INCLUDE_DIR} )
+ set_target_properties(cppdap-unittests PROPERTIES
+@@ -312,7 +323,11 @@ if(CPPDAP_BUILD_TESTS)
+ endif()
+
+ cppdap_set_target_options(cppdap-unittests)
+- target_link_libraries(cppdap-unittests PRIVATE cppdap)
++ if(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
++ target_link_libraries(cppdap-unittests PRIVATE cppdap GTest::gtest)
++ else()
++ target_link_libraries(cppdap-unittests PRIVATE cppdap)
++ endif()
+ endif(CPPDAP_BUILD_TESTS)
+
+ # fuzzer

base-commit: a8353e9d6b34fd8d42d2e8f14ce844849fe9c293
--
2.41.0
Z
Z
Zheng Junjie wrote on 15 Apr 18:42 +0200
Re: [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm.
878r1e60hy.fsf@iscas.ac.cn
hellow, i review this patch, and have some comment

Daniel Ziltener via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (3 lines)
> ---
> gnu/packages/debug.scm | 31 +++++++++++++++++++++++++++++++

Usually our message goes something like this:

gnu: Add cppdap.
* gnu/packages/debug.scm (cppdap): New variable.

Toggle quote (22 lines)
> 1 file changed, 31 insertions(+)
>
> diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
> index 6d4567acc4..7865dc32f4 100644
> --- a/gnu/packages/debug.scm
> +++ b/gnu/packages/debug.scm
> @@ -185,6 +185,37 @@ (define-public c-reduce
> tools that process C/C++ code.")
> (license license:ncsa)))
>
> +(define-public cppdap
> + (package
> + (name "cppdap")
> + (version "1.58.0-a")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url "https://github.com/google/cppdap")
> + (commit (string-append "dap-" version))))

usually we add (file-name (git-file-name name version)),

and it have a "third_party" directory, we need remove it.

CPPDAP_USE_EXTERNAL_GTEST_PACKAGE option to use system gtest. so we can
pick it.

Toggle quote (10 lines)
> + (sha256
> + (base32
> + "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
> + (build-system cmake-build-system)
> + (arguments
> + (list
> + #:configure-flags #~(list "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")
> + #:phases #~(modify-phases %standard-phases
> + (delete 'check))))

if no test target, please use "#:tests? #f" and add commit about it.

and it have CPPDAP_BUILD_TESTS, so we can enable it.

Toggle quote (3 lines)
> + (propagated-inputs
> + (list nlohmann-json))

need add some commit about why propagate nlohmann-json. and need add
(gnu packages cpp) module.

Toggle quote (8 lines)
> + (synopsis "C++ library for the Debug Adapter Protocol")
> + (description
> + "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter Protocol,
> +providing an API for implementing a DAP client or server.
> +cppdap provides C++ type-safe structures for the full DAP specification, and provides
> + a simple way to add custom protocol messages.")

It's a little over the line count

Toggle quote (6 lines)
> + (license license:expat)))
> +
> (define-public c-vise
> (package
> (name "c-vise")

The end result should be similar https://issues.guix.gnu.org/70397#1
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmYdWPkACgkQO1qpk+Gi
3/BBhg/+NKZ4aD8iMDYlg5rjLYLxLAuBLKu13J+UUsiJyZE3QIhnu17W7teuU0JR
1Zn14mOLPoILPZzBPQtSxrh2yK7CV/bTU/PnN7cPqY823/dAme+O3NMZQwLx532q
aVe+rCS1u3X2x9SrjCp9TrpX2LjlS0CsDzEXAsQzR6d7PyY1z7AlJkACJWqvsOcc
hDgZTC/LIQQLqcfCywSiqfKv4w0wTAKufnq8NLK4lYUnxeNnFLAoYxN3bgCfMbXM
DRzwc94g2drbxWDoADkPZnmVINpxlZj1kfFIBGkByVIw8WfLVDBRaOsJNdyQdEKN
mAOkT98ckQ+M8btH+rFl9NHzFiquNIc9uXw6ogK6gYoRDJz3JhCX6uRQ2aYLdhXC
KSg7kbs1QdzsRMuJ7ZcmamQhGzXA0N+Y8D9mFWhd2mUglGUF+6iSPbCR9tjlFmID
r4yfzupGqc5UBtDLqlCyVy9ee63arwIVS8FSkk8lrIinL/yL9Z1Zw61W3Onrr5EB
hvjcvUMr2jCDf2jD6lFAkRfo8Hj4DUrJMedUyf+7yxi3f1fOLRQjluiB1Qw6vWH9
+QiWhY+krDQ/f87E59rRPB1mMsw7KtsVb0+O8MbtC90u2guB+40mqTZsETV9Ao6Q
UDrMsaLzHrQAWQaW0hsjxHVB1M9IJ3+JknsyNH5YtxCVevgus9I=
=TtwT
-----END PGP SIGNATURE-----

D
D
Daniel Ziltener wrote on 15 Apr 23:54 +0200
Re: [PATCH] gnu: Add cppdap.
87a5lu9trt.fsf@lyrion.ch
Thank you very much! As I understand and see it, you have fixed the
commit for me, and there is nothing more to do for me?
I will make a note to myself about the correct commit message format for
the future.

Best regards,
Daniel
D
D
Daniel Ziltener wrote on 15 Apr 23:54 +0200
878r1e9trf.fsf@lyrion.ch
Thank you very much! As I understand and see it, you have fixed the
commit for me, and there is nothing more to do for me?
I will make a note to myself about the correct commit message format for
the future.

Best regards,
Daniel
D
D
Daniel Ziltener wrote on 15 Apr 23:57 +0200
877cgy9tn4.fsf@lyrion.ch
Thank you very much! As I understand and see it, you have fixed the
commit for me, and there is nothing more to do for me?
I will make a note to myself about the correct commit message format for
the future.

Best regards,
Daniel
D
D
Daniel Ziltener wrote on 15 Apr 23:57 +0200
875xwi9tm7.fsf@lyrion.ch
Thank you very much! As I understand and see it, you have fixed the
commit for me, and there is nothing more to do for me?
I will make a note to myself about the correct commit message format for
the future.

Best regards,
Daniel
D
D
Daniel Ziltener wrote on 16 Apr 00:04 +0200
8734rm9taf.fsf@lyrion.ch
Thank you very much! As I understand and see it, you have fixed the
commit for me, and there is nothing more to do for me?
I will make a note to myself about the correct commit message format for
the future.

Best regards,
Daniel
Z
Re: [bug#70397] [PATCH] gnu: Add cppdap.
(address . 70397-done@debbugs.gnu.org)(name . Daniel Ziltener)(address . dziltener@lyrion.ch)
8734rcjw15.fsf@iscas.ac.cn
Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:

Toggle quote (206 lines)
> From: Daniel Ziltener <dziltener@lyrion.ch>
>
> * gnu/packages/debug.scm (cppdap): New variable.
> * gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch: New
> patch.
> * gnu/local.mk (dist_patch_DATA): Register it.
>
> Signed-off-by: Zheng Junjie <zhengjunjie@iscas.ac.cn>
> Change-Id: I328ca0c01787defcc9d18f4ccd7762c86412cca7
> ---
> gnu/local.mk | 1 +
> gnu/packages/debug.scm | 50 +++++++++
> ...dd-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch | 101 ++++++++++++++++++
> 3 files changed, 152 insertions(+)
> create mode 100644 gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 64efee901f..a8cc5de803 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1078,6 +1078,7 @@ dist_patch_DATA = \
> %D%/packages/patches/cool-retro-term-wctype.patch \
> %D%/packages/patches/coreutils-gnulib-tests.patch \
> %D%/packages/patches/cppcheck-disable-char-signedness-test.patch \
> + %D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\
> %D%/packages/patches/cpuinfo-system-libraries.patch \
> %D%/packages/patches/cpulimit-with-glib-2.32.patch \
> %D%/packages/patches/crawl-upgrade-saves.patch \
> diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
> index 6d4567acc4..7a7eafddab 100644
> --- a/gnu/packages/debug.scm
> +++ b/gnu/packages/debug.scm
> @@ -46,6 +46,7 @@ (define-module (gnu packages debug)
> #:use-module (gnu packages bash)
> #:use-module (gnu packages bison)
> #:use-module (gnu packages c)
> + #:use-module (gnu packages cpp)
> #:use-module (gnu packages check)
> #:use-module (gnu packages code)
> #:use-module (gnu packages compression)
> @@ -185,6 +186,55 @@ (define-public c-reduce
> tools that process C/C++ code.")
> (license license:ncsa)))
>
> +(define-public cppdap
> + (package
> + (name "cppdap")
> + (version "1.58.0-a")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url "https://github.com/google/cppdap")
> + (commit (string-append "dap-" version))))
> + (modules '((guix build utils)))
> + (snippet
> + '(delete-file-recursively "third_party"))
> + (patches (search-patches
> + "cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch"))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
> + (build-system cmake-build-system)
> + (arguments
> + (list
> + #:configure-flags
> + #~(list
> + "-DCPPDAP_BUILD_TESTS=ON"
> + "-DCPPDAP_USE_EXTERNAL_GTEST_PACKAGE=ON"
> + ;; Only one of the following three can be enabled at the same time
> + ;; "-DCPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE=ON"
> + ;; "-DCPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE=ON"
> + "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")))
> + (native-inputs
> + (list googletest))
> + ;; see lib/cmake/cppdap/cppdapConfig.cmake
> + (propagated-inputs
> + (list
> + ;; Only one of the following three can be enabled at the same time
> + ;; rapidjson
> + ;; jsoncpp
> + nlohmann-json))
> + (home-page "https://github.com/google/cppdap")
> + (synopsis "C++ library for the Debug Adapter Protocol")
> + (description
> + "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter
> +Protocol, providing an API for implementing a DAP client or server. cppdap
> +provides C++ type-safe structures for the full DAP specification, and provides a
> +simple way to add custom protocol messages.")
> + (license license:expat)))
> +
> (define-public c-vise
> (package
> (name "c-vise")
> diff --git a/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch b/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch
> new file mode 100644
> index 0000000000..62df0634ce
> --- /dev/null
> +++ b/gnu/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch
> @@ -0,0 +1,101 @@
> +From 40d9eaf3b6eca2ab8d5558e8935d56a75bd97183 Mon Sep 17 00:00:00 2001
> +From: topazus <topazus@outlook.com>
> +Date: Wed, 27 Dec 2023 19:56:49 +0800
> +Subject: [PATCH] CMake: add CPPDAP_USE_EXTERNAL_GTEST_PACKAGE option
> +
> +---
> + CMakeLists.txt | 35 +++++++++++++++++++++++++----------
> + 1 file changed, 25 insertions(+), 10 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 1b3c321..7292f3c 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -40,6 +40,7 @@ option_if_not_defined(CPPDAP_INSTALL_VSCODE_EXAMPLES "Build and install dap exam
> + option_if_not_defined(CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE "Use nlohmann_json with find_package() instead of building internal submodule" OFF)
> + option_if_not_defined(CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE "Use RapidJSON with find_package()" OFF)
> + option_if_not_defined(CPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE "Use JsonCpp with find_package()" OFF)
> ++option_if_not_defined(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE "Use googletest with find_package()" OFF)
> +
> + ###########################################################
> + # Directories
> +@@ -59,7 +60,7 @@ set_if_not_defined(CPPDAP_GOOGLETEST_DIR ${CPPDAP_THIRD_PARTY_DIR}/googletest)
> + ###########################################################
> + # Submodules
> + ###########################################################
> +-if(CPPDAP_BUILD_TESTS)
> ++if(CPPDAP_BUILD_TESTS AND NOT CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
> + if(NOT EXISTS ${CPPDAP_GOOGLETEST_DIR}/.git)
> + message(WARNING "third_party/googletest submodule missing.")
> + message(WARNING "Run: `git submodule update --init` to build tests.")
> +@@ -161,7 +162,7 @@ function(cppdap_set_json_links target)
> + target_link_libraries(${target} PRIVATE JsonCpp::JsonCpp)
> + else()
> + target_include_directories(${target} PRIVATE "${CPPDAP_JSON_DIR}/include/")
> +- endif()
> ++ endif()
> + endfunction(cppdap_set_json_links)
> +
> + function(cppdap_set_target_options target)
> +@@ -247,7 +248,7 @@ write_basic_package_version_file(
> + )
> + configure_package_config_file(
> + ${CPPDAP_CMAKE_CONFIG_TEMPLATE}
> +- "${CPPDAP_CMAKE_PROJECT_CONFIG_FILE}"
> ++ "${CPPDAP_CMAKE_PROJECT_CONFIG_FILE}"
> + INSTALL_DESTINATION ${CPPDAP_CONFIG_INSTALL_DIR}
> + )
> +
> +@@ -276,6 +277,8 @@ DESTINATION ${CPPDAP_CONFIG_INSTALL_DIR})
> +
> + # tests
> + if(CPPDAP_BUILD_TESTS)
> ++ enable_testing()
> ++
> + set(DAP_TEST_LIST
> + ${CPPDAP_SRC_DIR}/any_test.cpp
> + ${CPPDAP_SRC_DIR}/chan_test.cpp
> +@@ -290,16 +293,24 @@ if(CPPDAP_BUILD_TESTS)
> + ${CPPDAP_SRC_DIR}/traits_test.cpp
> + ${CPPDAP_SRC_DIR}/typeinfo_test.cpp
> + ${CPPDAP_SRC_DIR}/variant_test.cpp
> +- ${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
> + )
> +
> +- set(DAP_TEST_INCLUDE_DIR
> +- ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/
> +- ${CPPDAP_GOOGLETEST_DIR}/googletest/
> +- ${CPPDAP_GOOGLETEST_DIR}/googletest/include/
> +- )
> ++ if(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
> ++ find_package(GTest REQUIRED)
> ++ else()
> ++ list(APPEND DAP_TEST_LIST
> ++ ${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
> ++ )
> ++
> ++ set(DAP_TEST_INCLUDE_DIR
> ++ ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/
> ++ ${CPPDAP_GOOGLETEST_DIR}/googletest/
> ++ ${CPPDAP_GOOGLETEST_DIR}/googletest/include/
> ++ )
> ++ endif()
> +
> + add_executable(cppdap-unittests ${DAP_TEST_LIST})
> ++ add_test(NAME cppdap-unittests COMMAND cppdap-unittests)
> +
> + target_include_directories(cppdap-unittests PUBLIC ${DAP_TEST_INCLUDE_DIR} )
> + set_target_properties(cppdap-unittests PROPERTIES
> +@@ -312,7 +323,11 @@ if(CPPDAP_BUILD_TESTS)
> + endif()
> +
> + cppdap_set_target_options(cppdap-unittests)
> +- target_link_libraries(cppdap-unittests PRIVATE cppdap)
> ++ if(CPPDAP_USE_EXTERNAL_GTEST_PACKAGE)
> ++ target_link_libraries(cppdap-unittests PRIVATE cppdap GTest::gtest)
> ++ else()
> ++ target_link_libraries(cppdap-unittests PRIVATE cppdap)
> ++ endif()
> + endif(CPPDAP_BUILD_TESTS)
> +
> + # fuzzer
>
> base-commit: a8353e9d6b34fd8d42d2e8f14ce844849fe9c293

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmYneBYACgkQO1qpk+Gi
3/DDYBAAg0Ury61nSLqnRdeH9+toRQOLr7WQ3IZQU3U5x7FH7iqf0X78tj7hew41
226XpTg7eNZZULepy9nx2XEHNEDDNK2yuiaKY1sA5UDiibgvxv6/jBWThLlh9YEs
LxgUAJfE2E0SGUU0fUTL2z+6kEAW24LLsRRMydk789dD5/wONEe8TKmVLypmAano
AYI9CKEuQ6hp2AdWhfWbnHYa8BrcSmLszWlp6BndemebYfFU4FbnL3A39+JZuxRO
ZW8UctzAl0JHQRvJgyyBg6FiYnWhgmG473ZTCH8Bvw0dPe49o17M9182Br3XoTWl
D2s7XBrolvwOElGNXh07kJ7qgt34io/IweqmFjbdOWww54k/VU8rfk8LzLKtEXQL
e1PRzh6A0HJb7XK+QhLGREqJgKZ2B/Q8UEPoSV3FTs8DvIak2LFFZ8kN7+43cvON
g8+k06smb3atRS1i/q3MIPSr+XSbwvJ7BexLxJKQlko1NIqiVQc6n6ULqZ2DcnWt
yyRKdMKYEoDsXW7SUs2dI2gTongRGjOj1r+D0JxW5X3Iewwrov0hSGvzuy4DYagy
lWJZKQYYBjUC3tZ4aII++AtbJ2PQaMnaRSxGjT+9V3dcxSwaQlsx4/AFL7cqEty1
GrdDkZvzqbGcpcyM0U6i847PBIJLdYDH89nOKp7ONt7316W+St8=
=xq+y
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 70397@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70397
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch