Added platform-specific DLL references in Unity integration. Updated Unity3D_iOS integration project
This commit is contained in:
@@ -1382,8 +1382,18 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
"$(SRCROOT)/../../../zerotierone",
|
||||||
|
"$(SRCROOT)/../../../ext/lwip/src/include/",
|
||||||
|
"$(SRCROOT)/../../../ext/lwip/src/include/ipv4/",
|
||||||
|
);
|
||||||
INFOPLIST_FILE = ZeroTierSDK_Unity3D_iOS/Info.plist;
|
INFOPLIST_FILE = ZeroTierSDK_Unity3D_iOS/Info.plist;
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
||||||
|
OTHER_CFLAGS = (
|
||||||
|
"-D__UNITY_3D__",
|
||||||
|
"-DZT_SDK",
|
||||||
|
"-DZT_SDK_DEBUG",
|
||||||
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
|
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@@ -1396,8 +1406,18 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
"$(SRCROOT)/../../../zerotierone",
|
||||||
|
"$(SRCROOT)/../../../ext/lwip/src/include/",
|
||||||
|
"$(SRCROOT)/../../../ext/lwip/src/include/ipv4/",
|
||||||
|
);
|
||||||
INFOPLIST_FILE = ZeroTierSDK_Unity3D_iOS/Info.plist;
|
INFOPLIST_FILE = ZeroTierSDK_Unity3D_iOS/Info.plist;
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
||||||
|
OTHER_CFLAGS = (
|
||||||
|
"-D__UNITY_3D__",
|
||||||
|
"-DZT_SDK",
|
||||||
|
"-DZT_SDK_DEBUG",
|
||||||
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
|
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@@ -1586,6 +1606,7 @@
|
|||||||
7CC0031D1D1216B0003E68DC /* Release */,
|
7CC0031D1D1216B0003E68DC /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
7CC003281D1216E3003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_iOS" */ = {
|
7CC003281D1216E3003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_iOS" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
@@ -1594,6 +1615,7 @@
|
|||||||
7CC0032A1D1216E3003E68DC /* Release */,
|
7CC0032A1D1216E3003E68DC /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
7CC003351D1216F8003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_OSX" */ = {
|
7CC003351D1216F8003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_OSX" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
@@ -1602,6 +1624,7 @@
|
|||||||
7CC003371D1216F8003E68DC /* Release */,
|
7CC003371D1216F8003E68DC /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
7CC0033F1D121742003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_Unity3D_OSX" */ = {
|
7CC0033F1D121742003E68DC /* Build configuration list for PBXNativeTarget "ZeroTierSDK_Unity3D_OSX" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
@@ -1610,6 +1633,7 @@
|
|||||||
7CC003411D121742003E68DC /* Release */,
|
7CC003411D121742003E68DC /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
@@ -38,9 +38,32 @@ using System.Net;
|
|||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|
||||||
public class ZeroTierNetworkInterface {
|
public class ZeroTierNetworkInterface {
|
||||||
|
|
||||||
|
// Apple
|
||||||
|
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
|
||||||
|
const string DLL_PATH = "ZeroTierSDK_Unity3D_OSX";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
const string DLL_PATH = "ZeroTierSDK_Unity3D_iOS";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Windows
|
||||||
|
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||||
|
const string DLL_PATH = "ZeroTierSDK_Unity3D_WIN";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Linux
|
||||||
|
#if UNITY_STANDALONE_LINUX
|
||||||
|
const string DLL_PATH = "ZeroTierSDK_Unity3D_LINUX";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Android
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
const string DLL_PATH = "ZeroTierSDK_Unity3D_ANDROID";
|
||||||
|
#endif
|
||||||
|
|
||||||
// ZeroTier background thread
|
// ZeroTier background thread
|
||||||
private Thread ztThread;
|
private Thread ztThread;
|
||||||
|
|
||||||
@@ -66,44 +89,43 @@ public class ZeroTierNetworkInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ZeroTier service / debug initialization
|
// ZeroTier service / debug initialization
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
public static extern void SetDebugFunction( IntPtr fp );
|
public static extern void SetDebugFunction( IntPtr fp );
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern int unity_start_service(string path);
|
private static extern int unity_start_service(string path);
|
||||||
|
|
||||||
// Connection calls
|
// Connection calls
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern int zt_socket(int family, int type, int protocol);
|
private static extern int zt_socket(int family, int type, int protocol);
|
||||||
|
|
||||||
|
[DllImport (DLL_PATH)]
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
|
||||||
unsafe private static extern int zt_bind(int sockfd, System.IntPtr addr, int addrlen);
|
unsafe private static extern int zt_bind(int sockfd, System.IntPtr addr, int addrlen);
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
unsafe private static extern int zt_connect(int sockfd, System.IntPtr addr, int addrlen);
|
unsafe private static extern int zt_connect(int sockfd, System.IntPtr addr, int addrlen);
|
||||||
|
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern int zt_accept(int sockfd);
|
private static extern int zt_accept(int sockfd);
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern int zt_listen(int sockfd, int backlog);
|
private static extern int zt_listen(int sockfd, int backlog);
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern int zt_close(int sockfd);
|
private static extern int zt_close(int sockfd);
|
||||||
|
|
||||||
// RX / TX
|
// RX / TX
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
unsafe private static extern int zt_recv(int sockfd, System.IntPtr buf, int len);
|
unsafe private static extern int zt_recv(int sockfd, System.IntPtr buf, int len);
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
unsafe private static extern int zt_send(int sockfd, System.IntPtr buf, int len);
|
unsafe private static extern int zt_send(int sockfd, System.IntPtr buf, int len);
|
||||||
|
|
||||||
// ZT Thread controls
|
// ZT Thread controls
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern bool zt_is_running();
|
private static extern bool zt_is_running();
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern void zt_terminate();
|
private static extern void zt_terminate();
|
||||||
|
|
||||||
// ZT Network controls
|
// ZT Network controls
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern bool zt_join_network(string nwid);
|
private static extern bool zt_join_network(string nwid);
|
||||||
[DllImport ("ZeroTierSDK_Unity3D_OSX")]
|
[DllImport (DLL_PATH)]
|
||||||
private static extern void zt_leave_network(string nwid);
|
private static extern void zt_leave_network(string nwid);
|
||||||
|
|
||||||
// Thread which starts the ZeroTier service
|
// Thread which starts the ZeroTier service
|
||||||
|
|||||||
Reference in New Issue
Block a user