diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2021-02-01 19:28:57 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2021-02-01 19:28:57 +0300 |
commit | 59054d906fa9b539a14768101ba66c1182c13f0f (patch) | |
tree | bc10d904496f23fadd7a3a06537ad0cbbd7ea4fe /build_files/build_environment | |
parent | 84dddf641edecb9de773ac7e07d18dab49b82db5 (diff) |
CMake/Windows/macOS: Add Libharu
Decision: https://lists.blender.org/pipermail/bf-committers/2020-December/050836.html
Adds CMake dependency builder support. Tested on
macOS and Windows (Thanks @LazyDodo).
Reviewed By: #platform_macos, LazyDodo, sebbas
Maniphest Task: T84836
Differential Revision: https://developer.blender.org/D9928
Diffstat (limited to 'build_files/build_environment')
-rw-r--r-- | build_files/build_environment/CMakeLists.txt | 1 | ||||
-rw-r--r-- | build_files/build_environment/cmake/haru.cmake | 46 | ||||
-rw-r--r-- | build_files/build_environment/cmake/harvest.cmake | 2 | ||||
-rw-r--r-- | build_files/build_environment/cmake/versions.cmake | 4 | ||||
-rw-r--r-- | build_files/build_environment/patches/haru.diff | 12 |
5 files changed, 65 insertions, 0 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index dfbb0e824a0..672f5820a16 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -92,6 +92,7 @@ include(cmake/package_python.cmake) include(cmake/numpy.cmake) include(cmake/usd.cmake) include(cmake/potrace.cmake) +include(cmake/haru.cmake) # Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed. include(cmake/boost.cmake) include(cmake/pugixml.cmake) diff --git a/build_files/build_environment/cmake/haru.cmake b/build_files/build_environment/cmake/haru.cmake new file mode 100644 index 00000000000..7382095f459 --- /dev/null +++ b/build_files/build_environment/cmake/haru.cmake @@ -0,0 +1,46 @@ +# ***** 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(HARU_EXTRA_ARGS + -DLIBHPDF_SHARED=OFF + -DLIBHPDF_STATIC=ON + -DLIBHPDF_EXAMPLES=OFF + -DLIBHPDF_ENABLE_EXCEPTIONS=ON +) + +ExternalProject_Add(external_haru + URL ${HARU_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${HARU_HASH} + PREFIX ${BUILD_DIR}/haru + PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/haru/src/external_haru < ${PATCH_DIR}/haru.diff + CMAKE_ARGS + -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/haru + ${DEFAULT_CMAKE_FLAGS} ${HARU_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/haru +) + +if(WIN32) + if(BUILD_MODE STREQUAL Release) + ExternalProject_Add_Step(external_haru after_install + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/haru/include ${HARVEST_TARGET}/haru/include + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/haru/lib/libhpdfs.lib ${HARVEST_TARGET}/haru/lib/libhpdfs.lib + DEPENDEES install + ) + endif() +endif() diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 536907f563d..6785b727a69 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -187,6 +187,8 @@ harvest(usd/lib/usd usd/lib/usd "*") harvest(usd/plugin usd/plugin "*") harvest(potrace/include potrace/include "*.h") harvest(potrace/lib potrace/lib "*.a") +harvest(haru/include haru/include "*.h") +harvest(haru/lib haru/lib "*.a") if(UNIX AND NOT APPLE) harvest(libglu/lib mesa/lib "*.so*") diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index d4a2c715ecc..8d3793ef242 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -331,3 +331,7 @@ set(GMP_HASH a325e3f09e6d91e62101e59f9bda3ec1) set(POTRACE_VERSION 1.16) set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz) set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69) + +set(HARU_VERSION 2_3_0) +set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz) +set(HARU_HASH 4f916aa49c3069b3a10850013c507460) diff --git a/build_files/build_environment/patches/haru.diff b/build_files/build_environment/patches/haru.diff new file mode 100644 index 00000000000..fed551b4bf0 --- /dev/null +++ b/build_files/build_environment/patches/haru.diff @@ -0,0 +1,12 @@ +diff --git a/src/hpdf_image_ccitt.c b/src/hpdf_image_ccitt.c +index 8672763..9be531a 100644 +--- a/src/hpdf_image_ccitt.c ++++ b/src/hpdf_image_ccitt.c +@@ -21,7 +21,6 @@ + #include <memory.h> + #include <assert.h> + +-#define G3CODES + #include "t4.h" + + typedef unsigned int uint32; |