1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
set(EXAMPLE_BIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples")
macro(open3d_add_example EXAMPLE_CPP_NAME)
add_executable(${EXAMPLE_CPP_NAME})
target_sources(${EXAMPLE_CPP_NAME} PRIVATE "${EXAMPLE_CPP_NAME}.cpp")
target_link_libraries(${EXAMPLE_CPP_NAME} PRIVATE Open3D::Open3D ${ARGN})
# Don't use open3d_link_3rdparty_libraries(${EXAMPLE_CPP_NAME}).
# Unlike benchmarks, examples are intended as standalone apps that link
# the main Open3D library, while the benchmarks executable needs 3rd-party
# libraries since it measures the internal components of Open3D.
open3d_show_and_abort_on_warning(${EXAMPLE_CPP_NAME})
open3d_set_global_properties(${EXAMPLE_CPP_NAME})
set_target_properties(${EXAMPLE_CPP_NAME} PROPERTIES
FOLDER "examples/cpp/"
RUNTIME_OUTPUT_DIRECTORY "${EXAMPLE_BIN_DIR}"
)
if (NOT BUILD_EXAMPLES)
set_target_properties(${EXAMPLE_CPP_NAME} PROPERTIES
EXCLUDE_FROM_ALL TRUE
)
endif()
list(APPEND EXAMPLE_TARGETS ${EXAMPLE_CPP_NAME})
endmacro()
open3d_add_example(CameraPoseTrajectory)
open3d_add_example(ColorMapOptimization)
open3d_add_example(DepthCapture)
open3d_add_example(EvaluatePCDMatch)
open3d_add_example(FileDialog Open3D::3rdparty_tinyfiledialogs)
open3d_add_example(FileSystem)
open3d_add_example(Flann)
open3d_add_example(Image)
open3d_add_example(IntegrateRGBD)
open3d_add_example(ISSKeypoints)
open3d_add_example(LineSet)
open3d_add_example(Log)
open3d_add_example(Octree)
open3d_add_example(OdometryRGBD)
if (TARGET Open3D::3rdparty_openmp)
open3d_add_example(OpenMP Open3D::3rdparty_openmp)
else()
open3d_add_example(OpenMP)
endif()
open3d_add_example(PCDFileFormat)
open3d_add_example(PointCloud)
open3d_add_example(PoseGraph)
open3d_add_example(ProgramOptions)
open3d_add_example(GeneralizedICP)
open3d_add_example(RegistrationColoredICP)
open3d_add_example(RegistrationRANSAC)
open3d_add_example(RegistrationFGR)
open3d_add_example(RGBDOdometry)
open3d_add_example(SLAC)
open3d_add_example(SLACIntegrate)
open3d_add_example(TIntegrateRGBD)
open3d_add_example(TOdometryRGBD)
open3d_add_example(TriangleMesh)
if (TARGET Open3D::3rdparty_openmp)
open3d_add_example(TrimMeshBasedOnPointCloud Open3D::3rdparty_openmp)
else ()
open3d_add_example(TrimMeshBasedOnPointCloud)
endif()
open3d_add_example(ViewDistances)
open3d_add_example(ViewPCDMatch)
open3d_add_example(Visualizer)
open3d_add_example(Voxelization)
if(BUILD_SYCL_MODULE)
open3d_add_example(SYCLDemo)
endif()
if (BUILD_GUI)
open3d_add_example(Draw)
open3d_add_example(MultipleWindows Open3D::3rdparty_threads)
open3d_add_example(OffscreenRendering)
open3d_add_example(TICPSequential Open3D::3rdparty_threads)
open3d_add_example(TICP Open3D::3rdparty_threads)
open3d_add_example(OfflineSLAM Open3D::3rdparty_threads)
open3d_add_example(OnlineSLAMRGBD Open3D::3rdparty_threads)
if (BUILD_LIBREALSENSE)
open3d_add_example(OnlineSLAMRealSense Open3D::3rdparty_librealsense Open3D::3rdparty_threads)
endif()
endif()
if(BUILD_WEBRTC)
open3d_add_example(DrawWebRTC)
endif()
if (BUILD_LIBREALSENSE)
if (TARGET Open3D::3rdparty_openmp)
open3d_add_example(RealSenseBagReader Open3D::3rdparty_librealsense Open3D::3rdparty_jsoncpp Open3D::3rdparty_openmp)
else()
open3d_add_example(RealSenseBagReader Open3D::3rdparty_librealsense Open3D::3rdparty_jsoncpp)
endif()
open3d_add_example(RealSenseRecorder Open3D::3rdparty_librealsense)
endif()
if (BUILD_AZURE_KINECT)
open3d_add_example(AzureKinectMKVReader Open3D::3rdparty_jsoncpp)
open3d_add_example(AzureKinectRecord Open3D::3rdparty_k4a)
open3d_add_example(AzureKinectViewer Open3D::3rdparty_k4a)
endif()
include(ProcessorCount)
ProcessorCount(NPROC)
# build-examples-iteratively is used to conserve space on CI machine.
add_custom_target(build-examples-iteratively
COMMAND ${CMAKE_COMMAND}
-DEXAMPLE_TARGETS="${EXAMPLE_TARGETS}"
-DCMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}"
-DEXAMPLE_BIN_DIR="${EXAMPLE_BIN_DIR}"
-DCMAKE_BUILD_TYPE="$<CONFIG>"
-DNPROC="${NPROC}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/iterative_build_examples.cmake
)
|