From 1d7bd0d10d8b2eddd766096e4624f7abba850042 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Tue, 3 Dec 2019 10:32:43 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 5 ++++ test_common/gl/gl_headers.h | 3 +-- test_common/gl/setup_win32.cpp | 2 -- test_conformance/gl/CMakeLists.txt | 41 +++++++++++++----------------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f084b3fc..110fa23c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") 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(CheckIncludeFiles) diff --git a/test_common/gl/gl_headers.h b/test_common/gl/gl_headers.h index 61fbe63c..2ec618bd 100644 --- a/test_common/gl/gl_headers.h +++ b/test_common/gl/gl_headers.h @@ -37,9 +37,8 @@ #include #include #else - #include + #include #include - #include #endif #ifdef _WIN32 #include diff --git a/test_common/gl/setup_win32.cpp b/test_common/gl/setup_win32.cpp index 62307dcb..f8a12645 100644 --- a/test_common/gl/setup_win32.cpp +++ b/test_common/gl/setup_win32.cpp @@ -21,8 +21,6 @@ #include #include -#include -#include #include typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( diff --git a/test_conformance/gl/CMakeLists.txt b/test_conformance/gl/CMakeLists.txt index c427bb00..dbabe605 100644 --- a/test_conformance/gl/CMakeLists.txt +++ b/test_conformance/gl/CMakeLists.txt @@ -1,10 +1,18 @@ +set (MODULE_NAME GL) + 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) -list(APPEND CLConform_LIBRARIES GL glut GLEW GLU) + list(APPEND CLConform_LIBRARIES GL glut GLEW GLU) endif(WIN32) -set (GL_SOURCES +set (${MODULE_NAME}_SOURCES main.cpp test_buffers.cpp test_image_methods.cpp @@ -26,42 +34,29 @@ set (GL_SOURCES ) 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) - list (APPEND GL_SOURCES ../../test_common/gl/setup_x11.cpp) + list (APPEND ${MODULE_NAME}_SOURCES ../../test_common/gl/setup_x11.cpp) endif(WIN32) # 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 # MSVC. if(MINGW) - list (APPEND GL_SOURCES GLEW/glew.c) + list (APPEND ${MODULE_NAME}_SOURCES GLEW/glew.c) set_source_files_properties( - ${GL_SOURCES} + ${${MODULE_NAME}_SOURCES} COMPILE_FLAGS -DGLEW_STATIC) include_directories("./GLEW/") 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( - ${GL_SOURCES} + ${${MODULE_NAME}_SOURCES} PROPERTIES LANGUAGE CXX) # 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 # folder. -target_include_directories(conformance_test_gl - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -TARGET_LINK_LIBRARIES(conformance_test_gl harness - ${CLConform_LIBRARIES}) +include(../CMakeCommon.txt) \ No newline at end of file