mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Added CMake option for glfwInit chdir on OS X.
This commit is contained in:
parent
bd2abbca9f
commit
6333a5caaf
@ -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(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
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)
|
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -286,6 +288,10 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
|||||||
|
|
||||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||||
|
|
||||||
|
if (GLFW_CD_RESOURCES)
|
||||||
|
set(_GLFW_CD_RESOURCES 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Universal build
|
# Universal build
|
||||||
if (GLFW_BUILD_UNIVERSAL)
|
if (GLFW_BUILD_UNIVERSAL)
|
||||||
message(STATUS "Building GLFW as Universal Binaries")
|
message(STATUS "Building GLFW as Universal Binaries")
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
// Change to our application bundle's resources directory, if present
|
// Change to our application bundle's resources directory, if present
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
|
#if defined(_GLFW_CD_RESOURCES)
|
||||||
|
|
||||||
static void changeToResourcesDirectory(void)
|
static void changeToResourcesDirectory(void)
|
||||||
{
|
{
|
||||||
char resourcesPath[MAXPATHLEN];
|
char resourcesPath[MAXPATHLEN];
|
||||||
@ -68,6 +70,8 @@ static void changeToResourcesDirectory(void)
|
|||||||
chdir(resourcesPath);
|
chdir(resourcesPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _GLFW_CD_RESOURCES */
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
@ -90,7 +94,9 @@ int _glfwPlatformInit(void)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_CD_RESOURCES)
|
||||||
changeToResourcesDirectory();
|
changeToResourcesDirectory();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Save the original gamma ramp
|
// Save the original gamma ramp
|
||||||
_glfw.originalRampSize = CGDisplayGammaTableCapacity(CGMainDisplayID());
|
_glfw.originalRampSize = CGDisplayGammaTableCapacity(CGMainDisplayID());
|
||||||
|
@ -64,6 +64,9 @@
|
|||||||
// Define this to 1 if glXGetProcAddressEXT is available
|
// Define this to 1 if glXGetProcAddressEXT is available
|
||||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT
|
#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
|
// Define this to 1 if using OpenGL as the client library
|
||||||
#cmakedefine _GLFW_USE_OPENGL
|
#cmakedefine _GLFW_USE_OPENGL
|
||||||
// Define this to 1 if using OpenGL ES 1.1 as the client library
|
// Define this to 1 if using OpenGL ES 1.1 as the client library
|
||||||
|
Loading…
Reference in New Issue
Block a user