Commit Graph

49 Commits

Author SHA1 Message Date
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
Frédéric Wang
cd8153a1ed Do not install the public headers on WIN32. #326 2016-10-12 14:33:19 +02:00
Frédéric Wang
93933405d3 Actually use BROTLI_INCLUDE_DIRS to get the path to headers. 2016-10-07 22:52:02 +02:00
Frédéric Wang
89a77a94bb Also install the brotli headers when building the shared libraries. #326 2016-10-07 22:26:26 +02:00
Eugene Kliuchnikov
d7c4da8ad0 Merge pull request #421 from fred-wang/cmake-shared-libraries
Add support for CMake's BUILD_SHARED_LIBS option. #326
2016-08-27 17:45:57 +02:00
Frédéric Wang
5e1219a32d Fix typo in CMakeFile: s/BROTLI_BUNDLE_MODE/BROTLI_BUNDLED_MODE/ 2016-08-27 12:14:50 +02:00
Frédéric Wang
074e4acd8a Add support for CMake's BUILD_SHARED_LIBS option. #326 2016-08-27 12:05:51 +02:00
Eugene Kliuchnikov
532921b8c8 Fix CMake includes. 2016-08-23 15:35:54 +02:00
Eugene Kliuchnikov
3dcc3c02d0 Fix CMake includedirs 2016-08-23 14:49:37 +02:00
Eugene Kliuchnikov
2c2d5578a6 Use version from common/version.h 2016-08-22 15:44:12 +02:00
Evan Nemerson
fe0e153cb8 cmake: use a different variable for testing with and without libm
CMake seems to cache the result when using the same variable, at least
with some versions, so previously systems requiring libm for log2 may
not have worked as expected.
2016-08-04 18:51:20 -07:00
Evan Nemerson
c1ec7ba292 appveyor: add Visual Studio builds (based on CMake)
This only goes back to VS 12 (2013) because MSVC didn't support log2
until then.
2016-07-29 13:24:17 -07:00
Evan Nemerson
03657e8089 Add mingw support. 2016-07-28 19:32:33 -07:00
Evan Nemerson
26a59359ed Add UBSan build, use clang for sanitizer builds. 2016-07-26 17:31:26 -07:00
Evan Nemerson
37be4e37ce travis: add many additional builds 2016-07-26 08:53:26 -07:00
Evan Nemerson
93ef13f823 Add CMake build system. 2016-07-26 08:53:26 -07:00