From c27bb4b45990641a1d09afe228f0948b5746f80c Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 00:30:13 +0200 Subject: [PATCH 1/6] refactoring with vcpkg tha hell --- CMakeLists.txt | 83 +++++++++++++--------------------------- README.md | 14 +++---- src/main.cpp | 6 +++ vcpkg-configuration.json | 15 ++++++++ vcpkg.json | 9 +++++ 5 files changed, 62 insertions(+), 65 deletions(-) create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 9495d34..ed4d462 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,18 @@ cmake_minimum_required(VERSION 3.31.6) +set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "Vcpkg target triplet" FORCE) +set(VCPKG_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Vcpkg build type" FORCE) + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + if(DEFINED ENV{VCPKG_ROOT}) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + CACHE STRING "Vcpkg toolchain file" FORCE) + message(STATUS "Using vcpkg toolchain from: $ENV{VCPKG_ROOT}") + else() + message(WARNING "VCPKG_ROOT not set — vcpkg will not be used.") + endif() +endif() + if(DEFINED ENV{PROGRAM_VERSION} AND NOT "$ENV{PROGRAM_VERSION}" STREQUAL "") set(VERSION $ENV{PROGRAM_VERSION}) else() @@ -22,67 +35,30 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) + +find_package(raylib CONFIG REQUIRED) +find_package(glfw3 REQUIRED) +find_package(freeimage CONFIG REQUIRED) + # Out folder for ready executables set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/output/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}") # static linking windows libs so i can distribute it without any dependencies for testing # cl alternatives to /MT and /MTd # https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fms-runtime-lib -if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_compile_options(-fms-runtime-lib="static") - add_link_options(-fms-runtime-lib="static") -elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") - add_compile_options(-fms-runtime-lib="static_dbg") - add_link_options(-fms-runtime-lib="static_dbg") -endif() +# if (CMAKE_BUILD_TYPE STREQUAL "Release") +# add_compile_options(-fms-runtime-lib="static") +# add_link_options(-fms-runtime-lib="static") +# elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") +# add_compile_options(-fms-runtime-lib="static_dbg") +# add_link_options(-fms-runtime-lib="static_dbg") +# endif() # FIX for compiling, compiler trying to use WinMain while im need main because it is easier to access argc and argv # hope to fix it later actually set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup") -# Dependencies -include(FetchContent) - -# Define where to download and extract FreeImage -set(FREEIMAGE_URL "https://netix.dl.sourceforge.net/project/freeimage/Binary%20Distribution/3.18.0/FreeImage3180Win32Win64.zip?viasf=1") -set(FREEIMAGE_ZIP "${CMAKE_BINARY_DIR}/FreeImage3180Win32Win64.zip") -set(FREEIMAGE_EXTRACT_DIR "${CMAKE_BINARY_DIR}/_deps") -# Download FreeImage zip if not already present -if(NOT EXISTS "${FREEIMAGE_ZIP}") - message(STATUS "Downloading FreeImage...") - file(DOWNLOAD "${FREEIMAGE_URL}" "${FREEIMAGE_ZIP}" SHOW_PROGRESS) -endif() - -# Extract FreeImage with 7z if not already extracted -if(NOT EXISTS "${FREEIMAGE_EXTRACT_DIR}/FreeImage/Dist/x64/FreeImage.lib") - message(STATUS "Extracting FreeImage using 7z...") - file(MAKE_DIRECTORY "${FREEIMAGE_EXTRACT_DIR}") - execute_process( - COMMAND 7z x "${FREEIMAGE_ZIP}" "-o${FREEIMAGE_EXTRACT_DIR}" -y - RESULT_VARIABLE result - ) - if(NOT result EQUAL 0) - message(FATAL_ERROR "7z extraction failed! Is 7z installed and in your PATH?") - endif() -endif() - -# Include directories and libraries for FreeImage -include_directories("${FREEIMAGE_EXTRACT_DIR}/FreeImage/Dist/x64") -link_directories("${FREEIMAGE_EXTRACT_DIR}/FreeImage/Dist/x64") - -FetchContent_Declare( - raylib - GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG 5.5 - GIT_SHALLOW TRUE -) - -# idk if works, someone said it dont, and i need use config.h | figure it out later -set(BUILD_AUDIO OFF CACHE BOOL "" FORCE) -set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -set(BUILD_GAMES OFF CACHE BOOL "" FORCE) -FetchContent_MakeAvailable(raylib) # src directory set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") @@ -102,11 +78,4 @@ else() add_executable(${PROJECT_NAME} WIN32 ${SOURCE_FILES}) endif() -target_link_libraries(${PROJECT_NAME} PRIVATE raylib FreeImage) - -# Copy FreeImage.dll after build -add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${FREEIMAGE_EXTRACT_DIR}/FreeImage/Dist/x64/FreeImage.dll" - "$/FreeImage.dll" -) +target_link_libraries(${PROJECT_NAME} PRIVATE raylib freeimage::FreeImage freeimage::FreeImagePlus glfw winmm ) \ No newline at end of file diff --git a/README.md b/README.md index 7582a9c..acb168c 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,16 @@ -# 🖼️ ImageViewer +

🌄 ImageViewer

> **ImageViewer** — inspired by Google's [Picasa Image Viewer](https://en.wikipedia.org/wiki/Picasa). (The name of the project may change in the future.) ---- - ## ⚙️ Tech Stack -- **Language**: C/C++ -- **Frameworks/Libs**: raylib (current implementation), FreeImage -- **Build System**: CMake 4.0.2 + Clang/LLVM (Clang-cl 20.1.6) - ---- + ## 🚧 Roadmap diff --git a/src/main.cpp b/src/main.cpp index a374774..139ad17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ +#include #include #include #include @@ -14,6 +15,10 @@ namespace Settings { } // namespace Settings int main(int argc, char *argv[]) { + FreeImage_Initialise(); +#ifdef _DEBUG + TraceLog(LOG_INFO, "FreeImage version %s", FreeImage_GetVersion()); +#endif if (argc <= 1) return 1; std::filesystem::path workingDir = std::filesystem::current_path(); // get current working directory SetConfigFlags(FLAG_WINDOW_UNDECORATED | FLAG_WINDOW_TRANSPARENT | FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_MAXIMIZED | FLAG_VSYNC_HINT); @@ -48,5 +53,6 @@ int main(int argc, char *argv[]) { if (Settings::drawDebugInfo) DrawFPS(10, 10); EndDrawing(); } + FreeImage_DeInitialise(); CloseWindow(); } \ No newline at end of file diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..6022279 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,15 @@ +{ + "defaultTriplet": "x64-windows-static", + "default-registry": { + "kind": "git", + "baseline": "f4fc135de213885b8d072203d324976e4aa1f171", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..f8deeb6 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,9 @@ +{ + "dependencies": [ + { + "name": "raylib", + "default-features": false + }, + "freeimage" + ] +} From ccf75bead0ad371b12514a62b7fd7205c9b446de Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 00:30:51 +0200 Subject: [PATCH 2/6] meh --- vcpkg-configuration.json | 1 - 1 file changed, 1 deletion(-) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 6022279..9c4ce58 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,5 +1,4 @@ { - "defaultTriplet": "x64-windows-static", "default-registry": { "kind": "git", "baseline": "f4fc135de213885b8d072203d324976e4aa1f171", From a92a6dbfcf7ce083af37e36399f90833f63e5eb2 Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:38:14 +0200 Subject: [PATCH 3/6] static! --- CMakeLists.txt | 4 +++- src/main.cpp | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed4d462..61190f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.31.6) -set(VCPKG_TARGET_TRIPLET "x64-windows-static-md" CACHE STRING "Vcpkg target triplet" FORCE) +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" CACHE STRING "" FORCE) + +set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "Vcpkg target triplet" FORCE) set(VCPKG_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Vcpkg build type" FORCE) if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) diff --git a/src/main.cpp b/src/main.cpp index 139ad17..2773331 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,3 @@ - #include #include #include @@ -16,9 +15,6 @@ namespace Settings { int main(int argc, char *argv[]) { FreeImage_Initialise(); -#ifdef _DEBUG - TraceLog(LOG_INFO, "FreeImage version %s", FreeImage_GetVersion()); -#endif if (argc <= 1) return 1; std::filesystem::path workingDir = std::filesystem::current_path(); // get current working directory SetConfigFlags(FLAG_WINDOW_UNDECORATED | FLAG_WINDOW_TRANSPARENT | FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_MAXIMIZED | FLAG_VSYNC_HINT); From ef7bbcac17c8d6505142cbd11a563c05bd16c6fe Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:53:13 +0200 Subject: [PATCH 4/6] Meh, reimplement workflow --- .github/workflows/debug.yml | 89 +++++++++++++++++++ .../{build.yml => release_build.yml} | 47 ++++------ FEATURES.md | 21 ----- 3 files changed, 104 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/debug.yml rename .github/workflows/{build.yml => release_build.yml} (72%) delete mode 100644 FEATURES.md diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml new file mode 100644 index 0000000..a14b6ed --- /dev/null +++ b/.github/workflows/debug.yml @@ -0,0 +1,89 @@ +name: Test build +on: + push: + branches: + - '**' + paths: + - 'src/**' + - '.github/workflows/debug.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' + pull_request: + branches: + - '**' + paths: + - 'src/**' + - '.github/workflows/debug.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' + +permissions: + contents: read + +jobs: + debug-build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Verify tools + run: | + clang-cl --version + cmake --version + + - name: Restore cached Primes + id: cache-restore + uses: actions/cache/restore@v4 + with: + path: | + ${{ github.workspace }}\build + key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt', 'vcpkg.json') }} + + - name: Configure (Debug) + run: > + cmake + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE + -DCMAKE_C_COMPILER="C:\Program Files\LLVM\bin\clang-cl.exe" + -DCMAKE_CXX_COMPILER="C:\Program Files\LLVM\bin\clang-cl.exe" + -S "${{ github.workspace }}" + -B "${{ github.workspace }}\build" + -G "Ninja" + + - name: Build (Debug) + run: > + cmake + --build "${{ github.workspace }}\build" + --config Debug + --target all + + - name: Configure (Release) + if: github.event_name != 'pull_request' + run: > + cmake + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE + -DCMAKE_C_COMPILER="C:\Program Files\LLVM\bin\clang-cl.exe" + -DCMAKE_CXX_COMPILER="C:\Program Files\LLVM\bin\clang-cl.exe" + -S "${{ github.workspace }}" + -B "${{ github.workspace }}\build" + -G "Ninja" + + - name: Build (Release) + if: github.event_name != 'pull_request' + run: > + cmake + --build "${{ github.workspace }}\build" + --config Release + --target all + + - name: Save Primes + if: steps.cache-restore.outputs.cache-hit != 'true' && github.event_name != 'pull_request' + id: cache-save + uses: actions/cache/save@v4 + with: + path: | + ${{ github.workspace }}\build + key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt', 'vcpkg.json') }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/release_build.yml similarity index 72% rename from .github/workflows/build.yml rename to .github/workflows/release_build.yml index 62be56a..1687001 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release_build.yml @@ -1,23 +1,7 @@ -name: Build & publish project +name: Build & Publish project on: workflow_dispatch: - push: - branches: - - main - paths: - - 'src/**' - - '.github/workflows/build.yml' - - 'CMakeLists.txt' - tags-ignore: - - '*' - pull_request: - branches: - - main - paths: - - 'src/**' - - '.github/workflows/build.yml' - - 'CMakeLists.txt' release: types: [published] @@ -42,11 +26,8 @@ jobs: uses: actions/cache/restore@v4 with: path: | - ${{ github.workspace }}\build\_deps\FreeImage - ${{ github.workspace }}\build\FreeImage3180Win32Win64.zip - ${{ github.workspace }}\build\_deps\raylib-src - ${{ github.workspace }}\build\_deps\raylib-build - key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt') }} + ${{ github.workspace }}\build + key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt', 'vcpkg.json') }} - name: Verify tools run: | @@ -72,7 +53,6 @@ jobs: --target all - name: Configure (Release) - if: success() && github.event_name == 'release' && github.event.action == 'published' run: > cmake -DCMAKE_BUILD_TYPE=Release @@ -84,7 +64,6 @@ jobs: -G "Ninja" - name: Build (Release) - if: success() && github.event_name == 'release' && github.event.action == 'published' run: > cmake --build "${{ github.workspace }}\build" @@ -97,12 +76,8 @@ jobs: uses: actions/cache/save@v4 with: path: | - ${{ github.workspace }}\build\_deps\FreeImage - ${{ github.workspace }}\build\FreeImage3180Win32Win64.zip - ${{ github.workspace }}\build\_deps\raylib-src - ${{ github.workspace }}\build\_deps\raylib-build - key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt') }} - + ${{ github.workspace }}\build + key: ${{ runner.os }}-build-cache-${{ hashFiles('CMakeLists.txt', 'vcpkg.json') }} - name: Package builds if: github.event_name == 'release' && github.event.action == 'published' @@ -110,13 +85,21 @@ jobs: 7z a ImageViewer_debug-${{ github.event.release.tag_name }}.zip .\output\Debug\* 7z a ImageViewer_release-${{ github.event.release.tag_name }}.zip .\output\Release\* - - name: Publish GitHub Release + - name: Conventional Changelog Action if: github.event_name == 'release' && github.event.action == 'published' + id: changelog + uses: TriPSs/conventional-changelog-action@v5 + with: + github-token: ${{ secrets.github_token }} + output-file: "false" + + - name: Publish GitHub Release + if: ${{ steps.changelog.outputs.skipped == 'false' }} && github.event_name == 'release' && github.event.action == 'published' uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.event.release.tag_name }} name: "ImageViewer ${{ github.event.release.tag_name }}" - body_path: FEATURES.md + body: ${{ steps.changelog.outputs.clean_changelog }} files: | ImageViewer_release-${{ github.event.release.tag_name }}.zip ImageViewer_debug-${{ github.event.release.tag_name }}.zip diff --git a/FEATURES.md b/FEATURES.md deleted file mode 100644 index 8597865..0000000 --- a/FEATURES.md +++ /dev/null @@ -1,21 +0,0 @@ -# 🖼️ ImageViewer - -## 🚧 Current features of release - -- [x] Basic image loading and rendering -- [x] Semi-transparent background -- [x] Image zoom&move around on screen -- [x] Support for PNG, JPEG, WebP etc. -- [ ] Arrow image navigation (inside app) -- [ ] Cool UI? -- [ ] Settings -- [ ] Image rotation -- [ ] Smooth animations - -## ⌨️ Shortcuts - -- `Mouse scroll` - Zoom -- `Ctrl + W` - Close Window -- `Ctrl + D` - Toggle Display fps -- `SPACE` - Reset image position -- `R` - Reset image position and zoom \ No newline at end of file From 99649fb300ca0710f576314046efe082dc72790c Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:59:10 +0200 Subject: [PATCH 5/6] Clean Cmake, also now we use vcpkg --- CMakeLists.txt | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61190f7..1072ca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.31.6) +# Static runtime linking for MSVC set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" CACHE STRING "" FORCE) set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "Vcpkg target triplet" FORCE) @@ -19,15 +20,14 @@ if(DEFINED ENV{PROGRAM_VERSION} AND NOT "$ENV{PROGRAM_VERSION}" STREQUAL "") set(VERSION $ENV{PROGRAM_VERSION}) else() set(VERSION 0.0.0) - message(STATUS "Local build (version not specified)") + message(STATUS "Debug or Local build (version not specified)") endif() project(ImageViewer VERSION ${VERSION} LANGUAGES CXX) set(COMPANY_NAME "fr0zert") set(PRODUCT_NAME "${PROJECT_NAME}") -set(FILE_DESCRIPTION "A simple ${PROJECT_NAME} appcation.") - +set(FILE_DESCRIPTION "A simple ${PROJECT_NAME} application.") # Generate compile_commands.json set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -37,7 +37,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) - find_package(raylib CONFIG REQUIRED) find_package(glfw3 REQUIRED) find_package(freeimage CONFIG REQUIRED) @@ -45,23 +44,10 @@ find_package(freeimage CONFIG REQUIRED) # Out folder for ready executables set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/output/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}") -# static linking windows libs so i can distribute it without any dependencies for testing -# cl alternatives to /MT and /MTd -# https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fms-runtime-lib -# if (CMAKE_BUILD_TYPE STREQUAL "Release") -# add_compile_options(-fms-runtime-lib="static") -# add_link_options(-fms-runtime-lib="static") -# elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") -# add_compile_options(-fms-runtime-lib="static_dbg") -# add_link_options(-fms-runtime-lib="static_dbg") -# endif() - # FIX for compiling, compiler trying to use WinMain while im need main because it is easier to access argc and argv # hope to fix it later actually set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup") - - # src directory set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") @@ -70,6 +56,7 @@ configure_file( "${SOURCE_DIR}/metadata/version.rc" @ONLY ) + # src files file(GLOB SOURCE_FILES "${SOURCE_DIR}/*.cpp" "${SOURCE_DIR}/*.hpp" "${SOURCE_DIR}/*.c" "${SOURCE_DIR}/*.h" "${SOURCE_DIR}/metadata/version.rc") @@ -80,4 +67,4 @@ else() add_executable(${PROJECT_NAME} WIN32 ${SOURCE_FILES}) endif() -target_link_libraries(${PROJECT_NAME} PRIVATE raylib freeimage::FreeImage freeimage::FreeImagePlus glfw winmm ) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} PRIVATE raylib freeimage::FreeImage freeimage::FreeImagePlus glfw winmm) \ No newline at end of file From fd6e90d48bf970bee3b8de1e86e8729b9eeb152a Mon Sep 17 00:00:00 2001 From: fr0zert <52128237+fr0zert@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:10:01 +0200 Subject: [PATCH 6/6] Workflow fix --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1072ca6..2f82ee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,13 @@ set(VCPKG_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Vcpkg build type" FORCE if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) if(DEFINED ENV{VCPKG_ROOT}) - set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" - CACHE STRING "Vcpkg toolchain file" FORCE) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" CACHE STRING "Vcpkg toolchain file" FORCE) message(STATUS "Using vcpkg toolchain from: $ENV{VCPKG_ROOT}") + elseif(DEFINED ENV{VCPKG_INSTALLATION_ROOT}) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" CACHE STRING "Vcpkg toolchain file" FORCE) + message(STATUS "Using vcpkg toolchain from: $ENV{VCPKG_INSTALLATION_ROOT}") else() - message(WARNING "VCPKG_ROOT not set — vcpkg will not be used.") + message(WARNING "VCPKG_ROOT or VCPKG_INSTALLATION_ROOT not set - vcpkg will not be used.") endif() endif()