mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Added dynamic linking test.
This commit is contained in:
parent
96267c8696
commit
0c122bb8ad
@ -281,6 +281,7 @@ version of GLFW.</p>
|
|||||||
<li>Added <code>GLFW_INCLUDE_GL3</code> macro for telling the GLFW header to include <code>gl3.h</code> header instead of <code>gl.h</code></li>
|
<li>Added <code>GLFW_INCLUDE_GL3</code> macro for telling the GLFW header to include <code>gl3.h</code> header instead of <code>gl.h</code></li>
|
||||||
<li>Added <code>windows</code> simple multi-window test program</li>
|
<li>Added <code>windows</code> simple multi-window test program</li>
|
||||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||||
|
<li>Added <code>dynamic</code> simple dynamic linking test program</li>
|
||||||
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
||||||
<li>Added initial window title parameter to <code>glfwOpenWindow</code></li>
|
<li>Added initial window title parameter to <code>glfwOpenWindow</code></li>
|
||||||
<li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
|
<li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
|
||||||
|
@ -1,35 +1,58 @@
|
|||||||
|
|
||||||
link_libraries(libglfwStatic ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
set(STATIC_DEPS libglfwStatic ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
||||||
|
set(SHARED_DEPS libglfwShared ${GLFW_LIBRARIES} ${OPENGL_glu_LIBRARY})
|
||||||
|
|
||||||
include_directories(${GLFW_SOURCE_DIR}/include
|
include_directories(${GLFW_SOURCE_DIR}/include
|
||||||
${GLFW_SOURCE_DIR}/support
|
${GLFW_SOURCE_DIR}/support
|
||||||
${OPENGL_INCLUDE_DIR})
|
${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(defaults defaults.c)
|
add_executable(defaults defaults.c)
|
||||||
add_executable(events events.c)
|
target_link_libraries(defaults ${STATIC_DEPS})
|
||||||
add_executable(fsaa fsaa.c getopt.c)
|
|
||||||
add_executable(fsfocus fsfocus.c)
|
|
||||||
add_executable(gamma gamma.c getopt.c)
|
|
||||||
add_executable(glfwinfo glfwinfo.c getopt.c)
|
|
||||||
add_executable(iconify iconify.c getopt.c)
|
|
||||||
add_executable(joysticks joysticks.c)
|
|
||||||
add_executable(listmodes listmodes.c)
|
|
||||||
add_executable(peter peter.c)
|
|
||||||
add_executable(reopen reopen.c)
|
|
||||||
|
|
||||||
if(APPLE)
|
add_executable(dynamic dynamic.c)
|
||||||
# Set fancy names for bundles
|
target_link_libraries(dynamic ${SHARED_DEPS})
|
||||||
add_executable(Accuracy MACOSX_BUNDLE accuracy.c)
|
|
||||||
add_executable(Sharing MACOSX_BUNDLE sharing.c)
|
add_executable(events events.c)
|
||||||
add_executable(Tearing MACOSX_BUNDLE tearing.c)
|
target_link_libraries(events ${STATIC_DEPS})
|
||||||
add_executable(Windows MACOSX_BUNDLE windows.c)
|
|
||||||
else()
|
add_executable(fsaa fsaa.c getopt.c)
|
||||||
# Set boring names for executables
|
target_link_libraries(fsaa ${STATIC_DEPS})
|
||||||
add_executable(accuracy WIN32 accuracy.c)
|
|
||||||
add_executable(sharing WIN32 sharing.c)
|
add_executable(fsfocus fsfocus.c)
|
||||||
add_executable(tearing WIN32 tearing.c)
|
target_link_libraries(fsfocus ${STATIC_DEPS})
|
||||||
add_executable(windows WIN32 windows.c)
|
|
||||||
endif(APPLE)
|
add_executable(gamma gamma.c getopt.c)
|
||||||
|
target_link_libraries(gamma ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(glfwinfo glfwinfo.c getopt.c)
|
||||||
|
target_link_libraries(glfwinfo ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(iconify iconify.c getopt.c)
|
||||||
|
target_link_libraries(iconify ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(joysticks joysticks.c)
|
||||||
|
target_link_libraries(joysticks ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(listmodes listmodes.c)
|
||||||
|
target_link_libraries(listmodes ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(peter peter.c)
|
||||||
|
target_link_libraries(peter ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(reopen reopen.c)
|
||||||
|
target_link_libraries(reopen ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(accuracy WIN32 MACOSX_BUNDLE accuracy.c)
|
||||||
|
target_link_libraries(accuracy ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c)
|
||||||
|
target_link_libraries(sharing ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c)
|
||||||
|
target_link_libraries(tearing ${STATIC_DEPS})
|
||||||
|
|
||||||
|
add_executable(windows WIN32 MACOSX_BUNDLE windows.c)
|
||||||
|
target_link_libraries(windows ${STATIC_DEPS})
|
||||||
|
|
||||||
set(WINDOWS_BINARIES accuracy sharing tearing windows)
|
set(WINDOWS_BINARIES accuracy sharing tearing windows)
|
||||||
set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify
|
set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify
|
||||||
|
87
tests/dynamic.c
Normal file
87
tests/dynamic.c
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
//========================================================================
|
||||||
|
// Dynamic linking test
|
||||||
|
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
//
|
||||||
|
// This test came about as the result of bug #3060461
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#define GLFW_DLL
|
||||||
|
#include <GL/glfw3.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||||
|
{
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
GLFWwindow window;
|
||||||
|
int major, minor, rev;
|
||||||
|
glfwGetVersion(&major, &minor, &rev);
|
||||||
|
|
||||||
|
if (major != GLFW_VERSION_MAJOR ||
|
||||||
|
minor != GLFW_VERSION_MINOR ||
|
||||||
|
rev != GLFW_VERSION_REVISION)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "GLFW library version mismatch\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("GLFW version: %i.%i.%i\n", major, minor, rev);
|
||||||
|
printf("GLFW version string: %s\n", glfwGetVersionString());
|
||||||
|
|
||||||
|
if (!glfwInit())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to initialize GLFW\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Dynamic Linking Test", NULL);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
glfwTerminate();
|
||||||
|
|
||||||
|
fprintf(stderr, "Failed to open GLFW window\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwSetWindowSizeCallback(window_size_callback);
|
||||||
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
|
while (glfwIsWindow(window))
|
||||||
|
{
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
glfwSwapBuffers();
|
||||||
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwTerminate();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user