- Implemented a new sample application in main.cpp to capture and display a live 3D point cloud using the ZED SDK and OpenGL. - Created test_opengl.cpp to demonstrate basic OpenGL rendering with depth testing using two triangles. - Added test_points.cpp to visualize a grid of colored points in OpenGL, showcasing point rendering capabilities.
76 lines
2.4 KiB
CMake
Executable File
76 lines
2.4 KiB
CMake
Executable File
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
|
|
PROJECT(ZED_Depth_Sensing)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
SET(CMAKE_BUILD_TYPE "Release")
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
option(LINK_SHARED_ZED "Link with the ZED SDK shared executable" ON)
|
|
|
|
if (NOT LINK_SHARED_ZED AND MSVC)
|
|
message(FATAL_ERROR "LINK_SHARED_ZED OFF : ZED SDK static libraries not available on Windows")
|
|
endif()
|
|
|
|
find_package(ZED REQUIRED)
|
|
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)
|
|
find_package(OpenCV REQUIRED)
|
|
find_package(GLUT REQUIRED)
|
|
find_package(GLEW REQUIRED)
|
|
SET(OpenGL_GL_PREFERENCE GLVND)
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
include_directories(${ZED_INCLUDE_DIRS})
|
|
message(STATUS "ZED include dir: ${ZED_INCLUDE_DIRS}")
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
include_directories(${GLEW_INCLUDE_DIRS})
|
|
include_directories(${GLUT_INCLUDE_DIR})
|
|
include_directories(${CUDA_INCLUDE_DIRS})
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
link_directories(${ZED_LIBRARY_DIR})
|
|
link_directories(${GLEW_LIBRARY_DIRS})
|
|
link_directories(${GLUT_LIBRARY_DIRS})
|
|
link_directories(${OpenGL_LIBRARY_DIRS})
|
|
link_directories(${CUDA_LIBRARY_DIRS})
|
|
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
|
|
|
IF (CMAKE_SYSTEM_PROCESSOR MATCHES aarch64)
|
|
add_definitions(-DJETSON_STYLE)
|
|
ENDIF()
|
|
|
|
FILE(GLOB_RECURSE SRC_FILES src/*.cpp)
|
|
FILE(GLOB_RECURSE HDR_FILES include/*.hpp)
|
|
|
|
ADD_EXECUTABLE(${PROJECT_NAME} ${HDR_FILES} ${SRC_FILES})
|
|
|
|
if (LINK_SHARED_ZED)
|
|
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
|
|
else()
|
|
SET(ZED_LIBS ${ZED_STATIC_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_LIBRARY})
|
|
endif()
|
|
|
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
|
|
${ZED_LIBS}
|
|
${OPENGL_LIBRARIES}
|
|
${GLUT_LIBRARIES}
|
|
${GLEW_LIBRARIES}
|
|
${OpenCV_LIBRARIES})
|
|
|
|
# Test executables
|
|
ADD_EXECUTABLE(test_opengl test_opengl.cpp)
|
|
TARGET_LINK_LIBRARIES(test_opengl
|
|
${OPENGL_LIBRARIES}
|
|
${GLUT_LIBRARIES}
|
|
${GLEW_LIBRARIES})
|
|
|
|
ADD_EXECUTABLE(test_points test_points.cpp)
|
|
TARGET_LINK_LIBRARIES(test_points
|
|
${OPENGL_LIBRARIES}
|
|
${GLUT_LIBRARIES}
|
|
${GLEW_LIBRARIES})
|
|
|
|
if(INSTALL_SAMPLES)
|
|
LIST(APPEND SAMPLE_LIST ${PROJECT_NAME})
|
|
SET(SAMPLE_LIST "${SAMPLE_LIST}" PARENT_SCOPE)
|
|
endif() |