diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7af9aa86..6f935948 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: Test: - if: "!contains(github.event.head_commit.message, '[skip ci]')" + if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -80,16 +80,17 @@ jobs: cppcheck: true clangtidy: true task: true - doxygen: true + doxygen: ${{ !contains(matrix.os, 'macos-11') }} - name: Test + if: ${{ !cancelled() }} run: | task test env: CMAKE_GENERATOR: ${{ matrix.cmake_generator }} - name: Lint - if: ${{ matrix.os == 'ubuntu-20.04' && matrix.compiler == 'gcc' }} + if: ${{ !cancelled() && matrix.os == 'ubuntu-20.04' && matrix.compiler == 'gcc' }} run: | # TODO add to setup-cpp python3 -m pip install --user cmakelint cmake-format diff --git a/README.md b/README.md index 5e242947..f555dfa0 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ endif() # Add project_options from https://github.com/aminya/project_options # Change the version in the following URL to update the package (watch the releases of the repository for future updates) -set(PROJECT_OPTIONS_VERSION "v0.32.2") +set(PROJECT_OPTIONS_VERSION "v0.34.0") FetchContent_Declare( _project_options URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip) @@ -77,8 +77,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "0fa8459cf3a7caca7adc58f992bc32ff13630684" - ENABLE_VCPKG_UPDATE + VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" ) # Set the project name and language diff --git a/docs/src/project_options_example.md b/docs/src/project_options_example.md index d901e283..d52ee2f6 100644 --- a/docs/src/project_options_example.md +++ b/docs/src/project_options_example.md @@ -20,7 +20,7 @@ endif() # Add project_options from https://github.com/aminya/project_options # Change the version in the following URL to update the package (watch the releases of the repository for future updates) -set(PROJECT_OPTIONS_VERSION "v0.32.2") +set(PROJECT_OPTIONS_VERSION "v0.34.0") FetchContent_Declare( _project_options URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip) @@ -30,7 +30,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "0fa8459cf3a7caca7adc58f992bc32ff13630684" + VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" ENABLE_VCPKG_UPDATE ) diff --git a/package.json b/package.json index 9468670d..6d4e06fd 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { "name": "project_options", + "version": "0.34.0", "homepage": "http://aminya.github.io/project_options" } 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.") diff --git a/src/DynamicProjectOptions.cmake b/src/DynamicProjectOptions.cmake index 7a9c6cd1..3e158e53 100644 --- a/src/DynamicProjectOptions.cmake +++ b/src/DynamicProjectOptions.cmake @@ -55,7 +55,7 @@ Here is an example of how to use ``dynamic_project_options``: # Add project_options from https://github.com/aminya/project_options # Change the version in the following URL to update the package (watch the releases of the repository for future updates) - set(PROJECT_OPTIONS_VERSION "v0.32.2") + set(PROJECT_OPTIONS_VERSION "v0.34.0") FetchContent_Declare( _project_options URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip) diff --git a/src/Git.cmake b/src/Git.cmake index 33cad874..66884bc6 100644 --- a/src/Git.cmake +++ b/src/Git.cmake @@ -12,11 +12,53 @@ Input variables: - ``REPOSITORY_PATH``: The path to the repository - ``REMOTE_URL``: The url of the remote to add - ``REMOTE_NAME``: The name of the remote to add (defaults to the remote user) +- ``SHALLOW_SINCE``: Create a shallow clone with a history after the specified time. date should be in format of `git log --date=raw`. +- ``BRANCH``: Only clone the given branch - ``FORCE_CLONE``: Force the clone even if the directory exists +Simple example: + +.. code:: cmake + + git_clone( + REPOSITORY_PATH + "./vcpkg" + REMOTE_URL + "https://github.com/microsoft/vcpkg.git" + ) + +Example for a shallow clone and checking out of a specific revision: + +.. code:: cmake + + git_clone( + REPOSITORY_PATH + "$ENV{HOME}/vcpkg" + REMOTE_URL + "https://github.com/microsoft/vcpkg.git" + SHALLOW_SINCE + "1686087993 -0700" + BRANCH + "master" + ) + git_checkout( + REPOSITORY_PATH + "$ENV{HOME}/vcpkg" + REVISION + ecd22cc3acc8ee3c406e566db1e19ece1f17f409 + ) + + ]] function(git_clone) - set(oneValueArgs REPOSITORY_PATH REMOTE_URL REMOTE_NAME FORCE_CLONE) + set(oneValueArgs + REPOSITORY_PATH + REMOTE_URL + REMOTE_NAME + SHALLOW_SINCE + BRANCH + FORCE_CLONE + ) cmake_parse_arguments(_fun "" "${oneValueArgs}" "" ${ARGN}) if("${_fun_REPOSITORY_PATH}" STREQUAL "" OR "${_fun_REMOTE_URL}" STREQUAL "") @@ -29,14 +71,23 @@ function(git_clone) find_program(GIT_EXECUTABLE "git" REQUIRED) get_filename_component(_fun_REPOSITORY_PARENT_PATH "${_fun_REPOSITORY_PATH}" DIRECTORY) + + set(GIT_ARGS "clone" "${_fun_REMOTE_URL}" "${_fun_REPOSITORY_PATH}") + + if(NOT "${_fun_SHALLOW_SINCE}" STREQUAL "") + list(APPEND GIT_ARGS "--shallow-since=${_fun_SHALLOW_SINCE}") + endif() + + if(NOT "${_fun_BRANCH}" STREQUAL "") + list(APPEND GIT_ARGS "--single-branch" "--branch=${_fun_BRANCH}") + endif() + execute_process( - COMMAND "${GIT_EXECUTABLE}" "clone" "${_fun_REMOTE_URL}" - WORKING_DIRECTORY "${_fun_REPOSITORY_PARENT_PATH}" COMMAND_ERROR_IS_FATAL LAST + COMMAND "${GIT_EXECUTABLE}" ${GIT_ARGS} WORKING_DIRECTORY "${_fun_REPOSITORY_PARENT_PATH}" + COMMAND_ERROR_IS_FATAL LAST ) else() - message( - STATUS "Repository already exists at ${_fun_REPOSITORY_PATH}. Waiting for git lock file.." - ) + message(STATUS "Repository already exists at ${_fun_REPOSITORY_PATH}.") git_wait(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") if(NOT EXISTS "${_fun_REPOSITORY_PATH}/.git") @@ -75,15 +126,18 @@ endfunction() Pull the given repository -It will temporarily switch back to the previous branch if the head is detached for updating +If ``TARGET_REVISION`` is given, the pull is skipped if the current revision is the same as the target revision. + +It will temporarily switch back to the previous branch if the head is detached for updating. Input variables: - ``REPOSITORY_PATH``: The path to the repository +- ``TARGET_REVISION``: if the current revision of the repository is the same as this given revision, the pull is skipped ]] function(git_pull) - set(oneValueArgs REPOSITORY_PATH) + set(oneValueArgs REPOSITORY_PATH TARGET_REVISION) cmake_parse_arguments(_fun "" "${oneValueArgs}" "" ${ARGN}) if("${_fun_REPOSITORY_PATH}" STREQUAL "") @@ -93,14 +147,30 @@ function(git_pull) # store the current revision git_revision(REVISION REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + # skip the pull if the revision is the same + if(NOT "${_fun_TARGET_REVISION}" STREQUAL "" AND "${REVISION}" STREQUAL "${_fun_TARGET_REVISION}") + message(STATUS "Skipping pull of ${_fun_REPOSITORY_PATH} because it's already at ${REVISION}") + return() + else() + # pull and restore it after the pull + set(_fun_TARGET_REVISION "${REVISION}") + endif() + git_switch_back(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") message(STATUS "Updating ${_fun_REPOSITORY_PATH}") find_program(GIT_EXECUTABLE "git" REQUIRED) - execute_process(COMMAND "${GIT_EXECUTABLE}" "pull" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}") + + # wait for lock before pulling + git_wait(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + + execute_process( + COMMAND "${GIT_EXECUTABLE}" "pull" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" + COMMAND_ERROR_IS_FATAL LAST + ) # restore the revision - git_checkout(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}" REVISION "${REVISION}") + git_checkout(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}" REVISION "${_fun_TARGET_REVISION}") endfunction() #[[.rst: @@ -115,6 +185,23 @@ Input variables: - ``REPOSITORY_PATH``: The path to the repository - ``REVISION``: The revision to checkout +.. code:: cmake + + git_checkout( + REPOSITORY_PATH + "$ENV{HOME}/vcpkg" + REVISION + ecd22cc3acc8ee3c406e566db1e19ece1f17f409 + ) + +.. code:: cmake + + git_checkout( + REPOSITORY_PATH + "./some_repo" + REVISION + v1.0.0 + ) ]] function(git_checkout) set(oneValueArgs REPOSITORY_PATH REVISION) @@ -124,6 +211,14 @@ function(git_checkout) message(FATAL_ERROR "REPOSITORY_PATH and REVISION are required") endif() + git_revision(REVISION REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + if("${REVISION}" STREQUAL "${_fun_REVISION}") + return() + endif() + + # wait for lock before checking out + git_wait(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + find_program(GIT_EXECUTABLE "git" REQUIRED) execute_process( COMMAND "${GIT_EXECUTABLE}" "-c" "advice.detachedHead=false" "checkout" "${_fun_REVISION}" @@ -288,7 +383,7 @@ function(git_revision REVISION) COMMAND "${GIT_EXECUTABLE}" "rev-parse" "HEAD" OUTPUT_VARIABLE _git_revision WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" - OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL LAST ) set(${REVISION} ${_git_revision} PARENT_SCOPE) endfunction() @@ -323,7 +418,7 @@ function(git_is_detached IS_DETACHED) COMMAND "${GIT_EXECUTABLE}" "rev-parse" "--abbrev-ref" "--symbolic-full-name" "HEAD" OUTPUT_VARIABLE _git_status WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" - OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL LAST ) if("${_git_status}" STREQUAL "HEAD") set(${IS_DETACHED} TRUE PARENT_SCOPE) @@ -337,7 +432,10 @@ endfunction() ``git_switch_back`` =================== -Detect if the head is detached, if so, switch back before calling git pull on a detached head +Detect if the head is detached, if so, switch/checkout back +If the switch/checkout back fails or goes to a detached state, try to checkout the default branch + +This is used before updating the repository in a pull Input variables: @@ -352,13 +450,42 @@ function(git_switch_back) message(FATAL_ERROR "REPOSITORY_PATH is required") endif() + # return if the head is not detached git_is_detached(IS_DETACHED REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + if(NOT ${IS_DETACHED}) + return() + endif() + # first try to switch back + message(STATUS "Switch back ${_fun_REPOSITORY_PATH}") + git_wait(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + execute_process( + COMMAND "${GIT_EXECUTABLE}" "switch" "-" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" + RESULT_VARIABLE _switch_back_result + ) + git_is_detached(IS_DETACHED REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + if(${_switch_back_result} EQUAL 0 AND NOT ${IS_DETACHED}) + return() + endif() + + # if the switch back failed, try to checkout the previous branch + message(STATUS "Switch back failed. Trying to checkout previous branch") + git_wait(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + execute_process( + COMMAND "${GIT_EXECUTABLE}" "checkout" "-" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" + RESULT_VARIABLE _checkout_result + ) + git_is_detached(IS_DETACHED REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + if(${_checkout_result} EQUAL 0 AND NOT ${IS_DETACHED}) + return() + endif() + + # switch/checkout back went to a detached state or failed, try to checkout the default branch + git_is_detached(IS_DETACHED REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") if(${IS_DETACHED}) - message(STATUS "Switch back ${_fun_REPOSITORY_PATH}") - execute_process( - COMMAND "${GIT_EXECUTABLE}" "switch" "-" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" - ) + message(STATUS "Trying to checkout default branch") + git_default_branch(default_branch REPOSITORY_PATH "${_fun_REPOSITORY_PATH}") + git_checkout(REPOSITORY_PATH "${_fun_REPOSITORY_PATH}" REVISION "${default_branch}") endif() endfunction() @@ -393,14 +520,66 @@ function(git_wait) while(NOT EXISTS "${_fun_REPOSITORY_PATH}/.git/index" OR EXISTS "${_fun_REPOSITORY_PATH}/.git/index.lock" ) - execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 0.5) + message(STATUS "Waiting for git lock file...[${counter}/${_fun_TIMEOUT_COUNTER}]") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 0.5 COMMAND_ERROR_IS_FATAL LAST) math(EXPR counter "${counter} + 1") if(${counter} GREATER ${_fun_TIMEOUT_COUNTER}) message(STATUS "Timeout waiting for git lock file. Continuing...") return() - else() - message(STATUS "Waiting for git lock file...[${counter}/${_fun_TIMEOUT_COUNTER}]") endif() endwhile() endfunction() + +#[[.rst: + +``git_default_branch`` +====================== +Get the default branch of the given repository. Defaults to master in case of failure + +Input variables: +- ``REPOSITORY_PATH``: The path to the repository + +Output variables: +- ``default_branch``: The variable to store the default branch in + + +.. code:: cmake + + git_default_branch( + REPOSITORY_PATH + "$ENV{HOME}/vcpkg" + default_branch + ) + +]] +function(git_default_branch default_branch) + # use git symbolic-ref refs/remotes/origin/HEAD to get the default branch + + set(oneValueArgs REPOSITORY_PATH) + cmake_parse_arguments(_fun "" "${oneValueArgs}" "" ${ARGN}) + + if("${_fun_REPOSITORY_PATH}" STREQUAL "") + message(FATAL_ERROR "REPOSITORY_PATH is required") + endif() + + find_program(GIT_EXECUTABLE "git" REQUIRED) + execute_process( + COMMAND "${GIT_EXECUTABLE}" "symbolic-ref" "refs/remotes/origin/HEAD" + OUTPUT_VARIABLE _default_branch + WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _default_branch_result + ) + + if(${_default_branch_result} EQUAL 0) + string(REGEX REPLACE "refs/remotes/origin/" "" _default_branch "${_default_branch}") + else() + message( + WARNING "Could not get default branch of ${_fun_REPOSITORY_PATH}. Considering it as master" + ) + set(_default_branch "master") + endif() + + set(${default_branch} ${_default_branch} PARENT_SCOPE) +endfunction() diff --git a/src/VCEnvironment.cmake b/src/VCEnvironment.cmake index 8fed3c00..6773e2a9 100644 --- a/src/VCEnvironment.cmake +++ b/src/VCEnvironment.cmake @@ -59,7 +59,8 @@ macro(msvc_toolchain) include(FetchContent) FetchContent_Declare( _msvc_toolchain - URL "https://github.com/MarkSchofield/WindowsToolchain/archive/refs/tags/v0.7.0.zip" + GIT_REPOSITORY "https://github.com/MarkSchofield/WindowsToolchain.git" + GIT_TAG "17c6d4ff6531ee268b9a22a8bcfbb3809e970e4e" ) FetchContent_MakeAvailable(_msvc_toolchain) include("${_msvc_toolchain_SOURCE_DIR}/Windows.MSVC.toolchain.cmake") diff --git a/src/Vcpkg.cmake b/src/Vcpkg.cmake index 77ed309a..c91b90f9 100644 --- a/src/Vcpkg.cmake +++ b/src/Vcpkg.cmake @@ -29,7 +29,7 @@ endmacro() macro(_update_vcpkg_repository) if(${_vcpkg_args_ENABLE_VCPKG_UPDATE}) - git_pull(REPOSITORY_PATH "${_vcpkg_args_VCPKG_DIR}") + git_pull(REPOSITORY_PATH "${_vcpkg_args_VCPKG_DIR}" TARGET_REVISION "${_vcpkg_args_VCPKG_REV}") endif() endmacro() @@ -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() @@ -94,7 +110,6 @@ endmacro() macro(_checkout_vcpkg_repository) if(NOT "${_vcpkg_args_VCPKG_REV}" STREQUAL "") - git_checkout(REPOSITORY_PATH "${_vcpkg_args_VCPKG_DIR}" REVISION "${_vcpkg_args_VCPKG_REV}") endif() endmacro() @@ -157,7 +172,7 @@ Or by specifying the options run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "0fa8459cf3a7caca7adc58f992bc32ff13630684" + VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" ENABLE_VCPKG_UPDATE ) diff --git a/tests/install/vcpkg.json b/tests/install/vcpkg.json index 7c556b53..c682f737 100644 --- a/tests/install/vcpkg.json +++ b/tests/install/vcpkg.json @@ -1,16 +1,16 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "another-project", "version-string": "0.1.0", - "builtin-baseline": "8dbd66f5a7821ced1ed57696b50375a977006813", + "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", "dependencies": [ { "name": "eigen3", - "version>=": "3.4.0" + "version>=": "3.4.0#2" }, { "name": "fmt", - "version>=": "8.1.1" + "version>=": "9.1.0#1" } ] } diff --git a/tests/myproj/CMakeLists.txt b/tests/myproj/CMakeLists.txt index 76647ca2..0c9be882 100644 --- a/tests/myproj/CMakeLists.txt +++ b/tests/myproj/CMakeLists.txt @@ -18,7 +18,7 @@ if(ENABLE_CROSS_COMPILING) endif() run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV - "6a3dd0874f153f8b375ec26210ea6d41dee3bb26" ENABLE_VCPKG_UPDATE + "10e052511428d6b0c7fcc63a139e8024bb146032" ENABLE_VCPKG_UPDATE ) project(myproj VERSION 0.2.0 LANGUAGES CXX C) @@ -61,9 +61,9 @@ project_options( # ENABLE_INCLUDE_WHAT_YOU_USE # ENABLE_GCC_ANALYZER ENABLE_COVERAGE - ENABLE_PCH - PCH_HEADERS - ${PCH_HEADERS} + # ENABLE_PCH + # PCH_HEADERS + # ${PCH_HEADERS} ENABLE_DOXYGEN ENABLE_INTERPROCEDURAL_OPTIMIZATION ENABLE_NATIVE_OPTIMIZATION diff --git a/tests/myproj/include/mylib/lib.hpp b/tests/myproj/include/mylib/lib.hpp index 6ecad59b..f74c7bad 100644 --- a/tests/myproj/include/mylib/lib.hpp +++ b/tests/myproj/include/mylib/lib.hpp @@ -3,7 +3,7 @@ // test external pac #include #include -#include +#include // test std libraries #include @@ -24,7 +24,7 @@ int some_fun() { auto eigen_vec = Eigen::VectorXd::LinSpaced(10, 0, 1); // print the vector - fmt::print("{}", eigen_vec); + fmt::print("[{}]", fmt::join(eigen_vec, ", ")); return 0; } diff --git a/tests/myproj/src/main/main.cpp b/tests/myproj/src/main/main.cpp index 3dc72141..25cc0b59 100644 --- a/tests/myproj/src/main/main.cpp +++ b/tests/myproj/src/main/main.cpp @@ -1,7 +1,7 @@ // test external pac #include #include -#include +#include // test std libraries #include @@ -19,11 +19,11 @@ int main() { fmt::print("Hello from fmt{}", "!"); Eigen::VectorXd eigen_vec = Eigen::Vector3d(1, 2, 3); - fmt::print("{}", eigen_vec); + fmt::print("[{}]", fmt::join(eigen_vec, ", ")); #if !defined(__MINGW32__) && !defined(__MSYS__) // TODO fails Eigen::VectorXd eigen_vec2 = Eigen::VectorXd::LinSpaced(10, 0, 1); - fmt::print("{}", eigen_vec2); + fmt::print("[{}]", fmt::join(eigen_vec2, ", ")); #endif // trigger address sanitizer diff --git a/tests/myproj/src/mylib2/lib.cpp b/tests/myproj/src/mylib2/lib.cpp index 38458dce..01524a76 100644 --- a/tests/myproj/src/mylib2/lib.cpp +++ b/tests/myproj/src/mylib2/lib.cpp @@ -1,7 +1,7 @@ // test external pac #include #include -#include +#include // test std libraries #include @@ -19,11 +19,11 @@ int some_fun2() { fmt::print("Hello from fmt{}", "!"); Eigen::VectorXd eigen_vec = Eigen::Vector3d(1, 2, 3); - fmt::print("{}", eigen_vec); + fmt::print("[{}]", fmt::join(eigen_vec, ", ")); #if !defined(__MINGW32__) && !defined(__MSYS__) // TODO fails Eigen::VectorXd eigen_vec2 = Eigen::VectorXd::LinSpaced(10, 0, 1); - fmt::print("{}", eigen_vec2); + fmt::print("[{}]", fmt::join(eigen_vec2, ", ")); #endif return 0; diff --git a/tests/myproj/vcpkg.json b/tests/myproj/vcpkg.json index 4c2f4ac3..c4cbbf8c 100644 --- a/tests/myproj/vcpkg.json +++ b/tests/myproj/vcpkg.json @@ -1,16 +1,16 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "myproject", "version-string": "0.1.0", - "builtin-baseline": "8dbd66f5a7821ced1ed57696b50375a977006813", + "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", "dependencies": [ { "name": "eigen3", - "version>=": "3.4.0" + "version>=": "3.4.0#2" }, { "name": "fmt", - "version>=": "8.1.1" + "version>=": "9.1.0#1" } ] } diff --git a/tests/rpi4-vcpkg/vcpkg.json b/tests/rpi4-vcpkg/vcpkg.json index 5aa0e59b..27a8baa3 100644 --- a/tests/rpi4-vcpkg/vcpkg.json +++ b/tests/rpi4-vcpkg/vcpkg.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "example", "version-string": "0.1.0", "dependencies": [