GL sharing: Test name adjustment and Windows compilation clarification. (#336)

* Test name adjustment and Windows compilation clarification.

* Add CLConform_GL_LIBRARIES_DIR CmakeLists variable for GL support

* GL sharing tests - library names justification

* Fix compilation errors function are overridden in glext.h.
This commit is contained in:
Grzegorz Wawiorko
2019-12-03 10:32:43 +01:00
committed by Kévin Petit
parent 18046e65d1
commit 1d7bd0d10d
4 changed files with 24 additions and 27 deletions

View File

@@ -123,6 +123,11 @@ else(CL_INCLUDE_DIR AND CL_LIB_DIR AND CL_LIBCLCXX_DIR)
message(FATAL_ERROR "Either install OpenCL or pass -DCL_INCLUDE_DIR, -DCL_LIB_DIR and -DCL_LIBCLCXX_DIR") message(FATAL_ERROR "Either install OpenCL or pass -DCL_INCLUDE_DIR, -DCL_LIB_DIR and -DCL_LIBCLCXX_DIR")
endif(CL_INCLUDE_DIR AND CL_LIB_DIR AND CL_LIBCLCXX_DIR) endif(CL_INCLUDE_DIR AND CL_LIB_DIR AND CL_LIBCLCXX_DIR)
# CLConform_GL_LIBRARIES_DIR - path to OpenGL libraries
if(GL_IS_SUPPORTED AND CLConform_GL_LIBRARIES_DIR)
link_directories(${CLConform_GL_LIBRARIES_DIR})
endif (GL_IS_SUPPORTED AND CLConform_GL_LIBRARIES_DIR)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFiles) include(CheckIncludeFiles)

View File

@@ -37,9 +37,8 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
#else #else
#include <GL/glew.h> #include <GL/glew.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glext.h>
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <GL/glut.h> #include <GL/glut.h>

View File

@@ -21,8 +21,6 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glut.h> #include <GL/glut.h>
#include <GL/glext.h>
#include <GL/glut.h>
#include <CL/cl_ext.h> #include <CL/cl_ext.h>
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(

View File

@@ -1,10 +1,18 @@
set (MODULE_NAME GL)
if(WIN32) if(WIN32)
list(APPEND CLConform_LIBRARIES glut32 opengl32 glu32 ) # Windows MSVC/Intel compiler hits:
# - dwonload free libraries package glew and glut/freeglut from the Internet
# - add x64/x86 binaries with glew and glut/freeglut libraries (.lib) to the directory lib/x64 or lib/x86.
# Include folder libs as cmake argument -DCLConform_GL_LIBRARIES_DIR=lib\x64 while solution generation
# - GL headers files should be added to project source directory and GL subdirectory
# - Add .dll files: glut glew to the test binary location.
list(APPEND CLConform_LIBRARIES opengl32 freeglut glew32)
else(WIN32) else(WIN32)
list(APPEND CLConform_LIBRARIES GL glut GLEW GLU) list(APPEND CLConform_LIBRARIES GL glut GLEW GLU)
endif(WIN32) endif(WIN32)
set (GL_SOURCES set (${MODULE_NAME}_SOURCES
main.cpp main.cpp
test_buffers.cpp test_buffers.cpp
test_image_methods.cpp test_image_methods.cpp
@@ -26,42 +34,29 @@ set (GL_SOURCES
) )
if (WIN32) if (WIN32)
list (APPEND GL_SOURCES ../../test_common/gl/setup_win32.cpp) list (APPEND ${MODULE_NAME}_SOURCES ../../test_common/gl/setup_win32.cpp)
else(WIN32) else(WIN32)
list (APPEND GL_SOURCES ../../test_common/gl/setup_x11.cpp) list (APPEND ${MODULE_NAME}_SOURCES ../../test_common/gl/setup_x11.cpp)
endif(WIN32) endif(WIN32)
# Compiling GLEW along with the project if the compiler is MINGW. # Compiling GLEW along with the project if the compiler is MINGW.
# The mingw linker was giving weird errors while linking to glew32.lib generated by # The mingw linker was giving weird errors while linking to glew32.lib generated by
# MSVC. # MSVC.
if(MINGW) if(MINGW)
list (APPEND GL_SOURCES GLEW/glew.c) list (APPEND ${MODULE_NAME}_SOURCES GLEW/glew.c)
set_source_files_properties( set_source_files_properties(
${GL_SOURCES} ${${MODULE_NAME}_SOURCES}
COMPILE_FLAGS -DGLEW_STATIC) COMPILE_FLAGS -DGLEW_STATIC)
include_directories("./GLEW/") include_directories("./GLEW/")
endif(MINGW) endif(MINGW)
if (MSVC)
if(CMAKE_CL_64)
list(APPEND CLConform_LIBRARIES glew64)
else(CMAKE_CL_64)
list(APPEND CLConform_LIBRARIES glew32)
endif(CMAKE_CL_64)
endif(MSVC)
add_executable(conformance_test_gl
${GL_SOURCES} ${GLUT_SOURCES})
set_source_files_properties( set_source_files_properties(
${GL_SOURCES} ${${MODULE_NAME}_SOURCES}
PROPERTIES LANGUAGE CXX) PROPERTIES LANGUAGE CXX)
# Add the current folder to the include path, so that # Add the current folder to the include path, so that
# test_common/gl/setup_x11.cpp can find testBase.h which is located in this # test_common/gl/setup_x11.cpp can find testBase.h which is located in this
# folder. # folder.
target_include_directories(conformance_test_gl include_directories(${CMAKE_CURRENT_SOURCE_DIR})
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
TARGET_LINK_LIBRARIES(conformance_test_gl harness include(../CMakeCommon.txt)
${CLConform_LIBRARIES})