From c20f209b1c3e94f26984d8136a38ee1927ce3427 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Fri, 21 Jan 2022 10:26:05 -0700 Subject: [PATCH] Cmake/Deps: Freetype 2.11.0 / brotli 1.0.9 The UI team requested adding woff2 support to freetype. this required a new dependency brotli. This changes adds brotili to the builder and bumps freetype to version 2.11.0 As freetype now depends on other libraries, for consistency all use of ${FREETYPE_LIBRARY} in cmake has been updated to use ${FREETYPE_LIBRARIES} adjustments have been made in the windows platform file, all other platforms use cmake's FindFreeType.cmake which already sets this variable. reviewed by: brecht Differential Revision: https://developer.blender.org/D13448 --- build_files/build_environment/CMakeLists.txt | 1 + .../build_environment/cmake/brotli.cmake | 38 +++++++++++++++++++ .../build_environment/cmake/download.cmake | 1 + .../build_environment/cmake/freetype.cmake | 10 ++++- .../build_environment/cmake/harvest.cmake | 2 + .../build_environment/cmake/versions.cmake | 11 +++++- .../cmake/platform/platform_win32.cmake | 2 +- intern/ghost/test/CMakeLists.txt | 2 +- source/blender/blenfont/CMakeLists.txt | 2 +- source/blender/blenkernel/CMakeLists.txt | 2 +- 10 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 build_files/build_environment/cmake/brotli.cmake diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index af1653de59a..0d305e0dd1f 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -63,6 +63,7 @@ include(cmake/jpeg.cmake) include(cmake/blosc.cmake) include(cmake/pthreads.cmake) include(cmake/openexr.cmake) +include(cmake/brotli.cmake) include(cmake/freetype.cmake) include(cmake/freeglut.cmake) include(cmake/glew.cmake) diff --git a/build_files/build_environment/cmake/brotli.cmake b/build_files/build_environment/cmake/brotli.cmake new file mode 100644 index 00000000000..24fdeae15af --- /dev/null +++ b/build_files/build_environment/cmake/brotli.cmake @@ -0,0 +1,38 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ***** END GPL LICENSE BLOCK ***** + +set(BROTLI_EXTRA_ARGS +) + +ExternalProject_Add(external_brotli + URL file://${PACKAGE_DIR}/${BROTLI_FILE} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH ${BROTLI_HASH_TYPE}=${BROTLI_HASH} + PREFIX ${BUILD_DIR}/brotli + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/brotli ${DEFAULT_CMAKE_FLAGS} ${BROTLI_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/brotli +) + +if(BUILD_MODE STREQUAL Release AND WIN32) + ExternalProject_Add_Step(external_brotli after_install + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/brotli/include ${HARVEST_TARGET}/brotli/include + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlidec-static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/brotlidec-static${LIBEXT} + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlicommon-static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/brotlicommon-static${LIBEXT} + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/download.cmake b/build_files/build_environment/cmake/download.cmake index 2a84202ea02..d3a4d767c08 100644 --- a/build_files/build_environment/cmake/download.cmake +++ b/build_files/build_environment/cmake/download.cmake @@ -94,3 +94,4 @@ download_source(POTRACE) download_source(HARU) download_source(ZSTD) download_source(FLEX) +download_source(BROTLI) diff --git a/build_files/build_environment/cmake/freetype.cmake b/build_files/build_environment/cmake/freetype.cmake index 49a83cb3377..52261b47618 100644 --- a/build_files/build_environment/cmake/freetype.cmake +++ b/build_files/build_environment/cmake/freetype.cmake @@ -23,9 +23,12 @@ set(FREETYPE_EXTRA_ARGS -DWITH_HarfBuzz=OFF -DFT_WITH_HARFBUZZ=OFF -DFT_WITH_BZIP2=OFF + -DFT_WITH_BROTLI=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE) + -DPC_BROTLIDEC_INCLUDEDIR=${LIBDIR}/brotli/include + -DPC_BROTLIDEC_LIBDIR=${LIBDIR}/brotli/lib + ) ExternalProject_Add(external_freetype URL file://${PACKAGE_DIR}/${FREETYPE_FILE} @@ -36,6 +39,11 @@ ExternalProject_Add(external_freetype INSTALL_DIR ${LIBDIR}/freetype ) +add_dependencies( + external_freetype + external_brotli +) + if(BUILD_MODE STREQUAL Release AND WIN32) ExternalProject_Add_Step(external_freetype after_install COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 4d06430ea49..0e68e720b44 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -79,6 +79,8 @@ endfunction() harvest(alembic/include alembic/include "*.h") harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a) harvest(alembic/bin alembic/bin "*") +harvest(brotli/include brotli/include "*.h") +harvest(brotli/lib brotli/lib "*.a") harvest(boost/include boost/include "*") harvest(boost/lib boost/lib "*.a") harvest(ffmpeg/include ffmpeg/include "*.h") diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index c758dbd265e..cc811cef06f 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -83,9 +83,9 @@ else() set(OPENEXR_VERSION_POSTFIX) endif() -set(FREETYPE_VERSION 2.10.2) +set(FREETYPE_VERSION 2.11.0) set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz) -set(FREETYPE_HASH b1cb620e4c875cd4d1bfa04945400945) +set(FREETYPE_HASH cf09172322f6b50cf8f568bf8fe14bde) set(FREETYPE_HASH_TYPE MD5) set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz) @@ -500,3 +500,10 @@ set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz) set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git) set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525) + +set(BROTLI_VERSION v1.0.9) +set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz) +set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46) +set(BROTLI_HASH_TYPE SHA256) +set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz) + diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 851dafc34fb..26cdde9d819 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -347,7 +347,7 @@ set(FREETYPE_INCLUDE_DIRS ${LIBDIR}/freetype/include ${LIBDIR}/freetype/include/freetype2 ) -set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib) +set(FREETYPE_LIBRARIES ${LIBDIR}/freetype/lib/freetype2ST.lib) windows_find_package(freetype REQUIRED) if(WITH_FFTW3) diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index 37bb00332dd..acd0da8785e 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -292,7 +292,7 @@ target_link_libraries(multitest_c guardedalloc_lib wcwidth_lib ${OPENGL_gl_LIBRARY} - ${FREETYPE_LIBRARY} + ${FREETYPE_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS} ${PLATFORM_LINKLIBS} diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index cc6e298b322..b1453b243c0 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -54,7 +54,7 @@ set(LIB bf_gpu bf_intern_guardedalloc - ${FREETYPE_LIBRARY} + ${FREETYPE_LIBRARIES} ) if(WIN32) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index cb32bc29463..358ae934088 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -522,7 +522,7 @@ set(LIB bf_simulation # For `vfontdata_freetype.c`. - ${FREETYPE_LIBRARY} + ${FREETYPE_LIBRARIES} ) if(WITH_BINRELOC)