introduces ios support? still needs metal

This commit is contained in:
2025-06-29 01:21:55 +03:00
parent af4f0c3cad
commit cdeaac7c0c
79 changed files with 2176 additions and 1349 deletions

View File

@@ -1,35 +0,0 @@
#include "god/c.h"
#include "god/ld.h"
#include "god/utils.h"
void launcher_build(struct build_data b)
{
char* files[] = {
"launcher/launcher.cpp",
NULL,
};
struct project p = {
.b = &b,
.files = files,
.name = "launcher",
};
struct project o = C_compile(p, (struct C_settings){
.generation_flags = C_GENERATION_FLAGS_PIC,
.compile_flags = C_COMPILE_FLAGS_WALL,
.include_dirs = include_dirs,
});
char* libs[] = {
"c",
NULL,
};
char* launcher_dll = ld_link_project(o, (struct link_settings){
.type = LINK_TYPE_EXECUTABLE,
.libs = libs,
});
mv("build/"GAME_NAME"/game/bin/"GAME_NAME,launcher_dll);
}

View File

@@ -19,12 +19,19 @@ int launcher_build()
ldProject = compileProject.Compile();
ldProject.linkType = ELINK_EXECUTABLE;
if (bStaticBuild)
{
ldProject.objects.AppendTail((CObject){tier0_lib});
ldProject.objects.AppendTail((CObject){tier1_lib});
ldProject.objects.AppendTail((CObject){rapier_lib});
ldProject.objects.AppendTail((CObject){engine_lib});
ldProject.objects.AppendTail((CObject){server_lib});
ldProject.objects.AppendTail((CObject){client_lib});
};
CUtlString outputProject = ldProject.Link();
const char *szGameName = ICommandLine::ParamValue("-game");
if (szGameName == NULL)
szGameName = "funnygame";
IFileSystem2::MakeDirectory(CUtlString("build/%s/game/bin",szGameName));
IFileSystem2::CopyFile(CUtlString("build/%s/game/bin/%s", szGameName, szGameName), outputProject);
IFileSystem2::MakeDirectory(CUtlString("%s/bin",szOutputDir.GetString()));
IFileSystem2::CopyFile(CUtlString("%s/bin/funnygame", szOutputDir.GetString()), outputProject);
return 0;
};

View File

@@ -3,6 +3,9 @@
#include "unistd.h"
#include "dlfcn.h"
#include "libgen.h"
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
#define MAX_PATH 4096
@@ -16,26 +19,33 @@ typedef void (*EngineMainFn)(int argc, char** argv);
EngineMainFn pEngineMain;
int main( int argc, char **argv ) {
#ifdef __linux__
readlink("/proc/self/exe",szLauncherPath, MAX_PATH);
dirname(szLauncherPath);
snprintf(szEnginePath, MAX_PATH, "%s/libengine.so", szLauncherPath);
snprintf(szTier0Path, MAX_PATH, "%s/libtier0.so", szLauncherPath);
printf("%s\n",szEnginePath);
printf("%s\n",szTier0Path);
#endif
#ifdef __APPLE__
uint32_t pathSize = sizeof(szLauncherPath);
int pathResult = _NSGetExecutablePath(szLauncherPath, &pathSize);
printf("%s\n",szLauncherPath);
char *szLauncherPath2 = dirname(szLauncherPath);
printf("%s\n",szLauncherPath2);
snprintf(szEnginePath, MAX_PATH, "%s/libengine.dylib", szLauncherPath2);
snprintf(szTier0Path, MAX_PATH, "%s/libtier0.dylib", szLauncherPath2);
#endif
pTier0Lib = dlopen(szTier0Path, RTLD_NOW | RTLD_GLOBAL);
if ( !pTier0Lib ) {
printf("Failed to open libtier0.so\n");
printf("Failed to open libtier0\n");
printf("\t%s\n",dlerror());
}
pEngineLib = dlopen(szEnginePath, RTLD_NOW | RTLD_GLOBAL);
if ( !pEngineLib ) {
printf("Failed to open libengine.so\n");
printf("Failed to open libengine\n");
printf("\t%s\n",dlerror());
}
printf("\t%p\n",pTier0Lib);
printf("\t%p\n",pEngineLib);
pEngineMain = (EngineMainFn)dlsym(pEngineLib, "FunnyMain");
if ( !pEngineMain ) {
printf("Symbol not found: FunnyMain\n");