chore: restore product scaffold to rollback baseline

This commit is contained in:
Edison Jwa
2026-05-29 14:02:04 +09:00
parent 2896f14ec9
commit fe6e07353e
434 changed files with 27278 additions and 63230 deletions
-60
View File
@@ -9,21 +9,6 @@ set(BINARY_NAME "chanora_flutter")
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "app.chanora.chanora_flutter")
# Repository root for Rust bridge builds / bundle staging.
set(CHANORA_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
# Optional path to a Linux ONNX Runtime shared library for Silero VAD.
# When set, the bundle carries a local `lib/libonnxruntime.so` sidecar and the
# runner exports `ORT_DYLIB_PATH` to that file before Flutter starts.
set(CHANORA_ONNXRUNTIME_SHARED_LIB "$ENV{CHANORA_ONNXRUNTIME_SHARED_LIB}" CACHE FILEPATH
"Absolute path to libonnxruntime.so for Linux bundle packaging")
# Optional path to a prebuilt Rust bridge shared library. When unset, the Linux
# bundle build runs `cargo build -p chanora_bridge` for the host profile and
# stages the resulting `libchanora_bridge.so` automatically.
set(CHANORA_BRIDGE_SHARED_LIB "$ENV{CHANORA_BRIDGE_SHARED_LIB}" CACHE FILEPATH
"Absolute path to libchanora_bridge.so for Linux bundle packaging")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
@@ -68,7 +53,6 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
find_program(CARGO_EXECUTABLE cargo REQUIRED)
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")
@@ -76,27 +60,6 @@ add_subdirectory("runner")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CHANORA_BRIDGE_PROFILE_DIR "debug")
set(CHANORA_BRIDGE_CARGO_ARGS build --package chanora_bridge)
else()
set(CHANORA_BRIDGE_PROFILE_DIR "release")
set(CHANORA_BRIDGE_CARGO_ARGS build --release --package chanora_bridge)
endif()
if(CHANORA_BRIDGE_SHARED_LIB)
set(CHANORA_BRIDGE_STAGED_LIB "${CHANORA_BRIDGE_SHARED_LIB}")
else()
set(CHANORA_BRIDGE_STAGED_LIB
"${CHANORA_REPO_ROOT}/target/${CHANORA_BRIDGE_PROFILE_DIR}/libchanora_bridge.so")
add_custom_target(chanora_bridge_bundle
COMMAND "${CARGO_EXECUTABLE}" ${CHANORA_BRIDGE_CARGO_ARGS}
WORKING_DIRECTORY "${CHANORA_REPO_ROOT}"
COMMENT "Building chanora_bridge for Linux bundle"
VERBATIM)
add_dependencies(${BINARY_NAME} chanora_bridge_bundle)
endif()
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
@@ -137,29 +100,6 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
if(EXISTS "${CHANORA_BRIDGE_STAGED_LIB}")
install(FILES "${CHANORA_BRIDGE_STAGED_LIB}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
else()
message(WARNING
"Chanora bridge shared library was not found for Linux bundling: "
"${CHANORA_BRIDGE_STAGED_LIB}")
endif()
if(CHANORA_ONNXRUNTIME_SHARED_LIB)
if(EXISTS "${CHANORA_ONNXRUNTIME_SHARED_LIB}")
install(FILES "${CHANORA_ONNXRUNTIME_SHARED_LIB}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
RENAME "libonnxruntime.so"
COMPONENT Runtime)
else()
message(WARNING
"CHANORA_ONNXRUNTIME_SHARED_LIB was set but the file was not found: "
"${CHANORA_ONNXRUNTIME_SHARED_LIB}")
endif()
endif()
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
@@ -14,27 +14,6 @@ struct _MyApplication {
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
static void configure_onnxruntime_dylib_path() {
const gchar* existing = g_getenv("ORT_DYLIB_PATH");
if (existing != nullptr && *existing != '\0') {
return;
}
g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr);
if (exe_path == nullptr) {
return;
}
g_autofree gchar* exe_dir = g_path_get_dirname(exe_path);
g_autofree gchar* ort_path =
g_build_filename(exe_dir, "lib", "libonnxruntime.so", nullptr);
if (!g_file_test(ort_path, G_FILE_TEST_IS_REGULAR)) {
return;
}
g_setenv("ORT_DYLIB_PATH", ort_path, TRUE);
}
// Called when first Flutter frame received.
static void first_frame_cb(MyApplication* self, FlView* view) {
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
@@ -131,7 +110,6 @@ static void my_application_startup(GApplication* application) {
// MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application startup.
configure_onnxruntime_dylib_path();
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}