diff --git a/README.md b/README.md index f74733dce..3d1eef1f5 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,21 @@ matrix: Platform-specific build scripts are available in the `scripts/` directory: - `./scripts/build-appimage.sh` - AppImage (Linux) - `./scripts/build-linux.sh` - Linux (Run only after build-appimage.sh) +- `.\scripts\build-windows.ps1` - Windows + + +#### Prerequisites +##### Windows + +Before building on Windows, install the following: + +* **[Visual Studio Build Tools 2026](https://visualstudio.microsoft.com/downloads/#visual-studio-2022-tools)** (or newer) with the **"Desktop development with C++"** workload — provides MSVC compiler and Windows SDK. +* **[CMake](https://cmake.org/download/)** +* **[Rust](https://rustup.rs)** (`rustup`) +* **[OpenSSL](https://slproweb.com/products/Win32OpenSSL.html)** +* **[Flutter SDK](https://docs.flutter.dev/get-started/install/windows)** +> [!IMPORTANT] +> You must run build as admin and without VPN in Russia you can't build because one is libs can't be download ## License diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index b7921748c..287b71045 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -176,6 +176,11 @@ abstract class ClientManager { settings: const InitializationSettings( android: AndroidInitializationSettings('notifications_icon'), iOS: DarwinInitializationSettings(), + windows: WindowsInitializationSettings( + appName: 'Extera', + appUserModelId: 'im.extera.app', + guid: 'a8b5c6d7-e8f9-4a0b-b1c2-d3e4f5a6b7c8', + ), ), ); @@ -191,6 +196,8 @@ abstract class ClientManager { priority: Priority.max, ), iOS: DarwinNotificationDetails(sound: 'notification.caf'), + windows: WindowsNotificationDetails( + ), ), ); } diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 1c2b99451..0a9d45b2d 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -4,7 +4,7 @@ project(fluffychat LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "fluffychat") +set(BINARY_NAME "extera") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. @@ -30,7 +30,7 @@ set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") # Use Unicode for all projects. -add_definitions(-DUNICODE -D_UNICODE) +add_definitions(-DUNICODE -D_UNICODE -D_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS) # Compilation settings that should be applied to most targets. # @@ -99,3 +99,14 @@ install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) + +# Ensure libsqlcipher.dll exists alongside sqlite3.dll +install(CODE " + if(EXISTS \"${CMAKE_INSTALL_PREFIX}/sqlite3.dll\") + file(COPY_FILE + \"${CMAKE_INSTALL_PREFIX}/sqlite3.dll\" + \"${CMAKE_INSTALL_PREFIX}/libsqlcipher.dll\" + ) + endif() +" COMPONENT Runtime) +target_compile_options(${BINARY_NAME} PRIVATE /W0) \ No newline at end of file diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt index b9e550fba..17411a8ab 100644 --- a/windows/runner/CMakeLists.txt +++ b/windows/runner/CMakeLists.txt @@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32 # that need different build settings. apply_standard_settings(${BINARY_NAME}) +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 52aa4877a..c11941c44 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 1,0,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else #define VERSION_AS_STRING "1.0.0" #endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico index f53c6c005..9f5c075c0 100644 Binary files a/windows/runner/resources/app_icon.ico and b/windows/runner/resources/app_icon.ico differ