diff --git a/src/build-scripts/build_dependencies.bash b/src/build-scripts/build_dependencies.bash new file mode 100755 index 0000000000..9ea7406be2 --- /dev/null +++ b/src/build-scripts/build_dependencies.bash @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + + +defs="" +for arg in "$@" +do + echo "Building $arg" + defs+=" -DBUILD_${arg}=ON" +done + + +if [[ "$defs" != "" ]]; then + cmake -S src/cmake/dependencies -B build/deps/depbuild -DCMAKE_INSTALL_PREFIX=build/deps/dist $defs + cmake --build build/deps/depbuild +fi diff --git a/src/cmake/build_Imath.cmake b/src/cmake/build_Imath.cmake deleted file mode 100644 index 25b7961111..0000000000 --- a/src/cmake/build_Imath.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Contributors to the OpenImageIO project. -# SPDX-License-Identifier: Apache-2.0 -# https://github.com/AcademySoftwareFoundation/OpenImageIO - -###################################################################### -# Imath by hand! -###################################################################### - -set_cache (Imath_BUILD_VERSION 3.1.10 "Imath version for local builds") -set (Imath_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath") -set (Imath_GIT_TAG "v${Imath_BUILD_VERSION}") -set_cache (Imath_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT} - DOC "Should a local Imath build, if necessary, build shared libraries" ADVANCED) - -string (MAKE_C_IDENTIFIER ${Imath_BUILD_VERSION} Imath_VERSION_IDENT) - -build_dependency_with_cmake(Imath - VERSION ${Imath_BUILD_VERSION} - GIT_REPOSITORY ${Imath_GIT_REPOSITORY} - GIT_TAG ${Imath_GIT_TAG} - CMAKE_ARGS - -D BUILD_SHARED_LIBS=${Imath_BUILD_SHARED_LIBS} - # Don't built unnecessary parts of Imath - -D BUILD_TESTING=OFF - -D IMATH_BUILD_EXAMPLES=OFF - -D IMATH_BUILD_PYTHON=OFF - -D IMATH_BUILD_TESTING=OFF - -D IMATH_BUILD_TOOLS=OFF - -D IMATH_INSTALL_DOCS=OFF - -D IMATH_INSTALL_PKG_CONFIG=OFF - -D IMATH_INSTALL_TOOLS=OFF - # Give the library a custom name and symbol namespace so it can't - # conflict with any others in the system or linked into the same app. - # not needed -D IMATH_NAMESPACE_CUSTOM=1 - # not needed -D IMATH_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_Imath_${Imath_VERSION_IDENT} - -D IMATH_LIB_SUFFIX=_v${Imath_VERSION_IDENT}_${PROJ_NAMESPACE_V} - ) - - -# Signal to caller that we need to find again at the installed location -set (Imath_REFIND TRUE) -set (Imath_REFIND_ARGS CONFIG) -set (Imath_REFIND_VERSION ${Imath_BUILD_VERSION}) - -if (Imath_BUILD_SHARED_LIBS) - install_local_dependency_libs (Imath Imath) -endif () diff --git a/src/cmake/build_OpenEXR.cmake b/src/cmake/build_OpenEXR.cmake deleted file mode 100644 index 849716fb8d..0000000000 --- a/src/cmake/build_OpenEXR.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright Contributors to the OpenImageIO project. -# SPDX-License-Identifier: Apache-2.0 -# https://github.com/AcademySoftwareFoundation/OpenImageIO - - -set_cache (OpenEXR_BUILD_VERSION 3.2.4 "OpenEXR version for local builds") -set (OpenEXR_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenEXR") -set (OpenEXR_GIT_TAG "v${OpenEXR_BUILD_VERSION}") -set_cache (OpenEXR_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT} - DOC "Should a local OpenEXR build, if necessary, build shared libraries" ADVANCED) - -string (MAKE_C_IDENTIFIER ${OpenEXR_BUILD_VERSION} OpenEXR_VERSION_IDENT) - -build_dependency_with_cmake(OpenEXR - VERSION ${OpenEXR_BUILD_VERSION} - GIT_REPOSITORY ${OpenEXR_GIT_REPOSITORY} - GIT_TAG ${OpenEXR_GIT_TAG} - CMAKE_ARGS - -D BUILD_SHARED_LIBS=${OpenEXR_BUILD_SHARED_LIBS} - -D OPENEXR_FORCE_INTERNAL_DEFLATE=ON - # Don't built unnecessary parts of OpenEXR - -D BUILD_TESTING=OFF - -D BUILD_WEBSITE=OFF - -D OPENEXR_BUILD_EXAMPLES=OFF - -D OPENEXR_BUILD_PYTHON=OFF - -D OPENEXR_BUILD_SHARED_LIBS=OFF - -D OPENEXR_BUILD_TOOLS=OFF - -D OPENEXR_BUILD_WEBSITE=OFF - -D OPENEXR_INSTALL_DOCS=OFF - -D OPENEXR_INSTALL_PKG_CONFIG=OFF - -D OPENEXR_INSTALL_TOOLS=OFF - # Give the library a custom name and symbol namespace so it can't - # conflict with any others in the system or linked into the same app. - -D OPENEXR_NAMESPACE_CUSTOM=1 - -D ILMTHREAD_NAMESPACE_CUSTOM=1 - -D IEX_NAMESPACE_CUSTOM=1 - -D OPENEXR_INTERNAL_IMF_NAMESPACE=${PROJ_NAMESPACE_V}_Imf_${OpenEXR_VERSION_IDENT} - -D ILMTHREAD_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_IlmThread_${OpenEXR_VERSION_IDENT} - -D Iex_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_Iex_${OpenEXR_VERSION_IDENT} - -D OPENEXR_LIB_SUFFIX=_v${OpenEXR_VERSION_IDENT}_${PROJ_NAMESPACE_V} - ) - - -# Signal to caller that we need to find again at the installed location -set (OpenEXR_REFIND TRUE) -set (OpenEXR_REFIND_ARGS CONFIG) -set (OpenEXR_REFIND_VERSION ${OpenEXR_BUILD_VERSION}) - -if (OpenEXR_BUILD_SHARED_LIBS) - install_local_dependency_libs (OpenEXR OpenEXR) - install_local_dependency_libs (OpenEXR IlmThread) - install_local_dependency_libs (OpenEXR Iex) -endif () diff --git a/src/cmake/dependencies/CMakeLists.txt b/src/cmake/dependencies/CMakeLists.txt new file mode 100644 index 0000000000..f2f0b5c967 --- /dev/null +++ b/src/cmake/dependencies/CMakeLists.txt @@ -0,0 +1,76 @@ +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + +cmake_minimum_required (VERSION 3.18.2) + +project (OpenImageIO_Dependencies + LANGUAGES CXX C) + +list (APPEND CMAKE_MODULE_PATH + "${PROJECT_SOURCE_DIR}/.." + ) + +# Utilities +include(set_utils) + +include(ExternalProject) + +option (VERBOSE "Print lots of messages while compiling" ON) +set (CMAKE_MESSAGE_LOG_LEVEL $,"VERBOSE","STATUS"> + CACHE STRING "CMake log level to display") + +set_cache (CMAKE_CXX_STANDARD 17 "C++ standard to use") +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE "Release") +endif () +message (STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") +set_if_not (CMAKE_POSITION_INDEPENDENT_CODE ON) + +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH + "Installation location" FORCE) +endif() +message (STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") + +set (prefix_paths ${CMAKE_INSTALL_PREFIX} ${CMAKE_PREFIX_PATH}) +set (BUILDER_COMMON_CMAKE_ARGS + -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + # -D CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} + -D CMAKE_IGNORE_PREFIX_PATH=${CMAKE_IGNORE_PREFIX_PATH} + -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK} + -D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -D CMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} + -D CMAKE_COMPILE_WARNING_AS_ERROR=OFF + -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -D CMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY} + -D CMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} + -D CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + -D CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + ) + +set_option (BUILD_all "Build all dependencies unconditionally" OFF VERBOSE) + +set (ALL_DEPS + ZLIB + Imath + OpenEXR + ) + +# set_cache (BUILD_Imath OFF "Build Imath library") +# if (BUILD_Imath OR BUILD_all) +# include (${PROJECT_SOURCE_DIR}/build_Imath.cmake) +# endif () + +foreach (dep IN LISTS ALL_DEPS) + set_cache (BUILD_${dep} ${BUILD_all} "Build ${dep} library" VERBOSE) + if (BUILD_${dep} OR BUILD_all) + include (${PROJECT_SOURCE_DIR}/build_${dep}.cmake) + set (${dep}_ROOT ${CMAKE_INSTALL_PREFIX}) + message(STATUS "Set ${dep}_ROOT = ${${dep}_ROOT}") + endif () +endforeach() diff --git a/src/cmake/dependencies/build_Imath.cmake b/src/cmake/dependencies/build_Imath.cmake new file mode 100644 index 0000000000..4099b6b268 --- /dev/null +++ b/src/cmake/dependencies/build_Imath.cmake @@ -0,0 +1,67 @@ +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + + +set_cache (Imath_BUILD_VERSION 3.1.10 "Imath version for local builds") +set_cache (Imath_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath" "Repo URL") +set_cache (Imath_GIT_TAG "v${Imath_BUILD_VERSION}" "Git tag to checkout") + +set_if_not (LOCAL_BUILD_SHARED_LIBS_DEFAULT OFF) +set_cache (Imath_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT} + DOC "Should a local Imath build, if necessary, build shared libraries" ADVANCED) +# string (MAKE_C_IDENTIFIER ${Imath_BUILD_VERSION} Imath_VERSION_IDENT) + + +ExternalProject_Add(Imath + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Imath + GIT_REPOSITORY ${Imath_GIT_REPOSITORY} + GIT_TAG ${Imath_GIT_TAG} + CMAKE_ARGS + ${BUILDER_COMMON_CMAKE_ARGS} + -D BUILD_SHARED_LIBS=${Imath_BUILD_SHARED_LIBS} + # Don't build unnecessary parts of Imath + -D BUILD_TESTING=OFF + -D IMATH_BUILD_EXAMPLES=OFF + -D IMATH_BUILD_PYTHON=OFF + -D IMATH_BUILD_TESTING=OFF + -D IMATH_BUILD_TOOLS=OFF + -D IMATH_INSTALL_DOCS=OFF + -D IMATH_INSTALL_PKG_CONFIG=OFF + -D IMATH_INSTALL_TOOLS=OFF + ) + + +# string (MAKE_C_IDENTIFIER ${Imath_BUILD_VERSION} Imath_VERSION_IDENT) +# +# build_dependency_with_cmake(Imath +# VERSION ${Imath_BUILD_VERSION} +# GIT_REPOSITORY ${Imath_GIT_REPOSITORY} +# GIT_TAG ${Imath_GIT_TAG} +# CMAKE_ARGS +# -D BUILD_SHARED_LIBS=${Imath_BUILD_SHARED_LIBS} +# # Don't built unnecessary parts of Imath +# -D BUILD_TESTING=OFF +# -D IMATH_BUILD_EXAMPLES=OFF +# -D IMATH_BUILD_PYTHON=OFF +# -D IMATH_BUILD_TESTING=OFF +# -D IMATH_BUILD_TOOLS=OFF +# -D IMATH_INSTALL_DOCS=OFF +# -D IMATH_INSTALL_PKG_CONFIG=OFF +# -D IMATH_INSTALL_TOOLS=OFF +# # Give the library a custom name and symbol namespace so it can't +# # conflict with any others in the system or linked into the same app. +# # not needed -D IMATH_NAMESPACE_CUSTOM=1 +# # not needed -D IMATH_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_Imath_${Imath_VERSION_IDENT} +# -D IMATH_LIB_SUFFIX=_v${Imath_VERSION_IDENT}_${PROJ_NAMESPACE_V} +# ) +# +# +# # Signal to caller that we need to find again at the installed location +# set (Imath_REFIND TRUE) +# set (Imath_REFIND_ARGS CONFIG) +# set (Imath_REFIND_VERSION ${Imath_BUILD_VERSION}) +# +# if (Imath_BUILD_SHARED_LIBS) +# install_local_dependency_libs (Imath Imath) +# endif () diff --git a/src/cmake/dependencies/build_OpenEXR.cmake b/src/cmake/dependencies/build_OpenEXR.cmake new file mode 100644 index 0000000000..af95377a2a --- /dev/null +++ b/src/cmake/dependencies/build_OpenEXR.cmake @@ -0,0 +1,58 @@ +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + + +set_cache (OpenEXR_BUILD_VERSION 3.2.4 "OpenEXR version for local builds") +set_cache (OpenEXR_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenEXR" "Repo URL") +set_cache (OpenEXR_GIT_TAG "v${OpenEXR_BUILD_VERSION}" "Git tag to checkout") + +set_if_not (LOCAL_BUILD_SHARED_LIBS_DEFAULT OFF) +set_cache (OpenEXR_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT} + DOC "Should a local OpenEXR build, if necessary, build shared libraries" ADVANCED) +# string (MAKE_C_IDENTIFIER ${OpenEXR_BUILD_VERSION} OpenEXR_VERSION_IDENT) + + +ExternalProject_Add(OpenEXR + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/OpenEXR + GIT_REPOSITORY ${OpenEXR_GIT_REPOSITORY} + GIT_TAG ${OpenEXR_GIT_TAG} + # DEPENDS Imath + CMAKE_ARGS + -D BUILD_SHARED_LIBS=${Imath_BUILD_SHARED_LIBS} + -D OPENEXR_FORCE_INTERNAL_DEFLATE=ON + # Don't built unnecessary parts of OpenEXR + -D BUILD_TESTING=OFF + -D BUILD_WEBSITE=OFF + -D OPENEXR_BUILD_EXAMPLES=OFF + -D OPENEXR_BUILD_PYTHON=OFF + -D OPENEXR_BUILD_SHARED_LIBS=OFF + -D OPENEXR_BUILD_TOOLS=OFF + -D OPENEXR_BUILD_WEBSITE=OFF + -D OPENEXR_INSTALL_DOCS=OFF + -D OPENEXR_INSTALL_PKG_CONFIG=OFF + -D OPENEXR_INSTALL_TOOLS=OFF + -D IMATH_ROOT=${Imath_ROOT} + ${BUILDER_COMMON_CMAKE_ARGS} + # Give the library a custom name and symbol namespace so it can't + # conflict with any others in the system or linked into the same app. + # -D OPENEXR_NAMESPACE_CUSTOM=1 + # -D ILMTHREAD_NAMESPACE_CUSTOM=1 + # -D IEX_NAMESPACE_CUSTOM=1 + # -D OPENEXR_INTERNAL_IMF_NAMESPACE=${PROJ_NAMESPACE_V}_Imf_${OpenEXR_VERSION_IDENT} + # -D ILMTHREAD_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_IlmThread_${OpenEXR_VERSION_IDENT} + # -D Iex_INTERNAL_NAMESPACE=${PROJ_NAMESPACE_V}_Iex_${OpenEXR_VERSION_IDENT} + # -D OPENEXR_LIB_SUFFIX=_v${OpenEXR_VERSION_IDENT}_${PROJ_NAMESPACE_V} + ) + + +# # Signal to caller that we need to find again at the installed location +# set (OpenEXR_REFIND TRUE) +# set (OpenEXR_REFIND_ARGS CONFIG) +# set (OpenEXR_REFIND_VERSION ${OpenEXR_BUILD_VERSION}) +# +# if (OpenEXR_BUILD_SHARED_LIBS) +# install_local_dependency_libs (OpenEXR OpenEXR) +# install_local_dependency_libs (OpenEXR IlmThread) +# install_local_dependency_libs (OpenEXR Iex) +# endif () diff --git a/src/cmake/build_ZLIB.cmake b/src/cmake/dependencies/build_ZLIB.cmake similarity index 55% rename from src/cmake/build_ZLIB.cmake rename to src/cmake/dependencies/build_ZLIB.cmake index 980fec8fe5..c8e1e9c4ec 100644 --- a/src/cmake/build_ZLIB.cmake +++ b/src/cmake/dependencies/build_ZLIB.cmake @@ -7,32 +7,22 @@ ###################################################################### set_cache (ZLIB_BUILD_VERSION 1.3.1 "ZLIB version for local builds") -set (ZLIB_GIT_REPOSITORY "https://github.com/madler/zlib") -set (ZLIB_GIT_TAG "v${ZLIB_BUILD_VERSION}") +set_cache (ZLIB_GIT_REPOSITORY "https://github.com/madler/zlib" "Repo URL") +set_cache (ZLIB_GIT_TAG "v${ZLIB_BUILD_VERSION}" "Git tag to checkout") +set_if_not (LOCAL_BUILD_SHARED_LIBS_DEFAULT OFF) set_cache (ZLIB_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT} DOC "Should execute a local ZLIB build, if necessary, build shared libraries" ADVANCED) -string (MAKE_C_IDENTIFIER ${ZLIB_BUILD_VERSION} ZLIB_VERSION_IDENT) +# string (MAKE_C_IDENTIFIER ${ZLIB_BUILD_VERSION} ZLIB_VERSION_IDENT) -build_dependency_with_cmake(ZLIB - VERSION ${ZLIB_BUILD_VERSION} +ExternalProject_Add(ZLIB + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ZLIB GIT_REPOSITORY ${ZLIB_GIT_REPOSITORY} GIT_TAG ${ZLIB_GIT_TAG} CMAKE_ARGS + ${BUILDER_COMMON_CMAKE_ARGS} -D BUILD_SHARED_LIBS=${ZLIB_BUILD_SHARED_LIBS} -D CMAKE_POSITION_INDEPENDENT_CODE=ON -D CMAKE_INSTALL_LIBDIR=lib ) - -# Set some things up that we'll need for a subsequent find_package to work -set (ZLIB_ROOT ${ZLIB_LOCAL_INSTALL_DIR}) - -# Signal to caller that we need to find again at the installed location -set (ZLIB_REFIND TRUE) -set (ZLIB_VERSION ${ZLIB_BUILD_VERSION}) -set (ZLIB_REFIND_VERSION ${ZLIB_BUILD_VERSION}) - -if (ZLIB_BUILD_SHARED_LIBS) - install_local_dependency_libs (ZLIB ZLIB) -endif () diff --git a/src/cmake/dependency_utils.cmake b/src/cmake/dependency_utils.cmake index aefad7b58a..11423ec6dc 100644 --- a/src/cmake/dependency_utils.cmake +++ b/src/cmake/dependency_utils.cmake @@ -283,7 +283,7 @@ macro (checked_find_package pkgname) # noValueKeywords: "REQUIRED;CONFIG;PREFER_CONFIG;DEBUG;NO_RECORD_NOTFOUND;NO_FP_RANGE_CHECK" # singleValueKeywords: - "ENABLE;ISDEPOF;VERSION_MIN;VERSION_MAX;RECOMMEND_MIN;RECOMMEND_MIN_REASON;BUILD_LOCAL" + "ENABLE;ISDEPOF;VERSION_MIN;VERSION_MAX;RECOMMEND_MIN;RECOMMEND_MIN_REASON;BUILD_LOCAL;BUILD_LOCAL_VERSION" # multiValueKeywords: "DEFINITIONS;PRINT;DEPS;SETVARIABLES" # argsToParse: @@ -312,7 +312,13 @@ macro (checked_find_package pkgname) OR ${PROJECT_NAME}_BUILD_MISSING_DEPS STREQUAL "all") set_if_not (_pkg_BUILD_LOCAL "missing") endif () - set (${pkgname}_local_build_script "${PROJECT_SOURCE_DIR}/src/cmake/build_${pkgname}.cmake") + # set (${pkgname}_local_build_script "${PROJECT_SOURCE_DIR}/src/cmake/build_${pkgname}.cmake") + if (EXISTS "${PROJECT_SOURCE_DIR}/src/cmake/dependencies/build_${pkgname}.cmake") + set (${pkgname}_local_build_script "${PROJECT_SOURCE_DIR}/src/cmake/dependencies/build_${pkgname}.cmake") + set (${pkgname}_local_build_script_new TRUE) + elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/cmake/build_${pkgname}.cmake") + set (${pkgname}_local_build_script "${PROJECT_SOURCE_DIR}/src/cmake/build_${pkgname}.cmake") + endif () if (EXISTS ${${pkgname}_local_build_script}) set (${pkgname}_local_build_script_exists TRUE) endif () @@ -410,7 +416,36 @@ macro (checked_find_package pkgname) AND EXISTS "${${pkgname}_local_build_script}") message (STATUS "${ColorMagenta}Building package ${pkgname} ${${pkgname}_VERSION} locally${ColorReset}") list(APPEND CMAKE_MESSAGE_INDENT " ") - include("${${pkgname}_local_build_script}") + if (${pkgname}_local_build_script_new) + if (_pkg_BUILD_LOCAL_VERSION) + set (${pkgname}_build_version_args + "-D${pkgname}_BUILD_VERSION=${_pkg_BUILD_LOCAL_VERSION}") + else () + unset (${pkgname}_build_version_args) + endif () + message (STATUS "${ColorBoldRed}New process build of ${pkgname} ${_pkg_BUILD_LOCAL_VERSION}${ColorReset}") + execute_process (COMMAND ${CMAKE_COMMAND} + # Put things in our special local build areas + -S ${PROJECT_SOURCE_DIR}/src/cmake/dependencies + -B "${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/${pkgname}-build" + -DCMAKE_INSTALL_PREFIX=${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/dist + -DCMAKE_BUILD_TYPE=${${PROJECT_NAME}_DEPENDENCY_BUILD_TYPE} + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF + -DBUILD_${pkgname}=ON + ${${pkgname}_build_version_args} + ) + execute_process (COMMAND ${CMAKE_COMMAND} + --build "${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/${pkgname}-build" + --config ${${PROJECT_NAME}_DEPENDENCY_BUILD_TYPE} + ) + set (${pkgname}_REFIND TRUE) + # set (${pkgname}_REFIND_ARGS CONFIG) + # set_if_not (${pkgname}_VERSION ${_pkg_BUILD_LOCAL_VERSION}) + set (${pkgname}_REFIND_VERSION ${_pkg_BUILD_LOCAL_VERSION}) + set (${pkgname}_ROOT "${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/dist") + else () + include("${${pkgname}_local_build_script}") + endif () list(POP_BACK CMAKE_MESSAGE_INDENT) # set (${pkgname}_FOUND TRUE) set (${pkgname}_LOCAL_BUILD TRUE) @@ -479,6 +514,7 @@ macro (checked_find_package pkgname) endif () endif () # unset (_${pkgname}_version_range) + unset (${pkgname}_build_version_args) endmacro() diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index eee6373d84..0e8548976e 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -37,7 +37,9 @@ include (FindThreads) # Dependencies for required formats and features. These are so critical # that we will not complete the build if they are not found. -checked_find_package (ZLIB REQUIRED) # Needed by several packages +# ZLIB needed by several packages +checked_find_package (ZLIB REQUIRED + BUILD_LOCAL_VERSION 1.3.1) # Help set up this target for libtiff config file when using static libtiff if (NOT TARGET CMath::CMath) @@ -49,17 +51,19 @@ if (NOT TARGET CMath::CMath) endif () endif () -# IlmBase & OpenEXR +# Imath checked_find_package (Imath REQUIRED VERSION_MIN 3.1 + BUILD_LOCAL_VERSION 3.1.10 PRINT IMATH_INCLUDES OPENEXR_INCLUDES Imath_VERSION ) +# OpenEXR checked_find_package (OpenEXR REQUIRED VERSION_MIN 3.1 + BUILD_LOCAL_VERSION 3.2.4 NO_FP_RANGE_CHECK - PRINT IMATH_INCLUDES OPENEXR_INCLUDES Imath_VERSION - ) + PRINT IMATH_INCLUDES OPENEXR_INCLUDES Imath_VERSION) # Force Imath includes to be before everything else to ensure that we have # the right Imath/OpenEXR version, not some older version in the system