Skip to content

Commit

Permalink
Merge branch 'main' of github.com:isl-org/Open3D into support-python-312
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Aug 20, 2024
2 parents ea0c66d + c219d82 commit 0c4132b
Show file tree
Hide file tree
Showing 59 changed files with 509 additions and 899 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 80
UseTab: Never
Standard: c++14
Standard: c++17
ContinuationIndentWidth: 8
AccessModifierOffset: -4
BinPackParameters: false
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ jobs:
echo "Add --gtest_random_seed=SEED to the test command to repeat this test sequence."
.\bin\${{ matrix.CONFIG }}\tests.exe --gtest_shuffle --gtest_filter=-*ReduceSum64bit2DCase0*:*ReduceSum64bit2DCase3*
- name: Linking to Open3D
working-directory: ${{ env.SRC_DIR }}/examples/cmake/open3d-cmake-find-package
run: |
$ErrorActionPreference = 'Stop'
git clone https://github.com/isl-org/open3d-cmake-find-package.git
cd open3d-cmake-find-package
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 `
Expand Down
170 changes: 75 additions & 95 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,15 @@ endfunction()
# LIBRARIES
# the expected library variable names to be found in <pkg>.
# If <pkg> also defines targets, use them instead and pass them via TARGETS option.
# PATHS
# Paths with hardcoded guesses. Same as in find_package.
# DEPENDS
# Adds targets that should be build before "name" as dependency.
#
function(open3d_find_package_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER;REQUIRED;QUIET" "PACKAGE;VERSION;PACKAGE_VERSION_VAR" "TARGETS;INCLUDE_DIRS;LIBRARIES" ${ARGN})
cmake_parse_arguments(arg "PUBLIC;HEADER;REQUIRED;QUIET"
"PACKAGE;VERSION;PACKAGE_VERSION_VAR"
"TARGETS;INCLUDE_DIRS;LIBRARIES;PATHS;DEPENDS" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_find_package_3rdparty_library(${name} ${ARGN})")
Expand All @@ -289,6 +295,9 @@ function(open3d_find_package_3rdparty_library name)
if(arg_QUIET)
list(APPEND find_package_args "QUIET")
endif()
if (arg_PATHS)
list(APPEND find_package_args PATHS ${arg_PATHS} NO_DEFAULT_PATH)
endif()
find_package(${arg_PACKAGE} ${find_package_args})
if(${arg_PACKAGE}_FOUND)
message(STATUS "Using installed third-party library ${name} ${${arg_PACKAGE}_VERSION}")
Expand Down Expand Up @@ -320,6 +329,9 @@ function(open3d_find_package_3rdparty_library name)
set(Open3D_3RDPARTY_EXTERNAL_MODULES ${Open3D_3RDPARTY_EXTERNAL_MODULES} PARENT_SCOPE)
endif()
endif()
if(arg_DEPENDS)
add_dependencies(${name} ${arg_DEPENDS})
endif()
set(${name}_FOUND TRUE PARENT_SCOPE)
set(${name}_VERSION ${${arg_PACKAGE_VERSION_VAR}} PARENT_SCOPE)
add_library(${PROJECT_NAME}::${name} ALIAS ${name})
Expand Down Expand Up @@ -425,7 +437,7 @@ function(open3d_import_3rdparty_library name)
else()
set(HIDDEN 0)
endif()
if(arg_GROUPED)
if(arg_GROUPED AND UNIX AND NOT APPLE)
target_link_libraries(${name} INTERFACE "-Wl,--start-group")
endif()
foreach(arg_LIBRARY IN LISTS arg_LIBRARIES)
Expand Down Expand Up @@ -454,7 +466,7 @@ function(open3d_import_3rdparty_library name)
${OPEN3D_HIDDEN_3RDPARTY_LINK_OPTIONS} PARENT_SCOPE)
endif()
endforeach()
if(arg_GROUPED)
if(arg_GROUPED AND UNIX AND NOT APPLE)
target_link_libraries(${name} INTERFACE "-Wl,--end-group")
endif()
endif()
Expand Down Expand Up @@ -1231,6 +1243,10 @@ if(BUILD_GUI)
# If the default version is not sufficient, look for some specific versions
if(NOT FILAMENT_C_COMPILER OR NOT FILAMENT_CXX_COMPILER)
find_program(CLANG_VERSIONED_CC NAMES
clang-19
clang-18
clang-17
clang-16
clang-15
clang-14
clang-13
Expand All @@ -1242,6 +1258,10 @@ if(BUILD_GUI)
clang-7
)
find_program(CLANG_VERSIONED_CXX NAMES
clang++-19
clang++-18
clang++-17
clang++-16
clang++-15
clang++-14
clang++-13
Expand Down Expand Up @@ -1269,7 +1289,7 @@ if(BUILD_GUI)
#
# On aarch64, the symbolic link path may not work for CMake's
# find_library. Therefore, when compiling Filament from source,
# we explicitly find the corresponidng path based on the clang
# we explicitly find the corresponding path based on the clang
# version.
execute_process(COMMAND ${FILAMENT_CXX_COMPILER} --version OUTPUT_VARIABLE clang_version)
if(clang_version MATCHES "clang version ([0-9]+)")
Expand Down Expand Up @@ -1311,24 +1331,10 @@ if(BUILD_GUI)
# We first search for these paths, and then search CMake's default
# search path. LLVM version must be >= 7 to compile Filament.
if (NOT CLANG_LIBDIR)
set(ubuntu_default_llvm_lib_dirs
/usr/lib/llvm-19/lib
/usr/lib/llvm-18/lib
/usr/lib/llvm-17/lib
/usr/lib/llvm-16/lib
/usr/lib/llvm-15/lib
/usr/lib/llvm-14/lib
/usr/lib/llvm-13/lib
/usr/lib/llvm-12/lib
/usr/lib/llvm-11/lib
/usr/lib/llvm-10/lib
/usr/lib/llvm-9/lib
/usr/lib/llvm-8/lib
/usr/lib/llvm-7/lib
)
foreach(llvm_lib_dir in ${ubuntu_default_llvm_lib_dirs})
message(STATUS "Searching ${llvm_lib_dir} for libc++ and libc++abi")
find_library(CPP_LIBRARY c++ PATHS ${llvm_lib_dir} NO_DEFAULT_PATH)
message(STATUS "Searching /usr/lib/llvm-[7..19]/lib/ for libc++ and libc++abi")
foreach(llvm_ver RANGE 7 19)
set(llvm_lib_dir "/usr/lib/llvm-${llvm_ver}/lib")
find_library(CPP_LIBRARY c++ PATHS ${llvm_lib_dir} NO_DEFAULT_PATH)
find_library(CPPABI_LIBRARY c++abi PATHS ${llvm_lib_dir} NO_DEFAULT_PATH)
if (CPP_LIBRARY AND CPPABI_LIBRARY)
set(CLANG_LIBDIR ${llvm_lib_dir})
Expand All @@ -1341,6 +1347,7 @@ if(BUILD_GUI)
# Fallback to non-ubuntu-default paths. Note that the PATH_SUFFIXES
# is not enforced by CMake.
if (NOT CLANG_LIBDIR)
message(STATUS "Clang C++ libraries not found. Searching other paths...")
find_library(CPPABI_LIBRARY c++abi PATH_SUFFIXES
llvm-19/lib
llvm-18/lib
Expand Down Expand Up @@ -1371,8 +1378,7 @@ if(BUILD_GUI)
# Ensure that libstdc++ gets linked first.
target_link_libraries(3rdparty_filament INTERFACE -lstdc++
${CPP_LIBRARY} ${CPPABI_LIBRARY})
message(STATUS "CPP_LIBRARY: ${CPP_LIBRARY}")
message(STATUS "CPPABI_LIBRARY: ${CPPABI_LIBRARY}")
message(STATUS "Filament C++ libraries: ${CPP_LIBRARY} ${CPPABI_LIBRARY}")
endif()
if (APPLE)
find_library(CORE_VIDEO CoreVideo)
Expand Down Expand Up @@ -1531,34 +1537,14 @@ if(BUILD_SYCL_MODULE)
endif()

if(BUILD_SYCL_MODULE)
option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB/DPL." ON)
option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB." ON)
else()
option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB/DPL." OFF)
option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB." OFF)
endif()
mark_as_advanced(OPEN3D_USE_ONEAPI_PACKAGES)

if(OPEN3D_USE_ONEAPI_PACKAGES)
# 1. oneTBB
# /opt/intel/oneapi/tbb/latest/lib/cmake/tbb
open3d_find_package_3rdparty_library(3rdparty_tbb
PACKAGE TBB
TARGETS TBB::tbb
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb)
target_compile_definitions(3rdparty_tbb INTERFACE OPEN3D_USE_ONEAPI_PACKAGES=1)
target_compile_definitions(3rdparty_tbb INTERFACE _PSTL_UDR_PRESENT=0)
target_compile_definitions(3rdparty_tbb INTERFACE _PSTL_UDS_PRESENT=0)
# 2. oneDPL
# /opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL
open3d_find_package_3rdparty_library(3rdparty_onedpl
PACKAGE oneDPL
TARGETS oneDPL
)
target_compile_definitions(3rdparty_onedpl INTERFACE _GLIBCXX_USE_TBB_PAR_BACKEND=0)
target_compile_definitions(3rdparty_onedpl INTERFACE PSTL_USE_PARALLEL_POLICIES=0)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_onedpl)

# 3. oneMKL
# 1. oneMKL
# /opt/intel/oneapi/mkl/latest/lib/cmake/mkl
set(MKL_THREADING tbb_thread)
set(MKL_LINK static)
Expand All @@ -1577,40 +1563,15 @@ if(OPEN3D_USE_ONEAPI_PACKAGES)
target_compile_definitions(3rdparty_mkl INTERFACE OPEN3D_USE_ONEAPI_PACKAGES)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_mkl)

else() # if(OPEN3D_USE_ONEAPI_PACKAGES)
# TBB
if(USE_SYSTEM_TBB)
open3d_find_package_3rdparty_library(3rdparty_tbb
PACKAGE TBB
TARGETS TBB::tbb
)
if(NOT 3rdparty_tbb_FOUND)
set(USE_SYSTEM_TBB OFF)
endif()
endif()
if(NOT USE_SYSTEM_TBB)
include(${Open3D_3RDPARTY_DIR}/mkl/tbb.cmake)
open3d_import_3rdparty_library(3rdparty_tbb
INCLUDE_DIRS ${STATIC_TBB_INCLUDE_DIR}
LIB_DIR ${STATIC_TBB_LIB_DIR}
LIBRARIES ${STATIC_TBB_LIBRARIES}
DEPENDS ext_tbb
)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_tbb)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb)
endif()

# parallelstl
include(${Open3D_3RDPARTY_DIR}/parallelstl/parallelstl.cmake)
open3d_import_3rdparty_library(3rdparty_parallelstl
PUBLIC
INCLUDE_DIRS ${PARALLELSTL_INCLUDE_DIRS}
INCLUDE_ALL
DEPENDS ext_parallelstl
# 2. oneTBB
# /opt/intel/oneapi/tbb/latest/lib/cmake/tbb
open3d_find_package_3rdparty_library(3rdparty_tbb
PACKAGE TBB
TARGETS TBB::tbb
)
list(APPEND Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_SYSTEM Open3D::3rdparty_parallelstl)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb)

else(OPEN3D_USE_ONEAPI_PACKAGES)
# MKL/BLAS
if(USE_BLAS)
if (USE_SYSTEM_BLAS)
Expand Down Expand Up @@ -1722,6 +1683,7 @@ else() # if(OPEN3D_USE_ONEAPI_PACKAGES)
# https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html
message(STATUS "Using MKL to support BLAS and LAPACK functionalities.")
open3d_import_3rdparty_library(3rdparty_blas
GROUPED
HIDDEN
INCLUDE_DIRS ${STATIC_MKL_INCLUDE_DIR}
LIB_DIR ${STATIC_MKL_LIB_DIR}
Expand All @@ -1735,7 +1697,25 @@ else() # if(OPEN3D_USE_ONEAPI_PACKAGES)
target_compile_definitions(3rdparty_blas INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:MKL_ILP64>")
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_blas)
endif()
endif() # if(OPEN3D_USE_ONEAPI_PACKAGES)

# TBB
if(USE_SYSTEM_TBB)
open3d_find_package_3rdparty_library(3rdparty_tbb
PACKAGE TBB
TARGETS TBB::tbb
)
if(NOT 3rdparty_tbb_FOUND)
set(USE_SYSTEM_TBB OFF)
endif()
endif()
if(NOT USE_SYSTEM_TBB)
include(${Open3D_3RDPARTY_DIR}/mkl/tbb.cmake)
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM TBB::tbb)
else()
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb)
endif()

endif(OPEN3D_USE_ONEAPI_PACKAGES)

# cuBLAS
if(BUILD_CUDA_MODULE)
Expand Down Expand Up @@ -1848,26 +1828,26 @@ if (BUILD_CUDA_MODULE)
endif ()

# IPP
if (WITH_IPPICV)
if (WITH_IPP)
# Ref: https://stackoverflow.com/a/45125525
set(IPPICV_SUPPORTED_HW AMD64 x86_64 x64 x86 X86 i386 i686)
set(IPP_SUPPORTED_HW AMD64 x86_64 x64) # 32 bit deprecated: x86 X86 i386 i686
# Unsupported: ARM64 aarch64 armv7l armv8b armv8l ...
if (NOT CMAKE_HOST_SYSTEM_PROCESSOR IN_LIST IPPICV_SUPPORTED_HW)
set(WITH_IPPICV OFF)
message(WARNING "IPP-ICV disabled: Unsupported Platform.")
if (NOT CMAKE_HOST_SYSTEM_PROCESSOR IN_LIST IPP_SUPPORTED_HW)
set(WITH_IPP OFF)
message(WARNING "Intel IPP disabled: Unsupported Platform.")
else ()
include(${Open3D_3RDPARTY_DIR}/ippicv/ippicv.cmake)
if (WITH_IPPICV)
message(STATUS "IPP-ICV ${IPPICV_VERSION_STRING} available. Building interface wrappers IPP-IW.")
open3d_import_3rdparty_library(3rdparty_ippicv
include(${Open3D_3RDPARTY_DIR}/ipp/ipp.cmake)
if (WITH_IPP)
message(STATUS "Using Intel IPP ${IPP_VERSION_STRING}.")
open3d_import_3rdparty_library(3rdparty_ipp
HIDDEN
INCLUDE_DIRS ${IPPICV_INCLUDE_DIR}
LIBRARIES ${IPPICV_LIBRARIES}
LIB_DIR ${IPPICV_LIB_DIR}
DEPENDS ext_ippicv
INCLUDE_DIRS ${IPP_INCLUDE_DIR}
LIBRARIES ${IPP_LIBRARIES}
LIB_DIR ${IPP_LIB_DIR}
DEPENDS ext_ipp
)
target_compile_definitions(3rdparty_ippicv INTERFACE ${IPPICV_DEFINITIONS})
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_ippicv)
target_compile_definitions(3rdparty_ipp INTERFACE IPP_VERSION_INT=${IPP_VERSION_INT})
list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_ipp)
endif()
endif()
endif ()
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/imgui/imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ FetchContent_Declare(
INSTALL_COMMAND ""
)

FetchContent_Populate(ext_imgui)
FetchContent_MakeAvailable(ext_imgui)
FetchContent_GetProperties(ext_imgui SOURCE_DIR IMGUI_SOURCE_DIR)
File renamed without changes.
60 changes: 60 additions & 0 deletions 3rdparty/ipp/ipp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Output variables:
# - IPP_INCLUDE_DIR
# - IPP_LIBRARIES
# - IPP_LIB_DIR
# - IPP_VERSION_STRING
# - IPP_VERSION_INT (for version check)

include(ExternalProject)

# These archives are created from the pip wheels for ipp-static, ipp-devel and
# ipp-include and excluding the shared libraries to reduce download size.
# Check in order APPLE -> WIN32 -> UNIX, since UNIX may be defined on APPLE / WIN32 as well
set(IPP_VERSION_STRING "2021.11.0") # From ipp/ippversion.h
set(IPP_VERSION_INT 20211100)
if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64)
set(IPP_VERSION_STRING "2021.9.1") # From ipp/ippversion.h
set(IPP_VERSION_INT 20210901)
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.9.1-macosx_10_15_x86_64.tar.xz")
set(IPP_HASH "f27e45da604a1f6d1d2a747a0f67ffafeaff084b0f860a963d8c3996e2f40bb3")
elseif(WIN32 AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64)
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.11.0-win_amd64.zip")
set(IPP_HASH "69e8a7dc891609de6fea478a67659d2f874d12b51a47bd2e3e5a7c4c473c53a6")
elseif(UNIX AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64)
set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.11.0-linux_x86_64.tar.xz")
set(IPP_HASH "51f33fd5bf5011e9eae0e034e5cc70a7c0ac0ba93d6a3f66fd7e145cf1a5e30b")
else()
set(WITH_IPP OFF)
message(FATAL_ERROR "Intel IPP disabled: Unsupported Platform.")
return()
endif()

if(WIN32)
set(IPP_SUBPATH "Library/")
else()
set(IPP_SUBPATH "")
endif()

ExternalProject_Add(ext_ipp
PREFIX ipp
URL ${IPP_URL}
URL_HASH SHA256=${IPP_HASH}
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/ipp"
# Copy all libs from lib/tl/tbb to lib/ since Open3D cmake scripts only support one LIB_DIR per dependency
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/${IPP_SUBPATH}lib/tl/tbb/ <SOURCE_DIR>/${IPP_SUBPATH}lib/
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(ext_ipp SOURCE_DIR)
set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/")
# Threading layer libs must be linked first.
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html
# Library dependency order:
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html
if (WIN32)
set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt)
else()
set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore)
endif()
set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib")
Loading

0 comments on commit 0c4132b

Please sign in to comment.