Clear repository

This commit is contained in:
GuilhermeWerner
2021-08-04 12:11:32 -03:00
parent 7ea5da797a
commit 17388bbd9d
30 changed files with 8 additions and 802 deletions

28
.gitignore vendored
View File

@ -1,39 +1,11 @@
# Binary Files
Binaries/
Intermediate/
# Cargo Files
Cargo.lock
# FFI Bindings
Source/Header.h
# Packaged Library
Package/
# Visual Studio Project Files
.vs/
*.sln
*.vcxproj
*.csproj
*.filters
*.user
# CMake Project Files
Makefile
# Xcode Project Files
*.xcodeproj
*.xcworkspace
# Mac OSX
.DS_Store

37
.vscode/tasks.json vendored
View File

@ -1,37 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Package (Windows)",
"type": "shell",
"command": "python",
"args": [
"./Scripts/Package.py"
],
},
{
"label": "Package (Linux)",
"type": "shell",
"command": "python3",
"args": [
"./Scripts/Package.py"
],
},
{
"label": "Copyright (Windows)",
"type": "shell",
"command": "python",
"args": [
"./Scripts/Copyright.py"
],
},
{
"label": "Copyright (Linux)",
"type": "shell",
"command": "python3",
"args": [
"./Scripts/Copyright.py"
],
}
]
}

View File

@ -1,38 +1 @@
#!/usr/bin/env pwsh
echo "Installing dependencies..."
cargo install cbindgen
echo "Generating bindings..."
cbindgen --config ./Config/Bindings.toml --crate tribufu --output ./Source/Header.h
# Windows
if ($IsWindows)
{
echo "Generating Visual Studio project..."
& "./Vendor/Premake/Windows/premake5.exe" "vs2019"
}
# Mac
elseif ($IsMacOS)
{
echo "Generating XCode project..."
sudo chmod +x ./Vendor/Premake/Mac/premake5
& "./Vendor/Premake/Mac/premake5" "xcode4"
}
# Linux
elseif ($IsLinux)
{
echo "Generating GMake project..."
sudo chmod +x ./Vendor/Premake/Linux/premake5
& "./Vendor/Premake/Linux/premake5" "gmake2"
}

View File

@ -1,28 +1 @@
#!/usr/bin/env sh
echo "Installing dependencies..."
cargo install cbindgen
echo "Generating bindings..."
cbindgen --config ./Config/Bindings.toml --crate tribufu --output ./Source/Header.h
# Linux
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
then
echo "Generating GMake project..."
sudo chmod +x ./Vendor/Premake/Linux/premake5
./Vendor/Premake/Linux/premake5 gmake2
# Mac
elif [ "$(uname)" = "Darwin" ]
then
echo "Generating XCode project..."
sudo chmod +x ./Vendor/Premake/Mac/premake5
./Vendor/Premake/Mac/premake5 xcode4
fi

View File

@ -10,35 +10,19 @@ edition = "2018"
publish = true
exclude = [
".cargo/",
".github/",
".vscode/",
"Config/",
"Documentation/",
"Examples/C",
"Examples/Cpp",
"Examples/CSharp",
"Scripts/",
"Vendor/",
".editorconfig",
".gitattributes",
"GenerateProjectFiles.*",
"premake5.lua",
"*.code-workspace",
"Bootstrap.ps1",
"Bootstrap.sh",
]
[lib]
name="TribuFu"
crate-type = ["staticlib", "cdylib", "rlib"]
crate-type = ["rlib"]
path = "Source/TribuFu.rs"
[dependencies]
libc = "0.2.0"
tokio = { version = "1.2.0", features = ["full"] }
reqwest = { version = "0.11.1", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
[[example]]
name="Hello"
path = "Examples/Rust/Hello.rs"

View File

@ -1,113 +0,0 @@
# This is a template cbindgen.toml file with all of the default values.
# Some values are commented out because their absence is the real default.
#
# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml
# for detailed documentation of every option here.
language = "C"
############## Options for Wrapping the Contents of the Header #################
header = "// Copyright (c) TribuFu. All Rights Reserved"
# trailer = "/* Text to put at the end of the generated file */"
# include_guard = "my_bindings_h"
pragma_once = true
# autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
include_version = false
namespace = "TribuFu"
namespaces = []
using_namespaces = []
sys_includes = []
includes = []
no_includes = false
cpp_compat = true
# A list of lines to add verbatim after the includes block
after_includes = "\n#define TRIBUFU_SDK 1"
############################ Code Style Options ################################
braces = "NextLine"
line_length = 100
tab_width = 4
line_endings = "LF" # also "CR", "CRLF", "Native"
############################# Codegen Options ##################################
style = "tag"
sort_by = "Name" # default for `fn.sort_by` and `const.sort_by`
usize_is_size_t = true
[defines]
# "target_os = freebsd" = "DEFINE_FREEBSD"
# "feature = serde" = "DEFINE_SERDE"
[export]
include = []
exclude = []
# prefix = "CAPI_"
item_types = []
renaming_overrides_prefixing = false
[export.rename]
[export.body]
[export.mangle]
[fn]
# rename_args = "PascalCase"
# must_use = "MUST_USE_FUNC"
# no_return = "NO_RETURN"
# prefix = "START_FUNC"
# postfix = "END_FUNC"
args = "auto"
sort_by = "Name"
[struct]
# rename_fields = "PascalCase"
# must_use = "MUST_USE_STRUCT"
derive_constructor = false
derive_eq = false
derive_neq = false
derive_lt = false
derive_lte = false
derive_gt = false
derive_gte = false
[enum]
# rename_variants = "PascalCase"
# must_use = "MUST_USE_ENUM"
add_sentinel = false
prefix_with_name = false
derive_helper_methods = false
derive_const_casts = false
derive_mut_casts = false
# cast_assert_name = "ASSERT"
derive_tagged_enum_destructor = false
derive_tagged_enum_copy_constructor = false
enum_class = true
private_default_tagged_enum_constructor = false
[const]
allow_static_const = true
allow_constexpr = false
sort_by = "Name"
[macro_expansion]
bitflags = false
############## Options for How Your Rust library Should Be Parsed ##############
[parse]
parse_deps = false
# include = []
exclude = []
clean = false
extra_bindings = []
[parse.expand]
crates = []
all_features = false
default_features = true
features = []

View File

@ -1,12 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
#include "stdio.h"
#include "TribuFu.h"
extern int32_t Hello(void);
int main()
{
printf("TribuFu SDK = %d\n", Hello());
}

View File

@ -1,24 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
using System;
using System.Runtime.InteropServices;
namespace CSharp
{
class Program
{
#if WINDOWS_PLATFORM
const string TribuFu = "TribuFu";
#else
const string TribuFu = "libTribuFu";
#endif
[DllImport(TribuFu)]
public static extern int Hello();
public static void Main(string[] args)
{
Console.WriteLine("TribuFu SDK = " + Hello());
}
}
}

View File

@ -1,14 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
#include <iostream>
#include "TribuFu.h"
using namespace std;
extern int32_t Hello();
int main()
{
cout << "TribuFu SDK = " << (int)TribuFu::Hello() << "\n";
}

View File

@ -1,10 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
fn main() {
println!("TribuFu SDK = {}", TribuFu::Hello());
}

View File

@ -1,3 +1 @@
# TribuFu SDK
SDK for games and apps access TribuFu services.

View File

@ -1,67 +0,0 @@
# Copyright (c) TribuFu. All Rights Reserved
import os
import subprocess
import platform
import shutil
from pathlib import Path
Path("./Package/Include").mkdir(parents=True, exist_ok=True)
Path("./Package/Library").mkdir(parents=True, exist_ok=True)
shutil.copy2("./Source/TribuFu.h", "./Package/Include/TribuFu.h")
if platform.system() == "Windows":
Path("./Package/Library/Windows").mkdir(parents=True, exist_ok=True)
shutil.copy2("./Binaries/release/TribuFu.dll", "./Package/Library/Windows/TribuFu.dll")
shutil.copy2("./Binaries/release/TribuFu.dll.lib", "./Package/Library/Windows/TribuFu.dll.lib")
shutil.copy2("./Binaries/release/TribuFu.lib", "./Package/Library/Windows/TribuFu.lib")
subprocess.check_call(
[
"./Vendor/rcedit.exe",
"./Package/Library/Windows/TribuFu.dll",
"--set-file-version",
"0.0.1",
"--set-product-version",
"0.0.1",
"--set-version-string",
"CompanyName",
"TribuFu",
"--set-version-string",
"FileDescription",
"SDK for games and apps access TribuFu services.",
"--set-version-string",
"FileVersion",
"0.0.1",
"--set-version-string",
"InternalName",
"SDK",
"--set-version-string",
"LegalCopyright",
"Copyright (c) TribuFu. All Rights Reserved",
"--set-version-string",
"OriginalFilename",
"TribuFu.dll",
"--set-version-string",
"ProductName",
"TribuFu SDK",
"--set-version-string",
"ProductVersion",
"0.0.1",
]
)
elif platform.system() == "Linux":
Path("./Package/Library/Linux").mkdir(parents=True, exist_ok=True)
shutil.copy2("./Binaries/release/libTribuFu.so", "./Package/Library/Linux/libTribuFu.so")
shutil.copy2("./Binaries/release/libTribuFu.a", "./Package/Library/Linux/libTribuFu.a")
elif platform.system() == "Mac":
Path("./Package/Library/Mac").mkdir(parents=True, exist_ok=True)
shutil.copy2("./Binaries/release/libTribuFu.dylib", "./Package/Library/Mac/libTribuFu.dylib")
shutil.copy2("./Binaries/release/libTribuFu.a", "./Package/Library/Mac/libTribuFu.a")

View File

@ -1,35 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn Login(name: *const c_char, password: *const c_char) {}
pub fn Logout() {}
pub fn Refresh() {}
pub fn Register(name: *const c_char, email: *const c_char, password: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn Login(name: *const c_char, password: *const c_char) {
super::Login(name, password);
}
#[no_mangle]
pub extern "C" fn Logout() {
super::Logout();
}
#[no_mangle]
pub extern "C" fn Refresh() {
super::Refresh();
}
#[no_mangle]
pub extern "C" fn Register(name: *const c_char, email: *const c_char, password: *const c_char) {
super::Register(name, email, password);
}
}

View File

@ -1,21 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetDevice(id: *const c_char) {}
pub fn GetUserDevices(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetDevice(id: *const c_char) {
super::GetDevice(id);
}
#[no_mangle]
pub extern "C" fn GetUserDevices(id: *const c_char) {
super::GetUserDevices(id);
}
}

View File

@ -1,21 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetEmail(address: *const c_char) {}
pub fn GetUserEmails(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetEmail(address: *const c_char) {
super::GetEmail(address);
}
#[no_mangle]
pub extern "C" fn GetUserEmails(id: *const c_char) {
super::GetUserEmails(id);
}
}

View File

@ -1,21 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetRole(id: *const c_char) {}
pub fn GetUserRoles(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetRole(id: *const c_char) {
super::GetRole(id);
}
#[no_mangle]
pub extern "C" fn GetUserRoles(id: *const c_char) {
super::GetUserRoles(id);
}
}

View File

@ -1,14 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetUser(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetUser(id: *const c_char) {
super::GetUser(id);
}
}

View File

@ -1,6 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
pub mod Auth;
pub mod Device;
pub mod Role;
pub mod User;

View File

@ -1,28 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn AddFriend(id1: *const c_char, id2: *const c_char) {}
pub fn AcceptFriend(id1: *const c_char, id2: *const c_char) {}
pub fn GetFriends(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn AddFriend(id1: *const c_char, id2: *const c_char) {
super::AddFriend(id1, id2);
}
#[no_mangle]
pub extern "C" fn AcceptFriend(id1: *const c_char, id2: *const c_char) {
super::AcceptFriend(id1, id2);
}
#[no_mangle]
pub extern "C" fn GetFriends(id: *const c_char) {
super::GetFriends(id);
}
}

View File

@ -1,17 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
pub fn InviteToTeam() {}
pub fn EnterTeam() {}
mod External {
#[no_mangle]
pub extern "C" fn InviteToTeam() {
super::InviteToTeam();
}
#[no_mangle]
pub extern "C" fn EnterTeam() {
super::EnterTeam();
}
}

View File

@ -1,14 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetMessage(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetMessage(id: *const c_char) {
super::GetMessage(id);
}
}

View File

@ -1,61 +0,0 @@
// Copyright (c) TribuFu. All Rights Reserved
#pragma once
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#define TRIBUFU_SDK 1
#ifdef __cplusplus
namespace TribuFu
{
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void AcceptFriend(const char *id1, const char *id2);
void AddFriend(const char *id1, const char *id2);
void EnterTeam(void);
void GetDevice(const char *id);
void GetFriends(const char *id);
void GetMessage(const char *id);
void GetRole(const char *id);
void GetUser(const char *id);
void GetUserDevices(const char *id);
void GetUserRoles(const char *id);
int32_t Hello(void);
void InviteToTeam(void);
void Login(const char *name, const char *password);
void Logout(void);
void Refresh(void);
void Register(const char *name, const char *email, const char *password);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,15 +1,11 @@
// Copyright (c) TribuFu. All Rights Reserved
#![allow(dead_code)]
#![allow(unused_variables)]
//! TribuFu SDK.
#![allow(non_snake_case)]
pub mod Account;
pub mod Friends;
pub mod Matchmaking;
pub mod Messages;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[no_mangle]
pub extern "C" fn Hello() -> i32 {
return 1;
pub fn Hello(input: String) -> String {
return format!("Hello {}", input);
}

View File

@ -1,27 +0,0 @@
Copyright (c) 2003-2019 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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Vendor/rcedit.exe vendored

Binary file not shown.

View File

@ -1,138 +0,0 @@
workspace "TribuFu"
architecture "x64"
configurations
{
"debug",
"release"
}
outputDir = "%{cfg.buildcfg}"
project "Cpp"
location "Examples/Cpp"
kind "ConsoleApp"
language "C++"
targetdir ("Binaries/" .. outputDir)
objdir ("Intermediate/")
files
{
"Examples/%{prj.name}/**.h",
"Examples/%{prj.name}/**.cpp",
}
includedirs
{
"Source"
}
libdirs
{
"Binaries/%{cfg.buildcfg}"
}
filter "system:windows"
staticruntime "On"
systemversion "latest"
links
{
"TribuFu.lib"
}
filter { "system:windows", "configurations:debug" }
runtime "Debug"
buildoptions "/MDd"
symbols "on"
filter { "system:windows", "configurations:release" }
runtime "Release"
buildoptions "/MD"
optimize "on"
project "C"
location "Examples/C"
kind "ConsoleApp"
language "C"
targetdir ("Binaries/" .. outputDir)
objdir ("Intermediate/")
files
{
"Examples/%{prj.name}/**.h",
"Examples/%{prj.name}/**.c",
}
includedirs
{
"Source"
}
libdirs
{
"Binaries/%{cfg.buildcfg}"
}
filter "system:windows"
staticruntime "On"
systemversion "latest"
links
{
"TribuFu.lib"
}
filter { "system:windows", "configurations:debug" }
runtime "Debug"
buildoptions "/MDd"
symbols "on"
filter { "system:windows", "configurations:release" }
runtime "Release"
buildoptions "/MD"
optimize "on"
project "CSharp"
location "Examples/CSharp"
kind "ConsoleApp"
language "C#"
targetdir ("Binaries/" .. outputDir)
objdir ("Intermediate/")
files
{
"Examples/%{prj.name}/**.cs",
}
includedirs
{
"Source"
}
libdirs
{
"Binaries/%{cfg.buildcfg}"
}
filter "system:windows"
staticruntime "On"
systemversion "latest"
defines
{
"WINDOWS_PLATFORM"
}
filter { "system:windows", "configurations:debug" }
runtime "Debug"
buildoptions "/MDd"
symbols "on"
filter { "system:windows", "configurations:release" }
runtime "Release"
buildoptions "/MD"
optimize "on"