introduces ios support? still needs metal
This commit is contained in:
@@ -25,22 +25,7 @@ CLDProject CCProject::Compile()
|
||||
{
|
||||
CUtlVector<CUtlString> args;
|
||||
V_printf(" CC %s\n", file.GetString());
|
||||
CUtlString szTarget = "";
|
||||
if (m_target.cpu == TARGET_CPU_AMD64)
|
||||
{
|
||||
if (m_target.kernel == TARGET_KERNEL_WINDOWS)
|
||||
{
|
||||
szTarget = "x86_64-pc-windows-gnu";
|
||||
}
|
||||
if (m_target.kernel == TARGET_KERNEL_LINUX)
|
||||
{
|
||||
szTarget = "x86_64-unknown-linux-gnu";
|
||||
}
|
||||
if (m_target.kernel == TARGET_KERNEL_DARWIN)
|
||||
{
|
||||
szTarget = "x86_64-apple-darwin";
|
||||
}
|
||||
};
|
||||
CUtlString szTarget = m_target.GetTriplet();
|
||||
CUtlString szOutputFile = CUtlString("%s/%s/cc/%u_%s/%s/%s.o",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), IFileSystem2::BuildDirectory(), file.GetString());
|
||||
CUtlString szOutputDir;
|
||||
|
||||
@@ -63,6 +48,13 @@ CLDProject CCProject::Compile()
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
|
||||
}
|
||||
if (m_target.kernel == TARGET_KERNEL_IOS)
|
||||
{
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk");
|
||||
args.AppendTail("-miphoneos-version-min=18.0 ");
|
||||
args.AppendTail("-fembed-bitcode");
|
||||
}
|
||||
if (bFPIC)
|
||||
args.AppendTail("-fPIC");
|
||||
if (bFPIE)
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "unistd.h"
|
||||
#include "libgen.h"
|
||||
#include "sys/stat.h"
|
||||
#ifdef __APPLE__
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
unsigned int g_hashState = 102851263;
|
||||
unsigned int CProject::GenerateProjectHash( void )
|
||||
@@ -23,7 +26,13 @@ unsigned int CProject::GenerateProjectHash( void )
|
||||
};
|
||||
|
||||
static char path[1024];
|
||||
#ifdef __linux__
|
||||
static ssize_t pathSize = readlink("/proc/self/exe", path, sizeof(path) - 1);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
static uint32_t pathSize = sizeof(path);
|
||||
int pathResult = _NSGetExecutablePath(path, &pathSize);
|
||||
#endif
|
||||
char *szPathDir = dirname(path);
|
||||
char *szBuildDir = 0;
|
||||
char *IFileSystem2::OwnDirectory()
|
||||
|
||||
@@ -22,7 +22,9 @@ CUtlString CLDProject::Link( void )
|
||||
szFileName = CUtlString("lib%s.so", m_szName.GetString());
|
||||
break;
|
||||
}
|
||||
CUtlString szOutputFile = CUtlString("%s/ld/%u_%s/%s",FPC_TEMPORAL_DIRNAME, hash, m_szName.GetString(), szFileName.GetString());
|
||||
|
||||
CUtlString szTarget = m_target.GetTriplet();
|
||||
CUtlString szOutputFile = CUtlString("%s/%s/ld/%u_%s/%s",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), szFileName.GetString());
|
||||
CUtlString szOutputDir = szOutputFile;
|
||||
szOutputDir = dirname(szOutputDir);
|
||||
IFileSystem2::MakeDirectory(szOutputDir);
|
||||
@@ -65,7 +67,21 @@ CUtlString CLDProject::Link( void )
|
||||
args = {
|
||||
"-o",
|
||||
szOutputFile,
|
||||
"-target",
|
||||
m_target.GetTriplet(),
|
||||
};
|
||||
if (m_target.kernel == TARGET_KERNEL_DARWIN)
|
||||
{
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
|
||||
}
|
||||
if (m_target.kernel == TARGET_KERNEL_IOS)
|
||||
{
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk");
|
||||
args.AppendTail("-miphoneos-version-min=18.0 ");
|
||||
args.AppendTail("-fembed-bitcode");
|
||||
}
|
||||
if (m_target.kernel == TARGET_KERNEL_LINUX)
|
||||
{
|
||||
args.AppendTail("-rdynamic");
|
||||
|
||||
@@ -2,6 +2,44 @@
|
||||
#include "tier1/commandline.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
|
||||
CUtlString Target_t::GetTriplet()
|
||||
{
|
||||
CUtlString triplet = "";
|
||||
|
||||
if ( cpu == TARGET_CPU_AMD64 )
|
||||
triplet.AppendTail("x86_64");
|
||||
if ( cpu == TARGET_CPU_AARCH64 )
|
||||
triplet.AppendTail("aarch64");
|
||||
triplet.AppendTail("-");
|
||||
if ( kernel == TARGET_KERNEL_WINDOWS )
|
||||
triplet.AppendTail("pc-windows-gnu");
|
||||
if ( kernel == TARGET_KERNEL_LINUX )
|
||||
triplet.AppendTail("unknown-linux-gnu");
|
||||
if ( kernel == TARGET_KERNEL_DARWIN )
|
||||
triplet.AppendTail("apple-darwin");
|
||||
if ( kernel == TARGET_KERNEL_IOS )
|
||||
triplet.AppendTail("apple-ios");
|
||||
|
||||
|
||||
return triplet;
|
||||
}
|
||||
Target_t Target_t::HostTarget()
|
||||
{
|
||||
ETargetKernel kernel =
|
||||
#if defined(__linux__)
|
||||
TARGET_KERNEL_LINUX
|
||||
#elif defined(__APPLE__)
|
||||
TARGET_KERNEL_DARWIN
|
||||
#endif
|
||||
;
|
||||
ETargetCPU cpu = TARGET_CPU_AMD64;
|
||||
return {
|
||||
.kernel = kernel,
|
||||
.cpu = cpu,
|
||||
.optimization = TARGET_DEBUG,
|
||||
};
|
||||
};
|
||||
Target_t Target_t::DefaultTarget()
|
||||
{
|
||||
CUtlString szDevice = ICommandLine::ParamValue("-device");
|
||||
@@ -16,6 +54,10 @@ Target_t Target_t::DefaultTarget()
|
||||
#endif
|
||||
;
|
||||
ETargetCPU cpu = TARGET_CPU_AMD64;
|
||||
if ( szArch == "x86_64" )
|
||||
cpu = TARGET_CPU_AMD64;
|
||||
else if ( szArch == "aarch64" )
|
||||
cpu = TARGET_CPU_AARCH64;
|
||||
|
||||
if ( szOS == "windows" )
|
||||
kernel = TARGET_KERNEL_WINDOWS;
|
||||
@@ -23,6 +65,8 @@ Target_t Target_t::DefaultTarget()
|
||||
kernel = TARGET_KERNEL_LINUX;
|
||||
else if ( szOS == "macos" )
|
||||
kernel = TARGET_KERNEL_DARWIN;
|
||||
else if ( szOS == "ios" )
|
||||
kernel = TARGET_KERNEL_IOS;
|
||||
else if ( szOS != 0 )
|
||||
V_printf("Unknown OS: %s\n", szOS.GetString());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user