diff --git a/.gitignore b/.gitignore index 6b35b1f..5b27050 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /woff2_compress /woff2_decompress /woff2_info + +build diff --git a/CMakeLists.txt b/CMakeLists.txt index ecfbb83..785faa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,16 +31,7 @@ if ("${isSystemDir}" STREQUAL "-1") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}") endif() -# Find Brotli dependencies -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -find_package(BrotliDec) -if (NOT BROTLIDEC_FOUND) - message(FATAL_ERROR "librotlidec is needed to build woff2.") -endif () -find_package(BrotliEnc) -if (NOT BROTLIENC_FOUND) - message(FATAL_ERROR "librotlienc is needed to build woff2.") -endif () +add_subdirectory(brotli) # Set compiler flags if (NOT CANONICAL_PREFIXES) @@ -65,30 +56,33 @@ set(CMAKE_CXX_STANDARD 11) # Set search path for our private/public headers as well as Brotli headers include_directories("src" "include" - "${BROTLIDEC_INCLUDE_DIRS}" "${BROTLIENC_INCLUDE_DIRS}") + "${BROTLI_INCLUDE_DIRS}") # Common part used by decoder and encoder add_library(woff2common + STATIC src/table_tags.cc src/variable_length.cc src/woff2_common.cc) # WOFF2 Decoder add_library(woff2dec + STATIC src/woff2_dec.cc src/woff2_out.cc) -target_link_libraries(woff2dec woff2common "${BROTLIDEC_LIBRARIES}") +target_link_libraries(woff2dec woff2common brotlidec-static) add_executable(woff2_decompress src/woff2_decompress.cc) target_link_libraries(woff2_decompress woff2dec) # WOFF2 Encoder add_library(woff2enc + STATIC src/font.cc src/glyph.cc src/normalize.cc src/transform.cc src/woff2_enc.cc) -target_link_libraries(woff2enc woff2common "${BROTLIENC_LIBRARIES}") +target_link_libraries(woff2enc woff2common brotlienc-static) add_executable(woff2_compress src/woff2_compress.cc) target_link_libraries(woff2_compress woff2enc) diff --git a/cmake/FindBrotliDec.cmake b/cmake/FindBrotliDec.cmake deleted file mode 100644 index abb06f4..0000000 --- a/cmake/FindBrotliDec.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017 Igalia S.L. All Rights Reserved. -# -# Distributed under MIT license. -# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - -# Try to find BrotliDec. Once done, this will define -# -# BROTLIDEC_FOUND - system has BrotliDec. -# BROTLIDEC_INCLUDE_DIRS - the BrotliDec include directories -# BROTLIDEC_LIBRARIES - link these to use BrotliDec. - -find_package(PkgConfig) - -pkg_check_modules(PC_BROTLIDEC libbrotlidec) - -find_path(BROTLIDEC_INCLUDE_DIRS - NAMES brotli/decode.h - HINTS ${PC_BROTLIDEC_INCLUDEDIR} -) - -find_library(BROTLIDEC_LIBRARIES - NAMES brotlidec - HINTS ${PC_BROTLIDEC_LIBDIR} -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BrotliDec - REQUIRED_VARS BROTLIDEC_INCLUDE_DIRS BROTLIDEC_LIBRARIES - FOUND_VAR BROTLIDEC_FOUND - VERSION_VAR PC_BROTLIDEC_VERSION) - -mark_as_advanced( - BROTLIDEC_INCLUDE_DIRS - BROTLIDEC_LIBRARIES -) diff --git a/cmake/FindBrotliEnc.cmake b/cmake/FindBrotliEnc.cmake deleted file mode 100644 index 4be347d..0000000 --- a/cmake/FindBrotliEnc.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017 Igalia S.L. All Rights Reserved. -# -# Distributed under MIT license. -# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT - -# Try to find BrotliEnc. Once done, this will define -# -# BROTLIENC_FOUND - system has BrotliEnc. -# BROTLIENC_INCLUDE_DIRS - the BrotliEnc include directories -# BROTLIENC_LIBRARIES - link these to use BrotliEnc. - -find_package(PkgConfig) - -pkg_check_modules(PC_BROTLIENC libbrotlienc) - -find_path(BROTLIENC_INCLUDE_DIRS - NAMES brotli/encode.h - HINTS ${PC_BROTLIENC_INCLUDEDIR} -) - -find_library(BROTLIENC_LIBRARIES - NAMES brotlienc - HINTS ${PC_BROTLIENC_LIBDIR} -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BrotliEnc - REQUIRED_VARS BROTLIENC_INCLUDE_DIRS BROTLIENC_LIBRARIES - FOUND_VAR BROTLIENC_FOUND - VERSION_VAR PC_BROTLIENC_VERSION) - -mark_as_advanced( - BROTLIENC_INCLUDE_DIRS - BROTLIENC_LIBRARIES -)