Skip to content

Commit

Permalink
Switched QHull ImGUI and GoogleTest to use FetchContent (#6645)
Browse files Browse the repository at this point in the history
* Switched QHull and GoogleTest to use FetchContent to populate their files at configure time. This means that the open3d_build_3rdparty_library function doesn't need to mark source files as generated which was causing them to be removed when running the clean target.
* Switched ImGUI to use FetchContent instead of external project so files are provided at configure time instead of build time.
* Removed vestigial ext_imgui target that used to download the imgui sources. Sources are now downloaded at configure time.
  • Loading branch information
dbs4261 authored Apr 15, 2024
1 parent 84b8e07 commit 172367e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
10 changes: 0 additions & 10 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ function(open3d_build_3rdparty_library name)
if(arg_SOURCES)
foreach(src IN LISTS arg_SOURCES)
get_filename_component(abs_src "${src}" ABSOLUTE BASE_DIR "${arg_DIRECTORY}")
# Mark as generated to skip CMake's file existence checks
set_source_files_properties(${abs_src} PROPERTIES GENERATED TRUE)
target_sources(${name} PRIVATE ${abs_src})
endforeach()
foreach(incl IN LISTS include_dirs)
Expand Down Expand Up @@ -1030,8 +1028,6 @@ if(NOT USE_SYSTEM_QHULLCPP)
src/libqhull_r/rboxlib_r.c
INCLUDE_DIRS
src/
DEPENDS
ext_qhull
)
open3d_build_3rdparty_library(3rdparty_qhullcpp DIRECTORY ${QHULL_SOURCE_DIR}
SOURCES
Expand All @@ -1057,8 +1053,6 @@ if(NOT USE_SYSTEM_QHULLCPP)
src/libqhullcpp/RoadLogEvent.cpp
INCLUDE_DIRS
src/
DEPENDS
ext_qhull
)
target_link_libraries(3rdparty_qhullcpp PRIVATE 3rdparty_qhull_r)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_qhullcpp)
Expand Down Expand Up @@ -1158,8 +1152,6 @@ if (BUILD_UNIT_TESTS)
googletest/
googlemock/include/
googlemock/
DEPENDS
ext_googletest
)
endif()
endif()
Expand Down Expand Up @@ -1190,8 +1182,6 @@ if(BUILD_GUI)
imgui_tables.cpp
imgui_widgets.cpp
imgui.cpp
DEPENDS
ext_imgui
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_imgui)
else()
Expand Down
8 changes: 4 additions & 4 deletions 3rdparty/googletest/googletest.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(ExternalProject)
include(FetchContent)

ExternalProject_Add(
FetchContent_Declare(
ext_googletest
PREFIX googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
Expand All @@ -12,5 +12,5 @@ ExternalProject_Add(
INSTALL_COMMAND ""
)

ExternalProject_Get_Property(ext_googletest SOURCE_DIR)
set(GOOGLETEST_SOURCE_DIR ${SOURCE_DIR})
FetchContent_Populate(ext_googletest)
FetchContent_GetProperties(ext_googletest SOURCE_DIR GOOGLETEST_SOURCE_DIR)
8 changes: 4 additions & 4 deletions 3rdparty/imgui/imgui.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(ExternalProject)
include(FetchContent)

ExternalProject_Add(
FetchContent_Declare(
ext_imgui
PREFIX imgui
URL https://github.com/ocornut/imgui/archive/refs/tags/v1.88.tar.gz
Expand All @@ -12,5 +12,5 @@ ExternalProject_Add(
INSTALL_COMMAND ""
)

ExternalProject_Get_Property(ext_imgui SOURCE_DIR)
set(IMGUI_SOURCE_DIR ${SOURCE_DIR})
FetchContent_Populate(ext_imgui)
FetchContent_GetProperties(ext_imgui SOURCE_DIR IMGUI_SOURCE_DIR)
8 changes: 4 additions & 4 deletions 3rdparty/qhull/qhull.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(ExternalProject)
include(FetchContent)

ExternalProject_Add(
FetchContent_Declare(
ext_qhull
PREFIX qhull
# v8.0.0+ causes seg fault
Expand All @@ -14,5 +14,5 @@ ExternalProject_Add(
INSTALL_COMMAND ""
)

ExternalProject_Get_Property(ext_qhull SOURCE_DIR)
set(QHULL_SOURCE_DIR ${SOURCE_DIR})
FetchContent_Populate(ext_qhull)
FetchContent_GetProperties(ext_qhull SOURCE_DIR QHULL_SOURCE_DIR)

0 comments on commit 172367e

Please sign in to comment.