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(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 ()
|
||||||
@ -102,4 +104,4 @@ set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
|
|||||||
|
|
||||||
if (${PLATFORM} MATCHES "Desktop")
|
if (${PLATFORM} MATCHES "Desktop")
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
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);
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user