unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm.
@ 2024-04-15 14:23 Daniel Ziltener via Guix-patches via
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
  2024-04-15 16:42 ` [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Zheng Junjie
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 14:23 UTC (permalink / raw)
  To: 70397; +Cc: dziltener

---
 gnu/packages/debug.scm | 31 +++++++++++++++++++++++++++++++
 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))))
+       (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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 14:23 [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Daniel Ziltener via Guix-patches via
@ 2024-04-15 16:26 ` Zheng Junjie
  2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
                     ` (5 more replies)
  2024-04-15 16:42 ` [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Zheng Junjie
  1 sibling, 6 replies; 9+ messages in thread
From: Zheng Junjie @ 2024-04-15 16:26 UTC (permalink / raw)
  To: 70397; +Cc: Daniel Ziltener

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
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm.
  2024-04-15 14:23 [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Daniel Ziltener via Guix-patches via
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
@ 2024-04-15 16:42 ` Zheng Junjie
  1 sibling, 0 replies; 9+ messages in thread
From: Zheng Junjie @ 2024-04-15 16:42 UTC (permalink / raw)
  To: Daniel Ziltener, 70397

[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]

hellow, i review this patch, and have some comment

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

> ---
>  gnu/packages/debug.scm | 31 +++++++++++++++++++++++++++++++

Usually our message goes something like this:

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

>  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.

and see https://github.com/google/cppdap/pull/124 , it add a
CPPDAP_USE_EXTERNAL_GTEST_PACKAGE option to use system gtest. so we can
pick it.

> +       (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.

> +    (propagated-inputs
> +     (list nlohmann-json))

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

> +    (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.")

It's a little over the line count

> +    (license license:expat)))
> +
>  (define-public c-vise
>    (package
>      (name "c-vise")

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
@ 2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
  2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 21:54 UTC (permalink / raw)
  To: Zheng Junjie, 70397


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 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
  2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
@ 2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
  2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 21:54 UTC (permalink / raw)
  To: Zheng Junjie, 70397


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 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
  2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
  2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
@ 2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
  2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 21:57 UTC (permalink / raw)
  To: Zheng Junjie, 70397


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 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
                     ` (2 preceding siblings ...)
  2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
@ 2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
  2024-04-15 22:04   ` Daniel Ziltener via Guix-patches via
  2024-04-23  8:57   ` bug#70397: " Z572
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 21:57 UTC (permalink / raw)
  To: Zheng Junjie, 70397


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 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#70397] [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
                     ` (3 preceding siblings ...)
  2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
@ 2024-04-15 22:04   ` Daniel Ziltener via Guix-patches via
  2024-04-23  8:57   ` bug#70397: " Z572
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Ziltener via Guix-patches via @ 2024-04-15 22:04 UTC (permalink / raw)
  To: Zheng Junjie, 70397


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 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#70397: [PATCH] gnu: Add cppdap.
  2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
                     ` (4 preceding siblings ...)
  2024-04-15 22:04   ` Daniel Ziltener via Guix-patches via
@ 2024-04-23  8:57   ` Z572
  5 siblings, 0 replies; 9+ messages in thread
From: Z572 @ 2024-04-23  8:57 UTC (permalink / raw)
  To: 70397-done; +Cc: Daniel Ziltener

[-- Attachment #1: Type: text/plain, Size: 8882 bytes --]

Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:

> 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

push. see https://git.savannah.gnu.org/cgit/guix.git/commit/?id=2d19e505f6f9f82aebc9ba8c74ba223818acd9bc 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-23  9:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-15 14:23 [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Daniel Ziltener via Guix-patches via
2024-04-15 16:26 ` [bug#70397] [PATCH] gnu: Add cppdap Zheng Junjie
2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
2024-04-15 21:54   ` Daniel Ziltener via Guix-patches via
2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
2024-04-15 21:57   ` Daniel Ziltener via Guix-patches via
2024-04-15 22:04   ` Daniel Ziltener via Guix-patches via
2024-04-23  8:57   ` bug#70397: " Z572
2024-04-15 16:42 ` [bug#70397] [PATCH] gnu: cppdap: Add cppdap to debug.scm Zheng Junjie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).