Brian Fiete 5 éve
szülő
commit
9f3fded709

+ 1 - 0
.gitignore

@@ -9,6 +9,7 @@
 **/.vs/*
 BeefSpace_User.toml
 lld-link.exe
+.DS_Store
 stats/
 **/dist/*
 BeefySysLib/third_party/*

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
BeefBuild/BeefProj.toml


+ 2 - 1
BeefLibs/corlib/src/GC.bf

@@ -119,7 +119,8 @@ namespace System
 		public static void Collect(bool async = true) {}
 		private static void MarkAllStaticMembers() {}
 		public static void DebugDumpLeaks() {}
-		public static void Mark(Object obj) {}
+		[SkipCall]
+		public static void Mark(Object obj) {}		
 		public static void Mark(void* ptr, int size) {}
 		public static void SetAutoCollectPeriod(int periodMS) {}
 		public static void SetCollectFreeThreshold(int freeBytes) {}

+ 41 - 2
BeefRT/CMakeLists.txt

@@ -35,7 +35,22 @@ add_definitions(
    -DBFRTMERGED
 )
 
-if (${APPLE})
+if (${IOS})  
+  include_directories(
+    .
+    ../BeefySysLib/  
+    ../BeefySysLib/third_party
+    ../BeefySysLib/third_party/freetype/include
+    ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/include
+    ../  
+    ../extern
+    ../extern/llvm/include  
+    ../extern/llvm_linux/include
+    ../extern/llvm/lib/Target
+
+    ../BeefySysLib/platform/ios
+  )
+elseif (${APPLE})
   include_directories(
     .
     ../BeefySysLib/  
@@ -201,15 +216,39 @@ file(GLOB SRC_FILES
     ../BeefySysLib/third_party/utf8proc/utf8proc.c    
 )
 
-if (${APPLE})
+if (${IOS})
     file(GLOB SRC_FILES_OS
         ../BeefySysLib/platform/darwin/BFPlatform.cpp
         ../BeefySysLib/platform/darwin/DarwinCommon.cpp
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/.libs/prep_cif.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/.libs/types.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/.libs/raw_api.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/.libs/java_raw_api.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/.libs/closures.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/aarch64/.libs/ffi.o
+        ../BeefySysLib/third_party/libffi/build_iphoneos-arm64/src/aarch64/.libs/sysv.o
+    )
+    # Simulator
+    # src/prep_cif.o src/types.o src/raw_api.o src/java_raw_api.o src/closures.o src/x86/ffi64.o src/x86/unix64.o src/x86/ffiw64.o src/x86/win64.o
+elseif (${APPLE})
+    file(GLOB SRC_FILES_OS
+        ../BeefySysLib/platform/darwin/BFPlatform.cpp
+        ../BeefySysLib/platform/darwin/DarwinCommon.cpp
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/prep_cif.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/types.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/raw_api.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/java_raw_api.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/closures.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/x86/ffi64.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/x86/unix64.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/x86/ffiw64.o
+        ../BeefySysLib/third_party/libffi/build_macosx-x86_64/src/x86/win64.o
     )
 elseif (${ANDROID})
   file(GLOB SRC_FILES_OS
         ../BeefySysLib/platform/android/BFPlatform.cpp
         ../BeefySysLib/platform/android/AndroidCommon.cpp
+
     )
 else()
     file(GLOB SRC_FILES_OS

+ 2 - 1
BeefRT/dbg/DbgInternal.cpp

@@ -297,7 +297,8 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::Reflection::TypeInstan
 // 	int dataOffset = (int)(sizeof(intptr) * 2);
 // 	memset(allocBytes + dataOffset, 0, size - dataOffset);
 	result = (bf::System::Object*)allocBytes;
-	auto classVData = typeInst->mTypeClassVData;	
+	auto classVData = typeInst->mTypeClassVData;
+	(void)classVData;	
 
 #ifndef BFRT_NODBGFLAGS
 	intptr dbgAllocInfo = (intptr)BF_RETURN_ADDRESS;

+ 2 - 2
BeefRT/dbg/gc.cpp

@@ -2761,9 +2761,9 @@ void GC::Report()
 {
 }
 
-void GC::Mark(Object* obj)
+/*void GC::Mark(Object* obj)
 {
-}
+}*/
 
 void GC::Mark(void* ptr, intptr size)
 {

+ 1 - 2
BeefRT/rt/Thread.h

@@ -146,8 +146,7 @@ public:
 	}
 
 	virtual void ThreadStarted()
-	{
-		int threadPriority = BfpThread_GetPriority(mThreadHandle, NULL);
+	{		
 		mRunning = true;
 	}
 

+ 4 - 0
BeefySysLib/Common.cpp

@@ -867,6 +867,7 @@ uint8* Beefy::LoadBinaryData(const StringImpl& path, int* size)
 
 	uint8* data = new uint8[aSize];
 	int readSize = (int)fread(data, 1, aSize, fP);
+	(void)readSize;
 	fclose(fP);
 	if (size)
 		*size = aSize;
@@ -897,6 +898,7 @@ char* Beefy::LoadTextData(const StringImpl& path, int* size)
 		data[dataLen] = 0;
 		data[dataLen + 1] = 0;
 		int readSize = (int)fread(data + 1, 1, dataLen - 1, fP);
+		(void)readSize;
 		fclose(fP);
 
 		// UTF16
@@ -921,6 +923,7 @@ char* Beefy::LoadTextData(const StringImpl& path, int* size)
 		if (size != NULL)
 			*size = strLen;
 		int readSize = (int)fread(data, 1, strLen, fP);
+		(void)readSize;
 		fclose(fP);		
 		return data;
 	}
@@ -934,6 +937,7 @@ char* Beefy::LoadTextData(const StringImpl& path, int* size)
 	if (strLen > 3)
 	{
 		int readSize = (int)fread(data + 3, 1, strLen - 3, fP);
+		(void)readSize;
 	}
 	fclose(fP);
 	return data;

+ 18 - 0
BeefySysLib/platform/PlatformInterface.h

@@ -123,6 +123,22 @@ BFP_EXPORT int64 BFP_CALLTYPE BfpSystem_GetCPUTickFreq();
 BFP_EXPORT void BFP_CALLTYPE BfpSystem_CreateGUID(BfpGUID* outGuid);
 BFP_EXPORT void BFP_CALLTYPE BfpSystem_GetComputerName(char* outStr, int* inOutStrSize, BfpSystemResult* outResult);
 
+#ifdef BFP_INTPTR_UNIQUE
+
+#ifdef BF32
+#define BfpSystem_InterlockedExchangePtr(ptr, val) BfpSystem_InterlockedExchange32((uint32*)(ptr), (uint32)(val))
+#define BfpSystem_InterlockedExchangeAddPtr(ptr, val) BfpSystem_InterlockedExchangeAdd32((uint32*)(ptr), (uint32)(val))
+#define BfpSystem_InterlockedCompareExchangePtr(ptr, oldVal, newVal) BfpSystem_InterlockedCompareExchange32((uint32*)(ptr), (uint32)(oldVal), (uint32)(newVal))
+#define BfpSystem_EndianSwapPtr(val) BfpSystem_EndianSwap32((uint32)(val))
+#else
+#define BfpSystem_InterlockedExchangePtr(ptr, val) BfpSystem_InterlockedExchange64((uint64*)(ptr), (uint64)(val))
+#define BfpSystem_InterlockedExchangeAddPtr(ptr, val) BfpSystem_InterlockedExchangeAdd64((uint64*)(ptr), (uint64)(val))
+#define BfpSystem_InterlockedCompareExchangePtr(ptr, oldVal, newVal) BfpSystem_InterlockedCompareExchange64((uint64*)(ptr), (uint64)(oldVal), (uint64)(newVal))
+#define BfpSystem_EndianSwapPtr(val) BfpSystem_EndianSwap64((uint64)(val))
+#endif
+
+#else
+
 #ifdef BF32
 #define BfpSystem_InterlockedExchangePtr BfpSystem_InterlockedExchange32
 #define BfpSystem_InterlockedExchangeAddPtr BfpSystem_InterlockedExchangeAdd32
@@ -135,6 +151,8 @@ BFP_EXPORT void BFP_CALLTYPE BfpSystem_GetComputerName(char* outStr, int* inOutS
 #define BfpSystem_EndianSwapPtr BfpSystem_EndianSwap64
 #endif
 
+#endif
+
 enum BfpProcessResult
 {
 	BfpProcessResult_Ok = BfpResult_Ok,

+ 10 - 1
BeefySysLib/platform/darwin/DarwinCommon.cpp

@@ -6,4 +6,13 @@
 #define lseek64 lseek
 #define ftruncate64 ftruncate
 
-#include "../posix/PosixCommon.cpp"
+#include "../posix/PosixCommon.cpp"
+
+char* itoa(int value, char* str, int base)
+{
+    if (base == 16)
+        sprintf(str, "%X", value);
+    else
+        sprintf(str, "%d", value);
+    return str;
+}

+ 3 - 385
BeefySysLib/platform/darwin/DarwinCommon.h

@@ -58,6 +58,8 @@ typedef int16_t int16;
 typedef int8_t int8;
 typedef unsigned int uint;
 
+#define BFP_INTPTR_UNIQUE
+
 //#define BF_PLATFORM_SDL
 
 #define NOP
@@ -146,388 +148,4 @@ typedef void* HMODULE;
 #define DIR_SEP_CHAR '/'
 #define DIR_SEP_CHAR_ALT '\\'
 
-static char* itoa(int value, char* str, int base)
-{
-    if (base == 16)
-        sprintf(str, "%X", value);
-    else
-        sprintf(str, "%d", value);
-    return str;
-}
-
-inline uint32 InterlockedCompareExchange(volatile uint32* dest, uint32 exch, uint32 comp)
-{
-    return __sync_val_compare_and_swap(dest, comp, exch);    
-}
-
-inline uint64 InterlockedCompareExchange64(volatile int64* dest, int64 exch, int64 comp)
-{
-    return __sync_val_compare_and_swap(dest, comp, exch);
-}
-
-inline void* InterlockedCompareExchangePointer(void* volatile* dest, void* exch, void* comp)
-{
-    return __sync_val_compare_and_swap(dest, comp, exch);
-}
-
-inline uint32 InterlockedExchange(volatile uint32* dest, uint32 val)
-{
-    return __sync_lock_test_and_set(dest, val);
-}
-
-inline uint64 InterlockedExchange64(volatile int64* dest, int64 val)
-{
-    return __sync_lock_test_and_set(dest, val);
-}
-
-inline uint32 InterlockedExchangeAdd(volatile uint32* dest, uint32 val)
-{
-    return __sync_add_and_fetch(dest, val);
-}
-
-inline int32 InterlockedIncrement(volatile uint32* val)
-{
-    return __sync_add_and_fetch(val, 1);
-}
-
-inline int64 InterlockedIncrement64(volatile int64* val)
-{
-    return __sync_add_and_fetch(val, 1);
-}
-
-inline int32 InterlockedDecrement(volatile uint32* val)
-{
-    return __sync_add_and_fetch(val, -1);
-}
-
-inline int64 InterlockedDecrement64(volatile int64* val)
-{
-    return __sync_add_and_fetch(val, -1);
-}
-
-#if 0
-
-#pragma once
-
-#ifdef __LP64__
-#define BF64
-#else
-#define BF32
-#endif
-
-#define BOOST_DETAIL_NO_CONTAINER_FWD
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <time.h>
-#include <assert.h>
-#include <sys/time.h>
-#include <libkern/OSAtomic.h>
-#include <cstdlib>
-#include <unistd.h>
-#include <wchar.h>
-#include <math.h>
-
-extern "C"
-{
-#define FFI_BUILDING
-#include "third_party/libffi/x86_64-apple-darwin12.5.0/include/ffi.h"
-}
-
-#define FFI_STDCALL FFI_DEFAULT_ABI
-#define FFI_THISCALL FFI_DEFAULT_ABI
-#define FFI_FASTCALL FFI_DEFAULT_ABI
-
-typedef uint64_t uint64;
-typedef uint32_t uint32;
-typedef uint16_t uint16;
-typedef uint8_t uint8;
-typedef int64_t int64;
-typedef int32_t int32;
-typedef int16_t int16;
-typedef int8_t int8;
-typedef unsigned int uint;
-
-#define BF_PLATFORM_DARWIN
-#define BF_PLATFORM_SDL
-
-#define NOP
-//#define BF_NOTHROW throw ()
-//#define BF_NOTHROW noexcept
-#define BF_NOTHROW
-
-#ifdef BF64
-typedef int64 intptr;
-typedef uint64 uintptr;
-#else
-typedef int32 intptr;
-typedef uint32 uintptr;
-#endif
-
-typedef wchar_t* BSTR;
-typedef int HRESULT;
-typedef uint32 DWORD;
-typedef int32 LONG;
-
-typedef pthread_key_t BFTlsKey;
-typedef pthread_t BF_THREADID;
-
-int64 abs(int64 val) noexcept;
-
-struct IID
-{
-    unsigned long  Data1;
-    unsigned short Data2;
-    unsigned short Data3;
-    unsigned char  Data4[ 8 ];
-};
-
-typedef void* HANDLE;
-typedef void* HMODULE;
-
-#include "../notwin/NotWin.h"
-
-#ifdef DEBUG
-#define _DEBUG
-#endif
-
-//ARM
-
-#if defined(__x86_64__) || defined(__i386__)
-#define BF_FULL_MEMORY_FENCE() __asm__ __volatile__("mfence": : :"memory")
-#define BF_SPINWAIT_NOP() __asm__ volatile ("pause\n" : : : "memory" );
-#else
-#define BF_FULL_MEMORY_FENCE() __sync_synchronize()
-#define BF_SPINWAIT_NOP() ((void) 0)
-#endif
-
-#define BF_COMPILER_FENCE() __asm__ __volatile__("": : :"memory")
-#define BF_THREAD_YIELD() sched_yield()
-
-#define BF_ASSERT assert
-#define BF_FATAL(msg) assert(msg == 0)
-
-#define BF_NOINLINE __attribute__ ((noinline))
-#define BF_NAKED
-
-#define _alloca alloca
-
-namespace Beefy
-{
-
-class CritSect
-{
-private:
-    pthread_mutex_t mCriticalSection;
-    
-public:
-    CritSect(void)
-    {
-        pthread_mutexattr_t		attributes;
-        
-        pthread_mutexattr_init(&attributes);
-        pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE);
-        pthread_mutex_init(&mCriticalSection, &attributes);
-        pthread_mutexattr_destroy(&attributes);
-    }
-    
-    ~CritSect(void)
-    {
-        pthread_mutex_destroy(&mCriticalSection);
-    }
-    
-    bool TryLock()
-    {
-        return pthread_mutex_trylock( &mCriticalSection ) == 0;
-    }
-    
-    void Lock()
-    {
-        pthread_mutex_lock( &mCriticalSection );
-    }
-    
-    void Unlock()
-    {
-        pthread_mutex_unlock(&mCriticalSection);
-    }
-};
-
-class SyncEvent
-{
-private:
-    pthread_mutex_t mMutex;
-    pthread_cond_t mCondition;
-    uint32 mSet;
-    bool mManualReset;
-    
-    bool mInitialState;
-    int mSetCount;
-    int mWaitForCountFail;
-    int mWaitForCountSucceed;
-    
-public:
-    SyncEvent(bool manualReset = false, bool initialState = false)
-    {
-        mManualReset = manualReset;
-        mSet = initialState;
-        int result = pthread_mutex_init(&mMutex, NULL);
-        BF_ASSERT(result == 0);
-        result = pthread_cond_init(&mCondition, NULL);
-        BF_ASSERT(result == 0);
-        
-        mInitialState = initialState;
-        mSetCount = 0;
-        mWaitForCountFail = 0;
-        mWaitForCountSucceed = 0;
-    }
-    
-    ~SyncEvent()
-    {
-        pthread_cond_destroy(&mCondition);
-        pthread_mutex_destroy(&mMutex);
-    }
-    
-    void Set()
-    {
-        pthread_mutex_lock(&mMutex);
-        mSet = true;
-        pthread_cond_signal(&mCondition);
-        pthread_mutex_unlock(&mMutex);
-        
-        mSetCount++;
-    }
-    
-    void Reset()
-    {
-        mSet = false;
-    }
-    
-    bool WaitFor(uint32 timeout)
-    {
-        int result = pthread_mutex_lock(&mMutex);
-        BF_ASSERT(result == 0);
-        while (!mSet)
-        {
-            struct timespec ts;
-            struct timeval tv;
-            gettimeofday(&tv, NULL);
-            
-            uint64 nsec = (uint64)timeout * 1000000;
-            ts.tv_nsec = tv.tv_usec * 1000;
-            ts.tv_sec = tv.tv_sec;
-            
-            ts.tv_nsec += nsec % 1000000000;
-            ts.tv_sec += nsec / 1000000000;
-            
-            ts.tv_sec += (ts.tv_nsec / 1000000000);
-            ts.tv_nsec %= 1000000000;
-            
-            result = pthread_cond_timedwait(&mCondition, &mMutex, &ts);
-            
-            if (timeout == (uint32)-1)
-                BF_ASSERT(result == 0);
-            
-            if (result != 0)
-            {
-                // Timeout
-                mWaitForCountFail++;
-                pthread_mutex_unlock(&mMutex);
-                return false;
-            }
-        }
-        if (!mManualReset)
-            mSet = false;
-        mWaitForCountSucceed++;
-        pthread_mutex_unlock(&mMutex);
-        return true;
-    }
-};
-
-}
-
-inline uint32 InterlockedCompareExchange(volatile uint32* dest, uint32 exch, uint32 comp)
-{
-    while (true)
-    {
-        if (OSAtomicCompareAndSwap32Barrier((int32)comp, (int32)exch, (volatile int32*)dest))
-            return comp;
-        // We don't want to return *dest being equal to 'comp' if the CAS result was false
-        uint32 oldVal = *dest;
-        if (oldVal != comp)
-            return oldVal;
-    }
-}
-
-inline uint64 InterlockedCompareExchange64(volatile int64* dest, int64 exch, int64 comp)
-{
-    while (true)
-    {
-        if (OSAtomicCompareAndSwap64Barrier((int64)comp, (int64)exch, (volatile int64*)dest))
-            return comp;
-        // We don't want to return *dest being equal to 'comp' if the CAS result was false
-        uint64 oldVal = *dest;
-        if (oldVal != comp)
-            return oldVal;
-    }
-}
-
-inline void* InterlockedCompareExchangePointer(void* volatile* dest, void* exch, void* comp)
-{
-    while (true)
-    {
-        if (OSAtomicCompareAndSwapPtrBarrier(comp, exch, dest))
-            return comp;
-        // We don't want to return *dest being equal to 'comp' if the CAS result was false
-        void* oldVal = *dest;
-        if (oldVal != comp)
-            return oldVal;
-    }
-}
-
-inline uint32 InterlockedExchange(volatile uint32* dest, uint32 val)
-{
-    while (true)
-    {
-        uint32 oldVal = *dest;
-        if (OSAtomicCompareAndSwap32Barrier((int32)oldVal, (int32)val, (volatile int32*)dest))
-            return oldVal;
-    }
-}
-
-inline uint64 InterlockedExchange64(volatile int64* dest, int64 val)
-{
-    while (true)
-    {
-        uint64 oldVal = *dest;
-        if (OSAtomicCompareAndSwap64Barrier((int64)oldVal, (int64)val, (volatile int64*)dest))
-            return oldVal;
-    }
-}
-
-inline uint32 InterlockedExchangeAdd(volatile uint32* dest, uint32 val)
-{
-    return 0;
-}
-
-inline int32 InterlockedIncrement(volatile uint32* val)
-{
-    return OSAtomicIncrement32Barrier((int32*)val);
-}
-
-inline int64 InterlockedIncrement64(volatile int64* val)
-{
-    return OSAtomicIncrement64Barrier(val);
-}
-
-inline int32 InterlockedDecrement(volatile uint32* val)
-{
-    return OSAtomicDecrement32Barrier((int32*)val);
-}
-
-inline int64 InterlockedDecrement64(volatile int64* val)
-{
-    return OSAtomicDecrement64Barrier(val);
-}
-
-#endif
+char* itoa(int value, char* str, int base);

+ 10 - 1
BeefySysLib/platform/ios/BFPlatform.h

@@ -4,6 +4,7 @@
 
 #include "../darwin/DarwinCommon.h"
 #include "TargetConditionals.h"
+#include <string>
 
 #ifndef __IPHONEOS__
 #define __IPHONEOS__
@@ -13,6 +14,8 @@
 #define BF_PLATFORM_POSIX
 #define BF_PLATFORM_OPENGL_ES2
 #define BF_PLATFORM_FULLSCREEN
+#define BF_PLATFORM_DARWIN
+#define BF_PLATFORM_NAME "BF_PLATFORM_IOS"
 
 #if !TARGET_IPHONE_SIMULATOR
 #ifdef __LP64__
@@ -43,12 +46,15 @@
 
 #endif
 
+#define BF_IMPORT extern "C"
+
 #ifdef BFSYSLIB_DYNAMIC
-#define BF_EXPORT extern "C" __declspec(dllexport)
+#define BF_EXPORT extern "C"
 #define BF_CALLTYPE
 #else
 #define BF_EXPORT extern "C"
 #define BF_CALLTYPE
+#define BF_RESOURCES_REL_DIR "../Resources"
 #endif
 
 #ifdef BF_PLATFORM_ARM32
@@ -59,3 +65,6 @@
 #define BF_REGISTER_COUNT 15
 #endif
 
+#define BF_DEBUG_BREAK()
+
+#include "../PlatformInterface.h"

+ 33 - 6
BeefySysLib/platform/posix/PosixCommon.cpp

@@ -1,12 +1,16 @@
 #include "Common.h"
 #include "BFPlatform.h"
 #include <sys/stat.h>
+#ifndef BF_PLATFORM_DARWIN
 #include <sys/sysinfo.h>
+#endif
 #include <sys/wait.h>
 #include <wchar.h>
 #include <fcntl.h>
 #include <time.h>
+#ifdef BFP_HAS_DLINFO
 #include <link.h>
+#endif
 #include <dirent.h>
 #include <syslog.h>
 #include <unistd.h>
@@ -148,9 +152,7 @@ int64 Beefy::GetFileTimeWrite(const StringImpl& path)
     int result = stat(path.c_str(), &statbuf);
     if (result == -1)
         return 0;
-    
-    //int64 fileTime = 0;
-    //BFSystemTimeToFileTime(statbuf.st_mtime, 0, &fileTime);
+        
     return statbuf.st_mtime;
 }
 
@@ -785,7 +787,7 @@ BFP_EXPORT BfpSpawn* BFP_CALLTYPE BfpSpawn_Create(const char* inTargetPath, cons
 {
     Beefy::Array<Beefy::StringView> stringViews;
 
-    //printf("Executing: %s %s %x\n", inTargetPath, args, flags);
+    //printf("BfpSpawn_Create: %s %s %x\n", inTargetPath, args, flags);    
 
 	if ((workingDir != NULL) && (workingDir[0] != 0))
 	{
@@ -989,12 +991,25 @@ BFP_EXPORT BfpSpawn* BFP_CALLTYPE BfpSpawn_Create(const char* inTargetPath, cons
     else if (pid == 0) // Child
     {
         if ((flags & BfpSpawnFlag_RedirectStdInput) != 0)
+        {
+            close(stdInFD[1]);            
             while ((dup2(stdInFD[0], STDIN_FILENO) == -1) && (errno == EINTR)) {}
+            close(stdInFD[0]);            
+        }
+
         if ((flags & BfpSpawnFlag_RedirectStdOutput) != 0)
+        {
+            close(stdOutFD[0]);
             while ((dup2(stdOutFD[1], STDOUT_FILENO) == -1) && (errno == EINTR)) {}
+            close(stdOutFD[1]);
+        }
         if ((flags & BfpSpawnFlag_RedirectStdError) != 0)
+        {
+            close(stdErrFD[0]);
             while ((dup2(stdErrFD[1], STDERR_FILENO) == -1) && (errno == EINTR)) {}
-
+            close(stdErrFD[0]);
+        }
+        
         // If successful then this shouldn't return at all:
         int result;
 
@@ -2280,20 +2295,32 @@ BFP_EXPORT void BFP_CALLTYPE BfpFindFileData_GetFileName(BfpFindFileData* findDa
 
 BFP_EXPORT BfpTimeStamp BFP_CALLTYPE BfpFindFileData_GetTime_LastWrite(BfpFindFileData* findData)
 {
-    GetStat(findData);
+    GetStat(findData);    
+#ifdef BF_PLATFORM_DARWIN    
+    return BfpToTimeStamp(findData->mStat.st_mtimespec);
+#else
     return BfpToTimeStamp(findData->mStat.st_mtim);
+#endif
 }
 
 BFP_EXPORT BfpTimeStamp BFP_CALLTYPE BfpFindFileData_GetTime_Created(BfpFindFileData* findData)
 {
     GetStat(findData);
+#ifdef BF_PLATFORM_DARWIN        
+    return BfpToTimeStamp(findData->mStat.st_ctimespec);
+#else
     return BfpToTimeStamp(findData->mStat.st_ctim);
+#endif
 }
 
 BFP_EXPORT BfpTimeStamp BFP_CALLTYPE BfpFindFileData_GetTime_Access(BfpFindFileData* findData)
 {
     GetStat(findData);
+#ifdef BF_PLATFORM_DARWIN
+    return BfpToTimeStamp(findData->mStat.st_atimespec);
+#else
     return BfpToTimeStamp(findData->mStat.st_atim);
+#endif
 }
 
 BFP_EXPORT BfpFileAttributes BFP_CALLTYPE BfpFindFileData_GetFileAttributes(BfpFindFileData* findData)

+ 4 - 4
BeefySysLib/util/UTF8.cpp

@@ -361,28 +361,28 @@ int Beefy::u8_read_escape_sequence(char *str, uint32 *dest)
         do {
             digs[dno++] = str[i++];
         } while (octal_digit(str[i]) && dno < 3);
-        ch = strtol(digs, NULL, 8);
+        ch = (uint32)strtol(digs, NULL, 8);
     }
     else if (str[0] == 'x') {
         while (hex_digit(str[i]) && dno < 2) {
             digs[dno++] = str[i++];
         }
         if (dno > 0)
-            ch = strtol(digs, NULL, 16);
+            ch = (uint32)strtol(digs, NULL, 16);
     }
     else if (str[0] == 'u') {
         while (hex_digit(str[i]) && dno < 4) {
             digs[dno++] = str[i++];
         }
         if (dno > 0)
-            ch = strtol(digs, NULL, 16);
+            ch = (uint32)strtol(digs, NULL, 16);
     }
     else if (str[0] == 'U') {
         while (hex_digit(str[i]) && dno < 8) {
             digs[dno++] = str[i++];
         }
         if (dno > 0)
-            ch = strtol(digs, NULL, 16);
+            ch = (uint32)strtol(digs, NULL, 16);
     }
     *dest = ch;
     

+ 4 - 2
IDE/src/BuildContext.bf

@@ -204,6 +204,8 @@ namespace IDE
 				arPath.Clear();
 				arPath.Append(gApp.mInstallDir);
 				arPath.Append(@"llvm\bin\llvm-ar.exe");
+#elif BF_PLATFORM_MACOS
+				arPath.Append("llvm/bin/llvm-ar");
 #else
 				arPath.Append("/usr/bin/ar");
 #endif
@@ -495,9 +497,9 @@ namespace IDE
 			if ((platformType == .macOS) || (platformType == .iOS))
 			{
 				if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
-					outRt.Append("libBeefRT_d.dylib");
+					outRt.Append("libBeefRT_d.a");
 				else
-					outRt.Append("libBeefRT.dylib");
+					outRt.Append("libBeefRT.a");
 				return;
 			}
 

+ 1 - 1
IDE/src/IDEApp.bf

@@ -8519,7 +8519,7 @@ namespace IDE
 										default:
 										}
 									case .macOS:
-										newString.AppendF("./{} -Wl,-rpath -Wl,.", rtName);
+										newString.AppendF("./{} -Wl,-rpath -Wl,@executable_path", rtName);
 									case .iOS:
 									case .Linux:
 										newString.AppendF("./{} -Wl,-rpath -Wl,$ORIGIN", rtName);

+ 2 - 0
IDEHelper/Compiler/BfIRCodeGen.cpp

@@ -4029,6 +4029,7 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
 	case BfRelocType_ROPI_RWPI:
 		relocModel = llvm::Reloc::Model::ROPI_RWPI;
 		break;
+	default: break;
 	}
 
 	switch (codeGenOptions.mPICLevel)
@@ -4042,6 +4043,7 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
 	case BfPICLevel_Big:
 		mLLVMModule->setPICLevel(llvm::PICLevel::Level::BigPIC);
 		break;
+	default: break;
 	}
 
 	std::unique_ptr<llvm::TargetMachine> target(

+ 1 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -1098,7 +1098,7 @@ void BfModule::EnsureIRBuilder(bool dbgVerifyCodeGen)
 			//  code as we walk the AST
 			//mBfIRBuilder->mDbgVerifyCodeGen = true;			
 			if (
-                (mModuleName == "Program")
+                (mModuleName == "-")
 				//|| (mModuleName == "System_Internal")
 				//|| (mModuleName == "vdata")
 				//|| (mModuleName == "Hey_Dude_Bro_TestClass")

+ 2 - 2
IDEHelper/Compiler/BfParser.cpp

@@ -191,8 +191,8 @@ static int DecodeInt(uint8* buf, int& idx)
 
 static int gCurDataId = 0;
 BfParserData::BfParserData()
-{	
-	mDataId = (int)::InterlockedIncrement((volatile uint32*)&gCurDataId);
+{		
+	mDataId = (int)BfpSystem_InterlockedExchangeAdd32((uint32*)&gCurDataId, 1) + 1;
 
 	mHash = 0;
 	mRefCount = -1;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 4 - 4
bin/build.sh


+ 15 - 0
bin/build_ios.sh

@@ -0,0 +1,15 @@
+# exit when any command fails
+set -e
+
+cd "$(dirname "$0")"
+cd ../builds
+
+if [ ! -d ios ]; then
+	mkdir ios
+	cd ios
+	cmake ../../BeefRT -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../bin/ios.toolchain.cmake -DPLATFORM=OS64
+	cd ..
+fi
+
+cd ios
+cmake --build . --config Debug

+ 672 - 0
bin/ios.toolchain.cmake

@@ -0,0 +1,672 @@
+# This file is part of the ios-cmake project. It was retrieved from
+# https://github.com/cristeab/ios-cmake.git, which is a fork of
+# https://code.google.com/p/ios-cmake/. Which in turn is based off of
+# the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which
+# are included with CMake 2.8.4
+#
+# The ios-cmake project is licensed under the new BSD license.
+#
+# Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software,
+# Kitware, Inc., Insight Software Consortium.  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 the copyright holder 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.
+#
+# This file is based off of the Platform/Darwin.cmake and
+# Platform/UnixPaths.cmake files which are included with CMake 2.8.4
+# It has been altered for iOS development.
+#
+# Updated by Alex Stewart ([email protected])
+#
+# *****************************************************************************
+#      Now maintained by Alexander Widerberg (widerbergaren [at] gmail.com)
+#                      under the BSD-3-Clause license
+#                   https://github.com/leetal/ios-cmake
+# *****************************************************************************
+#
+#                           INFORMATION / HELP
+#
+# The following arguments control the behaviour of this toolchain:
+#
+# PLATFORM: (default "OS")
+#    OS = Build for iPhoneOS.
+#    OS64 = Build for arm64 iphoneOS.
+#    OS64COMBINED = Build for arm64 x86_64 iphoneOS. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY)
+#    SIMULATOR = Build for x86 i386 iphoneOS Simulator.
+#    SIMULATOR64 = Build for x86_64 iphoneOS Simulator.
+#    TVOS = Build for arm64 tvOS.
+#    TVOSCOMBINED = Build for arm64 x86_64 tvOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY)
+#    SIMULATOR_TVOS = Build for x86_64 tvOS Simulator.
+#    WATCHOS = Build for armv7k arm64_32 for watchOS.
+#    WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY)
+#    SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator.
+#
+# CMAKE_OSX_SYSROOT: Path to the SDK to use.  By default this is
+#    automatically determined from PLATFORM and xcodebuild, but
+#    can also be manually specified (although this should not be required).
+#
+# CMAKE_DEVELOPER_ROOT: Path to the Developer directory for the platform
+#    being compiled for.  By default this is automatically determined from
+#    CMAKE_OSX_SYSROOT, but can also be manually specified (although this should
+#    not be required).
+#
+# DEPLOYMENT_TARGET: Minimum SDK version to target. Default 2.0 on watchOS and 9.0 on tvOS+iOS
+#
+# ENABLE_BITCODE: (1|0) Enables or disables bitcode support. Default 1 (true)
+#
+# ENABLE_ARC: (1|0) Enables or disables ARC support. Default 1 (true, ARC enabled by default)
+#
+# ENABLE_VISIBILITY: (1|0) Enables or disables symbol visibility support. Default 0 (false, visibility hidden by default)
+#
+# ENABLE_STRICT_TRY_COMPILE: (1|0) Enables or disables strict try_compile() on all Check* directives (will run linker
+#    to actually check if linking is possible). Default 0 (false, will set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY)
+#
+# ARCHS: (armv7 armv7s armv7k arm64 arm64_32 i386 x86_64) If specified, will override the default architectures for the given PLATFORM
+#    OS = armv7 armv7s arm64 (if applicable)
+#    OS64 = arm64 (if applicable)
+#    SIMULATOR = i386
+#    SIMULATOR64 = x86_64
+#    TVOS = arm64
+#    SIMULATOR_TVOS = x86_64 (i386 has since long been deprecated)
+#    WATCHOS = armv7k arm64_32 (if applicable)
+#    SIMULATOR_WATCHOS = x86_64 (i386 has since long been deprecated)
+#
+# This toolchain defines the following variables for use externally:
+#
+# XCODE_VERSION: Version number (not including Build version) of Xcode detected.
+# SDK_VERSION: Version of SDK being used.
+# CMAKE_OSX_ARCHITECTURES: Architectures being compiled for (generated from PLATFORM).
+#
+# This toolchain defines the following macros for use externally:
+#
+# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT)
+#   A convenience macro for setting xcode specific properties on targets.
+#   Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel
+#   example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all").
+#
+# find_host_package (PROGRAM ARGS)
+#   A macro used to find executable programs on the host system, not within the
+#   environment.  Thanks to the android-cmake project for providing the
+#   command.
+#
+# ******************************** DEPRECATIONS *******************************
+#
+# IOS_DEPLOYMENT_TARGET: (Deprecated) Alias to DEPLOYMENT_TARGET
+# CMAKE_IOS_DEVELOPER_ROOT: (Deprecated) Alias to CMAKE_DEVELOPER_ROOT
+# IOS_PLATFORM: (Deprecated) Alias to PLATFORM
+# IOS_ARCH: (Deprecated) Alias to ARCHS
+#
+# *****************************************************************************
+#
+
+# Fix for PThread library not in path
+set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+set(CMAKE_HAVE_THREADS_LIBRARY 1)
+set(CMAKE_USE_WIN32_THREADS_INIT 0)
+set(CMAKE_USE_PTHREADS_INIT 1)
+
+# Cache what generator is used
+set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}" CACHE STRING "Expose CMAKE_GENERATOR" FORCE)
+
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14")
+  set(MODERN_CMAKE YES)
+  message(STATUS "Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!")
+endif()
+
+# Get the Xcode version being used.
+execute_process(COMMAND xcodebuild -version
+  OUTPUT_VARIABLE XCODE_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION "${XCODE_VERSION}")
+string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION "${XCODE_VERSION}")
+message(STATUS "Building with Xcode version: ${XCODE_VERSION}")
+
+######## ALIASES (DEPRECATION WARNINGS)
+
+if(DEFINED IOS_PLATFORM)
+  set(PLATFORM ${IOS_PLATFORM})
+  message(DEPRECATION "IOS_PLATFORM argument is DEPRECATED. Consider using the new PLATFORM argument instead.")
+endif()
+
+if(DEFINED IOS_DEPLOYMENT_TARGET)
+  set(DEPLOYMENT_TARGET ${IOS_DEPLOYMENT_TARGET})
+  message(DEPRECATION "IOS_DEPLOYMENT_TARGET argument is DEPRECATED. Consider using the new DEPLOYMENT_TARGET argument instead.")
+endif()
+
+if(DEFINED CMAKE_IOS_DEVELOPER_ROOT)
+  set(CMAKE_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT})
+  message(DEPRECATION "CMAKE_IOS_DEVELOPER_ROOT argument is DEPRECATED. Consider using the new CMAKE_DEVELOPER_ROOT argument instead.")
+endif()
+
+if(DEFINED IOS_ARCH)
+  set(ARCHS ${IOS_ARCH})
+  message(DEPRECATION "IOS_ARCH argument is DEPRECATED. Consider using the new ARCHS argument instead.")
+endif()
+
+######## END ALIASES
+
+# Unset the FORCE on cache variables if in try_compile()
+set(FORCE_CACHE FORCE)
+get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
+if(_CMAKE_IN_TRY_COMPILE)
+  unset(FORCE_CACHE)
+endif()
+
+# Default to building for iPhoneOS if not specified otherwise, and we cannot
+# determine the platform from the CMAKE_OSX_ARCHITECTURES variable. The use
+# of CMAKE_OSX_ARCHITECTURES is such that try_compile() projects can correctly
+# determine the value of PLATFORM from the root project, as
+# CMAKE_OSX_ARCHITECTURES is propagated to them by CMake.
+if(NOT DEFINED PLATFORM)
+  if (CMAKE_OSX_ARCHITECTURES)
+    if(CMAKE_OSX_ARCHITECTURES MATCHES ".*arm.*" AND CMAKE_OSX_SYSROOT MATCHES ".*iphoneos.*")
+      set(PLATFORM "OS")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_SYSROOT MATCHES ".*iphonesimulator.*")
+      set(PLATFORM "SIMULATOR")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_OSX_SYSROOT MATCHES ".*iphonesimulator.*")
+      set(PLATFORM "SIMULATOR64")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64" AND CMAKE_OSX_SYSROOT MATCHES ".*appletvos.*")
+      set(PLATFORM "TVOS")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_OSX_SYSROOT MATCHES ".*appletvsimulator.*")
+      set(PLATFORM "SIMULATOR_TVOS")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*armv7k.*" AND CMAKE_OSX_SYSROOT MATCHES ".*watchos.*")
+      set(PLATFORM "WATCHOS")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_SYSROOT MATCHES ".*watchsimulator.*")
+      set(PLATFORM "SIMULATOR_WATCHOS")
+    endif()
+  endif()
+  if (NOT PLATFORM)
+    set(PLATFORM "OS")
+  endif()
+endif()
+
+set(PLATFORM_INT "${PLATFORM}" CACHE STRING "Type of platform for which the build targets.")
+
+# Handle the case where we are targeting iOS and a version above 10.3.4 (32-bit support dropped officially)
+if(PLATFORM_INT STREQUAL "OS" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4)
+  set(PLATFORM_INT "OS64")
+  message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.")
+elseif(PLATFORM_INT STREQUAL "SIMULATOR" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4)
+  set(PLATFORM_INT "SIMULATOR64")
+  message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.")
+endif()
+
+# Determine the platform name and architectures for use in xcodebuild commands
+# from the specified PLATFORM name.
+if(PLATFORM_INT STREQUAL "OS")
+  set(SDK_NAME iphoneos)
+  if(NOT ARCHS)
+    set(ARCHS armv7 armv7s arm64)
+  endif()
+elseif(PLATFORM_INT STREQUAL "OS64")
+  set(SDK_NAME iphoneos)
+  if(NOT ARCHS)
+    if (XCODE_VERSION VERSION_GREATER 10.0)
+      set(ARCHS arm64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example
+    else()
+      set(ARCHS arm64)
+    endif()
+  endif()
+elseif(PLATFORM_INT STREQUAL "OS64COMBINED")
+  set(SDK_NAME iphoneos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      if (XCODE_VERSION VERSION_GREATER 10.0)
+        set(ARCHS arm64 x86_64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example
+      else()
+        set(ARCHS arm64 x86_64)
+      endif()
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the OS64COMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR")
+  set(SDK_NAME iphonesimulator)
+  if(NOT ARCHS)
+    set(ARCHS i386)
+  endif()
+  message(DEPRECATION "SIMULATOR IS DEPRECATED. Consider using SIMULATOR64 instead.")
+elseif(PLATFORM_INT STREQUAL "SIMULATOR64")
+  set(SDK_NAME iphonesimulator)
+  if(NOT ARCHS)
+    set(ARCHS x86_64)
+  endif()
+elseif(PLATFORM_INT STREQUAL "TVOS")
+  set(SDK_NAME appletvos)
+  if(NOT ARCHS)
+    set(ARCHS arm64)
+  endif()
+elseif (PLATFORM_INT STREQUAL "TVOSCOMBINED")
+  set(SDK_NAME appletvos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      set(ARCHS arm64 x86_64)
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the TVOSCOMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS")
+  set(SDK_NAME appletvsimulator)
+  if(NOT ARCHS)
+    set(ARCHS x86_64)
+  endif()
+elseif(PLATFORM_INT STREQUAL "WATCHOS")
+  set(SDK_NAME watchos)
+  if(NOT ARCHS)
+    if (XCODE_VERSION VERSION_GREATER 10.0)
+      set(ARCHS armv7k arm64_32)
+    else()
+      set(ARCHS armv7k)
+    endif()
+  endif()
+elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED")
+  set(SDK_NAME watchos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      if (XCODE_VERSION VERSION_GREATER 10.0)
+        set(ARCHS armv7k arm64_32 i386)
+      else()
+        set(ARCHS armv7k i386)
+      endif()
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the WATCHOSCOMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS")
+  set(SDK_NAME watchsimulator)
+  if(NOT ARCHS)
+    set(ARCHS i386)
+  endif()
+else()
+  message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}")
+endif()
+message(STATUS "Configuring ${SDK_NAME} build for platform: ${PLATFORM_INT}, architecture(s): ${ARCHS}")
+
+if(MODERN_CMAKE AND PLATFORM_INT MATCHES ".*COMBINED" AND NOT USED_CMAKE_GENERATOR MATCHES "Xcode")
+  message(FATAL_ERROR "The COMBINED options only work with Xcode generator, -G Xcode")
+endif()
+
+# If user did not specify the SDK root to use, then query xcodebuild for it.
+execute_process(COMMAND xcodebuild -version -sdk ${SDK_NAME} Path
+    OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+if (NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT)
+  message(SEND_ERROR "Please make sure that Xcode is installed and that the toolchain"
+  "is pointing to the correct path. Please run:"
+  "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer"
+  "and see if that fixes the problem for you.")
+  message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} "
+  "does not exist.")
+elseif(DEFINED CMAKE_OSX_SYSROOT)
+  message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT} for platform: ${PLATFORM_INT} when checking compatibility")
+elseif(DEFINED CMAKE_OSX_SYSROOT_INT)
+   message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT_INT} for platform: ${PLATFORM_INT}")
+   set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "")
+endif()
+
+# Set Xcode property for SDKROOT as well if Xcode generator is used
+if(USED_CMAKE_GENERATOR MATCHES "Xcode")
+  set(CMAKE_OSX_SYSROOT "${SDK_NAME}" CACHE INTERNAL "")
+  if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
+    set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM 123456789A CACHE INTERNAL "")
+  endif()
+endif()
+
+# Specify minimum version of deployment target.
+if(NOT DEFINED DEPLOYMENT_TARGET)
+  if (PLATFORM_INT STREQUAL "WATCHOS" OR PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS")
+    # Unless specified, SDK version 2.0 is used by default as minimum target version (watchOS).
+    set(DEPLOYMENT_TARGET "2.0"
+            CACHE STRING "Minimum SDK version to build for." )
+  else()
+    # Unless specified, SDK version 9.0 is used by default as minimum target version (iOS, tvOS).
+    set(DEPLOYMENT_TARGET "9.0"
+            CACHE STRING "Minimum SDK version to build for." )
+  endif()
+  message(STATUS "Using the default min-version since DEPLOYMENT_TARGET not provided!")
+endif()
+# Use bitcode or not
+if(NOT DEFINED ENABLE_BITCODE AND NOT ARCHS MATCHES "((^|;|, )(i386|x86_64))+")
+  # Unless specified, enable bitcode support by default
+  message(STATUS "Enabling bitcode support by default. ENABLE_BITCODE not provided!")
+  set(ENABLE_BITCODE TRUE)
+elseif(NOT DEFINED ENABLE_BITCODE)
+  message(STATUS "Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!")
+  set(ENABLE_BITCODE FALSE)
+endif()
+set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL "Whether or not to enable bitcode" ${FORCE_CACHE})
+# Use ARC or not
+if(NOT DEFINED ENABLE_ARC)
+  # Unless specified, enable ARC support by default
+  set(ENABLE_ARC TRUE)
+  message(STATUS "Enabling ARC support by default. ENABLE_ARC not provided!")
+endif()
+set(ENABLE_ARC_INT ${ENABLE_ARC} CACHE BOOL "Whether or not to enable ARC" ${FORCE_CACHE})
+# Use hidden visibility or not
+if(NOT DEFINED ENABLE_VISIBILITY)
+  # Unless specified, disable symbols visibility by default
+  set(ENABLE_VISIBILITY FALSE)
+  message(STATUS "Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!")
+endif()
+set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols (-fvisibility=hidden)" ${FORCE_CACHE})
+# Set strict compiler checks or not
+if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE)
+  # Unless specified, disable strict try_compile()
+  set(ENABLE_STRICT_TRY_COMPILE FALSE)
+  message(STATUS "Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!")
+endif()
+set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler checks" ${FORCE_CACHE})
+# Get the SDK version information.
+execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
+  OUTPUT_VARIABLE SDK_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# Find the Developer root for the specific iOS platform being compiled for
+# from CMAKE_OSX_SYSROOT.  Should be ../../ from SDK specified in
+# CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain
+# this information from xcrun or xcodebuild.
+if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT USED_CMAKE_GENERATOR MATCHES "Xcode")
+  get_filename_component(PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT} PATH)
+  get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH)
+
+  if (NOT DEFINED CMAKE_DEVELOPER_ROOT)
+    message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: "
+      "${CMAKE_DEVELOPER_ROOT} does not exist.")
+  endif()
+endif()
+# Find the C & C++ compilers for the specified SDK.
+if(NOT CMAKE_C_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
+    OUTPUT_VARIABLE CMAKE_C_COMPILER
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}")
+endif()
+if(NOT CMAKE_CXX_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
+    OUTPUT_VARIABLE CMAKE_CXX_COMPILER
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}")
+endif()
+# Find (Apple's) libtool.
+execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
+  OUTPUT_VARIABLE BUILD_LIBTOOL
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+message(STATUS "Using libtool: ${BUILD_LIBTOOL}")
+# Configure libtool to be used instead of ar + ranlib to build static libraries.
+# This is required on Xcode 7+, but should also work on previous versions of
+# Xcode.
+set(CMAKE_C_CREATE_STATIC_LIBRARY
+  "${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+set(CMAKE_CXX_CREATE_STATIC_LIBRARY
+  "${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+# Find the toolchain's provided install_name_tool if none is found on the host
+if(NOT CMAKE_INSTALL_NAME_TOOL)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find install_name_tool
+      OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT
+      ERROR_QUIET
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+  set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE STRING "" ${FORCE_CACHE})
+  message(STATUS "Using install_name_tool: ${CMAKE_INSTALL_NAME_TOOL}")
+endif()
+# Get the version of Darwin (OS X) of the host.
+execute_process(COMMAND uname -r
+  OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+# CMake 3.14+ support building for iOS, watchOS and tvOS out of the box.
+if(MODERN_CMAKE)
+  if(SDK_NAME MATCHES "iphone")
+    set(CMAKE_SYSTEM_NAME iOS CACHE INTERNAL "" ${FORCE_CACHE})
+  elseif(SDK_NAME MATCHES "appletv")
+    set(CMAKE_SYSTEM_NAME tvOS CACHE INTERNAL "" ${FORCE_CACHE})
+  elseif(SDK_NAME MATCHES "watch")
+    set(CMAKE_SYSTEM_NAME watchOS CACHE INTERNAL "" ${FORCE_CACHE})
+  endif()
+
+  # Provide flags for a combined FAT library build on newer CMake versions
+  if(PLATFORM_INT MATCHES ".*COMBINED")
+    set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "" ${FORCE_CACHE})
+    set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" ${FORCE_CACHE})
+    message(STATUS "Will combine built (static) artifacts into FAT lib...")
+  endif()
+else()
+  # Legacy code path prior to CMake 3.14
+  set(CMAKE_SYSTEM_NAME Darwin CACHE INTERNAL "" ${FORCE_CACHE})
+endif()
+# Standard settings.
+set(CMAKE_SYSTEM_VERSION ${SDK_VERSION} CACHE INTERNAL "")
+set(UNIX TRUE CACHE BOOL "")
+set(APPLE TRUE CACHE BOOL "")
+set(IOS TRUE CACHE BOOL "")
+set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
+set(CMAKE_RANLIB ranlib CACHE FILEPATH "" FORCE)
+set(CMAKE_STRIP strip CACHE FILEPATH "" FORCE)
+# Set the architectures for which to build.
+set(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE STRING "Build architecture for iOS")
+# Change the type of target generated for try_compile() so it'll work when cross-compiling, weak compiler checks
+if(ENABLE_STRICT_TRY_COMPILE_INT)
+  message(STATUS "Using strict compiler checks (default in CMake).")
+else()
+  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+endif()
+# All iOS/Darwin specific settings - some may be redundant.
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+set(CMAKE_SHARED_MODULE_PREFIX "lib")
+set(CMAKE_SHARED_MODULE_SUFFIX ".so")
+set(CMAKE_C_COMPILER_ABI ELF)
+set(CMAKE_CXX_COMPILER_ABI ELF)
+set(CMAKE_C_HAS_ISYSROOT 1)
+set(CMAKE_CXX_HAS_ISYSROOT 1)
+set(CMAKE_MODULE_EXISTS 1)
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
+set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
+set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
+set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
+
+if(ARCHS MATCHES "((^|;|, )(arm64|arm64e|x86_64))+")
+  set(CMAKE_C_SIZEOF_DATA_PTR 8)
+  set(CMAKE_CXX_SIZEOF_DATA_PTR 8)
+  if(ARCHS MATCHES "((^|;|, )(arm64|arm64e))+")
+    set(CMAKE_SYSTEM_PROCESSOR "aarch64")
+  else()
+    set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+  endif()
+  message(STATUS "Using a data_ptr size of 8")
+else()
+  set(CMAKE_C_SIZEOF_DATA_PTR 4)
+  set(CMAKE_CXX_SIZEOF_DATA_PTR 4)
+  set(CMAKE_SYSTEM_PROCESSOR "arm")
+  message(STATUS "Using a data_ptr size of 4")
+endif()
+
+message(STATUS "Building for minimum ${SDK_NAME} version: ${DEPLOYMENT_TARGET}"
+               " (SDK version: ${SDK_VERSION})")
+# Note that only Xcode 7+ supports the newer more specific:
+# -m${SDK_NAME}-version-min flags, older versions of Xcode use:
+# -m(ios/ios-simulator)-version-min instead.
+if(PLATFORM_INT STREQUAL "OS" OR PLATFORM_INT STREQUAL "OS64")
+  if(XCODE_VERSION VERSION_LESS 7.0)
+    set(SDK_NAME_VERSION_FLAGS
+      "-mios-version-min=${DEPLOYMENT_TARGET}")
+  else()
+    # Xcode 7.0+ uses flags we can build directly from SDK_NAME.
+    set(SDK_NAME_VERSION_FLAGS
+      "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}")
+  endif()
+elseif(PLATFORM_INT STREQUAL "TVOS")
+  set(SDK_NAME_VERSION_FLAGS
+    "-mtvos-version-min=${DEPLOYMENT_TARGET}")
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS")
+  set(SDK_NAME_VERSION_FLAGS
+    "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}")
+elseif(PLATFORM_INT STREQUAL "WATCHOS")
+  set(SDK_NAME_VERSION_FLAGS
+    "-mwatchos-version-min=${DEPLOYMENT_TARGET}")
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS")
+  set(SDK_NAME_VERSION_FLAGS
+    "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}")
+else()
+  # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min.
+  set(SDK_NAME_VERSION_FLAGS
+    "-mios-simulator-version-min=${DEPLOYMENT_TARGET}")
+endif()
+message(STATUS "Version flags set to: ${SDK_NAME_VERSION_FLAGS}")
+set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE STRING
+    "Set CMake deployment target" ${FORCE_CACHE})
+
+if(ENABLE_BITCODE_INT)
+  set(BITCODE "-fembed-bitcode")
+  set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode CACHE INTERNAL "")
+  message(STATUS "Enabling bitcode support.")
+else()
+  set(BITCODE "")
+  set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE NO CACHE INTERNAL "")
+  message(STATUS "Disabling bitcode support.")
+endif()
+
+if(ENABLE_ARC_INT)
+  set(FOBJC_ARC "-fobjc-arc")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES CACHE INTERNAL "")
+  message(STATUS "Enabling ARC support.")
+else()
+  set(FOBJC_ARC "-fno-objc-arc")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC NO CACHE INTERNAL "")
+  message(STATUS "Disabling ARC support.")
+endif()
+
+if(NOT ENABLE_VISIBILITY_INT)
+  set(VISIBILITY "-fvisibility=hidden")
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES CACHE INTERNAL "")
+  message(STATUS "Hiding symbols (-fvisibility=hidden).")
+else()
+  set(VISIBILITY "")
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN NO CACHE INTERNAL "")
+endif()
+
+#Check if Xcode generator is used, since that will handle these flags automagically
+if(USED_CMAKE_GENERATOR MATCHES "Xcode")
+  message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as generator.")
+else()
+  set(CMAKE_C_FLAGS
+  "${SDK_NAME_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_C_FLAGS}")
+  # Hidden visibilty is required for C++ on iOS.
+  set(CMAKE_CXX_FLAGS
+  "${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} -fvisibility-inlines-hidden -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_CXX_FLAGS}")
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}")
+  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG -Os -ffast-math ${CMAKE_CXX_FLAGS_MINSIZEREL}")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG -O2 -g -ffast-math ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG -O3 -ffast-math ${CMAKE_CXX_FLAGS_RELEASE}")
+  set(CMAKE_C_LINK_FLAGS "${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
+  set(CMAKE_CXX_LINK_FLAGS "${SDK_NAME_VERSION_FLAGS}  -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
+
+  # In order to ensure that the updated compiler flags are used in try_compile()
+  # tests, we have to forcibly set them in the CMake cache, not merely set them
+  # in the local scope.
+  list(APPEND VARS_TO_FORCE_IN_CACHE
+    CMAKE_C_FLAGS
+    CMAKE_CXX_FLAGS
+    CMAKE_CXX_FLAGS_DEBUG
+    CMAKE_CXX_FLAGS_RELWITHDEBINFO
+    CMAKE_CXX_FLAGS_MINSIZEREL
+    CMAKE_CXX_FLAGS_RELEASE
+    CMAKE_C_LINK_FLAGS
+    CMAKE_CXX_LINK_FLAGS)
+  foreach(VAR_TO_FORCE ${VARS_TO_FORCE_IN_CACHE})
+    set(${VAR_TO_FORCE} "${${VAR_TO_FORCE}}" CACHE STRING "")
+  endforeach()
+endif()
+
+set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
+set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/Frameworks -rpath @loader_path/Frameworks")
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
+set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
+
+# Set the find root to the iOS developer roots and to user defined paths.
+set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT_INT} ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended
+ to all search paths")
+# Default to searching for frameworks first.
+set(CMAKE_FIND_FRAMEWORK FIRST)
+# Set up the default search directories for frameworks.
+set(CMAKE_FRAMEWORK_PATH
+  ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks
+  ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks
+  ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" ${FORCE_CACHE})
+
+# By default, search both the specified iOS SDK and the remainder of the host filesystem.
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE})
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" ${FORCE_CACHE})
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" ${FORCE_CACHE})
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "" ${FORCE_CACHE})
+endif()
+
+#
+# Some helper-macros below to simplify and beautify the CMakeFile
+#
+
+# This little macro lets you set any Xcode specific property.
+macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION)
+  set(XCODE_RELVERSION_I "${XCODE_RELVERSION}")
+  if(XCODE_RELVERSION_I STREQUAL "All")
+    set_property(TARGET ${TARGET} PROPERTY
+    XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}")
+  else()
+    set_property(TARGET ${TARGET} PROPERTY
+    XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}")
+  endif()
+endmacro(set_xcode_property)
+# This macro lets you find executable programs on the host system.
+macro(find_host_package)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
+  set(IOS FALSE)
+  find_package(${ARGN})
+  set(IOS TRUE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
+endmacro(find_host_package)

+ 6 - 1
extern/llvm_build.sh

@@ -23,7 +23,7 @@ if [ ! -d llvm_linux_8_0_0 ]; then
 	cd ..
 fi
 
-if [ ! -d llvm_linux_rel_8_0_0_rel ]; then
+if [ ! -d llvm_linux_rel_8_0_0 ]; then
 	mkdir llvm_linux_rel_8_0_0
 	cd llvm_linux_rel_8_0_0
 	cmake ../llvm-project_8_0_0/llvm -DCMAKE_BUILD_TYPE:String=Release
@@ -31,3 +31,8 @@ if [ ! -d llvm_linux_rel_8_0_0_rel ]; then
 	cd ..
 fi
 	
+if [ ! -d ../IDE/dist/llvm/bin ]; then
+	mkdir ../IDE/dist/llvm
+	mkdir ../IDE/dist/llvm/bin
+fi
+cp llvm_linux_rel_8_0_0/bin/llvm-ar ../IDE/dist/llvm/bin

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott