initial commit. can build openmvg into archimedes

This commit is contained in:
Jordan
2024-03-07 06:29:36 -08:00
commit e3f9413566
83 changed files with 2501 additions and 0 deletions

31
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,31 @@
# The Flutter tooling requires that developers have CMake 3.10 or later
# installed. You should not increase this version, as doing so will cause
# the plugin to fail to compile for some customers of the plugin.
cmake_minimum_required(VERSION 3.10)
include(ExternalProject)
project(archimedes_mobile_lib_library VERSION 0.0.1 LANGUAGES C)
ExternalProject_Add(openMVG
GIT_REPOSITORY "git@github.com:src-r-r/openMVG.git"
GIT_TAG "develop"
SOURCE_SUBDIR "src"
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_BUILD_DIR} -DCMAKE_INCLUDE-PATH=${CMAKE_BUILD_DIR}/include"
PREFIX ${CMAKE_BUILD_DIR}
INSTALL_DIR ${CMAKE_BUILD_DIR}
)
add_library(archimedes_mobile_lib SHARED
"archimedes_mobile_lib.c"
)
target_link_libraries(archimedes_mobile_lib ${OPENMVG_LIBRARIES})
include_directories(${OPENMVG_INCLUDE_DIRS})
set_target_properties(archimedes_mobile_lib PROPERTIES
PUBLIC_HEADER archimedes_mobile_lib.h
OUTPUT_NAME "archimedes_mobile_lib"
)
target_compile_definitions(archimedes_mobile_lib PUBLIC DART_SHARED_LIB)

View File

@ -0,0 +1,23 @@
#include "archimedes_mobile_lib.h"
// A very short-lived native function.
//
// For very short-lived functions, it is fine to call them on the main isolate.
// They will block the Dart execution while running the native function, so
// only do this for native functions which are guaranteed to be short-lived.
FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b) { return a + b; }
// A longer-lived native function, which occupies the thread calling it.
//
// Do not call these kind of native functions in the main isolate. They will
// block Dart execution. This will cause dropped frames in Flutter applications.
// Instead, call these native functions on a separate isolate.
FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b) {
// Simulate work.
#if _WIN32
Sleep(5000);
#else
usleep(5000 * 1000);
#endif
return a + b;
}

View File

@ -0,0 +1,30 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#if _WIN32
#include <windows.h>
#else
#include <pthread.h>
#include <unistd.h>
#endif
#if _WIN32
#define FFI_PLUGIN_EXPORT __declspec(dllexport)
#else
#define FFI_PLUGIN_EXPORT
#endif
// A very short-lived native function.
//
// For very short-lived functions, it is fine to call them on the main isolate.
// They will block the Dart execution while running the native function, so
// only do this for native functions which are guaranteed to be short-lived.
FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b);
// A longer lived native function, which occupies the thread calling it.
//
// Do not call these kind of native functions in the main isolate. They will
// block Dart execution. This will cause dropped frames in Flutter applications.
// Instead, call these native functions on a separate isolate.
FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b);