xcode framework build updates

This commit is contained in:
Joseph Henry
2016-07-04 13:42:44 -05:00
parent c578624d6b
commit 9f776adc69
12 changed files with 60 additions and 12 deletions

View File

@@ -1492,6 +1492,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DSDK", "-DSDK",
"-DSDK_SERVICE",
"-DSDK_BUNDLED",
"-DSDK_DEBUG", "-DSDK_DEBUG",
"-D__XCODE__", "-D__XCODE__",
); );
@@ -1520,6 +1522,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DSDK", "-DSDK",
"-DSDK_SERVICE",
"-DSDK_BUNDLED",
"-DSDK_DEBUG", "-DSDK_DEBUG",
"-D__XCODE__", "-D__XCODE__",
); );

View File

@@ -31,6 +31,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
7C3504EE1D2AD9D4007EBD64 /* Example_OSX-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example_OSX-Bridging-Header.h"; sourceTree = "<group>"; };
7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../build/OSX_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = "<group>"; }; 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../build/OSX_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = "<group>"; };
7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZeroTierSDK_OSX.h; path = ../../ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h; sourceTree = "<group>"; }; 7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZeroTierSDK_OSX.h; path = ../../ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h; sourceTree = "<group>"; };
7CFCB42D1D1AFEE800D3E66C /* Example_OSX_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_OSX_App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7CFCB42D1D1AFEE800D3E66C /* Example_OSX_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_OSX_App.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -80,6 +81,7 @@
7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */, 7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */,
7CFCB4361D1AFEE800D3E66C /* Main.storyboard */, 7CFCB4361D1AFEE800D3E66C /* Main.storyboard */,
7CFCB4391D1AFEE800D3E66C /* Info.plist */, 7CFCB4391D1AFEE800D3E66C /* Info.plist */,
7C3504EE1D2AD9D4007EBD64 /* Example_OSX-Bridging-Header.h */,
); );
path = Example_OSX_App; path = Example_OSX_App;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -263,10 +265,12 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../src";
INFOPLIST_FILE = Example_OSX_App/Info.plist; INFOPLIST_FILE = Example_OSX_App/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
"SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "Example_OSX_App/Example_OSX-Bridging-Header.h";
}; };
name = Debug; name = Debug;
}; };
@@ -275,6 +279,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../src";
INFOPLIST_FILE = Example_OSX_App/Info.plist; INFOPLIST_FILE = Example_OSX_App/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App";

View File

@@ -0,0 +1,35 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#ifndef Example_OSX_Bridging_Header_h
#define Example_OSX_Bridging_Header_h
int start_intercept();
int start_service(const char * path);
int join_network(const char * nwid);
void disable_intercept();
void enable_intercept();
#include <sys/socket.h>
#include "SDK_Signatures.h"
void zt_join_network(const char *nwid);
void zt_leave_network(const char *nwid);
// Direct Call ZT API
// These functions will provide direct access to ZT-enabled sockets with no hassle
int zts_connect(CONNECT_SIG);
int zt_bind(BIND_SIG);
int zt_accept(ACCEPT_SIG);
int zt_listen(LISTEN_SIG);
int zts_socket(SOCKET_SIG);
int zt_setsockopt(SETSOCKOPT_SIG);
int zt_getsockopt(GETSOCKOPT_SIG);
int zt_close(CLOSE_SIG);
int zt_getsockname(GETSOCKNAME_SIG);
#endif /* Example_OSX_Bridging_Header_h */

View File

@@ -7,7 +7,6 @@
// //
import Cocoa import Cocoa
i
class ViewController: NSViewController { class ViewController: NSViewController {

View File

@@ -70,7 +70,7 @@ remove_only_intermediates:
linux_shared_lib: remove_only_intermediates $(OBJS) linux_shared_lib: remove_only_intermediates $(OBJS)
mkdir -p build/linux_shared_lib mkdir -p build/linux_shared_lib
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFS) -DZT_SDK -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 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFS) -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-netcon-service to work # Build liblwip.so which must be placed in ZT home for zerotier-netcon-service to work
make -f make-liblwip.mk $(LWIP_FLAGS) make -f make-liblwip.mk $(LWIP_FLAGS)
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility # Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility

View File

@@ -83,7 +83,7 @@ remove_only_intermediates:
osx_shared_lib: remove_only_intermediates $(OBJS) osx_shared_lib: remove_only_intermediates $(OBJS)
mkdir -p build/osx_shared_lib mkdir -p build/osx_shared_lib
# Need to selectively rebuild one.cpp and OneService.cpp with ZT_SERVICE_NETCON and ZT_ONE_NO_ROOT_CHECK defined, and also NetconEthernetTap # 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) -DZT_SDK -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 $(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 # Build liblwip.so which must be placed in ZT home for zerotier-sdk-service to work
make -f make-liblwip.mk 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 # Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility

View File

@@ -40,8 +40,9 @@ extern "C" {
#define INTERCEPT_DISABLED 222 #define INTERCEPT_DISABLED 222
extern void load_symbols(); extern void load_symbols();
void zt_init_rpc(char *path, char *nwid); extern void zt_init_rpc(const char *path, const char *nwid);
extern char *api_netpath; extern char *api_netpath;
extern char *debug_logfile;
#if defined(__linux__) #if defined(__linux__)
extern int (*realaccept4)(ACCEPT4_SIG); extern int (*realaccept4)(ACCEPT4_SIG);

View File

@@ -42,6 +42,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#ifndef SDK_DEBUG_H
#define SDK_DEBUG_H
// Set during make (e.g. make SDK_DEBUG=2) // Set during make (e.g. make SDK_DEBUG=2)
#define DEBUG_LEVEL 5 #define DEBUG_LEVEL 5
@@ -51,7 +54,7 @@
#define MSG_DEBUG 4 // Information which is only useful to someone debugging #define MSG_DEBUG 4 // Information which is only useful to someone debugging
#define MSG_DEBUG_EXTRA 5 // If nothing in your world makes sense #define MSG_DEBUG_EXTRA 5 // If nothing in your world makes sense
char *debug_logfile = (char*)0; //char *debug_logfile = (char*)0;
void dwr(int level, const char *fmt, ... ); void dwr(int level, const char *fmt, ... );
void dwr(int level, const char *fmt, ... ) void dwr(int level, const char *fmt, ... )
@@ -78,6 +81,7 @@ void dwr(int level, const char *fmt, ... )
if(!debug_logfile) { // Try to get logfile from env if(!debug_logfile) { // Try to get logfile from env
debug_logfile = getenv("ZT_SDK_LOGFILE"); debug_logfile = getenv("ZT_SDK_LOGFILE");
} }
/*
if(debug_logfile) { if(debug_logfile) {
FILE *file = fopen(debug_logfile,"a"); FILE *file = fopen(debug_logfile,"a");
fprintf(file, "%s [tid=%7d] ", timestring, tid); fprintf(file, "%s [tid=%7d] ", timestring, tid);
@@ -85,6 +89,7 @@ void dwr(int level, const char *fmt, ... )
fclose(file); fclose(file);
va_end(ap); va_end(ap);
} }
*/
#endif #endif
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "%s [tid=%7d] ", timestring, tid); fprintf(stderr, "%s [tid=%7d] ", timestring, tid);
@@ -116,4 +121,6 @@ extern "C" {
} // extern "C" } // extern "C"
#endif #endif
#endif
#endif #endif

View File

@@ -47,6 +47,8 @@
#include "OSUtils.hpp" #include "OSUtils.hpp"
#include "SDK.h" #include "SDK.h"
void zt_init_rpc(const char * path, const char * nwid);
#include "SDK_Debug.h" #include "SDK_Debug.h"
#include "SDK_ServiceSetup.hpp" #include "SDK_ServiceSetup.hpp"
@@ -57,7 +59,6 @@ pthread_key_t thr_id_key;
static ZeroTier::OneService *volatile zt1Service; static ZeroTier::OneService *volatile zt1Service;
std::string homeDir; std::string homeDir;
std::string netDir; std::string netDir;
char *api_netpath;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -134,10 +135,8 @@ extern "C" {
JNIEXPORT void JNICALL Java_ZeroTier_SDK_startOneService(JNIEnv *env, jobject thisObj, jstring path) { JNIEXPORT void JNICALL Java_ZeroTier_SDK_startOneService(JNIEnv *env, jobject thisObj, jstring path) {
//char * path; //char * path;
homeDir = (*env)->GetStringUTFChars(env, path, NULL); homeDir = (*env)->GetStringUTFChars(env, path, NULL);
#else #else
void *startOneService(void *thread_id, string path) { void *startOneService(void *thread_id) {
homeDir = path;
#endif #endif
#if defined(SDK_BUNDLED) #if defined(SDK_BUNDLED)
@@ -159,7 +158,6 @@ extern "C" {
#if defined(__UNITY_3D__) && !defined(__ANDROID__) && !defined(__IOS__) #if defined(__UNITY_3D__) && !defined(__ANDROID__) && !defined(__IOS__)
// Unity3D on a non-mobile platform // Unity3D on a non-mobile platform
homeDir = "" + current_dir; // homeDir shall be current dir homeDir = "" + current_dir; // homeDir shall be current dir
// homeDir = "/Users/Joseph/utest2/";
#endif #endif
#if defined(__ANDROID__) #if defined(__ANDROID__)
@@ -177,7 +175,6 @@ extern "C" {
} }
LOGV("homeDir = %s", homeDir.c_str()); LOGV("homeDir = %s", homeDir.c_str());
// Where network .conf files will be stored // Where network .conf files will be stored
netDir = homeDir + "/networks.d"; netDir = homeDir + "/networks.d";

View File

@@ -83,7 +83,7 @@ int (*realclose)(CLOSE_SIG);
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Assembles (and/or) sets the RPC path for communication with the ZeroTier service // Assembles (and/or) sets the RPC path for communication with the ZeroTier service
void zt_init_rpc(char *path, char *nwid) void zt_init_rpc(const char *path, const char *nwid)
{ {
dwr(MSG_DEBUG, "zt_init_rpc\n"); dwr(MSG_DEBUG, "zt_init_rpc\n");
// Just double check we have // Just double check we have