introduces ios support? still needs metal
This commit is contained in:
20
fpc/fpc.dSYM/Contents/Info.plist
Normal file
20
fpc/fpc.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.fpc</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
fpc/fpc.dSYM/Contents/Resources/DWARF/fpc
Normal file
BIN
fpc/fpc.dSYM/Contents/Resources/DWARF/fpc
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
---
|
||||
triple: 'x86_64-apple-darwin'
|
||||
binary-path: fpc
|
||||
relocations: []
|
||||
...
|
||||
@@ -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());
|
||||
|
||||
|
||||
11
fpc/main.cpp
11
fpc/main.cpp
@@ -1,6 +1,7 @@
|
||||
#include "public/c.h"
|
||||
#include "public/helper.h"
|
||||
#include "public/ld.h"
|
||||
#include "public/target.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/commandline.h"
|
||||
#include "c.h"
|
||||
@@ -20,10 +21,18 @@ int build()
|
||||
compileScriptProject.files = {"build.cpp"};
|
||||
compileScriptProject.includeDirectories = {CUtlString("%s/public",IFileSystem2::OwnDirectory()),CUtlString("%s/public", IFileSystem2::BuildDirectory()), CUtlString("%s/../public",IFileSystem2::OwnDirectory()),CUtlString("%s/../public", IFileSystem2::BuildDirectory())};
|
||||
compileScriptProject.bFPIC = true;
|
||||
compileScriptProject.m_target = Target_t::HostTarget();
|
||||
CLDProject linkScriptProject = compileScriptProject.Compile();
|
||||
linkScriptProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
linkScriptProject.m_target = Target_t::HostTarget();
|
||||
CUtlString script = linkScriptProject.Link();
|
||||
void *scriptDLL = Plat_LoadLibrary(script);
|
||||
|
||||
auto PreinitFn = (void(*)())Plat_GetProc(scriptDLL, "Preinit");
|
||||
V_printf("%p\n",PreinitFn);
|
||||
if (PreinitFn)
|
||||
PreinitFn();
|
||||
|
||||
for (auto &build: BuildStages())
|
||||
{
|
||||
build->m_pMainFn();
|
||||
@@ -46,7 +55,7 @@ void IEngine_Signal(int sig)
|
||||
default:
|
||||
break;
|
||||
};
|
||||
_exit(0);
|
||||
Plat_Exit(0);
|
||||
};
|
||||
|
||||
int main(int c, char **v)
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
#ifndef TARGET_T
|
||||
#define TARGET_T
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
enum ETargetKernel
|
||||
{
|
||||
TARGET_KERNEL_LINUX,
|
||||
TARGET_KERNEL_WINDOWS,
|
||||
TARGET_KERNEL_DARWIN,
|
||||
TARGET_KERNEL_IOS,
|
||||
};
|
||||
|
||||
enum ETargetCPU
|
||||
{
|
||||
TARGET_CPU_AMD64,
|
||||
TARGET_CPU_I386,
|
||||
TARGET_CPU_AARCH64,
|
||||
};
|
||||
|
||||
enum ETargetOptimization
|
||||
@@ -26,6 +30,8 @@ struct Target_t
|
||||
ETargetKernel kernel;
|
||||
ETargetCPU cpu;
|
||||
ETargetOptimization optimization;
|
||||
CUtlString GetTriplet();
|
||||
static Target_t HostTarget();
|
||||
static Target_t DefaultTarget();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user