By convention projects using CMake which can build either static or
shared libraries use a BUILD_SHARED_LIBS flag to allow selecting between
both: the add_library() command automatically switches between both using
this variable when the library kind is not passed to add_library(). It
is also usual to expose the BUILD_SHARED_LIBS as an user-facing setting
with the option() command.
This way, the following will both work as expected:
% cmake -DBUILD_SHARED_LIBS=OFF ...
% cmake -DBUILS_SHARED_LIBS=ON ...
This is helpful for distributions which need (or want) to build only
static libraries.
Documentation:
- add note that brotli is a "stream" format, not an archive-like
- regenerate .1 with Pandoc
Build:
- drop legacy "BROTLI_BUILD_PORTABLE" option
- drop "BROTLI_SANITIZED" definition
Code:
- c: comb includes
- c/enc: extract encoder state into separate header
- c/enc: drop designated q10 codepath
- c/enc: dealing better with flushing of empty stream
- fix MSVC compilation
API:
- py: use library version instead of one in version.h
- c: add plugable API to report consumed input / produced output
- c/java: support "lean" prepared dictionaries (without copy of source)
* Wrap interface include directories with BUILD_INTERFACE generator expression
When exporting a CMake target using install(TARGETS) + install(EXPORT),
CMake requires all include directories to be clean of build system
directories.
https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.html
This change also allows use of brotli as a CMake subproject and
installing + exporting it.
* Fix typo in generator expression
* bootstrap: Verify functionality of sed
Check for the existence of sed by running a simple substitution rather
than using the --version flag. This lets us remove the weird exclusion
of FreeBSD from checking the sed requirement, and fixes checking the sed
requirement on other systems like macOS that use BSD sed, which doesn't
support --version.
* bootstrap: Detect flag for sed extended RE
Detect whether sed needs -E or -r to enable extended regular
expressions. Fixes bootstrap on macOS, whose BSD sed does not support
-r.
GNU sed has supported -E as a synonym for -r since version 4.2 (2009),
initially as an undocumented option for compatibility with BSD sed:
http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=3a8e165ab02487c372df217c1989e287625ce0ae
and later as a documented option after -E became POSIX:
http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=8b65e07904384b529a464c89f3739d2e7e4d5135
Starting python 3.10, the use of - instead of _ will get a warn (see https://bugs.gentoo.org/796281 for reference)
Signed-off-by: Marco Scardovi <marco@scardovi.com>
Not providing VERSION to "project" command will cause a warning.
Since this project's version is loaded from other files, this policy will help suppress the warning generated by cmake.
This policy is set because we can't provide "VERSION" in "project" command.
Use `cmake --help-policy CMP0048` for more information
Not all combinations are migrated to the initial configuration; corresponding TODOs added.
Drive-by: additional combinations uncovered minor portability problems -> fixed
Drive-by: remove no-longer used "script" files.
Co-authored-by: Eugene Kliuchnikov <eustas@chromium.org>
* slimmer stack frames in encoder
* fix MSAN problem in hasher_composite
(not dangerous, only in large_window mode)
* fix JNI decoder wrapper - power-of-two payloads fail to decode sometimes
* reformat polyfil.js and decode_test.js
Make VLA buffer types consistent in declarations and definitions.
Resolves build crash when using -Werror due to "vla-parameter" warning.
Signed-off-by: Adrian Herrera <adr.her.arc.95@gmail.com>
* re-enable Js build/test
* improve decoder performance
* rewrite dictionary data in Java/Js to a shorter uncompressed form
* improve dictionary generation tool
The -lm linker option is not known to MSVC and setting it triggers
errors in some build systems:
[6,366 / 6,367] Linking source/exe/envoy-static.exe; 11s remote
LINK : warning LNK4044: unrecognized option '/lm'; ignored
LINK : error LNK1218: warning treated as error; no output file generated
ERROR: C:/source/source/exe/BUILD:22:16: Linking of rule
'//source/exe:envoy-static' failed (Exit 4044): link.exe failed: error
executing command
Do not set -lm in case of MSVC.
clang-10 throws the following error:
In file included from external/org_brotli/c/enc/bit_cost.c:9:
external/org_brotli/c/enc/./bit_cost.h:48:16: error: implicit conversion
from 'size_t' (aka 'unsigned long') to 'double' may lose precision
[-Werror,-Wimplicit-int-float-conversion]
if (retval < sum) {
~ ^~~
1 error generated.
Make the conversion explicit.