mirror of
https://github.com/tribufu/sdk-rust
synced 2025-06-15 18:54:19 +00:00
Remove native projects
This commit is contained in:
@ -1,157 +0,0 @@
|
||||
language = "C"
|
||||
header = "// Copyright (c) Tribufu. All Rights Reserved.\n// SPDX-License-Identifier: MIT"
|
||||
pragma_once = true
|
||||
include_version = false
|
||||
namespaces = []
|
||||
using_namespaces = []
|
||||
sys_includes = ["tribufu/prelude.h"]
|
||||
includes = []
|
||||
no_includes = true
|
||||
cpp_compat = false
|
||||
braces = "NextLine"
|
||||
line_length = 100
|
||||
tab_width = 4
|
||||
documentation = true
|
||||
documentation_style = "doxy"
|
||||
style = "tag"
|
||||
|
||||
[defines]
|
||||
"debug_assertions" = "TRIBUFU_DEBUG"
|
||||
"not(debug_assertions)" = "TRIBUFU_RELEASE"
|
||||
"panic = abort" = "TRIBUFU_PANIC_ABORT"
|
||||
"panic = unwind" = "TRIBUFU_PANIC_UNWIND"
|
||||
"proc_macro" = "TRIBUFU_PROC_MACRO"
|
||||
"target_arch = aarch64" = "TRIBUFU_AARCH64"
|
||||
"target_arch = arm" = "TRIBUFU_ARM"
|
||||
"target_arch = armV7" = "TRIBUFU_ARMV7"
|
||||
"target_arch = armv4t" = "TRIBUFU_ARMV4T"
|
||||
"target_arch = armv6" = "TRIBUFU_ARMV6"
|
||||
"target_arch = armv7a" = "TRIBUFU_ARMV7A"
|
||||
"target_arch = armv7s" = "TRIBUFU_ARMV7S"
|
||||
"target_arch = avr" = "TRIBUFU_AVR"
|
||||
"target_arch = bpfeb" = "TRIBUFU_BPFEB"
|
||||
"target_arch = bpfel" = "TRIBUFU_BPFEL"
|
||||
"target_arch = hexagon" = "TRIBUFU_HEXAGON"
|
||||
"target_arch = i386" = "TRIBUFU_I386"
|
||||
"target_arch = i586" = "TRIBUFU_I586"
|
||||
"target_arch = i686" = "TRIBUFU_I686"
|
||||
"target_arch = m68k" = "TRIBUFU_M68K"
|
||||
"target_arch = mips" = "TRIBUFU_MIPS"
|
||||
"target_arch = mipsel" = "TRIBUFU_MIPSEL"
|
||||
"target_arch = msp430" = "TRIBUFU_MSP430"
|
||||
"target_arch = powerpc" = "TRIBUFU_POWERPC"
|
||||
"target_arch = powerpc64" = "TRIBUFU_POWERPC64"
|
||||
"target_arch = powerpc64l" = "TRIBUFU_POWERPC64L"
|
||||
"target_arch = riscv32gc" = "TRIBUFU_RISCV32GC"
|
||||
"target_arch = s390x" = "TRIBUFU_S390X"
|
||||
"target_arch = sparc" = "TRIBUFU_SPARC"
|
||||
"target_arch = sparc64" = "TRIBUFU_SPARC64"
|
||||
"target_arch = thumbv4t" = "TRIBUFU_THUMBV4T"
|
||||
"target_arch = thumbv7a" = "TRIBUFU_THUMBV7A"
|
||||
"target_arch = thumbv7neon" = "TRIBUFU_THUMBV7NEON"
|
||||
"target_arch = wasm32" = "TRIBUFU_WASM32"
|
||||
"target_arch = wasm64" = "TRIBUFU_WASM64"
|
||||
"target_arch = x86" = "TRIBUFU_X86"
|
||||
"target_arch = x86_64" = "TRIBUFU_X86_64"
|
||||
"target_endian = big" = "TRIBUFU_BIG_ENDIAN"
|
||||
"target_endian = little" = "TRIBUFU_LITTLE_ENDIAN"
|
||||
"target_env = gnu" = "TRIBUFU_GNU"
|
||||
"target_env = msvc" = "TRIBUFU_MSVC"
|
||||
"target_env = musl" = "TRIBUFU_MUSL"
|
||||
"target_env = sgx" = "TRIBUFU_SGX"
|
||||
"target_family = unix" = "TRIBUFU_UNIX"
|
||||
"target_family = wasm" = "TRIBUFU_WASM"
|
||||
"target_family = windows" = "TRIBUFU_MICROSOFT"
|
||||
"target_feature = avx" = "TRIBUFU_AVX"
|
||||
"target_feature = avx2" = "TRIBUFU_AVX2"
|
||||
"target_feature = crt-static" = "TRIBUFU_CRTSTATIC"
|
||||
"target_feature = rdrand" = "TRIBUFU_RDRAND"
|
||||
"target_feature = sse" = "TRIBUFU_SSE"
|
||||
"target_feature = sse2" = "TRIBUFU_SSE2"
|
||||
"target_feature = sse4.1" = "TRIBUFU_SSE41"
|
||||
"target_has_atomic = 128" = "TRIBUFU_ATOMIC_128"
|
||||
"target_has_atomic = 16" = "TRIBUFU_ATOMIC_16"
|
||||
"target_has_atomic = 32" = "TRIBUFU_ATOMIC_32"
|
||||
"target_has_atomic = 64" = "TRIBUFU_ATOMIC_64"
|
||||
"target_has_atomic = 8" = "TRIBUFU_ATOMIC_8"
|
||||
"target_has_atomic = ptr" = "TRIBUFU_ATOMIC_PTR"
|
||||
"target_os = android" = "TRIBUFU_ANDROID"
|
||||
"target_os = dragonfly" = "TRIBUFU_DRAGONFLY"
|
||||
"target_os = freebsd" = "TRIBUFU_FREEBSD"
|
||||
"target_os = ios" = "TRIBUFU_IOS"
|
||||
"target_os = linux" = "TRIBUFU_LINUX"
|
||||
"target_os = macos" = "TRIBUFU_MACOS"
|
||||
"target_os = netbsd" = "TRIBUFU_NETBSD"
|
||||
"target_os = openbsd" = "TRIBUFU_OPENBSD"
|
||||
"target_os = windows" = "TRIBUFU_WINDOWS"
|
||||
"target_pointer_width = 16" = "TRIBUFU_POINTER_16"
|
||||
"target_pointer_width = 32" = "TRIBUFU_POINTER_32"
|
||||
"target_pointer_width = 64" = "TRIBUFU_POINTER_64"
|
||||
"target_vendor = apple" = "TRIBUFU_APPLE"
|
||||
"target_vendor = fortanix" = "TRIBUFU_FORTANIX"
|
||||
"target_vendor = pc" = "TRIBUFU_MICROSOFT"
|
||||
"target_vendor = unknown" = "TRIBUFU_UNKNOWN"
|
||||
|
||||
[export]
|
||||
include = []
|
||||
exclude = []
|
||||
item_types = ["enums", "structs", "typedefs", "functions"]
|
||||
renaming_overrides_prefixing = false
|
||||
|
||||
[layout]
|
||||
packed = "PACKED"
|
||||
aligned_n = "ALIGNED"
|
||||
|
||||
[fn]
|
||||
prefix = "TRIBUFU_API"
|
||||
args = "horizontal"
|
||||
must_use = "MUST_USE_FUNC"
|
||||
no_return = "NO_RETURN"
|
||||
rename_args = "None"
|
||||
sort_by = "Name"
|
||||
|
||||
[struct]
|
||||
rename_fields = "None"
|
||||
must_use = "MUST_USE_STRUCT"
|
||||
derive_constructor = true
|
||||
derive_eq = false
|
||||
derive_neq = false
|
||||
derive_lt = false
|
||||
derive_lte = false
|
||||
derive_gt = false
|
||||
derive_gte = false
|
||||
|
||||
[enum]
|
||||
rename_variants = "None"
|
||||
add_sentinel = false
|
||||
prefix_with_name = false
|
||||
enum_class = false
|
||||
derive_helper_methods = false
|
||||
derive_const_casts = false
|
||||
derive_mut_casts = false
|
||||
must_use = "MUST_USE_ENUM"
|
||||
derive_tagged_enum_destructor = false
|
||||
derive_tagged_enum_copy_constructor = false
|
||||
derive_tagged_enum_copy_assignment = false
|
||||
private_default_tagged_enum_constructor = false
|
||||
|
||||
[const]
|
||||
allow_static_const = true
|
||||
allow_constexpr = false
|
||||
sort_by = "Name"
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
include = []
|
||||
exclude = []
|
||||
clean = false
|
||||
extra_bindings = []
|
||||
|
||||
[parse.expand]
|
||||
crates = []
|
||||
all_features = true
|
||||
default_features = true
|
||||
features = []
|
@ -1,14 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tribufu/api.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
tribufu_api_initialize();
|
||||
char *version = tribufu_api_get_user_agent();
|
||||
printf("%s\n", version);
|
||||
tribufu_free_string(version);
|
||||
tribufu_api_shutdown();
|
||||
return 0;
|
||||
}
|
@ -1,212 +0,0 @@
|
||||
--- @diagnostic disable: undefined-global
|
||||
|
||||
project "example_c"
|
||||
location "."
|
||||
kind "ConsoleApp"
|
||||
language "C"
|
||||
|
||||
targetdir("../../bin/%{cfg.platform}")
|
||||
objdir("../../target/%{cfg.buildcfg}/obj/%{prj.name}/%{cfg.platform}")
|
||||
|
||||
files
|
||||
{
|
||||
"./**.c",
|
||||
"./**.h",
|
||||
"../../include/**.h",
|
||||
}
|
||||
|
||||
vpaths
|
||||
{
|
||||
["Sources"] = { "./**.c" },
|
||||
["Headers"] = { "./**.h", "../../include/**.h" },
|
||||
}
|
||||
|
||||
includedirs
|
||||
{
|
||||
"../../include",
|
||||
}
|
||||
|
||||
libdirs
|
||||
{
|
||||
"../../bin/%{cfg.platform}",
|
||||
}
|
||||
|
||||
-- Profile
|
||||
|
||||
filter { "configurations:debug" }
|
||||
runtime "Debug"
|
||||
symbols "On"
|
||||
|
||||
defines
|
||||
{
|
||||
"DEBUG",
|
||||
"TRACE",
|
||||
"TRIBUFU_DEBUG",
|
||||
"TRIBUFU_TRACE",
|
||||
}
|
||||
|
||||
filter { "configurations:release" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
|
||||
defines
|
||||
{
|
||||
"RELEASE",
|
||||
"TRIBUFU_RELEASE",
|
||||
}
|
||||
|
||||
-- Platform
|
||||
|
||||
filter { "platforms:win-*" }
|
||||
system "windows"
|
||||
systemversion "latest"
|
||||
staticruntime "On"
|
||||
toolset "msc"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_WINDOWS",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk.lib",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:osx-*" }
|
||||
system "macosx"
|
||||
systemversion "10.15"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_APPLE",
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MAC",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:linux-*" }
|
||||
system "linux"
|
||||
toolset "gcc"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_LINUX",
|
||||
"TRIBUFU_UNIX",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:android-*" }
|
||||
system "android"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_ANDROID",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MOBILE",
|
||||
"TRIBUFU_UNIX",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:ios-*" }
|
||||
system "ios"
|
||||
systemversion "13.0"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_APPLE",
|
||||
"TRIBUFU_IOS",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MOBILE",
|
||||
"TRIBUFU_MONOLITHIC",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
-- Architecture
|
||||
|
||||
filter { "platforms:*-x86" }
|
||||
architecture "x86"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_32BITS",
|
||||
"TRIBUFU_X86",
|
||||
}
|
||||
|
||||
filter { "platforms:*-x64" }
|
||||
architecture "x64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_64BITS",
|
||||
"TRIBUFU_X64",
|
||||
}
|
||||
|
||||
filter { "platforms:*-arm64" }
|
||||
architecture "ARM64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_64BITS",
|
||||
"TRIBUFU_ARM64",
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <iostream>
|
||||
#include <tribufu/api.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
tribufu_api_initialize();
|
||||
const char *version = tribufu_api_get_user_agent();
|
||||
std::cout << version << std::endl;
|
||||
tribufu_free_string((char *)version);
|
||||
tribufu_api_shutdown();
|
||||
return 0;
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
--- @diagnostic disable: undefined-global
|
||||
|
||||
project "example_cpp"
|
||||
location "."
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
cppdialect "C++20"
|
||||
|
||||
targetdir("../../bin/%{cfg.platform}")
|
||||
objdir("../../target/%{cfg.buildcfg}/obj/%{prj.name}/%{cfg.platform}")
|
||||
|
||||
files
|
||||
{
|
||||
"./**.cpp",
|
||||
"./**.h",
|
||||
"../../include/**.h",
|
||||
}
|
||||
|
||||
vpaths
|
||||
{
|
||||
["Sources"] = { "./**.cpp" },
|
||||
["Headers"] = { "./**.h", "../../include/**.h" },
|
||||
}
|
||||
|
||||
includedirs
|
||||
{
|
||||
"../../include",
|
||||
}
|
||||
|
||||
libdirs
|
||||
{
|
||||
"../../bin/%{cfg.platform}",
|
||||
}
|
||||
|
||||
-- Profile
|
||||
|
||||
filter { "configurations:debug" }
|
||||
runtime "Debug"
|
||||
symbols "On"
|
||||
|
||||
defines
|
||||
{
|
||||
"DEBUG",
|
||||
"TRACE",
|
||||
"TRIBUFU_DEBUG",
|
||||
"TRIBUFU_TRACE",
|
||||
}
|
||||
|
||||
filter { "configurations:release" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
|
||||
defines
|
||||
{
|
||||
"RELEASE",
|
||||
"TRIBUFU_RELEASE",
|
||||
}
|
||||
|
||||
-- Platform
|
||||
|
||||
filter { "platforms:win-*" }
|
||||
system "windows"
|
||||
systemversion "latest"
|
||||
staticruntime "On"
|
||||
toolset "msc"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_WINDOWS",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk.lib",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:osx-*" }
|
||||
system "macosx"
|
||||
systemversion "10.15"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_APPLE",
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MAC",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:linux-*" }
|
||||
system "linux"
|
||||
toolset "gcc"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_DESKTOP",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_LINUX",
|
||||
"TRIBUFU_UNIX",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:android-*" }
|
||||
system "android"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_ANDROID",
|
||||
"TRIBUFU_DYNAMIC",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MOBILE",
|
||||
"TRIBUFU_UNIX",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
{
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:ios-*" }
|
||||
system "ios"
|
||||
systemversion "13.0"
|
||||
toolset "clang"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_APPLE",
|
||||
"TRIBUFU_IOS",
|
||||
"TRIBUFU_LIBRARY",
|
||||
"TRIBUFU_MOBILE",
|
||||
"TRIBUFU_MONOLITHIC",
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_sdk",
|
||||
}
|
||||
|
||||
-- Architecture
|
||||
|
||||
filter { "platforms:*-x86" }
|
||||
architecture "x86"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_32BITS",
|
||||
"TRIBUFU_X86",
|
||||
}
|
||||
|
||||
filter { "platforms:*-x64" }
|
||||
architecture "x64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_64BITS",
|
||||
"TRIBUFU_X64",
|
||||
}
|
||||
|
||||
filter { "platforms:*-arm64" }
|
||||
architecture "ARM64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_64BITS",
|
||||
"TRIBUFU_ARM64",
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/api.h>
|
@ -1,6 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/native.h>
|
@ -1,25 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define TRIBUFU_CPP
|
||||
#endif
|
||||
|
||||
#ifndef EXTERN_C
|
||||
#ifdef TRIBUFU_CPP
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TRIBUFU_API EXTERN_C
|
||||
|
||||
/*
|
||||
#ifdef TRIBUFU_LIBRARY
|
||||
#define TRIBUFU_API DLLEXPORT
|
||||
#else
|
||||
#define TRIBUFU_API DLLIMPORT
|
||||
#endif
|
||||
*/
|
@ -1,38 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/prelude.h>
|
||||
|
||||
typedef void TribufuApiGetUserInfoCallbackData;
|
||||
|
||||
typedef void (*TribufuApiGetUserInfoCallback)(void*, const TribufuApiGetUserInfoCallbackData*);
|
||||
|
||||
/**
|
||||
* Gets the user agent string for the Tribufu API.
|
||||
*/
|
||||
TRIBUFU_API const char *tribufu_api_get_user_agent(void);
|
||||
|
||||
TRIBUFU_API void tribufu_api_get_user_info(void *context, TribufuApiGetUserInfoCallback callback);
|
||||
|
||||
/**
|
||||
* Gets the version of the Tribufu API.
|
||||
*/
|
||||
TRIBUFU_API const char *tribufu_api_get_version(void);
|
||||
|
||||
/**
|
||||
* Initialize the Tribufu API instance.
|
||||
*
|
||||
* This must be called before any other API functions.
|
||||
*/
|
||||
TRIBUFU_API bool tribufu_api_initialize(void);
|
||||
|
||||
/**
|
||||
* Shutdown the Tribufu API instance.
|
||||
*
|
||||
* This must be called when the API is no longer needed.
|
||||
*/
|
||||
TRIBUFU_API void tribufu_api_shutdown(void);
|
||||
|
||||
TRIBUFU_API void tribufu_free_string(char *ptr);
|
@ -1,21 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef DLLEXPORT
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#endif
|
||||
#ifndef DLLIMPORT
|
||||
#define DLLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __MACH__ || __APPLE__ || __linux__ || __FreeBSD__ || __ANDROID__
|
||||
#ifndef DLLEXPORT
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#ifndef DLLIMPORT
|
||||
#define DLLIMPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/macros.h>
|
||||
#include <tribufu/platform.h>
|
||||
#include <tribufu/std.h>
|
@ -1,26 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef TRIBUFU_CPP
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#endif
|
31
premake5.lua
31
premake5.lua
@ -1,31 +0,0 @@
|
||||
--- @diagnostic disable: undefined-global
|
||||
|
||||
workspace "tribufu"
|
||||
location "."
|
||||
configurations { "debug", "release" }
|
||||
|
||||
if _ACTION == "vs2022" then
|
||||
platforms {
|
||||
"win-arm64",
|
||||
"win-x64",
|
||||
"win-x86",
|
||||
}
|
||||
end
|
||||
|
||||
if _ACTION == "gmake2" then
|
||||
platforms {
|
||||
"linux-arm64",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
}
|
||||
end
|
||||
|
||||
if _ACTION == "xcode4" then
|
||||
platforms {
|
||||
"osx-arm64",
|
||||
"osx-x64",
|
||||
}
|
||||
end
|
||||
|
||||
include "examples/c"
|
||||
include "examples/cpp"
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cbindgen --config ./config/cbindgen.toml --crate tribufu-sdk --output ./include/tribufu/native.h
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
|
||||
then
|
||||
./vendor/premake-core/linux/premake5 gmake2
|
||||
|
||||
elif [ "$(uname)" = "Darwin" ]
|
||||
then
|
||||
./vendor/premake-core/mac/premake5 xcode4
|
||||
fi
|
@ -2,11 +2,3 @@
|
||||
|
||||
echo "Building for win-x64"
|
||||
cargo build --workspace
|
||||
|
||||
New-Item "bin/win-x64" -ItemType Directory -Force
|
||||
Remove-Item -Path "bin/win-x64/*" -Force -Recurse
|
||||
|
||||
Copy-Item -Path "target/debug/tribufu_sdk.dll.lib" -Destination "bin/win-x64/tribufu_sdk.lib"
|
||||
Copy-Item -Path "target/debug/tribufu_sdk.dll" -Destination "bin/win-x64/tribufu_sdk.dll"
|
||||
|
||||
#msbuild /p:Configuration="debug" /p:Platform="win-x64"
|
||||
|
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
|
||||
call .\vendor\premake-core\windows\premake5.exe vs2022
|
@ -1,21 +0,0 @@
|
||||
[package]
|
||||
name = "tribufu-sdk"
|
||||
version = "0.0.0"
|
||||
description = "Tribufu Native"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "UNLICENSED"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name = "tribufu_sdk"
|
||||
crate-type = ["rlib", "cdylib", "staticlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tribufu = { path = "../../" }
|
||||
futures = "0.3.31"
|
||||
libc = "0.2.172"
|
||||
once_cell = "1.19.0"
|
||||
tokio = { version = "1.45.1", features = ["full"] }
|
@ -1,88 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
use crate::models::{TribufuApiCallbackContext, TribufuApiGetUserInfoCallback};
|
||||
use futures::lock::Mutex;
|
||||
use libc::{c_char, c_void};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
use tokio::runtime::Runtime;
|
||||
use tribufu::apis::tribufu_generated_api::TribufuGeneratedApiClient;
|
||||
use tribufu::TribufuApi;
|
||||
|
||||
static INSTANCE: Lazy<Mutex<Option<TribufuGeneratedApiClient>>> = Lazy::new(|| Mutex::new(None));
|
||||
static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().unwrap());
|
||||
|
||||
/// Gets the version of the Tribufu API.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_api_get_version() -> *const c_char {
|
||||
CString::new(TribufuApi::get_version()).unwrap().into_raw()
|
||||
}
|
||||
|
||||
/// Gets the user agent string for the Tribufu API.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_api_get_user_agent() -> *const c_char {
|
||||
CString::new(TribufuApi::get_user_agent())
|
||||
.unwrap()
|
||||
.into_raw()
|
||||
}
|
||||
|
||||
/// Initialize the Tribufu API instance.
|
||||
///
|
||||
/// This must be called before any other API functions.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_api_initialize() -> bool {
|
||||
let api = TribufuApi::from_env_or_default(None);
|
||||
|
||||
if INSTANCE.try_lock().is_none() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut instance = INSTANCE.try_lock().unwrap();
|
||||
*instance = Some(api);
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
/// Shutdown the Tribufu API instance.
|
||||
///
|
||||
/// This must be called when the API is no longer needed.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_api_shutdown() {
|
||||
if INSTANCE.try_lock().is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut instance = INSTANCE.try_lock().unwrap();
|
||||
*instance = None;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(unused_variables)]
|
||||
pub extern "C" fn tribufu_api_get_user_info(
|
||||
context: *mut c_void,
|
||||
callback: TribufuApiGetUserInfoCallback,
|
||||
) {
|
||||
let context = TribufuApiCallbackContext(context);
|
||||
|
||||
RUNTIME.spawn(async move {
|
||||
let mut instance = INSTANCE.lock().await;
|
||||
if instance.is_none() {
|
||||
callback(context.as_ptr(), ptr::null());
|
||||
return;
|
||||
}
|
||||
|
||||
let api = instance.as_mut();
|
||||
if api.is_none() {
|
||||
callback(context.as_ptr(), ptr::null());
|
||||
return;
|
||||
}
|
||||
|
||||
let api = api.unwrap();
|
||||
|
||||
// TODO: Implement logic here
|
||||
|
||||
callback(context.as_ptr(), ptr::null());
|
||||
});
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub mod api;
|
||||
pub mod mem;
|
||||
pub mod models;
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_free_string(ptr: *mut c_char) {
|
||||
if ptr.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let _ = CString::from_raw(ptr);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use libc::c_void;
|
||||
|
||||
pub struct TribufuApiCallbackContext(pub(crate) *mut c_void);
|
||||
|
||||
impl TribufuApiCallbackContext {
|
||||
pub(crate) fn as_ptr(&self) -> *mut c_void {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for TribufuApiCallbackContext {}
|
||||
unsafe impl Sync for TribufuApiCallbackContext {}
|
||||
|
||||
pub type TribufuApiGetUserInfoCallbackData = c_void;
|
||||
pub type TribufuApiGetUserInfoCallback =
|
||||
extern "C" fn(*mut c_void, *const TribufuApiGetUserInfoCallbackData);
|
27
vendor/premake-core/LICENSE.txt
vendored
27
vendor/premake-core/LICENSE.txt
vendored
@ -1,27 +0,0 @@
|
||||
Copyright (c) 2003-2022 Jason Perkins and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Premake nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
BIN
vendor/premake-core/linux/libluasocket.so
vendored
BIN
vendor/premake-core/linux/libluasocket.so
vendored
Binary file not shown.
BIN
vendor/premake-core/linux/premake5
vendored
BIN
vendor/premake-core/linux/premake5
vendored
Binary file not shown.
BIN
vendor/premake-core/mac/libluasocket.dylib
vendored
BIN
vendor/premake-core/mac/libluasocket.dylib
vendored
Binary file not shown.
BIN
vendor/premake-core/mac/premake5
vendored
BIN
vendor/premake-core/mac/premake5
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.dll
vendored
BIN
vendor/premake-core/windows/luasocket.dll
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.exp
vendored
BIN
vendor/premake-core/windows/luasocket.exp
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.lib
vendored
BIN
vendor/premake-core/windows/luasocket.lib
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.pdb
vendored
BIN
vendor/premake-core/windows/luasocket.pdb
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/premake5.exe
vendored
BIN
vendor/premake-core/windows/premake5.exe
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/premake5.pdb
vendored
BIN
vendor/premake-core/windows/premake5.pdb
vendored
Binary file not shown.
Reference in New Issue
Block a user