Skip to content

Commit

Permalink
fix(issue#10): fix multiply PCL_LIBRARIES import.
Browse files Browse the repository at this point in the history
1. fix a bug which leads to 'FLANN::FLANN-NOTFOUND' in Visual Studio.
2. more clearly CMakeLists.txt.
  • Loading branch information
Practice3DVision committed Apr 15, 2024
1 parent a34acdc commit 36a936f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(SLMaster)

set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_BUILD_TYPE Release)
#Release模式必须使用以下属性
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} /O2 /Zi")

add_subdirectory(src)
Expand Down
18 changes: 4 additions & 14 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,20 @@ project(SLMasterGui)
add_subdirectory(thirdParty/FluentUI)
add_subdirectory(thirdParty/QuickQanava)

find_package(PCL REQUIRED)
find_package(VTK REQUIRED)
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core Gui Quick Qml QuickControls2)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Quick Qml QuickControls2)
find_package(OpenCV COMPONENTS core cudev)

if(OpenCV_cudev_FOUND)
add_definitions(-DOPENCV_WITH_CUDA_MODULE)
endif()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OBJCXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.h ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.cpp)
file(GLOB_RECURSE QML ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.qml)
file(GLOB_RECURSE QRC ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.qrc ${CMAKE_CURRENT_SOURCE_DIR}/qml/qmldir* ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.rc)

set(SLMasterGuiDEPLIBS slmaster Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Qml Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::QuickControls2 QuickQanava)
if(CUDA_FOUND)
message("cuda found...")
list(APPEND SLMasterGuiDEPLIBS ${CUDA_LIBRARIES})
endif()
set(SLMasterGuiDEPLIBS slmaster ${VTK_LIBRARIES} Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Qml Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::QuickControls2 QuickQanava)

if (FLUENTUI_BUILD_STATIC_LIB AND (QT_VERSION VERSION_GREATER_EQUAL "6.2"))
list(APPEND SLMasterGuiDEPLIBS fluentui)
Expand All @@ -37,9 +27,9 @@ endif()
add_executable(SLMasterGui WIN32)
target_sources(SLMasterGui PRIVATE ${SOURCES} ${QML} ${QRC})
target_include_directories(SLMasterGui PRIVATE QuickQanava ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/calibrationMaster ${CMAKE_CURRENT_SOURCE_DIR}/src/nodes Qt${QT_VERSION_MAJOR}::QuickControls2)
target_link_libraries(SLMasterGui PRIVATE ${SLMasterGuiDEPLIBS} ${VTK_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(SLMasterGui PRIVATE ${SLMasterGuiDEPLIBS})

vtk_module_autoinit(
TARGETS SLMasterGui
MODULES ${VTK_LIBRARIES}
)
)
2 changes: 1 addition & 1 deletion src/algorithm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ FILE(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpuStructuredLight/*.h ${C

if(OpenCV_cudev_FOUND)
message(NOTICE "[SLMaster]: OpenCV With CUDA module.")
add_definitions(-DOPENCV_WITH_CUDA_MODULE)
enable_language(CUDA)
FILE(GLOB_RECURSE GPU_ALGORITHMS ${CMAKE_CURRENT_SOURCE_DIR}/gpuStructuredLight/*.h ${CMAKE_CURRENT_SOURCE_DIR}/gpuStructuredLight/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/gpuStructuredLight/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gpuStructuredLight/*.cu)
list(APPEND SOURCES ${GPU_ALGORITHMS})
source_group("SOURCES" FILES ${SOURCES})
add_library(algorithm ${SOURCES})
target_include_directories(algorithm PUBLIC {CMAKE_CURRENT_SOURCE_DIR} ${EIGEN3_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
target_link_libraries(algorithm PUBLIC ${OpenCV_LIBRARIES} ${PCL_LIBRARIES} ${CUDA_LIBRARIES})
target_compile_definitions(algorithm PUBLIC -DOPENCV_WITH_CUDA_MODULE)
set_target_properties(algorithm PROPERTIES CUDA_STANDARD 11)
else()
message(WARNING "[SLMaster]: OpenCV dosn't With CUDA module! Just complier CPU Version.")
Expand Down
5 changes: 0 additions & 5 deletions src/cameras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.20)

project(cameras)

find_package(OpenCV COMPONENTS core cudev)
if(OpenCV_cudev_FOUND)
add_definitions(-DOPENCV_WITH_CUDA_MODULE)
endif()

file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

if(BUILD_SLMASTER_SHARED)
Expand Down

0 comments on commit 36a936f

Please sign in to comment.