Update Android build scripts. Remove unnecessary project files

This commit is contained in:
Joseph Henry
2021-02-10 18:12:01 -08:00
parent a6fc3e44b8
commit 4e57827637
52 changed files with 116 additions and 596 deletions

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0
examples/android/ExampleAndroidApp/gradlew vendored Normal file → Executable file
View File

0
examples/android/ExampleAndroidApp/gradlew.bat vendored Executable file → Normal file
View File

30
examples/python/zt.i Normal file
View File

@@ -0,0 +1,30 @@
/* libzt.i */
%begin
%{
#define SWIG_PYTHON_CAST_MODE
%}
%include <stdint.i>
#define PYTHON_BUILD 1
%module libzt
%{
#include "../include/ZeroTier.h"
#include "../include/ZeroTierConstants.h"
%}
%define %cs_callback(TYPE, CSTYPE)
%typemap(ctype) TYPE, TYPE& "void *"
%typemap(in) TYPE %{ $1 = ($1_type)$input; %}
%typemap(in) TYPE& %{ $1 = ($1_type)&$input; %}
%typemap(imtype, out="IntPtr") TYPE, TYPE& "CSTYPE"
%typemap(cstype, out="IntPtr") TYPE, TYPE& "CSTYPE"
%typemap(csin) TYPE, TYPE& "$csinput"
%enddef
%cs_callback(userCallbackFunc, CSharpCallback)
%include "../include/ZeroTier.h"
%include "../include/ZeroTierConstants.h"

View File

@@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "binding-example"
version = "0.1.0"

View File

@@ -0,0 +1,10 @@
[package]
name = "binding-example"
version = "0.1.0"
authors = ["Joseph Henry <joseph.henry@zerotier.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
#rustc-link-search = ["../../../lib/debug/macos-x86_64/"]
[dependencies]

View File

@@ -0,0 +1,4 @@
fn main() {
println!("cargo:rustc-flags=-l dylib=c++");
//println!("cargo:rustc-link-search=.");
}

View File

@@ -0,0 +1,10 @@
#[link(name = "libzt", kind = "dylib")]
extern {
fn zts_socket(address_family: i32) -> i32;
}
fn main() {
let x = unsafe { zts_socket(100) };
println!("zts_socket() = {}", x);
}

6
examples/rust/program.c Normal file
View File

@@ -0,0 +1,6 @@
#include <stdio.h>
int zts_socket(int address_family)
{
return -777;
}

1
examples/rust/program.h Normal file
View File

@@ -0,0 +1 @@
int zts_socket(int address_family);

5
examples/rust/program.rs Normal file
View File

@@ -0,0 +1,5 @@
/* automatically generated by rust-bindgen 0.56.0 */
extern "C" {
pub fn zts_socket(address_family: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}