Only build oclgl tests if OpenGL is installed on the system

Change-Id: I226f2e09c98a970ce8dce0b6f670ca13d868aeb6
Este commit está contenido en:
Vlad Sytchenko
2020-06-02 11:56:14 -04:00
padre 1171ec72be
commit 876cf62e0e
Se han modificado 5 ficheros con 79 adiciones y 37 borrados
+5 -3
Ver fichero
@@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 3.5.1)
set(OCLTST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(OpenGL)
find_package(GLEW)
add_subdirectory(module/common)
add_subdirectory(log)
add_subdirectory(env)
add_subdirectory(module/gl)
if(OPENGL_FOUND AND GLEW_FOUND)
add_subdirectory(module/gl)
endif()
add_subdirectory(module/perf)
add_subdirectory(module/runtime)
+23 -5
Ver fichero
@@ -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()
+19 -6
Ver fichero
@@ -1,4 +1,4 @@
add_library(oclperf SHARED
set(OCLPERF_SOURCES
OCLPerf3DImageWriteSpeed.cpp
OCLPerfAES256.cpp
OCLPerfAtomicSpeed20.cpp
@@ -55,7 +55,6 @@ add_library(oclperf SHARED
OCLPerfSampleRate.cpp
OCLPerfScalarReplArrayElem.cpp
OCLPerfSdiP2PCopy.cpp
OCLPerfSepia.cpp
OCLPerfSHA256.cpp
OCLPerfSVMAlloc.cpp
OCLPerfSVMKernelArguments.cpp
@@ -69,7 +68,16 @@ add_library(oclperf SHARED
OCLPerfUAVWriteSpeedHostMem.cpp
OCLPerfUncoalescedRead.cpp
OCLPerfVerticalFetch.cpp
TestList.cpp
TestList.cpp)
if(OPENGL_FOUND AND GLEW_FOUND)
set(OCLPERF_SOURCES
${OCLPERF_SOURCES}
OCLPerfSepia.cpp)
endif()
add_library(oclperf SHARED
${OCLPERF_SOURCES}
$<TARGET_OBJECTS:Common>)
set_target_properties(oclperf PROPERTIES
@@ -88,9 +96,14 @@ target_include_directories(oclperf
target_link_libraries(oclperf
PRIVATE
OpenCL
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES})
OpenCL)
if(OPENGL_FOUND AND GLEW_FOUND)
target_link_libraries(oclperf
PRIVATE
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES})
endif()
add_custom_command(
TARGET oclperf POST_BUILD
+24 -20
Ver fichero
@@ -1,23 +1,23 @@
/* Copyright (c) 2010-present Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
/* Copyright (c) 2010-present Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#include "OCLTestListImp.h"
//
@@ -69,7 +69,9 @@
#include "OCLPerfSampleRate.h"
#include "OCLPerfScalarReplArrayElem.h"
#include "OCLPerfSdiP2PCopy.h"
#if USE_OPENGL
#include "OCLPerfSepia.h"
#endif
#include "OCLPerfTextureMemLatency.h"
#include "OCLPerfUAVReadSpeed.h"
#include "OCLPerfUAVReadSpeedHostMem.h"
@@ -143,7 +145,9 @@ TestEntry TestList[] = {
TEST(OCLPerfImageCopyCorners),
TEST(OCLPerfScalarReplArrayElem),
TEST(OCLPerfSdiP2PCopy),
#if USE_OPENGL
TEST(OCLPerfSepia),
#endif
TEST(OCLPerfFlush),
TEST(OCLPerfMemCreate),
TEST(OCLPerfImageMapUnmap),
@@ -61,9 +61,14 @@ target_include_directories(oclruntime
target_link_libraries(oclruntime
PRIVATE
OpenCL
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES})
OpenCL)
if(OPENGL_FOUND AND GLEW_FOUND)
target_link_libraries(oclruntime
PRIVATE
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES})
endif()
add_custom_command(
TARGET oclruntime POST_BUILD