Commit Graph

65 Commits

Author SHA1 Message Date
Evgenii Kliuchnikov
adbc354d23 simplify log2 check; currently we rely more on compiler than build system
PiperOrigin-RevId: 598794971
2024-01-16 04:02:00 -08:00
Eugene Kliuchnikov
adac2b0e7d
Merge branch 'master' into brotli-cmake-tweaks 2023-12-08 15:39:58 +01:00
Evgenii Kliuchnikov
2b6d8654d4 add an option to disable brotli tools
PiperOrigin-RevId: 585593185
2023-11-27 03:13:14 -08:00
Sergei Trofimovich
cff5803216 CMakeLists.txt: use CMAKE_INSTALL_FULL_MANDIR for mans install
Without the change install just fails for me as `SHARE_INSTALL_PREFIX`
is unset for me.

Following https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
I'm using absolute path expansion to install mans.
2023-09-21 16:39:53 +01:00
Sergei Trofimovich
3ad47114b8 CMakeLists.txt: use CMAKE_INSTALL_FULL_LIBDIR for runpath on darwin
Without the change on systems where `CMAKE_INSTALL_LIBDIR` is an
absolute path outside `CMAKE_INSTALL_PREFIX` (like `nixpkgs`) libraries
ended up embedding wrong RPATH and libraries failed to load.

The change uses suggestion from https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
to use `CMAKE_INSTALL_FULL_LIBDIR` (similar to library install code)
to enbed it as an RPATH.
2023-09-21 16:39:53 +01:00
Evgenii Kliuchnikov
ce9c16e882 upload full testdata archive
PiperOrigin-RevId: 565017690
2023-09-13 05:13:57 -07:00
Evgenii Kliuchnikov
cf95fbb9c5 reword cmake test generator warning
PiperOrigin-RevId: 564371898
2023-09-11 07:08:50 -07:00
Tomasz Kłoczko
741610efd3 install man pages
cmake modyfication to install man pages.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
2023-08-31 08:47:47 +00:00
Evgenii Kliuchnikov
257884a3c5 restore BROTLI_VERSION var in CMake build
PiperOrigin-RevId: 552507047
2023-07-31 09:37:29 -07:00
Evgenii Kliuchnikov
d639a81d35 add option to delete files that are not "compressed"
PiperOrigin-RevId: 552472135
2023-07-31 07:19:14 -07:00
zhongfly
802475e724
fix missing version in CMake build (#1048) 2023-07-31 11:04:46 +02:00
Evgenii Kliuchnikov
27a9a80992 simplify CMake build
PiperOrigin-RevId: 552238545
2023-07-30 03:45:11 -07:00
Evgenii Kliuchnikov
6ee96e291d Internal changes
PiperOrigin-RevId: 545262005
2023-07-04 07:55:25 +00:00
Evgenii Kliuchnikov
6db17c87f5 0.4-1.5% decoder speedup
PiperOrigin-RevId: 513248503
2023-07-04 07:53:20 +00:00
Eugene Kliuchnikov
50ebce107f
Fix Bazel build (#1024) 2023-06-22 11:29:08 +02:00
Eugene Kliuchnikov
81dc1c86c3
Ramp up CMake to v3 (#991)
Drive-by: drop premake5 support
2022-12-22 12:15:55 +01:00
Kleis Auke Wolthuizen
9b53703237
CMake: ensure static libraries are still installed on Emscripten (#988)
Similar to commit ce222e317e.
2022-12-20 11:03:21 +01:00
Adrian Perez
641bec0e30
CMake: Allow using BUILD_SHARED_LIBS to choose static/shared libs (#655)
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.
2022-12-16 11:42:42 +01:00
Lukas Oberhuber
f842c1bcf9
fix macos rpath (#976)
Without this patch, the three libraries are not provided with valid
rpaths, meaning they are not packaged correctly for macos.

c.f. https://github.com/google/brotli/issues/934
(which is a similar issue) but should be fixed by this fix as well.

Also https://gitlab.gnome.org/Infrastructure/gimp-macos-build/-/merge_requests/129
2022-11-17 14:37:20 +01:00
Evgenii Kliuchnikov
a8f5813b84 Update
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)
2022-11-17 13:03:09 +00:00
Anonymous Maarten
9801a2c5d6
Wrap interface include directories with BUILD_INTERFACE generator expression (#966)
* 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
2022-05-12 10:50:48 +03:00
Mohammad Bahoosh
e83c7b8e8f
Supress cmake warning (#931)
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
2021-12-15 13:28:25 +03:00
Dirk Lemstra
ce222e317e
Enabled install when building with emscripten. (#906)
* Enabled install when building with emscripten.

* Also install the pkg-config files.
2021-06-23 10:12:21 +02:00
Eugene Kliuchnikov
d052918255
Fix build files (#829) 2020-08-26 17:13:31 +02:00
Eugene Kliuchnikov
e8155d67b0
CMake: change default ("") build type to Release (#818)
Fix #817
2020-07-09 15:35:57 +02:00
Cristi Vîjdea
f503cb709c
Add HAVE_LOG2 build macro (#783)
* Add HAVE_LOG2 build macro

Fixes #781

* Rename macro to BROTLI_HAVE_LOG2 and move comment for visibility
2020-03-19 10:46:52 +01:00
Eugene Kliuchnikov
35ef5c554d
Disable PIC in EMCC mode. (#768) 2019-08-13 15:23:04 +02:00
Eugene Kliuchnikov
ca21dac8e5
Add an option to avoid building shared libraries. (#766)
Add an option to avoid building shared libraries (for building with EMCC)

Drive-by:
* maven: ramp up java level to minimal required
* travis: replace deprecated clang-5.0 with clang-7
* maven: fallback to jdk10 to void javadoc bug
2019-08-07 10:51:55 +02:00
Stephen Kyle
67f059eaf5 Cross compilation support (#709)
* build: add cross-compilation support to make

Set CROSS_COMPILE when running make to use the selected cross
compilation toolchain, such as arm-linux-gnueabihf, or
aarch64-linux-gnu.

Testing requires the presence of qemu - 'qemu-$(ARCH)' will be executed,
where ARCH is the first part of the toolchain triplet.

* build: add cross-compilation support to cmake

If C_COMPILER/CXX_COMPILER/CC/CXX are found to have cross-compilation
triplets in front of the compiler, then qemu will be used to execute the
tests.

* CI: add arm-linux-gnueabihf-gcc builder to Travis

The version of qemu available in Ubuntu trusty (as provided by Travis)
appears to have a bug in qemu-aarch64, which leads to the compatibility
tests failing on some inputs, erroneously rejecting the input as
corrupt.

Once Travis supports xenial, we could add an aarch64-gnu-linux-gcc
builder as well.

* CI: propagate cmake errors out of .travis.sh

Seems like even if cmake fails, the error isn't picked up by Travis.
2018-09-27 11:00:33 +02:00
Jørgen Ibsen
6eba239a5b Fix auto detect of bundled mode (#704)
Set bundled mode to ON when parent directory is not empty. Due to the
peculiarities of CMake if, comparing an undefined variable to the empty
string is false, so this likely never triggered.
2018-09-13 13:31:23 -04:00
Adrian Perez
515fc62313 Tell CMake to not check for a C++ compiler (#653)
By default CMake checks both for C and C++ compilers, while the latter
is not needed. Setting the list of languages to just "C" in the call to
project() removes the unneeded check.
2018-03-26 21:41:18 +06:00
Jeremy Bicha
63e15bb3a6 Don't set rpath (#629) 2017-12-07 20:39:07 +01:00
Eugene Kliuchnikov
0ad94eed00
Update (#620)
* add autotools build
* separate semantic and ABI version
* extract sources.lst (used by CMake and Automake)
* share pkgconfig templates (used by CMake and Automake)
* decoder: always set `total_out`
* encoder: fix `BROTLI_ENSURE_CAPACITY` macro (no-op after preprocessor)
* decoder/encoder: refine `free_func` contract
2017-11-28 15:37:28 +01:00
Eugene Kliuchnikov
b6a017492e Install static libraries as well (#601) 2017-09-20 10:04:06 +02:00
Eugene Kliuchnikov
52f0483332 Build both static and shared libs with CMake (#599) 2017-09-19 09:40:48 +02:00
Eugene Kliuchnikov
03739d2b11 Update (#555)
Update:
 * new CLI; bro -> brotli; + man page
 * JNI wrappers preparation (for bazel build)
 * add raw binary dictionary representation `dictionary.bin`
 * add ability to side-load brotli RFC dictionary
 * decoder persists last error now
 * fix `BrotliDecoderDecompress` documentation
 * go reader don't block until necessary
 * more consistent bazel target names
 * Java dictionary data compiled footprint reduced
 * Java tests refactoring
2017-05-29 17:55:14 +02:00
Eugene Kliuchnikov
2c001010aa Unify artifact installation (#544) 2017-05-24 17:19:34 +02:00
Eugene Kliuchnikov
6ece1d8791 Move files & update paths (#541)
* Move files & update paths

* Rename build to scripts.

* Fix paths

* Fix script.
2017-04-23 14:07:08 +02:00
Ian Duncan
aaa4424d9b Fix CMakeLists.txt specifying a nonexistent pkgconfig package (#518) 2017-03-01 16:19:57 +01:00
Eugene Kliuchnikov
11df843cf0 Update encoder (#504)
* pull `BROTLI_MAX_BACKWARD_LIMIT` to constants
 * split generic and Zopfli backward references code
 * pull hashers init and stitch invocation to encoder
 * make `dictionary_hash` a compilation unit
 * add `size hint` parameter
 * add new hasher
 * use `size hint` to pick new hasher for q4
 * modernize clz guard (fix #495)
 * move `hash to binary tree` to separate file
 * add `Initialize` and `Cleanup` to all hashers
 * do not raise OOM if malloc(0) == NULL (fix #500)
2017-02-06 14:20:43 +01:00
Eugene Kliuchnikov
fe9f9a9182 Split brotli common/dec/enc .pc files (#490)
Add URL, and use DEPENS_PRIVATE generator params
2016-12-22 08:57:44 +01:00
Evan Nemerson
6c47009892 FInishing touches for installing libbrotli with CMake (#464)
* build: fix bundled mode + BUILD_SHARED_LIBS

* cmake: add soversion information

* cmake: generate pkg-config file
2016-11-01 10:03:29 +01:00
Eugene Kliuchnikov
b93cb69831 * leave static compilation declaration intouch (e.g. Python build) 2016-10-18 17:14:49 +02:00
Eugene Kliuchnikov
69982c25f1 Build shared libraries by default
* Declare `BUILD_SHARED_LIBS` option for CMake
* Define `${LIB}_SHARED_COMPILATION` when compiling shared library
* Define and use BROTLI_xxx_API
* Fix remaining unprefixed defines in port.h
2016-10-18 16:45:32 +02:00
Eugene Kliuchnikov
d767ab9eb0 Merge pull request #439 from fred-wang/remove-underscore
Remove the underscore in the name of brotli libraries. #326
2016-10-17 14:29:38 +02:00
Frédéric Wang
1c7776605d CMake: Also add ARCHIVE DESTINATION for non-WIN32 2016-10-12 21:20:04 +02:00
Frédéric Wang
ed2748abbf Remove the underscore in the name of brotli libraries. #326 2016-10-12 18:24:04 +02:00
Frédéric Wang
9389876ee9 Add ARCHIVE destination for Windows. 2016-10-12 16:59:11 +02:00
Frédéric Wang
c41962f0ae Use install directories provided by GNUInstallDirs. 2016-10-12 16:12:13 +02:00
Frédéric Wang
82536d2bae Also install the libraries and headers when building static libraries. 2016-10-12 14:53:37 +02:00