deflate-ruby 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +95 -92
  3. data/LICENSE.txt +6 -6
  4. data/README.md +87 -65
  5. data/Rakefile +23 -0
  6. data/ext/deflate_ruby/{libdeflate/lib/x86/adler32_impl.h → adler32_impl.h} +8 -7
  7. data/ext/deflate_ruby/common_defs.h +748 -0
  8. data/ext/deflate_ruby/{libdeflate/lib/x86/cpu_features.c → cpu_features.c} +46 -16
  9. data/ext/deflate_ruby/{libdeflate/lib/x86/cpu_features.h → cpu_features.h} +2 -1
  10. data/ext/deflate_ruby/{libdeflate/lib/x86/crc32_impl.h → crc32_impl.h} +22 -23
  11. data/ext/deflate_ruby/{libdeflate/lib/crc32_multipliers.h → crc32_multipliers.h} +2 -4
  12. data/ext/deflate_ruby/{libdeflate/lib/x86/crc32_pclmul_template.h → crc32_pclmul_template.h} +23 -94
  13. data/ext/deflate_ruby/{libdeflate/lib/crc32_tables.h → crc32_tables.h} +1 -1
  14. data/ext/deflate_ruby/{libdeflate/lib/deflate_compress.c → deflate_compress.c} +59 -60
  15. data/ext/deflate_ruby/deflate_ruby.c +392 -218
  16. data/ext/deflate_ruby/deflate_ruby.h +6 -0
  17. data/ext/deflate_ruby/extconf.rb +35 -25
  18. data/ext/deflate_ruby/libdeflate/adler32.c +162 -0
  19. data/ext/deflate_ruby/libdeflate/{lib/arm → arm}/adler32_impl.h +14 -7
  20. data/ext/deflate_ruby/libdeflate/{lib/arm → arm}/crc32_impl.h +25 -31
  21. data/ext/deflate_ruby/libdeflate/arm/crc32_pmull_helpers.h +156 -0
  22. data/ext/deflate_ruby/libdeflate/arm/crc32_pmull_wide.h +226 -0
  23. data/ext/deflate_ruby/libdeflate/bt_matchfinder.h +342 -0
  24. data/ext/deflate_ruby/libdeflate/common_defs.h +2 -1
  25. data/ext/deflate_ruby/libdeflate/cpu_features_common.h +93 -0
  26. data/ext/deflate_ruby/libdeflate/crc32.c +262 -0
  27. data/ext/deflate_ruby/libdeflate/crc32_multipliers.h +375 -0
  28. data/ext/deflate_ruby/libdeflate/crc32_tables.h +587 -0
  29. data/ext/deflate_ruby/libdeflate/decompress_template.h +777 -0
  30. data/ext/deflate_ruby/libdeflate/deflate_compress.c +4128 -0
  31. data/ext/deflate_ruby/libdeflate/deflate_compress.h +15 -0
  32. data/ext/deflate_ruby/libdeflate/deflate_constants.h +56 -0
  33. data/ext/deflate_ruby/libdeflate/deflate_decompress.c +1208 -0
  34. data/ext/deflate_ruby/libdeflate/gzip_compress.c +90 -0
  35. data/ext/deflate_ruby/libdeflate/gzip_constants.h +45 -0
  36. data/ext/deflate_ruby/libdeflate/gzip_decompress.c +144 -0
  37. data/ext/deflate_ruby/libdeflate/hc_matchfinder.h +401 -0
  38. data/ext/deflate_ruby/libdeflate/ht_matchfinder.h +234 -0
  39. data/ext/deflate_ruby/libdeflate/lib_common.h +106 -0
  40. data/ext/deflate_ruby/libdeflate/libdeflate.h +2 -2
  41. data/ext/deflate_ruby/libdeflate/{lib/matchfinder_common.h → matchfinder_common.h} +3 -3
  42. data/ext/deflate_ruby/libdeflate/x86/adler32_impl.h +135 -0
  43. data/ext/deflate_ruby/libdeflate/x86/adler32_template.h +518 -0
  44. data/ext/deflate_ruby/libdeflate/x86/cpu_features.c +213 -0
  45. data/ext/deflate_ruby/libdeflate/x86/cpu_features.h +170 -0
  46. data/ext/deflate_ruby/libdeflate/x86/crc32_impl.h +159 -0
  47. data/ext/deflate_ruby/libdeflate/x86/crc32_pclmul_template.h +424 -0
  48. data/ext/deflate_ruby/libdeflate/x86/decompress_impl.h +57 -0
  49. data/ext/deflate_ruby/libdeflate.h +411 -0
  50. data/ext/deflate_ruby/matchfinder_common.h +224 -0
  51. data/ext/deflate_ruby/matchfinder_impl.h +122 -0
  52. data/ext/deflate_ruby/utils.c +141 -0
  53. data/ext/deflate_ruby/zlib_compress.c +82 -0
  54. data/ext/deflate_ruby/zlib_constants.h +21 -0
  55. data/ext/deflate_ruby/zlib_decompress.c +104 -0
  56. data/lib/deflate_ruby/version.rb +1 -1
  57. data/lib/deflate_ruby.rb +1 -63
  58. data/sig/deflate_ruby.rbs +4 -0
  59. data/test/test_deflate_ruby.rb +220 -0
  60. data/test/test_helper.rb +6 -0
  61. metadata +89 -144
  62. data/ext/deflate_ruby/libdeflate/CMakeLists.txt +0 -270
  63. data/ext/deflate_ruby/libdeflate/NEWS.md +0 -494
  64. data/ext/deflate_ruby/libdeflate/README.md +0 -228
  65. data/ext/deflate_ruby/libdeflate/libdeflate-config.cmake.in +0 -3
  66. data/ext/deflate_ruby/libdeflate/libdeflate.pc.in +0 -18
  67. data/ext/deflate_ruby/libdeflate/programs/CMakeLists.txt +0 -105
  68. data/ext/deflate_ruby/libdeflate/programs/benchmark.c +0 -696
  69. data/ext/deflate_ruby/libdeflate/programs/checksum.c +0 -218
  70. data/ext/deflate_ruby/libdeflate/programs/config.h.in +0 -19
  71. data/ext/deflate_ruby/libdeflate/programs/gzip.c +0 -688
  72. data/ext/deflate_ruby/libdeflate/programs/prog_util.c +0 -521
  73. data/ext/deflate_ruby/libdeflate/programs/prog_util.h +0 -225
  74. data/ext/deflate_ruby/libdeflate/programs/test_checksums.c +0 -200
  75. data/ext/deflate_ruby/libdeflate/programs/test_custom_malloc.c +0 -155
  76. data/ext/deflate_ruby/libdeflate/programs/test_incomplete_codes.c +0 -385
  77. data/ext/deflate_ruby/libdeflate/programs/test_invalid_streams.c +0 -130
  78. data/ext/deflate_ruby/libdeflate/programs/test_litrunlen_overflow.c +0 -72
  79. data/ext/deflate_ruby/libdeflate/programs/test_overread.c +0 -95
  80. data/ext/deflate_ruby/libdeflate/programs/test_slow_decompression.c +0 -472
  81. data/ext/deflate_ruby/libdeflate/programs/test_trailing_bytes.c +0 -151
  82. data/ext/deflate_ruby/libdeflate/programs/test_util.c +0 -237
  83. data/ext/deflate_ruby/libdeflate/programs/test_util.h +0 -61
  84. data/ext/deflate_ruby/libdeflate/programs/tgetopt.c +0 -118
  85. data/ext/deflate_ruby/libdeflate/scripts/android_build.sh +0 -118
  86. data/ext/deflate_ruby/libdeflate/scripts/android_tests.sh +0 -69
  87. data/ext/deflate_ruby/libdeflate/scripts/benchmark.sh +0 -10
  88. data/ext/deflate_ruby/libdeflate/scripts/checksum.sh +0 -10
  89. data/ext/deflate_ruby/libdeflate/scripts/checksum_benchmarks.sh +0 -253
  90. data/ext/deflate_ruby/libdeflate/scripts/cmake-helper.sh +0 -17
  91. data/ext/deflate_ruby/libdeflate/scripts/deflate_benchmarks.sh +0 -119
  92. data/ext/deflate_ruby/libdeflate/scripts/exec_tests.sh +0 -38
  93. data/ext/deflate_ruby/libdeflate/scripts/gen-release-archives.sh +0 -37
  94. data/ext/deflate_ruby/libdeflate/scripts/gen_bitreverse_tab.py +0 -19
  95. data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_multipliers.c +0 -199
  96. data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_tables.c +0 -105
  97. data/ext/deflate_ruby/libdeflate/scripts/gen_default_litlen_costs.py +0 -44
  98. data/ext/deflate_ruby/libdeflate/scripts/gen_offset_slot_map.py +0 -29
  99. data/ext/deflate_ruby/libdeflate/scripts/gzip_tests.sh +0 -523
  100. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/corpus/0 +0 -0
  101. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/fuzz.c +0 -95
  102. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/corpus/0 +0 -3
  103. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/fuzz.c +0 -62
  104. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/fuzz.sh +0 -108
  105. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/corpus/0 +0 -0
  106. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/fuzz.c +0 -19
  107. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/corpus/0 +0 -3
  108. data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/fuzz.c +0 -19
  109. data/ext/deflate_ruby/libdeflate/scripts/run_tests.sh +0 -416
  110. data/ext/deflate_ruby/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake +0 -8
  111. data/ext/deflate_ruby/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake +0 -8
  112. /data/ext/deflate_ruby/{libdeflate/lib/adler32.c → adler32.c} +0 -0
  113. /data/ext/deflate_ruby/{libdeflate/lib/x86/adler32_template.h → adler32_template.h} +0 -0
  114. /data/ext/deflate_ruby/{libdeflate/lib/bt_matchfinder.h → bt_matchfinder.h} +0 -0
  115. /data/ext/deflate_ruby/{libdeflate/lib/cpu_features_common.h → cpu_features_common.h} +0 -0
  116. /data/ext/deflate_ruby/{libdeflate/lib/crc32.c → crc32.c} +0 -0
  117. /data/ext/deflate_ruby/{libdeflate/lib/arm/crc32_pmull_helpers.h → crc32_pmull_helpers.h} +0 -0
  118. /data/ext/deflate_ruby/{libdeflate/lib/arm/crc32_pmull_wide.h → crc32_pmull_wide.h} +0 -0
  119. /data/ext/deflate_ruby/{libdeflate/lib/x86/decompress_impl.h → decompress_impl.h} +0 -0
  120. /data/ext/deflate_ruby/{libdeflate/lib/decompress_template.h → decompress_template.h} +0 -0
  121. /data/ext/deflate_ruby/{libdeflate/lib/deflate_compress.h → deflate_compress.h} +0 -0
  122. /data/ext/deflate_ruby/{libdeflate/lib/deflate_constants.h → deflate_constants.h} +0 -0
  123. /data/ext/deflate_ruby/{libdeflate/lib/deflate_decompress.c → deflate_decompress.c} +0 -0
  124. /data/ext/deflate_ruby/{libdeflate/lib/gzip_compress.c → gzip_compress.c} +0 -0
  125. /data/ext/deflate_ruby/{libdeflate/lib/gzip_constants.h → gzip_constants.h} +0 -0
  126. /data/ext/deflate_ruby/{libdeflate/lib/gzip_decompress.c → gzip_decompress.c} +0 -0
  127. /data/ext/deflate_ruby/{libdeflate/lib/hc_matchfinder.h → hc_matchfinder.h} +0 -0
  128. /data/ext/deflate_ruby/{libdeflate/lib/ht_matchfinder.h → ht_matchfinder.h} +0 -0
  129. /data/ext/deflate_ruby/{libdeflate/lib/lib_common.h → lib_common.h} +0 -0
  130. /data/ext/deflate_ruby/libdeflate/{lib/arm → arm}/cpu_features.c +0 -0
  131. /data/ext/deflate_ruby/libdeflate/{lib/arm → arm}/cpu_features.h +0 -0
  132. /data/ext/deflate_ruby/libdeflate/{lib/arm → arm}/matchfinder_impl.h +0 -0
  133. /data/ext/deflate_ruby/libdeflate/{lib/riscv → riscv}/matchfinder_impl.h +0 -0
  134. /data/ext/deflate_ruby/libdeflate/{lib/utils.c → utils.c} +0 -0
  135. /data/ext/deflate_ruby/libdeflate/{lib/x86 → x86}/matchfinder_impl.h +0 -0
  136. /data/ext/deflate_ruby/libdeflate/{lib/zlib_compress.c → zlib_compress.c} +0 -0
  137. /data/ext/deflate_ruby/libdeflate/{lib/zlib_constants.h → zlib_constants.h} +0 -0
  138. /data/ext/deflate_ruby/libdeflate/{lib/zlib_decompress.c → zlib_decompress.c} +0 -0
@@ -1,270 +0,0 @@
1
- cmake_minimum_required(VERSION 3.7)
2
-
3
- # Default to a release build.
4
- if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
5
- message(STATUS "No build type selected; defaulting to Release")
6
- set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
7
- endif()
8
-
9
- # With MSVC, don't automatically append /W3 to the compiler flags.
10
- # This makes it possible for the user to select /W4.
11
- if(POLICY CMP0092)
12
- cmake_policy(SET CMP0092 NEW)
13
- endif()
14
-
15
- # Extract the version string from libdeflate.h so that it doesn't have to be
16
- # duplicated here.
17
- set(VERSION_REGEX "#define LIBDEFLATE_VERSION_STRING[ \t]+\"([0-9\\.]+)\"")
18
- file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/libdeflate.h VERSION_STRING REGEX ${VERSION_REGEX})
19
- string(REGEX REPLACE ${VERSION_REGEX} "\\1" VERSION_STRING "${VERSION_STRING}")
20
-
21
- # Declare the project.
22
- project(libdeflate
23
- LANGUAGES C
24
- VERSION ${VERSION_STRING})
25
-
26
- # Include the CMake modules required by the top-level directory.
27
- include(CMakePackageConfigHelpers)
28
- include(CheckCCompilerFlag)
29
- include(GNUInstallDirs)
30
-
31
- # Declare the options, which can be overridden via 'cmake -DOPTION=VALUE'.
32
- option(LIBDEFLATE_BUILD_STATIC_LIB "Build the static library" ON)
33
- option(LIBDEFLATE_BUILD_SHARED_LIB "Build the shared library" ON)
34
- option(LIBDEFLATE_COMPRESSION_SUPPORT "Support compression" ON)
35
- option(LIBDEFLATE_DECOMPRESSION_SUPPORT "Support decompression" ON)
36
- option(LIBDEFLATE_ZLIB_SUPPORT "Support the zlib format" ON)
37
- option(LIBDEFLATE_GZIP_SUPPORT "Support the gzip format" ON)
38
- option(LIBDEFLATE_FREESTANDING
39
- "Build a freestanding library, i.e. a library that doesn't link to any
40
- libc functions like malloc(), free(), and memcpy(). Library users will
41
- need to provide a custom memory allocator." OFF)
42
- option(LIBDEFLATE_BUILD_GZIP "Build the libdeflate-gzip program" ON)
43
- option(LIBDEFLATE_BUILD_TESTS "Build the test programs" OFF)
44
- option(LIBDEFLATE_USE_SHARED_LIB
45
- "Link the libdeflate-gzip and test programs to the shared library instead
46
- of the static library" OFF)
47
-
48
- if(LIBDEFLATE_BUILD_TESTS)
49
- enable_testing()
50
- endif()
51
-
52
- # The gzip program can't be built if any library feature it needs is disabled.
53
- if(NOT LIBDEFLATE_COMPRESSION_SUPPORT OR NOT LIBDEFLATE_DECOMPRESSION_SUPPORT
54
- OR NOT LIBDEFLATE_GZIP_SUPPORT)
55
- set(LIBDEFLATE_BUILD_GZIP OFF)
56
- endif()
57
-
58
- # If the static library isn't being built, we have to link to the shared one.
59
- if(NOT LIBDEFLATE_BUILD_STATIC_LIB)
60
- set(LIBDEFLATE_USE_SHARED_LIB ON)
61
- endif()
62
-
63
- # Set common C compiler flags for all targets (the library and the programs).
64
- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
65
- set(CMAKE_C_STANDARD 99)
66
- if(NOT MSVC)
67
- check_c_compiler_flag(-Wdeclaration-after-statement HAVE_WDECLARATION_AFTER_STATEMENT)
68
- check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH)
69
- check_c_compiler_flag(-Wmissing-field-initializers HAVE_WMISSING_FIELD_INITIALIZERS)
70
- check_c_compiler_flag(-Wmissing-prototypes HAVE_WMISSING_PROTOTYPES)
71
- check_c_compiler_flag(-Wpedantic HAVE_WPEDANTIC)
72
- check_c_compiler_flag(-Wshadow HAVE_WSHADOW)
73
- check_c_compiler_flag(-Wstrict-prototypes HAVE_WSTRICT_PROTOTYPES)
74
- check_c_compiler_flag(-Wundef HAVE_WUNDEF)
75
- check_c_compiler_flag(-Wvla HAVE_WVLA)
76
- add_compile_options(
77
- -Wall
78
- $<$<BOOL:${HAVE_WDECLARATION_AFTER_STATEMENT}>:-Wdeclaration-after-statement>
79
- $<$<BOOL:${HAVE_WIMPLICIT_FALLTHROUGH}>:-Wimplicit-fallthrough>
80
- $<$<BOOL:${HAVE_WMISSING_FIELD_INITIALIZERS}>:-Wmissing-field-initializers>
81
- $<$<BOOL:${HAVE_WMISSING_PROTOTYPES}>:-Wmissing-prototypes>
82
- $<$<BOOL:${HAVE_WPEDANTIC}>:-Wpedantic>
83
- $<$<BOOL:${HAVE_WSHADOW}>:-Wshadow>
84
- $<$<BOOL:${HAVE_WSTRICT_PROTOTYPES}>:-Wstrict-prototypes>
85
- $<$<BOOL:${HAVE_WUNDEF}>:-Wundef>
86
- $<$<BOOL:${HAVE_WVLA}>:-Wvla>
87
- )
88
- endif()
89
- if(LIBDEFLATE_FREESTANDING)
90
- add_definitions(-DFREESTANDING)
91
- endif()
92
-
93
- # Determine the list of source files and the list of compiler options that will
94
- # be used for both the static library and the shared library.
95
-
96
- set(LIB_SOURCES
97
- common_defs.h
98
- libdeflate.h
99
- lib/arm/cpu_features.c
100
- lib/arm/cpu_features.h
101
- lib/cpu_features_common.h
102
- lib/deflate_constants.h
103
- lib/lib_common.h
104
- lib/utils.c
105
- lib/x86/cpu_features.c
106
- lib/x86/cpu_features.h
107
- )
108
- if(LIBDEFLATE_COMPRESSION_SUPPORT)
109
- list(APPEND LIB_SOURCES
110
- lib/arm/matchfinder_impl.h
111
- lib/bt_matchfinder.h
112
- lib/deflate_compress.c
113
- lib/deflate_compress.h
114
- lib/hc_matchfinder.h
115
- lib/ht_matchfinder.h
116
- lib/matchfinder_common.h
117
- lib/riscv/matchfinder_impl.h
118
- lib/x86/matchfinder_impl.h
119
- )
120
- endif()
121
- if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
122
- list(APPEND LIB_SOURCES
123
- lib/decompress_template.h
124
- lib/deflate_decompress.c
125
- lib/x86/decompress_impl.h
126
- )
127
- endif()
128
- if(LIBDEFLATE_ZLIB_SUPPORT)
129
- list(APPEND LIB_SOURCES
130
- lib/adler32.c
131
- lib/arm/adler32_impl.h
132
- lib/x86/adler32_impl.h
133
- lib/x86/adler32_template.h
134
- lib/zlib_constants.h
135
- )
136
- if(LIBDEFLATE_COMPRESSION_SUPPORT)
137
- list(APPEND LIB_SOURCES lib/zlib_compress.c)
138
- endif()
139
- if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
140
- list(APPEND LIB_SOURCES lib/zlib_decompress.c)
141
- endif()
142
- endif()
143
- if(LIBDEFLATE_GZIP_SUPPORT)
144
- list(APPEND LIB_SOURCES
145
- lib/arm/crc32_impl.h
146
- lib/arm/crc32_pmull_helpers.h
147
- lib/arm/crc32_pmull_wide.h
148
- lib/crc32.c
149
- lib/crc32_multipliers.h
150
- lib/crc32_tables.h
151
- lib/gzip_constants.h
152
- lib/x86/crc32_impl.h
153
- lib/x86/crc32_pclmul_template.h
154
- )
155
- if(LIBDEFLATE_COMPRESSION_SUPPORT)
156
- list(APPEND LIB_SOURCES lib/gzip_compress.c)
157
- endif()
158
- if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
159
- list(APPEND LIB_SOURCES lib/gzip_decompress.c)
160
- endif()
161
- endif()
162
-
163
- if(LIBDEFLATE_FREESTANDING)
164
- list(APPEND LIB_COMPILE_OPTIONS -ffreestanding -nostdlib)
165
- list(APPEND LIB_LINK_LIBRARIES -ffreestanding -nostdlib)
166
- endif()
167
-
168
- set(LIB_INCLUDE_DIRS
169
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
170
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>)
171
-
172
- # Build the static library.
173
- if(LIBDEFLATE_BUILD_STATIC_LIB)
174
- add_library(libdeflate_static STATIC ${LIB_SOURCES})
175
-
176
- # This alias allows third-party usage of the library with CMake to work the
177
- # same way with add_subdirectory() as with other ways.
178
- add_library(libdeflate::libdeflate_static ALIAS libdeflate_static)
179
-
180
- if(WIN32 AND NOT MINGW)
181
- set(STATIC_LIB_NAME deflatestatic)
182
- else()
183
- set(STATIC_LIB_NAME deflate)
184
- endif()
185
- set_target_properties(libdeflate_static PROPERTIES
186
- OUTPUT_NAME ${STATIC_LIB_NAME}
187
- PUBLIC_HEADER libdeflate.h)
188
- target_include_directories(libdeflate_static PUBLIC ${LIB_INCLUDE_DIRS})
189
- target_compile_definitions(libdeflate_static PRIVATE ${LIB_COMPILE_DEFINITIONS})
190
- target_compile_options(libdeflate_static PRIVATE ${LIB_COMPILE_OPTIONS})
191
- list(APPEND LIB_TARGETS libdeflate_static)
192
- endif()
193
-
194
- # Build the shared library.
195
- if(LIBDEFLATE_BUILD_SHARED_LIB)
196
- add_library(libdeflate_shared SHARED ${LIB_SOURCES})
197
-
198
- # This alias allows third-party usage of the library with CMake to work the
199
- # same way with add_subdirectory() as with other ways.
200
- add_library(libdeflate::libdeflate_shared ALIAS libdeflate_shared)
201
-
202
- set_target_properties(libdeflate_shared PROPERTIES
203
- OUTPUT_NAME deflate
204
- PUBLIC_HEADER libdeflate.h
205
- C_VISIBILITY_PRESET hidden
206
- SOVERSION 0)
207
- target_include_directories(libdeflate_shared PUBLIC ${LIB_INCLUDE_DIRS})
208
- target_compile_definitions(libdeflate_shared PUBLIC LIBDEFLATE_DLL)
209
- target_compile_definitions(libdeflate_shared PRIVATE ${LIB_COMPILE_DEFINITIONS})
210
- target_compile_options(libdeflate_shared PRIVATE ${LIB_COMPILE_OPTIONS})
211
- target_link_libraries(libdeflate_shared PRIVATE ${LIB_LINK_LIBRARIES})
212
- list(APPEND LIB_TARGETS libdeflate_shared)
213
- endif()
214
-
215
- # Install the static and/or shared library.
216
- install(TARGETS ${LIB_TARGETS}
217
- EXPORT libdeflate_exported_targets
218
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
219
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
220
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
221
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
222
-
223
- # Generate and install the pkg-config file. (Don't confuse this with the CMake
224
- # package config file, which is CMake-specific.) Take care to define the
225
- # include and lib directories in terms of the ${prefix} and ${exec_prefix}
226
- # pkg-config variables when possible, since some pkg-config users expect to be
227
- # able to override these variables to relocate packages.
228
- if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
229
- set(CMAKE_PKGCONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
230
- else()
231
- set(CMAKE_PKGCONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
232
- endif()
233
- if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
234
- set(CMAKE_PKGCONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
235
- else()
236
- set(CMAKE_PKGCONFIG_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
237
- endif()
238
- configure_file(libdeflate.pc.in libdeflate.pc @ONLY)
239
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdeflate.pc
240
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
241
-
242
- # Generate a "libdeflate-targets.cmake" file in the build tree that can be
243
- # included by outside projects to import targets from the build tree.
244
- export(EXPORT libdeflate_exported_targets
245
- NAMESPACE libdeflate::
246
- FILE libdeflate-targets.cmake)
247
-
248
- # Generate and install a separate "libdeflate-targets.cmake" file that can be
249
- # included by outside projects to import targets from the installation tree.
250
- install(EXPORT libdeflate_exported_targets
251
- NAMESPACE libdeflate::
252
- FILE libdeflate-targets.cmake
253
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
254
-
255
- # Generate and install the CMake package version and config files.
256
- write_basic_package_version_file(libdeflate-config-version.cmake
257
- VERSION ${PROJECT_VERSION}
258
- COMPATIBILITY AnyNewerVersion)
259
- configure_package_config_file(
260
- ${CMAKE_CURRENT_SOURCE_DIR}/libdeflate-config.cmake.in
261
- libdeflate-config.cmake
262
- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
263
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdeflate-config.cmake
264
- ${CMAKE_CURRENT_BINARY_DIR}/libdeflate-config-version.cmake
265
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
266
-
267
- # Build the programs subdirectory if needed.
268
- if(LIBDEFLATE_BUILD_GZIP OR LIBDEFLATE_BUILD_TESTS)
269
- add_subdirectory(programs)
270
- endif()