Commit 6333a5ca authored by Camilla Berglund's avatar Camilla Berglund
Browse files

Added CMake option for glfwInit chdir on OS X.

parent bd2abbca
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment