mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
Initial android support (#17)
* Upload Android armv7 libs * Fix debug build * utlvector: fix undefined behavior * wscript: add --use-ccache option * wscript: store ccache in a separate directory * Propertly use gl4es * fontconfig: fix font detection * [android]remove fontconfig dependency * Add build guide for other platforms Co-authored-by: JusicP <slender87844@gmail.com> Co-authored-by: nillerusr <nillerusr@users.noreply.github.com>
This commit is contained in:
co-authored by
JusicP
nillerusr
parent
2a490d398c
commit
2c6669f5e3
+18
-2
@@ -247,8 +247,10 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName, Sys_Flags flags )
|
||||
#elif POSIX
|
||||
int dlopen_mode = RTLD_NOW;
|
||||
|
||||
#ifndef ANDROID
|
||||
if ( flags & SYS_NOLOAD )
|
||||
dlopen_mode |= RTLD_NOLOAD;
|
||||
#endif
|
||||
|
||||
HMODULE ret = ( HMODULE )dlopen( str, dlopen_mode );
|
||||
if ( !ret && !( flags & SYS_NOLOAD ) )
|
||||
@@ -301,20 +303,34 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
|
||||
size_t cCwd = strlen( szCwd );
|
||||
|
||||
bool bUseLibPrefix = false;
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
struct stat statBuf;
|
||||
char *dataPath = getenv("APP_DATA_PATH");
|
||||
|
||||
|
||||
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib/lib%s", dataPath ,pModuleName);
|
||||
if( stat(szAbsoluteModuleName, &statBuf) != 0 )
|
||||
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib/%s", dataPath ,pModuleName);
|
||||
#else
|
||||
|
||||
#ifdef POSIX
|
||||
struct stat statBuf;
|
||||
Q_snprintf(szModuleName, sizeof(szModuleName), "bin/lib%s", pModuleName);
|
||||
bUseLibPrefix |= stat(szModuleName, &statBuf) == 0;
|
||||
#endif
|
||||
|
||||
if( bUseLibPrefix )
|
||||
Q_snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/bin/lib%s", szCwd, pModuleName );
|
||||
else
|
||||
Q_snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/bin/%s", szCwd, pModuleName );
|
||||
#endif // ANDROID
|
||||
Msg("LoadLibrary: pModule: %s, path: %s\n", pModuleName, szAbsoluteModuleName);
|
||||
|
||||
hDLL = Sys_LoadLibrary( szAbsoluteModuleName, flags );
|
||||
}
|
||||
else
|
||||
Msg("LoadLibrary: path: %s\n", pModuleName);
|
||||
|
||||
|
||||
if ( !hDLL )
|
||||
{
|
||||
|
||||
+4
-3
@@ -750,7 +750,7 @@ extern "C" {
|
||||
|
||||
return CALL(freopen)( mpath, mode, stream );
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
WRAP(fopen, FILE *, const char *path, const char *mode)
|
||||
{
|
||||
// if mode does not have w, a, or +, it's open for read.
|
||||
@@ -788,7 +788,7 @@ extern "C" {
|
||||
{
|
||||
return __wrap_open( pathname, O_CREAT|O_WRONLY|O_TRUNC, mode );
|
||||
}
|
||||
|
||||
#endif
|
||||
int __wrap_access(const char *pathname, int mode)
|
||||
{
|
||||
return __real_access( CWrap( pathname, false ), mode );
|
||||
@@ -815,6 +815,7 @@ extern "C" {
|
||||
{
|
||||
return CALL(opendir)( CWrap( name, false ) );
|
||||
}
|
||||
#ifndef ANDROID
|
||||
|
||||
WRAP(__xstat, int, int __ver, __const char *__filename, struct stat *__stat_buf)
|
||||
{
|
||||
@@ -835,7 +836,7 @@ extern "C" {
|
||||
{
|
||||
return CALL(__lxstat64)( __ver, CWrap( __filename, false), __stat_buf );
|
||||
}
|
||||
|
||||
#endif
|
||||
WRAP(chmod, int, const char *path, mode_t mode)
|
||||
{
|
||||
return CALL(chmod)( CWrap( path, false), mode );
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ def build(bld):
|
||||
'memstack.cpp',
|
||||
'NetAdr.cpp',
|
||||
'newbitbuf.cpp',
|
||||
'pathmatch.cpp', # [$LINUXALL]
|
||||
# 'pathmatch.cpp', # [$LINUXALL]
|
||||
# 'processor_detect.cpp', # [$WINDOWS||$X360]
|
||||
'processor_detect_linux.cpp', # [$POSIX]
|
||||
'qsort_s.cpp', # [$LINUXALL||$PS3]
|
||||
|
||||
Reference in New Issue
Block a user