Skip to content

Commit

Permalink
build: Enhacements to the dependency report (#4294)
Browse files Browse the repository at this point in the history
* List external dependencies found, as well as those not found.
* Sort and deduplicate the lists before printing.
* Print versions of everything

Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz authored Jun 20, 2024
1 parent 1a1e6b1 commit ea234b3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ jobs:
OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0
LLVM_VERSION=17.0.6 LLVM_DISTRO_NAME=ubuntu-22.04
SKIP_SYSTEM_DEPS_INSTALL=1 QT_VERSION=0
OpenImageIO_BUILD_MISSING_DEPS=none

runs-on: ${{ matrix.runner }}
env:
Expand Down
1 change: 1 addition & 0 deletions src/cmake/build_Robinmap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ set (Robinmap_ROOT ${Robinmap_INSTALL_DIR})

# Signal to caller that we need to find again at the installed location
set (Robinmap_REFIND TRUE)
set (Robinmap_VERSION ${Robinmap_BUILD_VERSION})
49 changes: 37 additions & 12 deletions src/cmake/dependency_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set_cache (${PROJECT_NAME}_BUILD_LOCAL_DEPS ""
set_cache (${PROJECT_NAME}_LOCAL_DEPS_ROOT "${PROJECT_BINARY_DIR}/deps"
"Directory were we do local builds of dependencies")
list (APPEND CMAKE_PREFIX_PATH ${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/dist)
include_directories(BEFORE ${${PROJECT_NAME}_LOCAL_DEPS_ROOT}/include)

# Build type for locally built dependencies. Default to the same build type
# as the current project.
Expand All @@ -39,6 +40,7 @@ endif ()

# Track all build deps we find with checked_find_package
set (CFP_ALL_BUILD_DEPS_FOUND "")
set (CFP_EXTERNAL_BUILD_DEPS_FOUND "")

# Track all build deps we failed to find with checked_find_package
set (CFP_ALL_BUILD_DEPS_NOTFOUND "")
Expand Down Expand Up @@ -74,24 +76,38 @@ function (print_package_notfound_report)
if (CFP_ALL_BUILD_DEPS_NOTFOUND OR CFP_ALL_BUILD_DEPS_BADVERSION)
message (STATUS)
message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}")
message (STATUS "${ColorBoldYellow}= Dependency report =${ColorReset}")
message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}")
message (STATUS)
if (CFP_ALL_BUILD_DEPS_NOTFOUND)
message (STATUS "${ColorBoldWhite}The following dependencies were not found:${ColorReset}")
foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_NOTFOUND)
if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS)
message (STATUS " ${_pkg} ${ColorMagenta}(BUILT LOCALLY)${ColorReset}")
else ()
message (STATUS " ${_pkg}")
endif ()
if (CFP_EXTERNAL_BUILD_DEPS_FOUND)
message (STATUS "${ColorBoldWhite}The following dependencies found externally:${ColorReset}")
list (SORT CFP_EXTERNAL_BUILD_DEPS_FOUND CASE INSENSITIVE)
list (REMOVE_DUPLICATES CFP_EXTERNAL_BUILD_DEPS_FOUND)
foreach (_pkg IN LISTS CFP_EXTERNAL_BUILD_DEPS_FOUND)
message (STATUS " ${_pkg} ${${_pkg}_VERSION}")
endforeach ()
endif ()
if (CFP_ALL_BUILD_DEPS_BADVERSION)
message (STATUS "${ColorBoldWhite}The following dependencies were found but were too old:${ColorReset}")
list (SORT CFP_ALL_BUILD_DEPS_BADVERSION CASE INSENSITIVE)
list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_BADVERSION)
foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_BADVERSION)
if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS)
message (STATUS " ${_pkg} ${ColorMagenta}(BUILT LOCALLY)${ColorReset}")
message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}")
else ()
message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION}")
endif ()
endforeach ()
endif ()
if (CFP_ALL_BUILD_DEPS_NOTFOUND)
message (STATUS "${ColorBoldWhite}The following dependencies were not found:${ColorReset}")
list (SORT CFP_ALL_BUILD_DEPS_NOTFOUND CASE INSENSITIVE)
list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_NOTFOUND)
foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_NOTFOUND)
if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS)
message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}")
else ()
message (STATUS " ${_pkg}")
message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION}")
endif ()
endforeach ()
endif ()
Expand Down Expand Up @@ -159,6 +175,13 @@ function (reject_out_of_range_versions pkgname pkgversion versionmin versionmax
# if (${pkgname}_local_build_script_exists)
# list (APPEND CFP_LOCALLY_BUILDABLE_DEPS_BADVERSION ${pkgname})
# endif ()
if (versionmax VERSION_GREATER_EQUAL 10000)
set (${pkgname}_NOT_FOUND_EXPLANATION
"(found ${pkgversion}, needed >= ${versionmin})" PARENT_SCOPE)
else ()
set (${pkgname}_NOT_FOUND_EXPLANATION
"(found ${pkgversion}, needed ${versionmin} ... ${versionmax})" PARENT_SCOPE)
endif ()
unset (${pkgname}_FOUND PARENT_SCOPE)
unset (${pkgname}_VERSION PARENT_SCOPE)
unset (${pkgname}_INCLUDE PARENT_SCOPE)
Expand Down Expand Up @@ -370,7 +393,9 @@ macro (checked_find_package pkgname)
reject_out_of_range_versions (${pkgname} ${${pkgname}_VERSION}
${_pkg_VERSION_MIN} ${_pkg_VERSION_MAX}
_pkg_version_in_range)
if (NOT _pkg_version_in_range)
if (_pkg_version_in_range)
list (APPEND CFP_EXTERNAL_BUILD_DEPS_FOUND ${pkgname})
else ()
message (STATUS "${ColorRed}${pkgname} ${${pkgname}_VERSION} is outside the required range ${_pkg_VERSION_MIN}...${_pkg_VERSION_MAX} ${ColorReset}")
list (APPEND CFP_ALL_BUILD_DEPS_BADVERSION ${pkgname})
if (${pkgname}_local_build_script_exists)
Expand Down Expand Up @@ -454,7 +479,7 @@ macro (checked_find_package pkgname)
message (STATUS "${ColorRed}Not using ${pkgname} -- disabled ${_disablereason} ${ColorReset}")
endif ()
endif ()
unset (_${pkgname}_version_range)
# unset (_${pkgname}_version_range)
endmacro()


Expand Down

0 comments on commit ea234b3

Please sign in to comment.