-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakelists.txt
47 lines (40 loc) · 1.73 KB
/
CMakelists.txt
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
cmake_minimum_required(VERSION 3.12.0)
set (CMAKE_CXX_STANDARD 14)
if(POLICY CMP0091)
# https://stackoverflow.com/a/56490614
cmake_policy(SET CMP0091 NEW)
endif()
# The options need to be the same as Open3D's default
# If Open3D is configured and built with custom options, you'll also need to
# specify the same custom options.
option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" ON)
# This needs cmake_policy(SET CMP0091 NEW)
if (STATIC_WINDOWS_RUNTIME)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
project(MultiPlaneDetection LANGUAGES C CXX)
set(Open3D_DIR "D:/Open3D-0.17.0/install/CMake")
# Find installed Open3D, which exports Open3D::Open3D
if(WIN32)
find_package(Open3D HINTS ${CMAKE_INSTALL_PREFIX}/CMake)
else()
find_package(Open3D HINTS ${CMAKE_INSTALL_PREFIX}/lib/cmake)
endif()
if(NOT Open3D_FOUND)
message(FATAL_ERROR "Open3D not found, please use -DCMAKE_INSTALL_PREFIX=open3d_install_dir")
endif()
add_executable(MultiPlaneDetection Detection.cpp Detection.h main.cpp)
target_link_libraries(MultiPlaneDetection Open3D::Open3D)
# On Windows, when BUILD_SHARED_LIBS, copy .dll to the executable directory
if(WIN32)
get_target_property(open3d_type Open3D::Open3D TYPE)
if(open3d_type STREQUAL "SHARED_LIBRARY")
message(STATUS "Will copy Open3D.dll to ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
add_custom_command(TARGET TestVisualizer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/bin/Open3D.dll
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
endif()
endif()