Only build oclgl tests if OpenGL is installed on the system

Change-Id: I226f2e09c98a970ce8dce0b6f670ca13d868aeb6
This commit is contained in:
Vlad Sytchenko
2020-06-02 11:56:14 -04:00
parent 1171ec72be
commit 876cf62e0e
5 changed files with 79 additions and 37 deletions
@@ -1,7 +1,5 @@
add_library(Common OBJECT
set(COMMON_SOURCES
${OCLTST_DIR}/module/common/BaseTestImp.cpp
${OCLTST_DIR}/module/common/OCLGLCommon.cpp
${OCLTST_DIR}/module/common/OCLGLCommonLinux.cpp
${OCLTST_DIR}/module/common/OCLTestImp.cpp
${OCLTST_DIR}/module/common/OCLTestListImp.cpp
${OCLTST_DIR}/module/common/OCLTestUtils.cpp
@@ -9,6 +7,15 @@ add_library(Common OBJECT
${OCLTST_DIR}/module/common/OCLWrapper.cpp
${OCLTST_DIR}/module/common/Timer.cpp)
if(OPENGL_FOUND AND GLEW_FOUND)
set(COMMON_SOURCES
${COMMON_SOURCES}
${OCLTST_DIR}/module/common/OCLGLCommon.cpp
${OCLTST_DIR}/module/common/OCLGLCommonLinux.cpp)
endif()
add_library(Common OBJECT ${COMMON_SOURCES})
set_target_properties(Common PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
@@ -20,12 +27,23 @@ target_compile_definitions(Common
ATI_OS_LINUX
CL_TARGET_OPENCL_VERSION=220)
if(OPENGL_FOUND AND GLEW_FOUND)
target_compile_definitions(Common
PUBLIC
USE_OPENGL=1)
endif()
target_include_directories(Common
PUBLIC
${OPENCL_ICD_LOADER_HEADERS_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS}
${OCLTST_DIR}/include
${OCLTST_DIR}/module/common
${OCLTST_DIR}/module/include
${PROJECT_SOURCE_DIR}/amdocl) #TODO remove cl_profile_amd.h dependency
if(OPENGL_FOUND AND GLEW_FOUND)
target_include_directories(Common
PUBLIC
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS})
endif()