introduces ios support? still needs metal
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
#include "god/build.h"
|
||||
#include "god/c.h"
|
||||
#include "god/ld.h"
|
||||
|
||||
char* tier0_lib = 0;
|
||||
void tier0_build(struct build_data b)
|
||||
{
|
||||
char* files[] = {
|
||||
"tier0/mem.cpp",
|
||||
"tier0/platform.cpp",
|
||||
"tier0/lib.cpp",
|
||||
NULL,
|
||||
};
|
||||
struct C_Macro macros[] = {
|
||||
(struct C_Macro){"TIER0_IMPLEMENTATION","1"},
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
struct project p = {
|
||||
.b = &b,
|
||||
.files = files,
|
||||
.name = "tier0",
|
||||
};
|
||||
|
||||
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,
|
||||
.macros = macros,
|
||||
});
|
||||
char* libs[] = {
|
||||
"c",
|
||||
NULL,
|
||||
};
|
||||
|
||||
tier0_lib = ld_link_project(o, (struct link_settings){
|
||||
.type = LINK_TYPE_DYNAMIC,
|
||||
.libs = libs,
|
||||
});
|
||||
mv("build/"GAME_NAME"/game/bin/libtier0.so",tier0_lib);
|
||||
}
|
||||
@@ -20,15 +20,20 @@ int tier0_build()
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = compileProject.Compile();
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
if (bStaticBuild)
|
||||
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||
else
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
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",szGameName), outputProject);
|
||||
if (!bStaticBuild)
|
||||
{
|
||||
IFileSystem2::MakeDirectory(CUtlString("%s/bin",szOutputDir.GetString()));
|
||||
IFileSystem2::CopyFile(CUtlString("%s/bin", szOutputDir.GetString()), outputProject);
|
||||
} else {
|
||||
tier0_lib = outputProject;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "dlfcn.h"
|
||||
#include "execinfo.h"
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include "dlfcn.h"
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#include "windows.h"
|
||||
#include "dbghelp.h"
|
||||
@@ -22,7 +25,7 @@ PLATFORM_INTERFACE void Plat_FatalErrorFunc(const char* szFormat, ...)
|
||||
va_end(list);
|
||||
fflush(stdout);
|
||||
raise(SIGTRAP);
|
||||
_exit(1);
|
||||
Plat_Exit(1);
|
||||
}
|
||||
|
||||
PLATFORM_INTERFACE void Plat_ListDirRecursive(const char* szPath, ListDirCallbackFn file, ListDirCallbackFn dir)
|
||||
@@ -163,6 +166,12 @@ PLATFORM_INTERFACE void *Plat_LoadLibrary( const char *psz )
|
||||
V_printf("Failed to open %s\n\t%s\n", psz, dlerror());
|
||||
return lib;
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
void *lib = dlopen(psz, RTLD_GLOBAL | RTLD_NOW);
|
||||
if (!lib)
|
||||
V_printf("Failed to open %s\n\t%s\n", psz, dlerror());
|
||||
return lib;
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
return LoadLibraryA(psz);
|
||||
#endif
|
||||
@@ -172,6 +181,9 @@ PLATFORM_INTERFACE void *Plat_GetProc( void *lib, const char *psz )
|
||||
#ifdef __linux__
|
||||
return dlsym(lib, psz);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
return dlsym(lib, psz);
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
return (void*)GetProcAddress((HMODULE)lib, psz);
|
||||
#endif
|
||||
@@ -194,3 +206,13 @@ PLATFORM_INTERFACE double Plat_GetTime( void )
|
||||
|
||||
return (tp.tv_sec-s_starttime)+tp.tv_nsec/1e9;
|
||||
}
|
||||
|
||||
PLATFORM_INTERFACE void Plat_Exit( int status )
|
||||
{
|
||||
#ifdef __linux__
|
||||
_exit(status);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
_exit(status);
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user