mirror of
https://github.com/google/brotli.git
synced 2025-01-04 06:00:15 +00:00
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
This commit is contained in:
parent
3d1767186d
commit
ca21dac8e5
33
.travis.yml
33
.travis.yml
@ -44,27 +44,27 @@ matrix:
|
|||||||
## Test that fuzzer is compiling / working.
|
## Test that fuzzer is compiling / working.
|
||||||
###
|
###
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=fuzz C_COMPILER=clang-5.0 CXX_COMPILER=clang++-5.0 ASAN_OPTIONS=detect_leaks=0
|
env: BUILD_SYSTEM=fuzz C_COMPILER=clang-7 CXX_COMPILER=clang++-7 ASAN_OPTIONS=detect_leaks=0
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-xenial-7
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-7
|
||||||
|
|
||||||
###
|
###
|
||||||
## clang on Linux
|
## clang on Linux
|
||||||
###
|
###
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=cmake C_COMPILER=clang-5.0 CXX_COMPILER=clang++-5.0
|
env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-xenial-7
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-7
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=cmake C_COMPILER=clang-3.5 CXX_COMPILER=clang++-3.5
|
env: BUILD_SYSTEM=cmake C_COMPILER=clang-3.5 CXX_COMPILER=clang++-3.5
|
||||||
addons:
|
addons:
|
||||||
@ -145,35 +145,38 @@ matrix:
|
|||||||
## Sanitizers
|
## Sanitizers
|
||||||
###
|
###
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=cmake C_COMPILER=clang-5.0 CXX_COMPILER=clang++-5.0 SANITIZER=address ASAN_OPTIONS=detect_leaks=0
|
env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=address ASAN_OPTIONS=detect_leaks=0
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-xenial-7
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-7
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=cmake C_COMPILER=clang-5.0 CXX_COMPILER=clang++-5.0 SANITIZER=thread
|
env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=thread
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-xenial-7
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-7
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=cmake C_COMPILER=clang-5.0 CXX_COMPILER=clang++-5.0 SANITIZER=undefined CFLAGS="-fno-sanitize-recover=undefined,integer"
|
env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=undefined CFLAGS="-fno-sanitize-recover=undefined,integer"
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-5.0
|
- llvm-toolchain-xenial-7
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-7
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: BUILD_SYSTEM=maven
|
env: BUILD_SYSTEM=maven
|
||||||
|
jdk:
|
||||||
|
# maven + jdk11 + javadoc == trouble
|
||||||
|
- openjdk10
|
||||||
language: java
|
language: java
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 2.8.6)
|
|||||||
|
|
||||||
project(brotli C)
|
project(brotli C)
|
||||||
|
|
||||||
|
option(BROTLI_DISABLE_SHARED "do not build shared libraries")
|
||||||
|
|
||||||
# If Brotli is being bundled in another project, we don't want to
|
# If Brotli is being bundled in another project, we don't want to
|
||||||
# install anything. However, we want to let people override this, so
|
# install anything. However, we want to let people override this, so
|
||||||
# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just
|
# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just
|
||||||
@ -137,10 +139,16 @@ endfunction()
|
|||||||
transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
||||||
include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
||||||
|
|
||||||
add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
|
if(BROTLI_DISABLE_SHARED)
|
||||||
add_library(brotlidec SHARED ${BROTLI_DEC_C})
|
set(BROTLI_SHARED_LIBS "")
|
||||||
add_library(brotlienc SHARED ${BROTLI_ENC_C})
|
else()
|
||||||
|
set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc)
|
||||||
|
add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
|
||||||
|
add_library(brotlidec SHARED ${BROTLI_DEC_C})
|
||||||
|
add_library(brotlienc SHARED ${BROTLI_ENC_C})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(BROTLI_STATIC_LIBS brotlicommon-static brotlidec-static brotlienc-static)
|
||||||
add_library(brotlicommon-static STATIC ${BROTLI_COMMON_C})
|
add_library(brotlicommon-static STATIC ${BROTLI_COMMON_C})
|
||||||
add_library(brotlidec-static STATIC ${BROTLI_DEC_C})
|
add_library(brotlidec-static STATIC ${BROTLI_DEC_C})
|
||||||
add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
|
add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
|
||||||
@ -148,13 +156,13 @@ add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
|
|||||||
# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
|
# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
|
||||||
include_directories(${BROTLI_INCLUDE_DIRS})
|
include_directories(${BROTLI_INCLUDE_DIRS})
|
||||||
|
|
||||||
foreach(lib brotlicommon brotlidec brotlienc)
|
foreach(lib IN LISTS BROTLI_SHARED_LIBS)
|
||||||
target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
|
target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
|
||||||
string(TOUPPER "${lib}" LIB)
|
string(TOUPPER "${lib}" LIB)
|
||||||
set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION" )
|
set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(lib brotlicommon brotlidec brotlienc brotlicommon-static brotlidec-static brotlienc-static)
|
foreach(lib IN LISTS BROTLI_SHARED_LIBS BROTLI_STATIC_LIBS)
|
||||||
target_link_libraries(${lib} ${LIBM_LIBRARY})
|
target_link_libraries(${lib} ${LIBM_LIBRARY})
|
||||||
set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS})
|
set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS})
|
||||||
set_target_properties(${lib} PROPERTIES
|
set_target_properties(${lib} PROPERTIES
|
||||||
@ -164,8 +172,10 @@ foreach(lib brotlicommon brotlidec brotlienc brotlicommon-static brotlidec-stati
|
|||||||
set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}")
|
set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT BROTLI_DISABLE_SHARED)
|
||||||
target_link_libraries(brotlidec brotlicommon)
|
target_link_libraries(brotlidec brotlicommon)
|
||||||
target_link_libraries(brotlienc brotlicommon)
|
target_link_libraries(brotlienc brotlicommon)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(brotlidec-static brotlicommon-static)
|
target_link_libraries(brotlidec-static brotlicommon-static)
|
||||||
target_link_libraries(brotlienc-static brotlicommon-static)
|
target_link_libraries(brotlienc-static brotlicommon-static)
|
||||||
|
@ -80,8 +80,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.5</source>
|
<source>1.6</source>
|
||||||
<target>1.5</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
Loading…
Reference in New Issue
Block a user