From d38019a994a42609376975227201531007cba9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Thu, 29 May 2025 11:03:34 +0200 Subject: [PATCH] Move to VCPKG. (#7) --- .gitattributes | 6 ++++++ .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 25 ++++++++++++++++++++++++ CMakeLists.txt | 8 ++------ CMakePresets.json | 17 ++++++++++++++++ vcpkg.json | 17 ++++++++++++++++ 7 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/build.yml create mode 100644 .pre-commit-config.yaml create mode 100644 CMakePresets.json create mode 100644 vcpkg.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9790024 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.py text eol=crlf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c486f62 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build Installer Wizard Plugin + +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: windows-2022 + steps: + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Set environmental variables + shell: bash + run: | + echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + + - name: Configure Installer Wizard Plugin build + shell: pwsh + run: | + cmake --preset vs2022-windows "-DCMAKE_INSTALL_PREFIX=install" "-DVCPKG_MANIFEST_FEATURES=standalone" + + - name: Build Installer Wizard Plugin + run: cmake --build vsbuild --config RelWithDebInfo + + - name: Install Installer Wizard Plugin + run: cmake --install vsbuild --config RelWithDebInfo + + - name: Upload Installer Wizard Plugin artifact + uses: actions/upload-artifact@master + with: + name: installer_wizard + path: ./install/bin/plugins diff --git a/.gitignore b/.gitignore index f22e853..b3abdd9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ src/ui/*.py **/.mypy_cache .tox .vscode +venv # MO2 build files: vsbuild diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..047c78c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - id: check-merge-conflict + - id: mixed-line-ending + args: [--fix=lf] + - id: check-case-conflict + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.7 # must match pyproject.toml + hooks: + - id: ruff + args: [--extend-select, I, --fix] + - id: ruff-format + +ci: + autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks." + autofix_prs: true + autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate." + autoupdate_schedule: quarterly + submodules: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e02556..2fb2ad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,7 @@ cmake_minimum_required(VERSION 3.16) -if(DEFINED DEPENDENCIES_DIR) - include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake) -else() - include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake) -endif() - project(installer_wizard LANGUAGES NONE) +find_package(mo2-cmake CONFIG REQUIRED) + add_subdirectory(src) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..acc6d97 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,17 @@ +{ + "configurePresets": [ + { + "binaryDir": "${sourceDir}/vsbuild", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "generator": "Visual Studio 17 2022", + "name": "vs2022-windows" + } + ], + "buildPresets": [ + { + "name": "vs2022-windows", + "configurePreset": "vs2022-windows" + } + ], + "version": 4 +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..a27b7c5 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,17 @@ +{ + "features": { + "standalone": { + "description": "Build Standalone.", + "dependencies": [ + "mo2-cmake" + ] + } + }, + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "repository": "https://github.com/ModOrganizer2/vcpkg-registry", + "baseline": "69db61b22147b14ad66fd05cf798d855f6d68c12" + } + } +}