new OSX shared library target
This commit is contained in:
@@ -14,24 +14,25 @@ For more support on these integrations, or if you'd like help creating a new int
|
||||
***
|
||||
## Important Build flags
|
||||
|
||||
- `SDK_DEBUG` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h`
|
||||
- `SDK_DEBUG_LOGFILE` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`.
|
||||
- `SDK_LWIP_DEBUG` - Turns on debug output for the lwIP library.
|
||||
- `SDK_BUNDLED` - Builds the SDK as a single bundled target including a the RPC mechanism, the lwIP library, and the ZeroTier service.
|
||||
- `SDK_SOCKS_PROXY` - Enables the SOCK5 Proxy. This flag is enabled by default on must builds, especially mobile.
|
||||
- `SDK_DEBUG=1` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h`
|
||||
- `SDK_DEBUG_LOGFILE=1` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`.
|
||||
- `SDK_LWIP_DEBUG=1` - Turns on debug output for the lwIP library.
|
||||
- `SDK_BUNDLED=1` - Builds the SDK as a single bundled target including a the RPC mechanism, the lwIP library, and the ZeroTier service.
|
||||
- `SDK_SOCKS_PROXY=1` - Enables the SOCK5 Proxy. This flag is enabled by default on must builds, especially mobile.
|
||||
|
||||
***
|
||||
## Current Integrations
|
||||
|
||||
### Apple `make apple`
|
||||
##### iOS
|
||||
- [Embedding within an app](apple/example_app/iOS) `make ios_app_framework`
|
||||
- Unity3D plugin `make ios_unity3d_bundle`
|
||||
- [Embedding within an app](apple/example_app/iOS) `make ios_app_framework` -> `build/ios_app_framework/*`
|
||||
- Unity3D plugin `make ios_unity3d_bundle` -> `build/ios_unity3d_bundle/*`
|
||||
|
||||
##### OSX
|
||||
- [Embedding within an app](apple/example_app/OSX) `make osx_app_framework`
|
||||
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_shared_lib`
|
||||
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle`
|
||||
- [Linking into an app at compiletime](../docs/osx_zt_sdk.md) `make osx_shared_lib` -> `build/libztosx.so`
|
||||
- [Embedding within an app with Xcode](apple/example_app/OSX) `make osx_app_framework` -> `build/osx_app_framework/*`
|
||||
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_service_and_intercept` -> `build/zerotier-sdk-service` + `build/libztintercept.so`
|
||||
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle` ->
|
||||
|
||||
***
|
||||
### Linux
|
||||
@@ -39,8 +40,8 @@ For more support on these integrations, or if you'd like help creating a new int
|
||||
- [Using the SDK with Docker](docker)
|
||||
|
||||
### Android `make android`
|
||||
- [Embedding within an app](android) `make android_jni_lib`
|
||||
- [Unity 3D plugin](../docs/android_unity3d_zt_sdk.md) `make android_unity3d_plugin`
|
||||
- [Embedding within an app](android) `make android_jni_lib` -> `build/android_jni_lib/YOUR_ARCH/libZeroTierOneJNI.so`
|
||||
- [Unity 3D plugin](../docs/android_unity3d_zt_sdk.md) `make android_unity3d_plugin` -> `build/android_unity3d_plugin/*`
|
||||
|
||||
***
|
||||
### Windows
|
||||
|
||||
@@ -8,7 +8,16 @@ Imagine a flat, encrypted, no-configuration LAN for all of the instances of your
|
||||
This short tutorial will show you how to enable ZeroTier functionality for your OSX app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works.
|
||||
|
||||
***
|
||||
## Via Static-linking
|
||||
|
||||
## Via Traditional Linking (Everything bundled)
|
||||
|
||||
```
|
||||
make osx_shared_lib`
|
||||
g++ myapp.cpp -o myapp libztosx.so
|
||||
./myapp
|
||||
```
|
||||
|
||||
## Via Traditional Linking (Service+Intercept model)
|
||||
|
||||
Example:
|
||||
|
||||
@@ -23,7 +32,7 @@ Run application
|
||||
|
||||
./myapp
|
||||
|
||||
## Via App Framework
|
||||
## Via App Framework in XCode
|
||||
|
||||
***
|
||||
**Step 1: Build iOS framework**
|
||||
|
||||
@@ -14,24 +14,25 @@ For more support on these integrations, or if you'd like help creating a new int
|
||||
***
|
||||
## Important Build flags
|
||||
|
||||
- `SDK_DEBUG` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h`
|
||||
- `SDK_DEBUG_LOGFILE` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`.
|
||||
- `SDK_LWIP_DEBUG` - Turns on debug output for the lwIP library.
|
||||
- `SDK_BUNDLED` - Builds the SDK as a single bundled target including a the RPC mechanism, the lwIP library, and the ZeroTier service.
|
||||
- `SDK_SOCKS_PROXY` - Enables the SOCK5 Proxy. This flag is enabled by default on must builds, especially mobile.
|
||||
- `SDK_DEBUG=1` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h`
|
||||
- `SDK_DEBUG_LOGFILE=1` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`.
|
||||
- `SDK_LWIP_DEBUG=1` - Turns on debug output for the lwIP library.
|
||||
- `SDK_BUNDLED=1` - Builds the SDK as a single bundled target including a the RPC mechanism, the lwIP library, and the ZeroTier service.
|
||||
- `SDK_SOCKS_PROXY=1` - Enables the SOCK5 Proxy. This flag is enabled by default on must builds, especially mobile.
|
||||
|
||||
***
|
||||
## Current Integrations
|
||||
|
||||
### Apple `make apple`
|
||||
##### iOS
|
||||
- [Embedding within an app](apple/example_app/iOS) `make ios_app_framework`
|
||||
- Unity3D plugin `make ios_unity3d_bundle`
|
||||
- [Embedding within an app](apple/example_app/iOS) `make ios_app_framework` -> `build/ios_app_framework/*`
|
||||
- Unity3D plugin `make ios_unity3d_bundle` -> `build/ios_unity3d_bundle/*`
|
||||
|
||||
##### OSX
|
||||
- [Embedding within an app](apple/example_app/OSX) `make osx_app_framework`
|
||||
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_shared_lib`
|
||||
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle`
|
||||
- [Linking into an app at compiletime](../docs/osx_zt_sdk.md) `make osx_shared_lib` -> `build/libztosx.so`
|
||||
- [Embedding within an app with Xcode](apple/example_app/OSX) `make osx_app_framework` -> `build/osx_app_framework/*`
|
||||
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_service_and_intercept` -> `build/zerotier-sdk-service` + `build/libztintercept.so`
|
||||
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle` ->
|
||||
|
||||
***
|
||||
### Linux
|
||||
@@ -39,8 +40,8 @@ For more support on these integrations, or if you'd like help creating a new int
|
||||
- [Using the SDK with Docker](docker)
|
||||
|
||||
### Android `make android`
|
||||
- [Embedding within an app](android) `make android_jni_lib`
|
||||
- [Unity 3D plugin](../docs/android_unity3d_zt_sdk.md) `make android_unity3d_plugin`
|
||||
- [Embedding within an app](android) `make android_jni_lib` -> `build/android_jni_lib/YOUR_ARCH/libZeroTierOneJNI.so`
|
||||
- [Unity 3D plugin](../docs/android_unity3d_zt_sdk.md) `make android_unity3d_plugin` -> `build/android_unity3d_plugin/*`
|
||||
|
||||
***
|
||||
### Windows
|
||||
|
||||
@@ -8,7 +8,16 @@ Imagine a flat, encrypted, no-configuration LAN for all of the instances of your
|
||||
This short tutorial will show you how to enable ZeroTier functionality for your OSX app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works.
|
||||
|
||||
***
|
||||
## Via Static-linking
|
||||
|
||||
## Via Traditional Linking (Everything bundled)
|
||||
|
||||
```
|
||||
make osx_shared_lib`
|
||||
g++ myapp.cpp -o myapp libztosx.so
|
||||
./myapp
|
||||
```
|
||||
|
||||
## Via Traditional Linking (Service+Intercept model)
|
||||
|
||||
Example:
|
||||
|
||||
@@ -23,7 +32,7 @@ Run application
|
||||
|
||||
./myapp
|
||||
|
||||
## Via App Framework
|
||||
## Via App Framework in XCode
|
||||
|
||||
***
|
||||
**Step 1: Build iOS framework**
|
||||
|
||||
13
make-mac.mk
13
make-mac.mk
@@ -59,7 +59,7 @@ apple: osx ios
|
||||
ios: ios_app_framework ios_unity3d_bundle
|
||||
|
||||
# Build all OSX targets
|
||||
osx: osx_app_framework osx_unity3d_bundle osx_shared_lib
|
||||
osx: osx_app_framework osx_unity3d_bundle osx_shared_lib osx_service_and_intercept
|
||||
|
||||
# Build all Android targets
|
||||
# Chip architectures can be specified in integrations/android/android_jni_lib/java/jni/Application.mk
|
||||
@@ -99,18 +99,18 @@ remove_only_intermediates:
|
||||
-find . -type f \( -name '*.o' -o -name '*.so' \) -delete
|
||||
|
||||
osx_shared_lib: remove_only_intermediates $(OBJS)
|
||||
mkdir -p $(BUILD)/osx_shared_lib
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DSDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Izerotierone/service -Isrc -shared -o $(BUILD)/libztosx.so $(OBJS) zerotierone/service/OneService.cpp src/SDK_ServiceSetup.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_Sockets.c src/SDK_Intercept.c src/SDK_Debug.c src/SDK_RPC.c $(LDLIBS) -ldl
|
||||
|
||||
osx_service_and_intercept: remove_only_intermediates $(OBJS)
|
||||
# Need to selectively rebuild one.cpp and OneService.cpp with ZT_SERVICE_NETCON and ZT_ONE_NO_ROOT_CHECK defined, and also NetconEthernetTap
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DSDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Isrc -o $(BUILD)/zerotier-sdk-service $(OBJS) zerotierone/service/OneService.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_RPC.c $(LDLIBS) -ldl
|
||||
# Build liblwip.so which must be placed in ZT home for zerotier-sdk-service to work
|
||||
make -f make-liblwip.mk
|
||||
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility
|
||||
cd src ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
|
||||
mv src/libztintercept.so $(BUILD)/osx_shared_lib/libztintercept.so
|
||||
mv src/libztintercept.so $(BUILD)/libztintercept.so
|
||||
ln -sf zerotier-sdk-service zerotier-cli
|
||||
ln -sf zerotier-sdk-service zerotier-idtool
|
||||
cp docs/osx_zt_sdk.md $(BUILD)/osx_shared_lib/README.md
|
||||
|
||||
|
||||
prep:
|
||||
cp $(INT)/android/android_jni_lib/java/libs/* build
|
||||
@@ -118,7 +118,8 @@ prep:
|
||||
# Check for the presence of built frameworks/bundles/libaries
|
||||
check:
|
||||
./check.sh $(BUILD)/lwip/liblwip.so
|
||||
./check.sh $(BUILD)/osx_shared_lib/libztintercept.so
|
||||
./check.sh $(BUILD)/libztintercept.so
|
||||
./check.sh $(BUILD)/libztosx.so
|
||||
./check.sh $(BUILD)/osx_unity3d_bundle/Debug/ZeroTierSDK_Unity3D_OSX.bundle
|
||||
./check.sh $(BUILD)/osx_app_framework/Debug/ZeroTierSDK_OSX.framework
|
||||
./check.sh $(BUILD)/ios_app_framework/Debug-iphoneos/ZeroTierSDK_iOS.framework
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -40,9 +38,7 @@ extern "C" {
|
||||
|
||||
#define INTERCEPT_ENABLED 111
|
||||
#define INTERCEPT_DISABLED 222
|
||||
|
||||
extern std::string homeDir;
|
||||
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
// JNI naming convention: Java_PACKAGENAME_CLASSNAME_METHODNAME
|
||||
/* If you define anything else in this file it that you wish to expose to your Android
|
||||
|
||||
Reference in New Issue
Block a user