diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed58a70..1ed8d9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -304,6 +304,58 @@ jobs: filename: '.\nuget\*.nupkg' api-key: ${{ secrets.NUGET_DOT_ORG_API_KEY }} if: startsWith(github.ref, 'refs/tags/') +##### vcpkg ##### + vcpkg: + strategy: + fail-fast: false + matrix: + include: + - {os: debian, codename: bookworm, image_owner: } + # - {os: debian, codename: bookworm, image_owner: i386/, labels: [i386,docker]} + # - {os: debian, codename: bookworm, image_owner: , labels: [arm32,docker]} + # - {os: debian, codename: bookworm, image_owner: , labels: [arm64,docker]} + runs-on: ${{ (matrix.labels == '' && 'ubuntu-latest') || matrix.labels }} + container: ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }} + name: vcpkg - linux | ${{ matrix.labels[0] }} + steps: + - name: add cppfw deb repo + uses: myci-actions/add-deb-repo@main + with: + repo: deb https://gagis.hopto.org/repo/cppfw/${{ matrix.os }} ${{ matrix.codename }} main + repo-name: cppfw + keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg + install: myci cmake git curl zip unzip tar nodejs pkg-config + - name: git clone + uses: myci-actions/checkout@main + - name: install vcpkg + run: | + git clone https://github.com/microsoft/vcpkg.git vcpkg-installation + (cd vcpkg-installation; ./bootstrap-vcpkg.sh) + - name: set VCPKG_ROOT + uses: myci-actions/export-env-var@main + with: {name: VCPKG_ROOT, value: "$(pwd)/vcpkg-installation"} + - name: add VCPKG_ROOT to PATH + uses: myci-actions/export-env-var@main + with: {name: PATH, value: "$PATH:$VCPKG_ROOT"} + - name: prepare vcpkg port + run: | + myci-vcpkg-prepare.sh --git-ref ${{ github.sha }} + - name: test vcpkg port + run: | + cd vcpkg/test + cmake . + make + ./test + - name: upload vcpkg logs to artifacts + if: always() # even if previous steps fail, this one needs to be run + uses: actions/upload-artifact@v4 + with: + name: vcpkg_logs + path: vcpkg-installation/buildtrees/${{ env.PACKAGE_NAME }}/ + - name: deploy vcpkg port + run: | + myci-deploy-vcpkg.sh --repo cppfw/vcpkg-repo --port-dir vcpkg/overlay/${PACKAGE_NAME} + if: startsWith(github.ref, 'refs/tags/') ##### conan - linux ##### conan-linux: strategy: diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..e07171e --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.10) + +include(GNUInstallDirs) + +set(name agg) + +project(${name}) + +# find_package(utki CONFIG REQUIRED) + +file(GLOB_RECURSE srcs "../src/${name}/src/*.cpp") + +add_library( + ${name} + STATIC + ${srcs} +) + +target_compile_features(${name} PUBLIC cxx_std_17) +set_target_properties(${name} PROPERTIES CXX_STANDARD_REQUIRED ON) +set_target_properties(${name} PROPERTIES CXX_EXTENSIONS OFF) + +target_include_directories( + ${name} + INTERFACE + $ + $ +) + +# target_link_libraries( +# ${name} +# PUBLIC +# utki::utki +# ) + +# install library header files preserving directory hierarchy +install( + DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/../include/${name}" + DESTINATION + "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN + "*.hpp" +) + +install( + TARGETS + ${name} + EXPORT # generate cmake configs + ${name}-config +) + +# install cmake configs +install( + EXPORT + ${name}-config + FILE + ${name}-config.cmake + DESTINATION + ${CMAKE_INSTALL_DATAROOTDIR}/${name} + NAMESPACE + ${name}:: +) diff --git a/vcpkg/portfile.cmake.in b/vcpkg/portfile.cmake.in new file mode 100644 index 0000000..1b19cd0 --- /dev/null +++ b/vcpkg/portfile.cmake.in @@ -0,0 +1,26 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cppfw/${PORT} + REF $(git_ref) + SHA512 $(archive_hash) + HEAD_REF main +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/cmake" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup() + +# Delete the include directory from the debug installation to prevent overlap. +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Install the LICENSE file to the package's share directory and rename it to copyright. +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +# Copy the usage instruction file to the package's share directory. +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) diff --git a/vcpkg/test/CMakeLists.txt b/vcpkg/test/CMakeLists.txt new file mode 100644 index 0000000..f625952 --- /dev/null +++ b/vcpkg/test/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.10) + +set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) + +project(test) + +find_package(agg CONFIG REQUIRED) + +add_executable(test main.cpp) + +target_link_libraries(test PRIVATE agg::agg) diff --git a/vcpkg/test/main.cpp b/vcpkg/test/main.cpp new file mode 100644 index 0000000..0a398cb --- /dev/null +++ b/vcpkg/test/main.cpp @@ -0,0 +1,13 @@ +#include + +using namespace std::string_view_literals; + +int main(int argc, const char** argv){ + agg::trans_affine t(10, 20, 30, 40, 50, 60); + + t.reset(); + + std::cout << "t = " << t.sx << ", " << t.sy << ", " << t.tx << ", " << t.ty << ", " << t.shx << ", " << t.shy << std::endl; + + return 0; +} diff --git a/vcpkg/test/vcpkg-configuration.json b/vcpkg/test/vcpkg-configuration.json new file mode 100644 index 0000000..47748ad --- /dev/null +++ b/vcpkg/test/vcpkg-configuration.json @@ -0,0 +1,10 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "5e5d0e1cd7785623065e77eff011afdeec1a3574", + "repository": "https://github.com/microsoft/vcpkg" + }, + "overlay-ports": [ + "../overlay" + ] + } diff --git a/vcpkg/test/vcpkg.json b/vcpkg/test/vcpkg.json new file mode 100644 index 0000000..b88ea69 --- /dev/null +++ b/vcpkg/test/vcpkg.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "agg" + ] +} \ No newline at end of file diff --git a/vcpkg/usage b/vcpkg/usage new file mode 100644 index 0000000..d9b15eb --- /dev/null +++ b/vcpkg/usage @@ -0,0 +1,4 @@ +agg provides CMake targets: + +find_package(agg CONFIG REQUIRED) +target_link_libraries(main PRIVATE agg::agg) diff --git a/vcpkg/vcpkg.json.in b/vcpkg/vcpkg.json.in new file mode 100644 index 0000000..a8e3c9a --- /dev/null +++ b/vcpkg/vcpkg.json.in @@ -0,0 +1,17 @@ +{ + "name": "agg", + "version": "$(version)", + "homepage": "https://github.com/cppfw/agg", + "description": "Antigrain Geometry vector graphics library in C++", + "license": "MIT", + "dependencies": [ + { + "name" : "vcpkg-cmake", + "host" : true + }, + { + "name" : "vcpkg-cmake-config", + "host" : true + } + ] + }