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/cmake | |
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/cmake')
-rw-r--r-- | build_files/cmake/Modules/FindHaru.cmake | 64 | ||||
-rw-r--r-- | build_files/cmake/config/blender_full.cmake | 1 | ||||
-rw-r--r-- | build_files/cmake/config/blender_lite.cmake | 1 | ||||
-rw-r--r-- | build_files/cmake/config/blender_release.cmake | 1 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 13 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 12 |
6 files changed, 92 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindHaru.cmake b/build_files/cmake/Modules/FindHaru.cmake new file mode 100644 index 00000000000..5774f83b8c5 --- /dev/null +++ b/build_files/cmake/Modules/FindHaru.cmake @@ -0,0 +1,64 @@ +# - Find HARU library +# Find the native Haru includes and library +# This module defines +# HARU_INCLUDE_DIRS, where to find hpdf.h, set when +# HARU_INCLUDE_DIR is found. +# HARU_LIBRARIES, libraries to link against to use Haru. +# HARU_ROOT_DIR, The base directory to search for Haru. +# This can also be an environment variable. +# HARU_FOUND, If false, do not try to use Haru. +# +# also defined, but not for general use are +# HARU_LIBRARY, where to find the Haru library. + +#============================================================================= +# Copyright 2021 Blender Foundation. +# +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. +#============================================================================= + +# If HARU_ROOT_DIR was defined in the environment, use it. +if(NOT HARU_ROOT_DIR AND NOT $ENV{HARU_ROOT_DIR} STREQUAL "") + set(HARU_ROOT_DIR $ENV{HARU_ROOT_DIR}) +endif() + +set(_haru_SEARCH_DIRS + ${HARU_ROOT_DIR} + /opt/lib/haru +) + +find_path(HARU_INCLUDE_DIR + NAMES + hpdf.h + HINTS + ${_haru_SEARCH_DIRS} + PATH_SUFFIXES + include/haru +) + +find_library(HARU_LIBRARY + NAMES + hpdfs + HINTS + ${_haru_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib +) + +# Handle the QUIETLY and REQUIRED arguments and set HARU_FOUND to TRUE if +# all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Haru DEFAULT_MSG HARU_LIBRARY HARU_INCLUDE_DIR) + +if(HARU_FOUND) + set(HARU_LIBRARIES ${HARU_LIBRARY}) + set(HARU_INCLUDE_DIRS ${HARU_INCLUDE_DIR}) +endif() + +mark_as_advanced( + HARU_INCLUDE_DIR + HARU_LIBRARY +) + +unset(_haru_SEARCH_DIRS) diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake index aab997ab453..75f78befb60 100644 --- a/build_files/cmake/config/blender_full.cmake +++ b/build_files/cmake/config/blender_full.cmake @@ -19,6 +19,7 @@ set(WITH_DRACO ON CACHE BOOL "" FORCE) set(WITH_FFTW3 ON CACHE BOOL "" FORCE) set(WITH_FREESTYLE ON CACHE BOOL "" FORCE) set(WITH_GMP ON CACHE BOOL "" FORCE) +set(WITH_HARU ON CACHE BOOL "" FORCE) set(WITH_IK_ITASC ON CACHE BOOL "" FORCE) set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE) diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake index 480548abca7..680734aba6e 100644 --- a/build_files/cmake/config/blender_lite.cmake +++ b/build_files/cmake/config/blender_lite.cmake @@ -24,6 +24,7 @@ set(WITH_DRACO OFF CACHE BOOL "" FORCE) set(WITH_FFTW3 OFF CACHE BOOL "" FORCE) set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE) set(WITH_GMP OFF CACHE BOOL "" FORCE) +set(WITH_HARU OFF CACHE BOOL "" FORCE) set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE) set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE) diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake index 96101ee7bcc..973d6cdb34e 100644 --- a/build_files/cmake/config/blender_release.cmake +++ b/build_files/cmake/config/blender_release.cmake @@ -20,6 +20,7 @@ set(WITH_DRACO ON CACHE BOOL "" FORCE) set(WITH_FFTW3 ON CACHE BOOL "" FORCE) set(WITH_FREESTYLE ON CACHE BOOL "" FORCE) set(WITH_GMP ON CACHE BOOL "" FORCE) +set(WITH_HARU ON CACHE BOOL "" FORCE) set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE) set(WITH_IK_ITASC ON CACHE BOOL "" FORCE) set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE) diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 31da5292eaf..b4f201e1959 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -428,6 +428,19 @@ if(WITH_GMP) endif() endif() +if(WITH_HARU) + find_package(Haru) + if(NOT HARU_FOUND) + message(WARNING "Haru not found, disabling WITH_HARU") + set(WITH_HARU OFF) + endif() + if(NOT WITH_IMAGE_TIFF) + # Some symbols in libharu are provided by libtiff. + message(WARNING "WITH_IMAGE_TIFF not enabled, disabling WITH_HARU") + set(WITH_HARU OFF) + endif() +endif() + if(EXISTS ${LIBDIR}) without_system_libs_end() endif() diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 016ae58fde4..69a78ba7ca6 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -800,3 +800,15 @@ if(WITH_POTRACE) set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib) set(POTRACE_FOUND On) endif() + +if(WITH_HARU) + if(EXISTS ${LIBDIR}/haru) + set(HARU_FOUND On) + set(HARU_ROOT_DIR ${LIBDIR}/haru) + set(HARU_INCLUDE_DIRS ${HARU_ROOT_DIR}/include) + set(HARU_LIBRARIES ${HARU_ROOT_DIR}/lib/libhpdfs.lib) + else() + message(WARNING "Haru was not found, disabling WITH_HARU") + set(WITH_HARU OFF) + endif() +endif() |