cmake_minimum_required(VERSION 3.24)

include(${CMAKE_SOURCE_DIR}/cmake/cmakebase.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/project.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/ss928.cmake)

PROJECT(lidar_driver)

set(CMAKE_CXX_STANDARD 14) # 设置使用C++11标准
set(CMAKE_CXX_STANDARD_REQUIRED ON) # 确保编译器遵循C++11标准

set(CMAKE_SOURCE_DIR "./")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")

set(OPENGL_opengl_LIBRARY /usr/lib/aarch64-linux-gnu/libOpenGL.so)
set(OPENGL_glx_LIBRARY /usr/lib/aarch64-linux-gnu/libGLX.so)
set(X11_X11_LIB /usr/lib/aarch64-linux-gnu/libX11.so)
find_package(Open3D REQUIRED)
if(NOT Open3D_FOUND)
    message(FATAL_ERROR "Open3D not found.")
endif()
MESSAGE(${Open3D_VERSION})
message(STATUS "Open3D include dirs: ${Open3D_INCLUDE_DIRS}")
message(STATUS "Open3D library dirs: ${Open3D_LIBRARY_DIRS}")
message(STATUS "Open3D libraries: ${Open3D_LIBRARIES}")

include_directories(
    /usr/local/include
    ${CMAKE_SOURCE_DIR}/include/open3d/
    ${CMAKE_SOURCE_DIR}/include/
    ${CMAKE_SOURCE_DIR}/include/open3d/
    ${CMAKE_SOURCE_DIR}/include/open3d/3rdparty/
    ${CMAKE_SOURCE_DIR}/include/eigen3/
    ${CMAKE_SOURCE_DIR}/include/Livox/
)

link_directories(
    /usr/local/lib
    /usr/lib/aarch64-linux-gnu
)

aux_source_directory(${CMAKE_SOURCE_DIR}/ CORE_LIST)
add_executable(${PROJECT_NAME} ${CORE_LIST})

set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath-link,/usr/lib/aarch64-linux-gnu")
target_link_libraries(
    ${PROJECT_NAME} 
    ${SYSTEM_LINK_LIB}
    livox_sdk_static 
    pthread
    dl
    Open3D::Open3D
)


