mirror of
				https://github.com/velopack/velopack.git
				synced 2025-10-25 15:19:22 +00:00 
			
		
		
		
	wip
This commit is contained in:
		| @@ -2,6 +2,9 @@ fn main() { | ||||
|     cxx_build::bridge("src/lib.rs") | ||||
|         .file("src/bridge.cc") | ||||
|         .flag_if_supported("/std:c++17") | ||||
|         .flag_if_supported("/DEF:src/lib.def") | ||||
|         .flag_if_supported("/FORCE:UNRESOLVED") | ||||
|         // .warnings_into_errors(true) | ||||
|         .std("c++17") | ||||
|         .compile("velopack_libc"); | ||||
|  | ||||
| @@ -9,4 +12,5 @@ fn main() { | ||||
|     println!("cargo:rerun-if-changed=src/lib.rs"); | ||||
|     println!("cargo:rerun-if-changed=src/bridge.hpp"); | ||||
|     println!("cargo:rerun-if-changed=src/bridge.cc"); | ||||
|     println!("cargo:rustc-link-arg=/WHOLEARCHIVE:velopack_libc.lib"); | ||||
| } | ||||
| @@ -1,7 +1,45 @@ | ||||
| #ifndef VELOPACK_HPP | ||||
| #define VELOPACK_HPP | ||||
| #ifndef VELOPACK_H | ||||
| #define VELOPACK_H | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #define DLL_EXPORT __declspec(dllexport) | ||||
| #else | ||||
| #define DLL_EXPORT __attribute__((visibility("default"))) __attribute__((used)) | ||||
| #endif | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| typedef void* update_manager_t; | ||||
|  | ||||
| typedef struct { | ||||
|     bool AllowVersionDowngrade; | ||||
|     char* ExplicitChannel; | ||||
| } update_options_t; | ||||
|  | ||||
| #endif // VELOPACK_HPP | ||||
| typedef struct { | ||||
|     char* RootAppDir; | ||||
|     char* UpdateExePath; | ||||
|     char* PackagesDir; | ||||
|     char* ManifestPath; | ||||
|     char* CurrentBinaryDir; | ||||
|     bool IsPortable; | ||||
| } locator_config_t; | ||||
|  | ||||
| DLL_EXPORT update_manager_t velopack_new_update_manager(const char* url_or_path, const update_options_t* options, const locator_config_t* locator = 0); | ||||
| //fn bridge_get_current_version(manager: &UpdateManagerOpaque) -> String; | ||||
| //fn bridge_get_app_id(manager: &UpdateManagerOpaque) -> String; | ||||
| //fn bridge_is_portable(manager: &UpdateManagerOpaque) -> bool; | ||||
| //fn bridge_update_pending_restart(manager: &UpdateManagerOpaque) -> AssetOption; | ||||
| //fn bridge_check_for_updates(manager: &UpdateManagerOpaque) -> Result<UpdateInfoOption>; | ||||
| //fn bridge_download_update(manager: &UpdateManagerOpaque, to_download: UpdateInfoDto, progress: UniquePtr<DownloadCallbackManager>) -> Result<()>; | ||||
| //fn bridge_wait_exit_then_apply_update(manager: &UpdateManagerOpaque, to_download: AssetDto, silent: bool, restart: bool, restart_args: Vec<String>) -> Result<()>; | ||||
| //fn bridge_appbuilder_run(cb: UniquePtr<HookCallbackManager>, custom_args: StringArrayOption, locator: LocatorConfigOption, auto_apply: bool); | ||||
| //fn bridge_set_logger_callback(cb: UniquePtr<LoggerCallbackManager>); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif // VELOPACK_H | ||||
| @@ -1,2 +1,7 @@ | ||||
| #include "velopack_libc/include/Velopack.h" | ||||
| #include "velopack_libc/src/bridge.hpp" | ||||
| #include "velopack_libc/src/bridge.hpp" | ||||
|  | ||||
| DLL_EXPORT update_manager_t velopack_new_update_manager(const char* url_or_path, const update_options_t* options, const locator_config_t* locator) | ||||
| { | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										3
									
								
								src/lib-cpp/src/lib.def
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/lib-cpp/src/lib.def
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| LIBRARY velopack_libc | ||||
| EXPORTS | ||||
|     velopack_new_update_manager | ||||
| @@ -289,9 +289,6 @@ fn bridge_appbuilder_run(cb: cxx::UniquePtr<ffi::HookCallbackManager>, custom_ar | ||||
|         app = app.set_args(custom_args.data); | ||||
|     } | ||||
|  | ||||
|     let _ = log::set_logger(&LOGGER); | ||||
|     log::set_max_level(log::LevelFilter::Trace); | ||||
|  | ||||
|     app.run(); | ||||
| } | ||||
|  | ||||
| @@ -346,6 +343,9 @@ fn get_logger() -> Option<*mut ffi::LoggerCallbackManager> { | ||||
| } | ||||
|  | ||||
| fn bridge_set_logger_callback(cb: cxx::UniquePtr<ffi::LoggerCallbackManager>) { | ||||
|     let _ = log::set_logger(&LOGGER); | ||||
|     log::set_max_level(log::LevelFilter::Trace); | ||||
|      | ||||
|     let cb = cb.into_raw(); | ||||
|     store_logger(cb); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user