unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob f67f87126eb9b4fae4991d8bdb734dde8ea07240 3242 bytes (raw)
name: packages/patches/heatshrink-add-cmake.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
 
From 0886e9ca76552b8e325841e2b820b4563e5d5aba Mon Sep 17 00:00:00 2001
From: tamasmeszaros <meszaros.q@gmail.com>
Date: Thu, 27 Jul 2023 23:11:25 +0200
Subject: [PATCH] Add CMake build script

---
 CMakeLists.txt  | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
 Config.cmake.in |  5 +++
 2 files changed, 87 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 Config.cmake.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5b840eb
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(heatshrink C)
+
+add_library(${PROJECT_NAME} heatshrink_decoder.c heatshrink_encoder.c)
+add_library(${PROJECT_NAME}_dynalloc heatshrink_decoder.c heatshrink_encoder.c)
+
+find_library(MATH_LIBRARY m) # Business as usual
+if(MATH_LIBRARY)
+    target_link_libraries(${PROJECT_NAME} PUBLIC ${MATH_LIBRARY})
+endif()
+
+target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
+target_include_directories(${PROJECT_NAME}_dynalloc PUBLIC $<INSTALL_INTERFACE:include>)
+
+target_compile_definitions(${PROJECT_NAME} PUBLIC HEATSHRINK_DYNAMIC_ALLOC=0)
+target_compile_definitions(${PROJECT_NAME}_dynalloc PUBLIC HEATSHRINK_DYNAMIC_ALLOC=1)
+
+if (UNIX)
+  add_executable(${PROJECT_NAME}_cmd heatshrink.c)
+  target_link_libraries(${PROJECT_NAME}_cmd ${PROJECT_NAME}_dynalloc)
+  set_target_properties(${PROJECT_NAME}_cmd PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
+endif ()
+
+# Installation and export:
+
+include(CMakePackageConfigHelpers)
+
+write_basic_package_version_file(
+    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+    VERSION 0.4.1
+    COMPATIBILITY AnyNewerVersion
+)
+
+set(_exported_targets ${PROJECT_NAME} ${PROJECT_NAME}_dynalloc)
+if (UNIX)
+  list(APPEND _exported_targets ${PROJECT_NAME}_cmd)
+endif ()
+
+install(TARGETS ${_exported_targets}
+        EXPORT ${PROJECT_NAME}Targets
+)
+
+export(EXPORT ${PROJECT_NAME}Targets 
+       FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" 
+       NAMESPACE ${PROJECT_NAME}::
+)
+
+include(GNUInstallDirs)
+set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+  "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+  INSTALL_DESTINATION ${ConfigPackageLocation}
+)
+
+install(
+    FILES
+      heatshrink_common.h
+      heatshrink_config.h
+      heatshrink_encoder.h
+      heatshrink_decoder.h
+    DESTINATION
+      include/${PROJECT_NAME}
+  )
+
+install(EXPORT ${PROJECT_NAME}Targets
+  FILE
+    ${PROJECT_NAME}Targets.cmake
+  NAMESPACE
+    ${PROJECT_NAME}::
+  DESTINATION
+    ${ConfigPackageLocation}
+)
+
+install(
+  FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+  DESTINATION
+    ${ConfigPackageLocation}
+)
diff --git a/Config.cmake.in b/Config.cmake.in
new file mode 100644
index 0000000..0809ba9
--- /dev/null
+++ b/Config.cmake.in
@@ -0,0 +1,5 @@
+@PACKAGE_INIT@
+
+if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake)
+    include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+endif ()

debug log:

solving f67f87126eb9b4fae4991d8bdb734dde8ea07240 ...
found f67f87126eb9b4fae4991d8bdb734dde8ea07240 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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