From 0b3e25a26d2c8726e7527773e1c3388938c24098 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 1 Feb 2024 14:53:24 -0800 Subject: [PATCH 1/3] ci: skip vcpkg updates based on the requested revision --- src/Vcpkg.cmake | 52 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/src/Vcpkg.cmake b/src/Vcpkg.cmake index 8f2f7778..c91b90f9 100644 --- a/src/Vcpkg.cmake +++ b/src/Vcpkg.cmake @@ -59,28 +59,44 @@ macro(_bootstrap_vcpkg) endmacro() macro(_is_vcpkg_outdated) - if("${_vcpkg_args_VCPKG_UPDATE_THRESHOLD}" STREQUAL "") - set(_vcpkg_args_VCPKG_UPDATE_THRESHOLD 3600) - endif() + # skip the update if the requested revision is the same as the current revision + git_revision(_REVISION REPOSITORY_PATH "${_vcpkg_args_VCPKG_DIR}") + if(NOT "${_vcpkg_args_VCPKG_REV}" STREQUAL "" AND "${_REVISION}" STREQUAL + "${_vcpkg_args_VCPKG_REV}" + ) + message(STATUS "Skipping vcpkg update as it's already at ${_REVISION}") + set(_vcpkg_args_ENABLE_VCPKG_UPDATE OFF) + elseif(NOT "${_vcpkg_args_VCPKG_REV}" STREQUAL "" AND NOT "${_REVISION}" STREQUAL + "${_vcpkg_args_VCPKG_REV}" + ) + # Requested revision is different from the current revision, so update + set(_vcpkg_args_ENABLE_VCPKG_UPDATE ON) + else() + # Requested revision is not specified, so update depending on the timestamp + # Check if the vcpkg registry is updated using the timestamp file that project_option generates + if("${_vcpkg_args_VCPKG_UPDATE_THRESHOLD}" STREQUAL "") + set(_vcpkg_args_VCPKG_UPDATE_THRESHOLD 3600) + endif() - if(${_vcpkg_args_ENABLE_VCPKG_UPDATE}) - set(_time_stamp_file "${VCPKG_PARENT_DIR}/.vcpkg_last_update") - - if(EXISTS "${_time_stamp_file}") - string(TIMESTAMP _current_time "%s") - file(TIMESTAMP "${_time_stamp_file}" _vcpkg_last_update "%s") - # if the last update was more than VCPKG_UPDATE_THRESHOLD - math(EXPR time_diff "${_current_time} - ${_vcpkg_last_update}") - if(${time_diff} GREATER ${_vcpkg_args_VCPKG_UPDATE_THRESHOLD}) + if(${_vcpkg_args_ENABLE_VCPKG_UPDATE}) + set(_time_stamp_file "${VCPKG_PARENT_DIR}/.vcpkg_last_update") + + if(EXISTS "${_time_stamp_file}") + string(TIMESTAMP _current_time "%s") + file(TIMESTAMP "${_time_stamp_file}" _vcpkg_last_update "%s") + # if the last update was more than VCPKG_UPDATE_THRESHOLD + math(EXPR time_diff "${_current_time} - ${_vcpkg_last_update}") + if(${time_diff} GREATER ${_vcpkg_args_VCPKG_UPDATE_THRESHOLD}) + set(_vcpkg_args_ENABLE_VCPKG_UPDATE ON) + file(TOUCH "${_time_stamp_file}") + else() + message(STATUS "vcpkg updated recently. Skipping update.") + set(_vcpkg_args_ENABLE_VCPKG_UPDATE OFF) + endif() + else() set(_vcpkg_args_ENABLE_VCPKG_UPDATE ON) file(TOUCH "${_time_stamp_file}") - else() - message(STATUS "vcpkg updated recently. Skipping update.") - set(_vcpkg_args_ENABLE_VCPKG_UPDATE OFF) endif() - else() - set(_vcpkg_args_ENABLE_VCPKG_UPDATE ON) - file(TOUCH "${_time_stamp_file}") endif() endif() endmacro() From 6e861771caf51007b5bb15c70634ba63142d9d47 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 2 Feb 2024 08:05:10 -0800 Subject: [PATCH 2/3] fix: gracefully warn if doxygen is not installed --- src/Doxygen.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Doxygen.cmake b/src/Doxygen.cmake index 64c053db..d8eae523 100644 --- a/src/Doxygen.cmake +++ b/src/Doxygen.cmake @@ -79,7 +79,11 @@ function(enable_doxygen DOXYGEN_THEME) endif() # find doxygen and dot if available - find_package(Doxygen REQUIRED OPTIONAL_COMPONENTS dot) + find_package(Doxygen OPTIONAL_COMPONENTS dot) + if (NOT Doxygen_FOUND) + message(WARNING "Doxygen not found, install doxygen and try again. Documentation will not be generated.") + return() + endif() # add doxygen-docs target message(STATUS "Adding `doxygen-docs` target that builds the documentation.") From 6557d00bdc56749665ea64e09b829a97c565dbc5 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 2 Feb 2024 08:05:37 -0800 Subject: [PATCH 3/3] ci: skip doxygen installation on macos --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0632413f..6f935948 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: cppcheck: true clangtidy: true task: true - doxygen: true + doxygen: ${{ !contains(matrix.os, 'macos-11') }} - name: Test if: ${{ !cancelled() }}