diff --git a/.exemplar_version b/.exemplar_version index 447909a..8f59e27 100644 --- a/.exemplar_version +++ b/.exemplar_version @@ -1 +1 @@ -ab5c7c0cbf1f67eb43b7be9c2d18acd4d6de1ea4 +0131279454a8b54a6038203a7b714e2e0a835039 diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 431f009..4af901c 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -13,10 +13,10 @@ on: jobs: beman-submodule-check: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.6.1 preset-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.6.1 with: matrix_config: > [ @@ -27,7 +27,7 @@ jobs: ] build-and-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.6.1 with: matrix_config: > { @@ -118,7 +118,13 @@ jobs: ] } + vcpkg-ci: + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-vcpkg-ci.yml@1.6.1 + with: + port_name: beman-iterator-interface + container_image: ghcr.io/bemanproject/infra-containers-gcc:14 + create-issue-when-fault: needs: [preset-test, build-and-test] if: failure() && github.event_name == 'schedule' - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.6.1 diff --git a/.github/workflows/pre-commit-check.yml b/.github/workflows/pre-commit-check.yml index 980f6c5..ceb6da8 100644 --- a/.github/workflows/pre-commit-check.yml +++ b/.github/workflows/pre-commit-check.yml @@ -16,4 +16,4 @@ permissions: jobs: pre-commit: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-pre-commit.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-pre-commit.yml@1.6.1 diff --git a/.github/workflows/pre-commit-update.yml b/.github/workflows/pre-commit-update.yml index f21cd86..43baea1 100644 --- a/.github/workflows/pre-commit-update.yml +++ b/.github/workflows/pre-commit-update.yml @@ -9,7 +9,7 @@ on: jobs: auto-update-pre-commit: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.5.3 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.6.1 secrets: APP_ID: ${{ secrets.AUTO_PR_BOT_APP_ID }} PRIVATE_KEY: ${{ secrets.AUTO_PR_BOT_PRIVATE_KEY }} diff --git a/.github/workflows/vcpkg-release.yml b/.github/workflows/vcpkg-release.yml new file mode 100644 index 0000000..f5194e1 --- /dev/null +++ b/.github/workflows/vcpkg-release.yml @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +name: vcpkg registry release +on: + release: + types: [published] +jobs: + vcpkg-release: + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-vcpkg-release.yml@1.6.1 + with: + port_name: beman-iterator-interface + secrets: + VCPKG_REGISTRY_TOKEN: ${{ secrets.VCPKG_REGISTRY_TOKEN }} diff --git a/.gitignore b/.gitignore index d293e3b..d62996c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ # ignore vscode settings .vscode + +# ignore vim swap files +.swp + +# ignore merge/patch backup files +.orig diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a790d5..cbf059b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,4 +45,4 @@ repos: hooks: - id: beman-tidy -exclude: 'cookiecutter/|infra/' +exclude: 'cookiecutter/|infra/|port/' diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a761d8..31c4964 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.30...4.3) project( - beman.iterator_interface # CMake Project Name, which is also the name of the top-level - # targets (e.g., library, executable, etc.). + beman.iterator_interface DESCRIPTION "iterator creation mechanisms" LANGUAGES CXX VERSION 0.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cc5192..e56dea5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,30 @@ ctest --test-dir build ## Dependency Management +### vcpkg + +The best way to install the project's dependencies is to use the vcpkg workflow. + +To do so, make sure vcpkg is installed and `VCPKG_ROOT` is defined in your environment, +then specify +`-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"`. Vcpkg will handle +the project's dependencies, including GoogleTest. + +Example commands: + +``` +cmake \ + -B build \ + -S . \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" +cmake --build build +ctest --test-dir build +``` + +The file `./vcpkg.json` configures the list of dependencies that will be configured by +vcpkg. + ### FetchContent Instead of installing the project's dependencies via a package manager, you can optionally diff --git a/README.md b/README.md index a629c02..9f6b796 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,17 @@ For details on building beman.iterator_interface without using a CMake preset, r ### Installation +#### Vcpkg + +The preferred way to install iterator_interface is via vcpkg. To do so, after installing vcpkg +itself, you need to add support for the Beman project's [vcpkg +registry](https://github.com/bemanproject/vcpkg-registry) by configuring a +`vcpkg-configuration.json` file (which iterator_interface [provides](vcpkg-configuration.json)). + +Then, simply run `vcpkg install beman-iterator-interface`. + +#### Manual + To install beman.iterator_interface globally after building with the `gcc-release` preset, you can run: diff --git a/infra/.beman_submodule b/infra/.beman_submodule index 56dbbcc..a2ad45f 100644 --- a/infra/.beman_submodule +++ b/infra/.beman_submodule @@ -1,3 +1,3 @@ [beman_submodule] remote=https://github.com/bemanproject/infra.git -commit_hash=ea3ef79f77fdcc378149ebc7406e81e9ceb04146 +commit_hash=1b14bad2cd2cf0e44d1aeb608557e0e35ce27eaa diff --git a/infra/README.md b/infra/README.md index bf9bbb0..6cb8dd6 100644 --- a/infra/README.md +++ b/infra/README.md @@ -22,7 +22,7 @@ This repository is intended to be used as a beman-submodule in other Beman repos #### `beman_install_library` The CMake modules in this repository are intended to be used by Beman libraries. Use the -`beman_add_install_library_config()` function to install your library, along with header +`beman_install_library()` function to install your library, along with header files, any metadata files, and a CMake config file for `find_package()` support. ```cmake @@ -31,7 +31,7 @@ add_library(beman::something ALIAS beman.something) # ... configure your target as needed ... -find_package(beman-install-library REQUIRED) +include(infra/cmake/beman-install-library.cmake) beman_install_library(beman.something) ``` diff --git a/infra/cmake/llvm-libc++-toolchain.cmake b/infra/cmake/llvm-libc++-toolchain.cmake index 76264c6..eabf363 100644 --- a/infra/cmake/llvm-libc++-toolchain.cmake +++ b/infra/cmake/llvm-libc++-toolchain.cmake @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: BSL-1.0 +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # This toolchain file is not meant to be used directly, # but to be invoked by CMake preset and GitHub CI. diff --git a/infra/cmake/telemetry.sh b/infra/cmake/telemetry.sh index 307cc94..323982e 100755 --- a/infra/cmake/telemetry.sh +++ b/infra/cmake/telemetry.sh @@ -29,7 +29,7 @@ _ME="$(basename "${0}")" _print_help() { cat <_FOUND tells CMake that `find_package` is # not needed for this package anymore - set("${BemanExemplar_pkgName}_FOUND" TRUE PARENT_SCOPE) + set("${Beman_pkgName}_FOUND" TRUE PARENT_SCOPE) endif() endif() endforeach() endfunction() +set(BEMAN_USE_FETCH_CONTENT_ENABLED ON) + cmake_language( - SET_DEPENDENCY_PROVIDER BemanExemplar_provideDependency + SET_DEPENDENCY_PROVIDER Beman_provideDependency SUPPORTED_METHODS FIND_PACKAGE ) diff --git a/port/portfile.cmake.in b/port/portfile.cmake.in new file mode 100644 index 0000000..7b3a98e --- /dev/null +++ b/port/portfile.cmake.in @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO bemanproject/iterator_interface + REF "v@VERSION@" + SHA512 @SHA512@ + HEAD_REF main +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBEMAN_ITERATOR_INTERFACE_BUILD_TESTS=OFF + -DBEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup( + PACKAGE_NAME beman.iterator_interface + CONFIG_PATH lib/cmake/beman.iterator_interface +) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug" + "${CURRENT_PACKAGES_DIR}/lib" +) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/port/vcpkg.json.in b/port/vcpkg.json.in new file mode 100644 index 0000000..a550289 --- /dev/null +++ b/port/vcpkg.json.in @@ -0,0 +1,17 @@ +{ + "name": "beman-iterator-interface", + "version-semver": "@VERSION@", + "description": "iterator creation mechanisms", + "homepage": "https://github.com/bemanproject/iterator_interface", + "license": "Apache-2.0 WITH LLVM-exception", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/tests/beman/iterator_interface/CMakeLists.txt b/tests/beman/iterator_interface/CMakeLists.txt index c379d80..0257c0d 100644 --- a/tests/beman/iterator_interface/CMakeLists.txt +++ b/tests/beman/iterator_interface/CMakeLists.txt @@ -13,4 +13,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(beman.iterator_interface.tests) +gtest_discover_tests(beman.iterator_interface.tests DISCOVERY_TIMEOUT 60) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..25169b2 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,15 @@ +{ + "default-registry": { + "kind": "git", + "repository": "https://github.com/microsoft/vcpkg.git", + "baseline": "80f9bcfa455e875d9c1bf7a7c6692d7e1e481061" + }, + "registries": [ + { + "kind": "git", + "repository": "https://github.com/bemanproject/vcpkg-registry.git", + "baseline": "5195f94f2b550163917c1152180fc59bbd760556", + "packages": ["beman-*"] + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..a00f170 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,10 @@ +{ + "name": "beman-iterator-interface", + "version-semver": "0.1.0", + "dependencies": [ + { + "name": "gtest", + "host": true + } + ] +}