From 189587d51e7e8093350e86982168cb8821a0e062 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 25 Sep 2025 10:21:57 -0400 Subject: [PATCH] Enhance CMake configuration and update dependencies - Updated CMakeLists.txt to set policies for older submodules, improving compatibility with various CMake versions. - Modified vcpkg.json to change the SDL2 dependency to a core variant and updated the builtin baseline to the latest version, ensuring better package management. - Improved file dialog functionality in file_dialog.cc by adding conditional compilation for NFD support, providing fallback behavior when NFD is unavailable. --- CMakeLists.txt | 8 ++++++++ src/app/core/platform/file_dialog.cc | 12 ++++++++++++ vcpkg.json | 5 ++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9331a49d..597c9ca5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,14 @@ # Yet Another Zelda3 Editor # by scawful cmake_minimum_required(VERSION 3.16) + +# Set policy for older submodules +if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() project(yaze VERSION 0.3.0 DESCRIPTION "Yet Another Zelda3 Editor" LANGUAGES CXX C) diff --git a/src/app/core/platform/file_dialog.cc b/src/app/core/platform/file_dialog.cc index 637bd4a9..03eb42d2 100644 --- a/src/app/core/platform/file_dialog.cc +++ b/src/app/core/platform/file_dialog.cc @@ -216,9 +216,12 @@ std::vector FileDialogWrapper::GetFilesInFolder( #elif defined(__linux__) +#ifdef YAZE_ENABLE_NFD #include +#endif std::string FileDialogWrapper::ShowOpenFileDialog() { +#ifdef YAZE_ENABLE_NFD NFD_Init(); nfdu8char_t *out_path = NULL; nfdu8filter_item_t filters[1] = {{"Rom File", "sfc,smc"}}; @@ -237,9 +240,14 @@ std::string FileDialogWrapper::ShowOpenFileDialog() { } NFD_Quit(); return "Error: NFD_OpenDialog"; +#else + // NFD not available - return empty string or implement fallback + return ""; +#endif } std::string FileDialogWrapper::ShowOpenFolderDialog() { +#ifdef YAZE_ENABLE_NFD NFD_Init(); nfdu8char_t *out_path = NULL; nfdresult_t result = NFD_PickFolderU8(&out_path); @@ -254,6 +262,10 @@ std::string FileDialogWrapper::ShowOpenFolderDialog() { } NFD_Quit(); return "Error: NFD_PickFolder"; +#else + // NFD not available - return empty string or implement fallback + return ""; +#endif } std::vector FileDialogWrapper::GetSubdirectoriesInFolder( diff --git a/vcpkg.json b/vcpkg.json index 318e279e..aa5182ff 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,8 +5,7 @@ "dependencies": [ "zlib", "libpng", - "sdl2", - "abseil" + "sdl2[core]" ], - "builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" + "builtin-baseline": "2024.12.16" }