Skip to content

Commit f161150

Browse files
committed
Set auto-installation pipelines
1 parent 0fee79d commit f161150

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pyinstall:
2+
@python3 -m pip install --upgrade pip
3+
@pip install numpy
4+
@pip install --verbose ./python/
5+
6+
pyinstall_with_demo: pyinstall
7+
@pip install open3d==0.18.0
8+
9+
cppinstall:
10+
@cmake -Bcpp/build cpp/
11+
@cmake --build cpp/build -j$(nproc --all)
12+
13+
cppinstall_with_demo:
14+
@cmake -Bcpp/build cpp/ -DINCLUDE_CPP_EXAMPLES=ON
15+
@cmake --build cpp/build -j$(nproc --all)

cpp/CMakeLists.txt

+28-18
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ else()
1616
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1717
endif()
1818

19-
option(BUILD_CPP_EXAMPLES "Build C++ example codes, which require Open3D for visualization" OFF)
19+
option(INCLUDE_CPP_EXAMPLES "Include C++ example codes, which require Open3D for visualization" OFF)
2020

2121
# Parameters in `patchworkpp` subdirectory.
2222
# Thus, link should be `patchworkpp::ground_seg_cores`
@@ -25,28 +25,38 @@ set(TARGET_NAME ground_seg_cores)
2525

2626
add_subdirectory(patchworkpp)
2727

28-
if (BUILD_CPP_EXAMPLES)
29-
list(APPEND Open3D_LIBRARIES dl)
30-
set(INCLUDE_EXAMPLES ON CACHE BOOL "Build examples")
28+
if (INCLUDE_CPP_EXAMPLES)
29+
if(CMAKE_VERSION VERSION_LESS "3.15")
30+
# Just automatically update cmake version
31+
execute_process(COMMAND bash ../scripts/install_latest.cmake.bash
32+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
33+
endif()
3134

32-
if (INCLUDE_EXAMPLES)
35+
list(APPEND Open3D_LIBRARIES dl)
3336

34-
message(STATUS "Building examples for c++")
37+
message(STATUS "Building examples for c++")
38+
find_package(Open3D QUIET)
39+
if (NOT Open3D_FOUND)
40+
message(STATUS "Open3D not found, installing Open3D...")
41+
execute_process(COMMAND bash ../scripts/install_open3d.bash
42+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
3543
find_package(Open3D REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/lib/CMake)
36-
37-
list(APPEND Open3D_LIBRARIES dl)
38-
link_directories(${Open3D_LIBRARY_DIRS})
44+
else()
3945
message(STATUS "Found Open3D ${Open3D_VERSION}")
46+
endif()
47+
48+
list(APPEND Open3D_LIBRARIES dl)
49+
link_directories(${Open3D_LIBRARY_DIRS})
50+
message(STATUS "Found Open3D ${Open3D_VERSION}")
4051

41-
add_executable(demo_visualize ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_visualize.cpp)
42-
target_link_libraries(demo_visualize PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
43-
target_include_directories(demo_visualize PUBLIC ${Open3D_INCLUDE_DIRS})
44-
set_target_properties(demo_visualize PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
52+
add_executable(demo_visualize ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_visualize.cpp)
53+
target_link_libraries(demo_visualize PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
54+
target_include_directories(demo_visualize PUBLIC ${Open3D_INCLUDE_DIRS})
55+
set_target_properties(demo_visualize PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
4556

46-
add_executable(demo_sequential ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_sequential.cpp)
47-
target_link_libraries(demo_sequential PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
48-
target_include_directories(demo_sequential PUBLIC ${Open3D_INCLUDE_DIRS})
49-
set_target_properties(demo_sequential PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
57+
add_executable(demo_sequential ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_sequential.cpp)
58+
target_link_libraries(demo_sequential PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
59+
target_include_directories(demo_sequential PUBLIC ${Open3D_INCLUDE_DIRS})
60+
set_target_properties(demo_sequential PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
5061

51-
endif()
5262
endif()

0 commit comments

Comments
 (0)