mirror of https://github.com/raysan5/raylib
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:
parent
d17c519f88
commit
c74230a9ea
|
@ -73,7 +73,9 @@ elseif (${PLATFORM} MATCHES "DRM")
|
|||
find_library(DRM drm)
|
||||
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)
|
||||
|
||||
endif ()
|
||||
|
@ -102,4 +104,4 @@ set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
|
|||
|
||||
if (${PLATFORM} MATCHES "Desktop")
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
11
src/models.c
11
src/models.c
|
@ -3168,7 +3168,11 @@ static Model LoadOBJ(const char *fileName)
|
|||
unsigned int dataSize = (unsigned int)strlen(fileData);
|
||||
char currentDir[1024] = { 0 };
|
||||
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;
|
||||
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(faceCount);
|
||||
|
||||
chdir(currentDir);
|
||||
if (CHDIR(currentDir) != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", currentDir);
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
|
|
Loading…
Reference in New Issue