ob64 0.4.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/ob64/version.rb +1 -1
- data/ob64.gemspec +2 -0
- data/vendor/libbase64/.gitignore +12 -0
- data/vendor/libbase64/.travis.yml +71 -0
- data/vendor/libbase64/CMakeLists.txt +264 -0
- data/vendor/libbase64/LICENSE +28 -0
- data/vendor/libbase64/Makefile +93 -0
- data/vendor/libbase64/README.md +474 -0
- data/vendor/libbase64/base64-benchmarks.png +0 -0
- data/vendor/libbase64/bin/base64.c +132 -0
- data/vendor/libbase64/cmake/Modules/TargetArch.cmake +29 -0
- data/vendor/libbase64/cmake/Modules/TargetSIMDInstructionSet.cmake +34 -0
- data/vendor/libbase64/cmake/base64-config.cmake.in +5 -0
- data/vendor/libbase64/cmake/config.h.in +25 -0
- data/vendor/libbase64/cmake/test-arch.c +35 -0
- data/vendor/libbase64/include/libbase64.h +145 -0
- data/vendor/libbase64/lib/arch/avx/codec.c +42 -0
- data/vendor/libbase64/lib/arch/avx2/codec.c +42 -0
- data/vendor/libbase64/lib/arch/avx2/dec_loop.c +110 -0
- data/vendor/libbase64/lib/arch/avx2/dec_reshuffle.c +34 -0
- data/vendor/libbase64/lib/arch/avx2/enc_loop.c +89 -0
- data/vendor/libbase64/lib/arch/avx2/enc_reshuffle.c +83 -0
- data/vendor/libbase64/lib/arch/avx2/enc_translate.c +30 -0
- data/vendor/libbase64/lib/arch/generic/32/dec_loop.c +86 -0
- data/vendor/libbase64/lib/arch/generic/32/enc_loop.c +73 -0
- data/vendor/libbase64/lib/arch/generic/64/enc_loop.c +77 -0
- data/vendor/libbase64/lib/arch/generic/codec.c +39 -0
- data/vendor/libbase64/lib/arch/generic/dec_head.c +37 -0
- data/vendor/libbase64/lib/arch/generic/dec_tail.c +91 -0
- data/vendor/libbase64/lib/arch/generic/enc_head.c +24 -0
- data/vendor/libbase64/lib/arch/generic/enc_tail.c +34 -0
- data/vendor/libbase64/lib/arch/neon32/codec.c +72 -0
- data/vendor/libbase64/lib/arch/neon32/dec_loop.c +106 -0
- data/vendor/libbase64/lib/arch/neon32/enc_loop.c +58 -0
- data/vendor/libbase64/lib/arch/neon32/enc_reshuffle.c +54 -0
- data/vendor/libbase64/lib/arch/neon32/enc_translate.c +57 -0
- data/vendor/libbase64/lib/arch/neon64/codec.c +70 -0
- data/vendor/libbase64/lib/arch/neon64/dec_loop.c +129 -0
- data/vendor/libbase64/lib/arch/neon64/enc_loop.c +66 -0
- data/vendor/libbase64/lib/arch/neon64/enc_reshuffle.c +54 -0
- data/vendor/libbase64/lib/arch/sse41/codec.c +42 -0
- data/vendor/libbase64/lib/arch/sse42/codec.c +42 -0
- data/vendor/libbase64/lib/arch/ssse3/codec.c +42 -0
- data/vendor/libbase64/lib/arch/ssse3/dec_loop.c +173 -0
- data/vendor/libbase64/lib/arch/ssse3/dec_reshuffle.c +33 -0
- data/vendor/libbase64/lib/arch/ssse3/enc_loop.c +67 -0
- data/vendor/libbase64/lib/arch/ssse3/enc_reshuffle.c +48 -0
- data/vendor/libbase64/lib/arch/ssse3/enc_translate.c +33 -0
- data/vendor/libbase64/lib/codec_choose.c +281 -0
- data/vendor/libbase64/lib/codecs.h +65 -0
- data/vendor/libbase64/lib/env.h +67 -0
- data/vendor/libbase64/lib/exports.txt +7 -0
- data/vendor/libbase64/lib/lib.c +164 -0
- data/vendor/libbase64/lib/lib_openmp.c +149 -0
- data/vendor/libbase64/lib/tables/.gitignore +1 -0
- data/vendor/libbase64/lib/tables/Makefile +17 -0
- data/vendor/libbase64/lib/tables/table_dec_32bit.h +393 -0
- data/vendor/libbase64/lib/tables/table_enc_12bit.h +1031 -0
- data/vendor/libbase64/lib/tables/table_enc_12bit.py +45 -0
- data/vendor/libbase64/lib/tables/table_generator.c +184 -0
- data/vendor/libbase64/lib/tables/tables.c +40 -0
- data/vendor/libbase64/lib/tables/tables.h +23 -0
- metadata +64 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf866c04fac9e6cf9d4f8c98741f17e2109e0bd5fd545d2d0482b4c28a6dd61a
|
4
|
+
data.tar.gz: e6ee12aebbece01e6e1ce8181aafdfe9b32b7fbd2d1307c07d7af02d46b73f4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280e35ae08985662cc05a26c5f30ef5e9897b8d7a641a83e7a0bc8bf91a1790dbf8c36f5129ff7dface1e5eeb8d286ef43387688202b26a254a6bad860faa65d
|
7
|
+
data.tar.gz: f246fed35467cce900ffb7664ca62012c6d0e7bda5c2180a99814fba558331f83ab33d21a1868a0d850fa39b59eec223e39445584703f0302f339e159ce9be83
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://rubygems.org/gems/ob64)
|
4
4
|
[](https://github.com/jcmfernandes/ob64/actions?query=workflow:Test)
|
5
|
-
[](http://www.rubydoc.info/gems/ob64/0.
|
5
|
+
[](http://www.rubydoc.info/gems/ob64/0.5.0)
|
6
6
|
|
7
7
|
A *fast* Base64 encoder and decoder as a Ruby gem.
|
8
8
|
|
data/lib/ob64/version.rb
CHANGED
data/ob64.gemspec
CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
18
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
20
|
+
end + Dir.chdir(File.join(File.expand_path(__dir__), "vendor", "libbase64")) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }.map! { |f| "vendor/libbase64/#{f}" }
|
20
22
|
end
|
21
23
|
spec.require_paths = ["lib"]
|
22
24
|
spec.extensions = ["ext/ob64/extconf.rb"]
|
@@ -0,0 +1,71 @@
|
|
1
|
+
language: c
|
2
|
+
services: docker
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
allow_failures:
|
6
|
+
- os: osx
|
7
|
+
- arch: ppc64le
|
8
|
+
|
9
|
+
include:
|
10
|
+
- name: linux-amd64-gcc
|
11
|
+
os: linux
|
12
|
+
arch: amd64
|
13
|
+
compiler: gcc
|
14
|
+
script: test/ci/amd64.sh
|
15
|
+
|
16
|
+
- name: linux-amd64-gcc +openmp
|
17
|
+
os: linux
|
18
|
+
arch: amd64
|
19
|
+
compiler: gcc
|
20
|
+
env: OPENMP=1 OMP_NUM_THREADS=4
|
21
|
+
script: test/ci/amd64.sh
|
22
|
+
|
23
|
+
- name: linux-amd64-clang
|
24
|
+
os: linux
|
25
|
+
arch: amd64
|
26
|
+
compiler: clang
|
27
|
+
script: test/ci/amd64.sh
|
28
|
+
|
29
|
+
- name: linux-arm32-gcc
|
30
|
+
compiler: gcc
|
31
|
+
script: test/ci/docker-arm32.sh
|
32
|
+
|
33
|
+
- name: linux-arm32-clang
|
34
|
+
compiler: clang
|
35
|
+
script: test/ci/docker-arm32.sh
|
36
|
+
|
37
|
+
- name: linux-powerpc-gcc
|
38
|
+
compiler: gcc
|
39
|
+
script: test/ci/docker-powerpc.sh
|
40
|
+
|
41
|
+
- name: linux-arm64-gcc
|
42
|
+
os: linux
|
43
|
+
arch: arm64
|
44
|
+
compiler: gcc
|
45
|
+
env: NEON64_CFLAGS="-march=armv8-a"
|
46
|
+
script: test/ci/generic.sh
|
47
|
+
|
48
|
+
- name: linux-arm64-clang
|
49
|
+
os: linux
|
50
|
+
arch: arm64
|
51
|
+
compiler: clang
|
52
|
+
env: NEON64_CFLAGS="-march=armv8-a"
|
53
|
+
script: test/ci/generic.sh
|
54
|
+
|
55
|
+
- name: linux-s390x-gcc
|
56
|
+
os: linux
|
57
|
+
arch: s390x
|
58
|
+
compiler: gcc
|
59
|
+
script: test/ci/generic.sh
|
60
|
+
|
61
|
+
- name: linux-ppc64le-gcc
|
62
|
+
os: linux
|
63
|
+
arch: ppc64le
|
64
|
+
compiler: gcc
|
65
|
+
script: test/ci/generic.sh
|
66
|
+
|
67
|
+
- name: osx-amd64-clang
|
68
|
+
os: osx
|
69
|
+
arch: amd64
|
70
|
+
compiler: clang
|
71
|
+
script: test/ci/amd64.sh
|
@@ -0,0 +1,264 @@
|
|
1
|
+
# Written in 2016-2017, 2021 by Henrik Steffen Gaßmann henrik@gassmann.onl
|
2
|
+
#
|
3
|
+
# To the extent possible under law, the author(s) have dedicated all
|
4
|
+
# copyright and related and neighboring rights to this software to the
|
5
|
+
# public domain worldwide. This software is distributed without any warranty.
|
6
|
+
#
|
7
|
+
# You should have received a copy of the CC0 Public Domain Dedication
|
8
|
+
# along with this software. If not, see
|
9
|
+
#
|
10
|
+
# http://creativecommons.org/publicdomain/zero/1.0/
|
11
|
+
#
|
12
|
+
########################################################################
|
13
|
+
cmake_minimum_required(VERSION 3.1)
|
14
|
+
|
15
|
+
project(base64 LANGUAGES C VERSION 0.4.0)
|
16
|
+
|
17
|
+
include(GNUInstallDirs)
|
18
|
+
include(CMakeDependentOption)
|
19
|
+
include(FeatureSummary)
|
20
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
|
21
|
+
|
22
|
+
#######################################################################
|
23
|
+
# platform detection
|
24
|
+
include(TargetArch)
|
25
|
+
detect_target_architecture(_TARGET_ARCH)
|
26
|
+
|
27
|
+
|
28
|
+
###################################################################
|
29
|
+
# optional/conditional dependencies
|
30
|
+
find_package(OpenMP)
|
31
|
+
set_package_properties(OpenMP PROPERTIES
|
32
|
+
TYPE OPTIONAL
|
33
|
+
PURPOSE "Allows to utilize openmp"
|
34
|
+
)
|
35
|
+
|
36
|
+
|
37
|
+
########################################################################
|
38
|
+
# Compilation options
|
39
|
+
option(BASE64_BUILD_TESTS "add test projects" ON)
|
40
|
+
cmake_dependent_option(BASE64_WITH_OPENMP "use openmp" OFF "OPENMP_FOUND" OFF)
|
41
|
+
add_feature_info("OpenMP codec" BASE64_WITH_OPENMP "spreads codec work accross multiple threads")
|
42
|
+
cmake_dependent_option(BASE64_REGENERATE_TABLES "regenerate the codec tables" OFF "NOT CMAKE_CROSSCOMPILING" OFF)
|
43
|
+
|
44
|
+
set(_IS_X86 "\"${_TARGET_ARCH}\" STREQUAL \"x86\" OR \"${_TARGET_ARCH}\" STREQUAL \"x64\"")
|
45
|
+
cmake_dependent_option(BASE64_WITH_SSSE3 "add SSSE 3 codepath" ON ${_IS_X86} OFF)
|
46
|
+
add_feature_info(SSSE3 BASE64_WITH_SSSE3 "add SSSE 3 codepath")
|
47
|
+
cmake_dependent_option(BASE64_WITH_SSE41 "add SSE 4.1 codepath" ON ${_IS_X86} OFF)
|
48
|
+
add_feature_info(SSE4.1 BASE64_WITH_SSE41 "add SSE 4.1 codepath")
|
49
|
+
cmake_dependent_option(BASE64_WITH_SSE42 "add SSE 4.2 codepath" ON ${_IS_X86} OFF)
|
50
|
+
add_feature_info(SSE4.2 BASE64_WITH_SSE42 "add SSE 4.2 codepath")
|
51
|
+
cmake_dependent_option(BASE64_WITH_AVX "add AVX codepath" ON ${_IS_X86} OFF)
|
52
|
+
add_feature_info(AVX BASE64_WITH_AVX "add AVX codepath")
|
53
|
+
cmake_dependent_option(BASE64_WITH_AVX2 "add AVX 2 codepath" ON ${_IS_X86} OFF)
|
54
|
+
add_feature_info(AVX2 BASE64_WITH_AVX2 "add AVX2 codepath")
|
55
|
+
|
56
|
+
set(_IS_ARM "\"${_TARGET_ARCH}\" STREQUAL \"arm\"")
|
57
|
+
cmake_dependent_option(BASE64_WITH_NEON32 "add NEON32 codepath" OFF ${_IS_ARM} OFF)
|
58
|
+
add_feature_info(NEON32 BASE64_WITH_NEON32 "add NEON32 codepath")
|
59
|
+
|
60
|
+
set(_IS_ARM64 "\"${_TARGET_ARCH}\" STREQUAL \"arm64\"")
|
61
|
+
cmake_dependent_option(BASE64_WITH_NEON64 "add NEON64 codepath" ON ${_IS_ARM64} OFF)
|
62
|
+
add_feature_info(NEON64 BASE64_WITH_NEON64 "add NEON64 codepath")
|
63
|
+
|
64
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
65
|
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
66
|
+
|
67
|
+
########################################################################
|
68
|
+
# Regenerate headers
|
69
|
+
|
70
|
+
if (BASE64_REGENERATE_TABLES)
|
71
|
+
# Generate tables in build folder and copy to source tree.
|
72
|
+
# Don't add the tables in the source tree to the outputs, to avoid `make clean` removing them.
|
73
|
+
add_executable(table_generator
|
74
|
+
lib/tables/table_generator.c
|
75
|
+
)
|
76
|
+
|
77
|
+
add_custom_command(OUTPUT table_dec_32bit.h "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_dec_32bit.h"
|
78
|
+
COMMAND table_generator > table_dec_32bit.h
|
79
|
+
COMMAND "${CMAKE_COMMAND}" -E copy table_dec_32bit.h "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_dec_32bit.h"
|
80
|
+
DEPENDS table_generator
|
81
|
+
)
|
82
|
+
set(Python_ADDITIONAL_VERSIONS 3)
|
83
|
+
find_package(PythonInterp REQUIRED)
|
84
|
+
add_custom_command(OUTPUT table_enc_12bit.h "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_enc_12bit.h"
|
85
|
+
COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_enc_12bit.py" > table_enc_12bit.h
|
86
|
+
COMMAND "${CMAKE_COMMAND}" -E copy table_enc_12bit.h "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_enc_12bit.h"
|
87
|
+
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/lib/tables/table_enc_12bit.py"
|
88
|
+
)
|
89
|
+
endif()
|
90
|
+
|
91
|
+
|
92
|
+
########################################################################
|
93
|
+
# library project
|
94
|
+
add_library(base64
|
95
|
+
# library files
|
96
|
+
lib/lib.c
|
97
|
+
lib/codec_choose.c
|
98
|
+
include/libbase64.h
|
99
|
+
|
100
|
+
lib/tables/tables.c
|
101
|
+
# Add generated headers explicitly to target, to insert them in the dependency tree
|
102
|
+
lib/tables/table_dec_32bit.h
|
103
|
+
lib/tables/table_enc_12bit.h
|
104
|
+
|
105
|
+
# codec implementations
|
106
|
+
lib/arch/generic/codec.c
|
107
|
+
|
108
|
+
lib/arch/ssse3/codec.c
|
109
|
+
lib/arch/sse41/codec.c
|
110
|
+
lib/arch/sse42/codec.c
|
111
|
+
lib/arch/avx/codec.c
|
112
|
+
lib/arch/avx2/codec.c
|
113
|
+
|
114
|
+
lib/arch/neon32/codec.c
|
115
|
+
lib/arch/neon64/codec.c
|
116
|
+
)
|
117
|
+
|
118
|
+
target_include_directories(base64
|
119
|
+
PUBLIC
|
120
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
121
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
122
|
+
PRIVATE
|
123
|
+
"${CMAKE_CURRENT_BINARY_DIR}"
|
124
|
+
)
|
125
|
+
|
126
|
+
####################################################################
|
127
|
+
# platform/compiler specific configuration
|
128
|
+
set_target_properties(base64 PROPERTIES
|
129
|
+
C_STANDARD 99
|
130
|
+
C_STANDARD_REQUIRED YES
|
131
|
+
C_EXTENSIONS OFF
|
132
|
+
DEFINE_SYMBOL BASE64_EXPORTS
|
133
|
+
VERSION ${PROJECT_VERSION}
|
134
|
+
SOVERSION ${PROJECT_VERSION_MAJOR}
|
135
|
+
)
|
136
|
+
|
137
|
+
#generate_export_header(base64)
|
138
|
+
# the following definitions and those in libbase64.h have been
|
139
|
+
# kept forward compatible in case we ever switch to generate_export_header
|
140
|
+
if (BUILD_SHARED_LIBS)
|
141
|
+
set_target_properties(base64 PROPERTIES
|
142
|
+
C_VISIBILITY_PRESET hidden
|
143
|
+
)
|
144
|
+
else()
|
145
|
+
target_compile_definitions(base64
|
146
|
+
PUBLIC
|
147
|
+
BASE64_STATIC_DEFINE
|
148
|
+
)
|
149
|
+
endif()
|
150
|
+
|
151
|
+
target_compile_options(base64 PRIVATE
|
152
|
+
$<$<C_COMPILER_ID:MSVC>:
|
153
|
+
/W4
|
154
|
+
/WX # All warnings as error
|
155
|
+
/we4013 # Error warning C4013: 'function' undefined; assuming extern returning int
|
156
|
+
/we4700 # Error warning C4700: uninitialized local variable
|
157
|
+
/we4715 # not all control paths return a value
|
158
|
+
/we4003 # not enough actual parameters for macro
|
159
|
+
/wd4456 # disable warning C4456: declaration of 'xxx' hides previous local declaration
|
160
|
+
>
|
161
|
+
$<$<NOT:$<C_COMPILER_ID:MSVC>>:
|
162
|
+
-Wall
|
163
|
+
-Wextra
|
164
|
+
-Wpedantic
|
165
|
+
-O3
|
166
|
+
>
|
167
|
+
)
|
168
|
+
|
169
|
+
target_compile_definitions(base64 PRIVATE
|
170
|
+
$<$<C_COMPILER_ID:MSVC>:
|
171
|
+
# remove unnecessary warnings about unchecked iterators
|
172
|
+
_SCL_SECURE_NO_WARNINGS
|
173
|
+
>
|
174
|
+
)
|
175
|
+
|
176
|
+
########################################################################
|
177
|
+
# SIMD settings
|
178
|
+
include(TargetSIMDInstructionSet)
|
179
|
+
define_SIMD_compile_flags()
|
180
|
+
|
181
|
+
if (_TARGET_ARCH STREQUAL "x86" OR _TARGET_ARCH STREQUAL "x64")
|
182
|
+
macro(configure_codec _TYPE)
|
183
|
+
if (BASE64_WITH_${_TYPE})
|
184
|
+
message(STATUS "Add codec: lib/arch/${_DIR}/codec.c")
|
185
|
+
string(TOLOWER "${_TYPE}" _DIR)
|
186
|
+
set_source_files_properties("lib/arch/${_DIR}/codec.c" PROPERTIES
|
187
|
+
COMPILE_FLAGS "${COMPILE_FLAGS_${_TYPE}}"
|
188
|
+
)
|
189
|
+
|
190
|
+
if (${ARGC} GREATER 1 AND MSVC)
|
191
|
+
set_source_files_properties("lib/arch/${_DIR}/codec.c" PROPERTIES
|
192
|
+
COMPILE_DEFINITIONS ${ARGV1}
|
193
|
+
)
|
194
|
+
endif()
|
195
|
+
endif()
|
196
|
+
endmacro()
|
197
|
+
|
198
|
+
configure_codec(SSSE3 __SSSE3__)
|
199
|
+
configure_codec(SSE41 __SSSE4_1__)
|
200
|
+
configure_codec(SSE42 __SSSE4_2__)
|
201
|
+
configure_codec(AVX)
|
202
|
+
configure_codec(AVX2)
|
203
|
+
|
204
|
+
elseif (_TARGET_ARCH STREQUAL "arm")
|
205
|
+
set(BASE64_NEON32_CFLAGS "${COMPILE_FLAGS_NEON32}" CACHE STRING "the NEON32 compile flags (for 'lib/arch/neon32/codec.c')")
|
206
|
+
mark_as_advanced(BASE64_NEON32_CFLAGS)
|
207
|
+
|
208
|
+
if (BASE64_WITH_NEON32)
|
209
|
+
set_source_files_properties("lib/arch/neon32/codec.c" PROPERTIES
|
210
|
+
COMPILE_FLAGS "${BASE64_NEON32_CFLAGS} "
|
211
|
+
)
|
212
|
+
endif()
|
213
|
+
|
214
|
+
#elseif (_TARGET_ARCH STREQUAL "arm64" AND BASE64_WITH_NEON64)
|
215
|
+
|
216
|
+
endif()
|
217
|
+
|
218
|
+
configure_file("${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
|
219
|
+
|
220
|
+
########################################################################
|
221
|
+
# OpenMP Settings
|
222
|
+
if (BASE64_WITH_OpenMP)
|
223
|
+
target_compile_options(base64
|
224
|
+
PRIVATE
|
225
|
+
${OpenMP_C_FLAGS}
|
226
|
+
)
|
227
|
+
endif()
|
228
|
+
|
229
|
+
########################################################################
|
230
|
+
if (BASE64_BUILD_TESTS)
|
231
|
+
enable_testing()
|
232
|
+
add_subdirectory(test)
|
233
|
+
endif()
|
234
|
+
|
235
|
+
########################################################################
|
236
|
+
# cmake install
|
237
|
+
install(DIRECTORY include/ TYPE INCLUDE)
|
238
|
+
install(TARGETS base64 EXPORT base64-targets)
|
239
|
+
|
240
|
+
include(CMakePackageConfigHelpers)
|
241
|
+
configure_package_config_file(cmake/base64-config.cmake.in
|
242
|
+
"${CMAKE_CURRENT_BINARY_DIR}/base64-config.cmake"
|
243
|
+
|
244
|
+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
245
|
+
)
|
246
|
+
write_basic_package_version_file(
|
247
|
+
"${CMAKE_CURRENT_BINARY_DIR}/base64-config-version.cmake"
|
248
|
+
VERSION ${BASE64_VERSION}
|
249
|
+
COMPATIBILITY ExactVersion
|
250
|
+
)
|
251
|
+
|
252
|
+
install(FILES
|
253
|
+
"${CMAKE_CURRENT_BINARY_DIR}/base64-config.cmake"
|
254
|
+
"${CMAKE_CURRENT_BINARY_DIR}/base64-config-version.cmake"
|
255
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
256
|
+
)
|
257
|
+
|
258
|
+
install(EXPORT base64-targets
|
259
|
+
NAMESPACE aklomp::
|
260
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
261
|
+
)
|
262
|
+
|
263
|
+
########################################################################
|
264
|
+
feature_summary(WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND ENABLED_FEATURES DISABLED_FEATURES)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Copyright (c) 2005-2007, Nick Galbreath
|
2
|
+
Copyright (c) 2013-2019, Alfred Klomp
|
3
|
+
Copyright (c) 2015-2017, Wojciech Mula
|
4
|
+
Copyright (c) 2016-2017, Matthieu Darbois
|
5
|
+
All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
8
|
+
modification, are permitted provided that the following conditions are
|
9
|
+
met:
|
10
|
+
|
11
|
+
- Redistributions of source code must retain the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer.
|
13
|
+
|
14
|
+
- Redistributions in binary form must reproduce the above copyright
|
15
|
+
notice, this list of conditions and the following disclaimer in the
|
16
|
+
documentation and/or other materials provided with the distribution.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
19
|
+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
20
|
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
21
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
24
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
25
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,93 @@
|
|
1
|
+
CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic
|
2
|
+
|
3
|
+
# Set OBJCOPY if not defined by environment:
|
4
|
+
OBJCOPY ?= objcopy
|
5
|
+
|
6
|
+
OBJS = \
|
7
|
+
lib/arch/avx2/codec.o \
|
8
|
+
lib/arch/generic/codec.o \
|
9
|
+
lib/arch/neon32/codec.o \
|
10
|
+
lib/arch/neon64/codec.o \
|
11
|
+
lib/arch/ssse3/codec.o \
|
12
|
+
lib/arch/sse41/codec.o \
|
13
|
+
lib/arch/sse42/codec.o \
|
14
|
+
lib/arch/avx/codec.o \
|
15
|
+
lib/lib.o \
|
16
|
+
lib/codec_choose.o \
|
17
|
+
lib/tables/tables.o
|
18
|
+
|
19
|
+
HAVE_AVX2 = 0
|
20
|
+
HAVE_NEON32 = 0
|
21
|
+
HAVE_NEON64 = 0
|
22
|
+
HAVE_SSSE3 = 0
|
23
|
+
HAVE_SSE41 = 0
|
24
|
+
HAVE_SSE42 = 0
|
25
|
+
HAVE_AVX = 0
|
26
|
+
|
27
|
+
# The user should supply compiler flags for the codecs they want to build.
|
28
|
+
# Check which codecs we're going to include:
|
29
|
+
ifdef AVX2_CFLAGS
|
30
|
+
HAVE_AVX2 = 1
|
31
|
+
endif
|
32
|
+
ifdef NEON32_CFLAGS
|
33
|
+
HAVE_NEON32 = 1
|
34
|
+
endif
|
35
|
+
ifdef NEON64_CFLAGS
|
36
|
+
HAVE_NEON64 = 1
|
37
|
+
endif
|
38
|
+
ifdef SSSE3_CFLAGS
|
39
|
+
HAVE_SSSE3 = 1
|
40
|
+
endif
|
41
|
+
ifdef SSE41_CFLAGS
|
42
|
+
HAVE_SSE41 = 1
|
43
|
+
endif
|
44
|
+
ifdef SSE42_CFLAGS
|
45
|
+
HAVE_SSE42 = 1
|
46
|
+
endif
|
47
|
+
ifdef AVX_CFLAGS
|
48
|
+
HAVE_AVX = 1
|
49
|
+
endif
|
50
|
+
ifdef OPENMP
|
51
|
+
CFLAGS += -fopenmp
|
52
|
+
endif
|
53
|
+
|
54
|
+
|
55
|
+
.PHONY: all analyze clean
|
56
|
+
|
57
|
+
all: bin/base64 lib/libbase64.o
|
58
|
+
|
59
|
+
bin/base64: bin/base64.o lib/libbase64.o
|
60
|
+
$(CC) $(CFLAGS) -o $@ $^
|
61
|
+
|
62
|
+
lib/libbase64.o: $(OBJS)
|
63
|
+
$(LD) -r -o $@ $^
|
64
|
+
$(OBJCOPY) --keep-global-symbols=lib/exports.txt $@
|
65
|
+
|
66
|
+
lib/config.h:
|
67
|
+
@echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@
|
68
|
+
@echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@
|
69
|
+
@echo "#define HAVE_NEON64 $(HAVE_NEON64)" >> $@
|
70
|
+
@echo "#define HAVE_SSSE3 $(HAVE_SSSE3)" >> $@
|
71
|
+
@echo "#define HAVE_SSE41 $(HAVE_SSE41)" >> $@
|
72
|
+
@echo "#define HAVE_SSE42 $(HAVE_SSE42)" >> $@
|
73
|
+
@echo "#define HAVE_AVX $(HAVE_AVX)" >> $@
|
74
|
+
|
75
|
+
$(OBJS): lib/config.h
|
76
|
+
$(OBJS): CFLAGS += -Ilib
|
77
|
+
|
78
|
+
lib/arch/avx2/codec.o: CFLAGS += $(AVX2_CFLAGS)
|
79
|
+
lib/arch/neon32/codec.o: CFLAGS += $(NEON32_CFLAGS)
|
80
|
+
lib/arch/neon64/codec.o: CFLAGS += $(NEON64_CFLAGS)
|
81
|
+
lib/arch/ssse3/codec.o: CFLAGS += $(SSSE3_CFLAGS)
|
82
|
+
lib/arch/sse41/codec.o: CFLAGS += $(SSE41_CFLAGS)
|
83
|
+
lib/arch/sse42/codec.o: CFLAGS += $(SSE42_CFLAGS)
|
84
|
+
lib/arch/avx/codec.o: CFLAGS += $(AVX_CFLAGS)
|
85
|
+
|
86
|
+
%.o: %.c
|
87
|
+
$(CC) $(CFLAGS) -o $@ -c $<
|
88
|
+
|
89
|
+
analyze: clean
|
90
|
+
scan-build --use-analyzer=`which clang` --status-bugs make
|
91
|
+
|
92
|
+
clean:
|
93
|
+
rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h $(OBJS)
|