Commit 5acaae39 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot

Merge topic 'examples_correctly_link_to_libGLU'

a37a3f39 Examples that use glu functions now properly link to OpenGL::GLU
a44ad273 Make sure Rendering example doesn't conflict with rendering testing name
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !1147
parents 0059351e a37a3f39
......@@ -34,6 +34,7 @@
# - OpenGL::GL
# For OpenGL Will also provide the more explicit targets of:
# - OpenGL::OpenGL
# - OpenGL::GLU
# - OpenGL::GLX
# - OpenGL::EGL
function(vtkm_find_gl)
......@@ -59,18 +60,16 @@ function(vtkm_find_gl)
endforeach()
#Find GL
if(CMAKE_VERSION VERSION_LESS 3.10)
if(DO_GL_FIND AND NOT TARGET OpenGL::GL)
if(DO_GL_FIND AND NOT TARGET OpenGL::GL)
if(CMAKE_VERSION VERSION_LESS 3.10)
find_package(OpenGL ${GL_REQUIRED} ${QUIETLY} MODULE)
endif()
else()
#clunky but we need to make sure we use the upstream module if it exists
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "")
if(DO_GL_FIND AND NOT TARGET OpenGL::GL)
else()
#clunky but we need to make sure we use the upstream module if it exists
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "")
find_package(OpenGL ${GL_REQUIRED} ${QUIETLY} MODULE)
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
endif()
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
endif()
#Find GLEW
......@@ -106,11 +105,11 @@ if(VTKm_ENABLE_GL_CONTEXT)
INTERFACE OpenGL::OpenGL OpenGL::GLX GLEW::GLEW)
elseif(TARGET OpenGL::GL)
target_link_libraries(vtkm_rendering_gl_context
INTERFACE OpenGL::GL GLEW::GLEW)
INTERFACE OpenGL::GL OpenGL::GLU GLEW::GLEW)
endif()
elseif(VTKm_ENABLE_OSMESA_CONTEXT)
target_link_libraries(vtkm_rendering_gl_context
INTERFACE OpenGL::GL GLEW::GLEW)
INTERFACE OpenGL::GL OpenGL::GLU GLEW::GLEW)
elseif(VTKm_ENABLE_EGL_CONTEXT)
target_link_libraries(vtkm_rendering_gl_context
INTERFACE OpenGL::OpenGL OpenGL::EGL GLEW::GLEW)
......
......@@ -30,19 +30,21 @@ if(TARGET OpenGL::GL AND
TARGET GLUT::GLUT AND
TARGET GLEW::GLEW)
set(gl_libs OpenGL::GL GLEW::GLEW GLUT::GLUT)
add_executable(HelloWorld_SERIAL HelloWorld.cxx LoadShaders.h)
target_link_libraries(HelloWorld_SERIAL
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont ${gl_libs})
if(TARGET vtkm::tbb)
add_executable(HelloWorld_TBB HelloWorldTBB.cxx LoadShaders.h)
target_link_libraries(HelloWorld_TBB
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont ${gl_libs})
endif()
if(TARGET vtkm::cuda)
add_executable(HelloWorld_CUDA HelloWorld.cu LoadShaders.h)
target_link_libraries(HelloWorld_CUDA
PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
PRIVATE vtkm_cont ${gl_libs})
endif()
endif()
......@@ -32,17 +32,18 @@ if(TARGET OpenGL::GL AND
set_source_files_properties(quaternion.h PROPERTIES HEADER_FILE_ONLY TRUE)
set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT)
add_executable(IsosurfaceUniformGrid_SERIAL IsosurfaceUniformGrid.cxx quaternion.h)
target_link_libraries(IsosurfaceUniformGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(IsosurfaceUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
if(TARGET vtkm::cuda)
add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu quaternion.h)
target_link_libraries(IsosurfaceUniformGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(IsosurfaceUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
endif()
if(TARGET vtkm::tbb)
add_executable(IsosurfaceUniformGrid_TBB IsosurfaceUniformGridTBB.cxx quaternion.h)
target_link_libraries(IsosurfaceUniformGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(IsosurfaceUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
endif()
endif()
......@@ -20,7 +20,7 @@
##
##=============================================================================
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(Rendering CXX)
project(RenderingExample CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
......@@ -34,12 +34,12 @@ if(NOT TARGET GLUT::GLUT)
return()
endif()
add_executable(Rendering_SERIAL Rendering.cxx)
target_link_libraries(Rendering_SERIAL PRIVATE vtkm_rendering GLUT::GLUT)
add_executable(RenderingExample_SERIAL Rendering.cxx)
target_link_libraries(RenderingExample_SERIAL PRIVATE vtkm_rendering GLUT::GLUT)
if(TARGET vtkm::tbb)
add_executable(Rendering_TBB Rendering.cxx)
add_executable(RenderingExample_TBB Rendering.cxx)
target_compile_definitions(Rendering_TBB PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB")
target_link_libraries(Rendering_TBB PRIVATE vtkm_rendering GLUT::GLUT)
target_link_libraries(RenderingExample_TBB PRIVATE vtkm_rendering GLUT::GLUT)
endif()
......@@ -30,17 +30,19 @@ if(TARGET OpenGL::GL AND
TARGET GLUT::GLUT AND
TARGET GLEW::GLEW)
add_executable(StreamLineUniformGrid_SERIAL StreamLineUniformGrid.cxx)
target_link_libraries(StreamLineUniformGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT)
add_executable(StreamLineUniformGrid_SERIAL StreamLineUniformGrid.cxx)
target_link_libraries(StreamLineUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
if(TARGET vtkm::cont)
add_executable(StreamLineUniformGrid_CUDA StreamLineUniformGrid.cu)
target_link_libraries(StreamLineUniformGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(StreamLineUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
endif()
if(TARGET vtkm::tbb)
add_executable(StreamLineUniformGrid_TBB StreamLineUniformGridTBB.cxx)
target_link_libraries(StreamLineUniformGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(StreamLineUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
endif()
endif()
......@@ -29,15 +29,18 @@ vtkm_find_gl(OPTIONAL GL GLUT GLEW)
if(TARGET OpenGL::GL AND
TARGET GLUT::GLUT AND
TARGET GLEW::GLEW)
set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT)
add_executable(TetrahedralizeExplicitGrid_SERIAL TetrahedralizeExplicitGrid.cxx)
add_executable(TriangulateExplicitGrid_SERIAL TriangulateExplicitGrid.cxx)
add_executable(TetrahedralizeUniformGrid_SERIAL TetrahedralizeUniformGrid.cxx)
add_executable(TriangulateUniformGrid_SERIAL TriangulateUniformGrid.cxx)
target_link_libraries(TetrahedralizeExplicitGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateExplicitGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeUniformGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateUniformGrid_SERIAL PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeExplicitGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
if(TARGET vtkm::cuda)
add_executable(TetrahedralizeExplicitGrid_CUDA TetrahedralizeExplicitGrid.cu)
......@@ -45,10 +48,10 @@ if(TARGET OpenGL::GL AND
add_executable(TetrahedralizeUniformGrid_CUDA TetrahedralizeUniformGrid.cu)
add_executable(TriangulateUniformGrid_CUDA TriangulateUniformGrid.cu)
target_link_libraries(TetrahedralizeExplicitGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateExplicitGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeUniformGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateUniformGrid_CUDA PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeExplicitGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
endif()
if(TARGET vtkm::tbb)
......@@ -57,9 +60,9 @@ if(TARGET OpenGL::GL AND
add_executable(TetrahedralizeUniformGrid_TBB TetrahedralizeUniformGridTBB.cxx)
add_executable(TriangulateUniformGrid_TBB TriangulateUniformGridTBB.cxx)
target_link_libraries(TetrahedralizeExplicitGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateExplicitGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeUniformGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TriangulateUniformGrid_TBB PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(TetrahedralizeExplicitGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
endif()
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment