Enable DRM platform cross compilation support (#1717)

* Log a warning if chdir failed, use agnostic CHDIR instead of chdir

* Only include libdrm directory explicitly when not cross compiling
This commit is contained in:
Jon 2021-04-09 10:57:14 -07:00 committed by GitHub
parent d17c519f88
commit c74230a9ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -73,7 +73,9 @@ elseif (${PLATFORM} MATCHES "DRM")
find_library(DRM drm) find_library(DRM drm)
find_library(GBM gbm) find_library(GBM gbm)
include_directories(/usr/include/libdrm) if (NOT CMAKE_CROSSCOMPILING)
include_directories(/usr/include/libdrm)
endif ()
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} pthread m dl) set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} pthread m dl)
endif () endif ()

View File

@ -3168,7 +3168,11 @@ static Model LoadOBJ(const char *fileName)
unsigned int dataSize = (unsigned int)strlen(fileData); unsigned int dataSize = (unsigned int)strlen(fileData);
char currentDir[1024] = { 0 }; char currentDir[1024] = { 0 };
strcpy(currentDir, GetWorkingDirectory()); strcpy(currentDir, GetWorkingDirectory());
chdir(GetDirectoryPath(fileName)); const char *workingDir = GetDirectoryPath(fileName);
if (CHDIR(workingDir) != 0)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", workingDir);
}
unsigned int flags = TINYOBJ_FLAG_TRIANGULATE; unsigned int flags = TINYOBJ_FLAG_TRIANGULATE;
int ret = tinyobj_parse_obj(&attrib, &meshes, &meshCount, &materials, &materialCount, fileData, dataSize, flags); int ret = tinyobj_parse_obj(&attrib, &meshes, &meshCount, &materials, &materialCount, fileData, dataSize, flags);
@ -3306,7 +3310,10 @@ static Model LoadOBJ(const char *fileName)
RL_FREE(vnCount); RL_FREE(vnCount);
RL_FREE(faceCount); RL_FREE(faceCount);
chdir(currentDir); if (CHDIR(currentDir) != 0)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", currentDir);
}
} }
return model; return model;