Added CMake option for glfwInit chdir on OS X.

This commit is contained in:
Camilla Berglund 2013-01-21 16:21:59 +01:00
Родитель bd2abbca9f
Коммит 6333a5caaf
3 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -14,7 +14,9 @@ option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if (NOT APPLE)
if (APPLE)
option(GLFW_CD_RESOURCES "Make glfwInit chdir to Contents/Resources" ON)
else()
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
endif()
@ -286,6 +288,10 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
if (GLFW_CD_RESOURCES)
set(_GLFW_CD_RESOURCES 1)
endif()
# Universal build
if (GLFW_BUILD_UNIVERSAL)
message(STATUS "Building GLFW as Universal Binaries")

Просмотреть файл

@ -34,6 +34,8 @@
// Change to our application bundle's resources directory, if present
//========================================================================
#if defined(_GLFW_CD_RESOURCES)
static void changeToResourcesDirectory(void)
{
char resourcesPath[MAXPATHLEN];
@ -68,6 +70,8 @@ static void changeToResourcesDirectory(void)
chdir(resourcesPath);
}
#endif /* _GLFW_CD_RESOURCES */
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
@ -90,7 +94,9 @@ int _glfwPlatformInit(void)
return GL_FALSE;
}
#if defined(_GLFW_CD_RESOURCES)
changeToResourcesDirectory();
#endif
// Save the original gamma ramp
_glfw.originalRampSize = CGDisplayGammaTableCapacity(CGMainDisplayID());

Просмотреть файл

@ -64,6 +64,9 @@
// Define this to 1 if glXGetProcAddressEXT is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT
// Define this to 1 if glfwInit should change the current directory
#cmakedefine _GLFW_CD_RESOURCES
// Define this to 1 if using OpenGL as the client library
#cmakedefine _GLFW_USE_OPENGL
// Define this to 1 if using OpenGL ES 1.1 as the client library