Skip to content

Commit

Permalink
update windows and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Feb 1, 2024
1 parent a3b2fe9 commit c357e66
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 37 deletions.
25 changes: 5 additions & 20 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "2f708eb8396e362e280fac22cf171c2cb467343c"
revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4"
channel: "stable"

project_type: app
Expand All @@ -13,26 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
- platform: android
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
- platform: ios
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: linux
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
- platform: macos
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
- platform: web
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
- platform: windows
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4

# User provided section

Expand Down
9 changes: 8 additions & 1 deletion linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ set_target_properties(${BINARY_NAME}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)


# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
Expand Down Expand Up @@ -122,6 +123,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
COMPONENT Runtime)
endforeach(bundled_library)

# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
Expand All @@ -135,4 +142,4 @@ install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
endif()
2 changes: 1 addition & 1 deletion linux/main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "my_application.h"

int main(int argc, char** argv) {
g_autoptr(MaidApplication) app = my_application_new();
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}
16 changes: 8 additions & 8 deletions linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

#include "flutter/generated_plugin_registrant.h"

struct _MaidApplication {
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};

G_DEFINE_TYPE(MaidApplication, my_application, GTK_TYPE_APPLICATION)
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)

// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MaidApplication* self = MY_APPLICATION(application);
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));

Expand Down Expand Up @@ -64,7 +64,7 @@ static void my_application_activate(GApplication* application) {

// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
MaidApplication* self = MY_APPLICATION(application);
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);

Expand All @@ -83,20 +83,20 @@ static gboolean my_application_local_command_line(GApplication* application, gch

// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MaidApplication* self = MY_APPLICATION(object);
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}

static void my_application_class_init(MaidApplicationClass* klass) {
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}

static void my_application_init(MaidApplication* self) {}
static void my_application_init(MyApplication* self) {}

MaidApplication* my_application_new() {
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
Expand Down
6 changes: 3 additions & 3 deletions linux/my_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

#include <gtk/gtk.h>

G_DECLARE_FINAL_TYPE(MaidApplication, my_application, MY, APPLICATION,
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)

/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MaidApplication.
* Returns: a new #MyApplication.
*/
MaidApplication* my_application_new();
MyApplication* my_application_new();

#endif // FLUTTER_MY_APPLICATION_H_
2 changes: 1 addition & 1 deletion packages/llama_cpp_dart
11 changes: 9 additions & 2 deletions windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")


# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
Expand All @@ -61,7 +62,7 @@ include(flutter/generated_plugins.cmake)
# Support files are copied into place next to the executable, so that it can
# run in place. This is done instead of making a separate bundle (as on Linux)
# so that building and running from within Visual Studio will work.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
# Make the "install" step default, as it's required to run.
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand All @@ -86,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES)
COMPONENT Runtime)
endif()

# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
Expand All @@ -98,4 +105,4 @@ install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
# Install the AOT library on non-Debug builds only.
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)
COMPONENT Runtime)
2 changes: 1 addition & 1 deletion windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ BEGIN
VALUE "FileDescription", "maid" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "maid" "\0"
VALUE "LegalCopyright", "Copyright (C) 2023 com.danemadsen. All rights reserved." "\0"
VALUE "LegalCopyright", "Copyright (C) 2024 com.danemadsen. All rights reserved." "\0"
VALUE "OriginalFilename", "maid.exe" "\0"
VALUE "ProductName", "maid" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
Expand Down

0 comments on commit c357e66

Please sign in to comment.