Skip to content

Commit

Permalink
build(examples): modernize opengl imports to close #658 and close #661
Browse files Browse the repository at this point in the history
Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
  • Loading branch information
piedar committed Sep 19, 2022
1 parent b9cb6bd commit f6de60f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 9 additions & 6 deletions examples/CMakeLists.txt
Expand Up @@ -2,6 +2,8 @@
# Packages needed for examples
######################################################################################

cmake_minimum_required(VERSION 3.8.2)

# These examples have no external dependencies and should always build.
add_executable(freenect-camtest camtest.c)
add_executable(freenect-wavrecord wavrecord.c)
Expand All @@ -12,6 +14,7 @@ install(TARGETS freenect-camtest freenect-wavrecord

# Most viewers need pthreads and GLUT.
set(THREADS_USE_PTHREADS_WIN32 true)
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(Threads)
find_package(OpenGL)
find_package(GLUT)
Expand All @@ -25,11 +28,11 @@ if (Threads_FOUND AND OPENGL_FOUND AND GLUT_FOUND)
add_executable(freenect-chunkview chunkview.c)
add_executable(freenect-micview micview.c)

target_link_libraries(freenect-glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-hiview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-chunkview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-micview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-glview freenect OpenGL::GL GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-regview freenect OpenGL::GL GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-hiview freenect OpenGL::GL GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-chunkview freenect OpenGL::GL GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-micview freenect OpenGL::GL GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})

install(TARGETS freenect-glview freenect-regview freenect-hiview freenect-chunkview freenect-micview
DESTINATION bin)
Expand All @@ -51,7 +54,7 @@ if (BUILD_C_SYNC)
if (OPENGL_FOUND AND GLUT_FOUND)
include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
add_executable(freenect-glpclview glpclview.c)
target_link_libraries(freenect-glpclview freenect_sync ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${MATH_LIB})
target_link_libraries(freenect-glpclview freenect_sync OpenGL::GL OpenGL::GLU GLUT::GLUT ${MATH_LIB})
install(TARGETS freenect-glpclview
DESTINATION bin)
endif ()
Expand Down
5 changes: 3 additions & 2 deletions wrappers/cpp/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ install(FILES libfreenect.hpp

if (BUILD_EXAMPLES)
set(THREADS_USE_PTHREADS_WIN32 true)
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(Threads)
find_package(OpenGL)
find_package(GLUT)
Expand All @@ -18,8 +19,8 @@ if (BUILD_EXAMPLES)
target_compile_features(freenect-cppview PUBLIC cxx_std_11)
target_compile_features(freenect-cpp_pcview PUBLIC cxx_std_11)

target_link_libraries(freenect-cppview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-cpp_pcview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-cppview freenect OpenGL::GL OpenGL::GLU GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
target_link_libraries(freenect-cpp_pcview freenect OpenGL::GL OpenGL::GLU GLUT::GLUT ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})

install(TARGETS freenect-cppview freenect-cpp_pcview
DESTINATION bin)
Expand Down

0 comments on commit f6de60f

Please sign in to comment.