Skip to content

Commit

Permalink
MAINT: reduce code.
Browse files Browse the repository at this point in the history
  • Loading branch information
oddkiva committed May 23, 2024
1 parent ed43ec5 commit 7bdeec6
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 56 deletions.
1 change: 0 additions & 1 deletion cpp/examples/Kalpana/EasyGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ foreach(file ${example_FILES})
DO::Sara::ImageIO #
DO::Kalpana::EasyGL #
${HDF5_LIBRARIES} #
fmt::fmt #
glfw)
target_compile_definitions(
${filename}
Expand Down
1 change: 0 additions & 1 deletion cpp/examples/Kalpana/ImPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ target_link_libraries(
ImGui
ImPlot
${HDF5_LIBRARIES} #
fmt::fmt
glfw)
target_compile_definitions(
implot_example
Expand Down
3 changes: 1 addition & 2 deletions cpp/examples/Sara/FeatureMatching/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ sara_add_example(video_edge_matching)
target_link_libraries(video_edge_matching PRIVATE Boost::filesystem)

sara_add_example(video_sift_matching)
target_link_libraries(video_sift_matching PRIVATE fmt::fmt #
Boost::program_options)
target_link_libraries(video_sift_matching PRIVATE Boost::program_options)
7 changes: 2 additions & 5 deletions cpp/examples/Sara/MultiViewGeometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ sara_add_example(omnidirectional_camera_example)

# Single view geometry.
sara_add_example(metric_birds_eye_viewer)
target_link_libraries(metric_birds_eye_viewer PRIVATE fmt::fmt)

sara_add_example(orthogonal_vanishing_point_detection)
target_include_directories(orthogonal_vanishing_point_detection
PRIVATE ${CMAKE_SOURCE_DIR}/cpp)
target_link_libraries(
orthogonal_vanishing_point_detection
PRIVATE fmt::fmt #
Boost::program_options #
PRIVATE Boost::program_options #
$<$<BOOL:${OpenMP_CXX_FOUND}>:OpenMP::OpenMP_CXX>)

# Two-view geometry.
Expand All @@ -52,9 +50,8 @@ target_link_libraries(essential_5_point_example PRIVATE tinyply)
# Visual odometry.
sara_add_example(visual_odometry_example)
target_link_libraries(
visual_odometry_example
visual_odometry_example #
PRIVATE DO::Kalpana::EasyGL #
fmt::fmt #
glfw)

# Bundle adjustment.
Expand Down
3 changes: 1 addition & 2 deletions cpp/examples/Sara/NeuralNetworks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ foreach (file ${neuralnetworks_SOURCE_FILES})
DO::Sara::ImageIO
DO::Sara::VideoIO
DO::Sara::Darknet
$<$<BOOL:${OpenMP_CXX_FOUND}>:OpenMP::OpenMP_CXX>
fmt::fmt)
$<$<BOOL:${OpenMP_CXX_FOUND}>:OpenMP::OpenMP_CXX>)
set_target_properties(${filename}
PROPERTIES
COMPILE_FLAGS ${SARA_DEFINITIONS}
Expand Down
40 changes: 22 additions & 18 deletions cpp/examples/Shakti/FeatureDetectors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ function(shakti_add_example)
set(name shakti_${_filename})

add_executable(${name} ${shakti_add_example_SOURCES})
target_include_directories(${name} PRIVATE ${CUDA_TOOLKIT_INCLUDE}
${Boost_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/cpp)
target_link_libraries(${name} PRIVATE ${Boost_LIBRARIES}
${shakti_add_example_DEPENDENCIES})
target_include_directories(
${name} #
PRIVATE ${CUDA_TOOLKIT_INCLUDE} ${Boost_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/cpp)
target_link_libraries(
${name} #
PRIVATE ${Boost_LIBRARIES} #
${shakti_add_example_DEPENDENCIES})

set_target_properties(${name} PROPERTIES FOLDER "Examples/Shakti/Cuda")

#target_compile_options(
# ${name} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>)
# cmake-format: off
# target_compile_options( ${name} PRIVATE
# $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>)
# cmake-format: on

set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/bin)
Expand All @@ -29,16 +34,15 @@ endfunction()
file(GLOB SRC_FILES FILES *.cpp *.cu)

foreach(file ${SRC_FILES})
# cmake-format: off
shakti_add_example(
SOURCES
${file}
DEPENDENCIES
DO::Sara::Core
DO::Sara::Graphics
DO::Sara::ImageProcessing
DO::Sara::VideoIO
DO::Shakti::Cuda::MultiArray
DO::Shakti::Cuda::Utilities
DO::Shakti::Cuda::FeatureDetectors
fmt::fmt)
SOURCES ${file}
DEPENDENCIES DO::Sara::Core
DO::Sara::Graphics
DO::Sara::ImageProcessing
DO::Sara::VideoIO
DO::Shakti::Cuda::MultiArray
DO::Shakti::Cuda::Utilities
DO::Shakti::Cuda::FeatureDetectors)
# cmake-format: on
endforeach()
1 change: 0 additions & 1 deletion cpp/examples/Shakti/Halide/SIFT/V2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ target_link_libraries(halide_sift_pyramid_example
PRIVATE
${DO_Sara_LIBRARIES}
${Boost_LIBRARIES}
fmt::fmt
DO_Shakti_Halide_Sift_gpu_v2
$<$<BOOL:${CMAKE_CUDA_COMPILER}>:${CUDA_CUDA_LIBRARY}>
$<$<BOOL:${NvidiaVideoCodec_ROOT}>:DO::Shakti::Cuda::VideoIO>)
Expand Down
1 change: 0 additions & 1 deletion cpp/examples/Shakti/Halide/SIFT/V3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ target_link_libraries(
DO::Sara::ImageIO
DO::Sara::SfM
DO::Sara::VideoIO
fmt::fmt
${HALIDE_SIFT_LIBRARIES})
set_property(TARGET halide_batched_sift_octave_example
PROPERTY FOLDER "Examples/Shakti/Halide")
1 change: 0 additions & 1 deletion cpp/examples/Shakti/TensorRT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ foreach(file ${TRT_EXAMPLE_FILES})
DO::Shakti::Cuda::Utilities
DO::Shakti::Cuda::TensorRT
tinycolormap
fmt::fmt
tensorrt_yolov4_utilities)

set_target_properties(
Expand Down
1 change: 0 additions & 1 deletion cpp/src/DO/Kalpana/EasyGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ target_compile_definitions(DO_Kalpana_EasyGL PUBLIC GL_SILENCE_DEPRECATION)
target_link_libraries(
DO_Kalpana_EasyGL
PRIVATE DO::Sara::Core #
fmt::fmt
PUBLIC ${OPENGL_LIBRARIES})
if(NOT APPLE)
target_include_directories(DO_Kalpana_EasyGL #
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/DO/Kalpana/Qt/3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ target_link_libraries(
Qt${QT_VERSION}::OpenGL #
$<$<EQUAL:${QT_VERSION},6>:Qt6::OpenGLWidgets> #
${OPENGL_LIBRARIES} #
DO::Sara::Core
PRIVATE fmt::fmt)
DO::Sara::Core)
set_property(TARGET DO_Kalpana_Qt_3D PROPERTY FOLDER "Libraries/Kalpana")
1 change: 0 additions & 1 deletion cpp/src/DO/Sara/Logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ target_include_directories(DO_Sara_Logging PUBLIC ${CMAKE_SOURCE_DIR}/cpp/src)
target_link_libraries(
DO_Sara_Logging #
PUBLIC Boost::log #
fmt::fmt #
DO::Sara::Core)
set_target_properties(DO_Sara_Logging PROPERTIES FOLDER "Libraries/Sara")

Expand Down
5 changes: 2 additions & 3 deletions cpp/src/DO/Sara/NeuralNetworks/Darknet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ add_library(DO_Sara_Darknet ${DO_Sara_Darknet_SOURCE_FILES})
add_library(DO::Sara::Darknet ALIAS DO_Sara_Darknet)

target_link_libraries(
DO_Sara_Darknet
DO_Sara_Darknet #
PUBLIC DO::Sara::Core #
DO::Sara::ImageProcessing
PRIVATE fmt::fmt)
DO::Sara::ImageProcessing)
set_property(TARGET DO_Sara_Darknet PROPERTY FOLDER "Libraries/Sara")
7 changes: 4 additions & 3 deletions cpp/src/DO/Sara/UseDOSaraCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ if(NOT DO_Sara_Core_ADDED)
PUBLIC ${CMAKE_SOURCE_DIR}/cpp/third-party/eigen #
$<$<NOT:$<PLATFORM_ID:iOS>>:${HDF5_INCLUDE_DIRS}>)
target_link_libraries(
DO_Sara_Core PUBLIC $<$<NOT:$<PLATFORM_ID:iOS>>:${HDF5_CXX_LIBRARIES}>)
DO_Sara_Core #
PUBLIC fmt::fmt # This is a deliberate choice.
$<$<NOT:$<PLATFORM_ID:iOS>>:${HDF5_CXX_LIBRARIES}>)
target_compile_definitions(
DO_Sara_Core
PUBLIC
Expand All @@ -21,6 +23,5 @@ if(NOT DO_Sara_Core_ADDED)
PUBLIC
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<PLATFORM_ID:Linux>>:SHELL:-Xcudafe --diag_suppress=20236>"
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<PLATFORM_ID:Linux>>:SHELL:-Xcudafe --diag_suppress=20012>"
$<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>
)
$<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>)
endif()
3 changes: 1 addition & 2 deletions cpp/src/DO/Sara/UseDOSaraImageIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ if(SARA_USE_FROM_SOURCE)
$<$<CXX_COMPILER_ID:MSVC>:WebP::webpdemux>)
endif()
target_link_libraries(
DO_Sara_ImageIO
DO_Sara_ImageIO #
PUBLIC DO::Sara::Core #
fmt::fmt #
easyexif)

target_compile_definitions(
Expand Down
1 change: 0 additions & 1 deletion cpp/src/DO/Sara/UseDOSaraVideoIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if(SARA_USE_FROM_SOURCE)
PRIVATE DO::Sara::Core #
DO::Sara::Logging #
DO::Sara::ImageProcessing #
fmt::fmt #
${FFMPEG_LIBRARIES})
endif()
endif()
1 change: 0 additions & 1 deletion cpp/src/DO/Shakti/Halide/SIFT/V2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ target_link_libraries(
PUBLIC Halide::Halide #
Halide::Runtime #
PRIVATE DO::Sara::Core #
fmt::fmt #
${HALIDE_SIFT_BLOCK_LIBRARIES_V2})
set_property(TARGET DO_Shakti_Halide_Sift_gpu_v2
PROPERTY FOLDER "Libraries/Shakti/Halide")
3 changes: 1 addition & 2 deletions cpp/src/DO/Shakti/OpenCL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ target_include_directories(
target_link_libraries(
DO_Sara_OpenCL #
INTERFACE DO::Sara::Core #
OpenCL::OpenCL #
fmt::fmt)
OpenCL::OpenCL)

target_compile_definitions(
DO_Sara_OpenCL
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/DO/Shakti/Vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ target_link_libraries(
DO_Shakti_Vulkan
PUBLIC DO::Sara::Core #
Vulkan::Vulkan #
glfw #
fmt::fmt)
glfw)

set_target_properties(DO_Shakti_Vulkan PROPERTIES FOLDER "Libraries/Shakti")
2 changes: 1 addition & 1 deletion cpp/test/Sara/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreach (file ${test_core_SOURCE_FILES})
sara_add_test(
NAME ${filename}
SOURCES ${file}
DEPENDENCIES DO::Sara::Core fmt::fmt
DEPENDENCIES DO::Sara::Core
FOLDER Core)
endforeach ()

Expand Down
2 changes: 1 addition & 1 deletion cpp/test/Sara/MultiViewGeometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ foreach (file ${test_multiviewgeometry_SOURCE_FILES})
sara_add_test(
NAME ${filename}
SOURCES ${file}
DEPENDENCIES DO::Sara::MultiViewGeometry fmt::fmt
DEPENDENCIES DO::Sara::MultiViewGeometry
FOLDER MultiViewGeometry)
endforeach ()

Expand Down
9 changes: 6 additions & 3 deletions cpp/test/Sara/RANSAC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
file(GLOB test_SOURCE_FILES FILES test_*.cpp)

foreach (file ${test_SOURCE_FILES})
foreach(file ${test_SOURCE_FILES})
get_filename_component(filename "${file}" NAME_WE)
# cmake-format: off
sara_add_test(
NAME ${filename}
SOURCES ${file}
DEPENDENCIES DO::Sara::MultiViewGeometry DO::Sara::RANSAC fmt::fmt
DEPENDENCIES DO::Sara::MultiViewGeometry
DO::Sara::RANSAC
FOLDER RANSAC)
endforeach ()
# cmake-format: on
endforeach()
1 change: 0 additions & 1 deletion cpp/test/Shakti/Cuda/FeatureDetectors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ foreach(file ${test_FILES})
DO::Shakti::Cuda::MultiArray
DO::Shakti::Cuda::Utilities
DO::Shakti::Cuda::FeatureDetectors
fmt::fmt
FOLDER CUDA)
endforeach()

0 comments on commit 7bdeec6

Please sign in to comment.