diff --git a/.clang-format b/.clang-format index 63f78edb55a..e7623066a4d 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ BasedOnStyle: Google IndentWidth: 4 ColumnLimit: 80 UseTab: Never -Standard: c++14 +Standard: c++17 ContinuationIndentWidth: 8 AccessModifierOffset: -4 BinPackParameters: false diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 57faf093a81..b7b2226cb85 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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 ` diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index eb47efb68a2..74aa40c3b33 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -266,9 +266,15 @@ endfunction() # LIBRARIES # the expected library variable names to be found in . # If 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})") @@ -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}") @@ -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}) @@ -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) @@ -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() @@ -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 @@ -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 @@ -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]+)") @@ -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}) @@ -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 @@ -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) @@ -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) @@ -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) @@ -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} @@ -1735,7 +1697,25 @@ else() # if(OPEN3D_USE_ONEAPI_PACKAGES) target_compile_definitions(3rdparty_blas INTERFACE "$<$: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) @@ -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 () diff --git a/3rdparty/imgui/imgui.cmake b/3rdparty/imgui/imgui.cmake index 12ea3175736..064d227c1f9 100644 --- a/3rdparty/imgui/imgui.cmake +++ b/3rdparty/imgui/imgui.cmake @@ -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) diff --git a/3rdparty/ippicv/LICENSE b/3rdparty/ipp/LICENSE similarity index 100% rename from 3rdparty/ippicv/LICENSE rename to 3rdparty/ipp/LICENSE diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake new file mode 100755 index 00000000000..ffc9b320512 --- /dev/null +++ b/3rdparty/ipp/ipp.cmake @@ -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 /${IPP_SUBPATH}lib/tl/tbb/ /${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") \ No newline at end of file diff --git a/3rdparty/ippicv/CMakeLists.txt b/3rdparty/ippicv/CMakeLists.txt deleted file mode 100644 index a5780e29438..00000000000 --- a/3rdparty/ippicv/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# Adapted from https://github.com/opencv/opencv/blob/master/3rdparty/ippicv/CMakeLists.txt -cmake_minimum_required(VERSION 3.0) -project(ippiw) - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -file(GLOB lib_srcs iw/src/*.c) -file(GLOB lib_hdrs iw/include/*.h iw/include/iw/*.h iw/include/iw++/*.hpp) -file(GLOB IPPICV_LIBRARY - icv/lib/*/${CMAKE_STATIC_LIBRARY_PREFIX}*${CMAKE_STATIC_LIBRARY_SUFFIX}) - -add_library(ippiw STATIC ${lib_srcs} ${lib_hdrs}) -target_compile_definitions(ippiw PRIVATE IW_BUILD ICV_BASE) -target_include_directories(ippiw PRIVATE icv/include iw/include) -target_compile_definitions(ippiw PRIVATE IW_ENABLE_iwiResize_Nearest=1) - -if(UNIX) - if(${CMAKE_C_COMPILER_ID} MATCHES GNU OR - ${CMAKE_C_COMPILER_ID} MATCHES Clang OR - ${CMAKE_C_COMPILER_ID} MATCHES Intel) - target_compile_options(ippiw PRIVATE -Wno-unused-function -Wno-missing-braces -Wno-missing-field-initializers) - endif() - if(${CMAKE_C_COMPILER_ID} MATCHES Clang) - target_compile_options(ippiw PRIVATE -Wno-self-assign) - endif() -endif() - -install(TARGETS ippiw - ARCHIVE DESTINATION lib) -install(FILES ${IPPICV_LIBRARY} - DESTINATION lib) -install(DIRECTORY iw/include/ DESTINATION include - FILES_MATCHING PATTERN "*.h*") -install(DIRECTORY icv/include/ DESTINATION include/icv - FILES_MATCHING PATTERN "*.h*") diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake deleted file mode 100755 index e889378f47a..00000000000 --- a/3rdparty/ippicv/ippicv.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# Adapted from: https://github.com/opencv/opencv/blob/master/3rdparty/ippicv/ippicv.cmake -# Downloads IPPICV libraries from the OpenCV 3rd party repo - -include(ExternalProject) - -# Commit SHA in the opencv_3rdparty repo -set(IPPICV_COMMIT "a56b6ac6f030c312b2dce17430eef13aed9af274") -# Check in order APPLE -> WIN32 -> UNIX, since UNIX may be defined on APPLE / -# WIN32 as well -if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64) - set(OPENCV_ICV_NAME "ippicv_2020_mac_intel64_20191018_general.tgz") - set(OPENCV_ICV_HASH "3a39aad1eef2f6019dda9555f6db2d34063c1e464dc0e498eaa0c6b55817f2fe") -elseif(WIN32 AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64) - set(OPENCV_ICV_NAME "ippicv_2020_win_intel64_20191018_general.zip") - set(OPENCV_ICV_HASH "e64e09f8a2e121d4fff440fb12b1298bc0760f1391770aefe5d1deb6630352b7") -elseif(WIN32 AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES 86) # {x86, i386, i686} - set(OPENCV_ICV_NAME "ippicv_2020_win_ia32_20191018_general.zip") - set(OPENCV_ICV_HASH "c1e0e26f32aec4374df05a145cfac09774e15f9b53f0bdfaac3eca3205db6106") -elseif(UNIX AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64) - set(OPENCV_ICV_NAME "ippicv_2020_lnx_intel64_20191018_general.tgz") - set(OPENCV_ICV_HASH "08627fa5660d52d59309a572dd7db5b9c8aea234cfa5aee0942a1dd903554246") -elseif(UNIX AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES 86) # {x86, i386, i686} - set(OPENCV_ICV_NAME "ippicv_2020_lnx_ia32_20191018_general.tgz") - set(OPENCV_ICV_HASH "acf8976ddea689b6d8c9640d6cfa6852d5c74c1fc368b57029b13ed7714fbd95") -else() - set(WITH_IPPICV OFF) - message(FATAL_ERROR "IPP-ICV disabled: Unsupported Platform.") - return() -endif() - -if(WIN32) - set(lib_name ippicvmt) -else() - set(lib_name ippicv) -endif() - -ExternalProject_Add(ext_ippicv - PREFIX ippicv - URL https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/${OPENCV_ICV_NAME} - URL_HASH SHA256=${OPENCV_ICV_HASH} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/ippicv" - UPDATE_COMMAND "" - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ippicv/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX= - ${ExternalProject_CMAKE_ARGS_hidden} - BUILD_BYPRODUCTS - /lib/${CMAKE_STATIC_LIBRARY_PREFIX}ippiw${CMAKE_STATIC_LIBRARY_SUFFIX} - /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - -ExternalProject_Get_Property(ext_ippicv INSTALL_DIR) -set(IPPICV_INCLUDE_DIR "${INSTALL_DIR}/include/icv/" "${INSTALL_DIR}/include/") -set(IPPICV_LIBRARIES ippiw ${lib_name}) -set(IPPICV_LIB_DIR "${INSTALL_DIR}/lib") -set(IPPICV_VERSION_STRING "2020.0.0 Gold") # From icv/ippversion.h diff --git a/3rdparty/mkl/0001-Allow-selecttion-of-static-dynamic-MSVC-runtime.patch b/3rdparty/mkl/0001-Allow-selecttion-of-static-dynamic-MSVC-runtime.patch deleted file mode 100644 index 9dc35dd1455..00000000000 --- a/3rdparty/mkl/0001-Allow-selecttion-of-static-dynamic-MSVC-runtime.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 92e3a4717f888c9e97e22f9e7e83fc15c8aa15ae Mon Sep 17 00:00:00 2001 -From: Yixing Lao -Date: Mon, 14 Sep 2020 03:30:00 -0700 -Subject: [PATCH] Allow selecttion of static/dynamic MSVC runtime - ---- - CMakeLists.txt | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e05f27a..5a0c680 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,5 +1,15 @@ - cmake_minimum_required(VERSION 3.1 FATAL_ERROR) - -+##### begin open3d patch -+if(POLICY CMP0091) -+ cmake_policy(SET CMP0091 NEW) -+endif() -+option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF) -+if(STATIC_WINDOWS_RUNTIME) -+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -+endif() -+##### end open3d patch -+ - if (POLICY CMP0048) - # cmake warns if loaded from a min-3.0-required parent dir, so silence the warning: - cmake_policy(SET CMP0048 NEW) --- -2.27.0.windows.1 - diff --git a/3rdparty/mkl/mkl.cmake b/3rdparty/mkl/mkl.cmake index 6a8a923717b..bff63b0faa5 100644 --- a/3rdparty/mkl/mkl.cmake +++ b/3rdparty/mkl/mkl.cmake @@ -7,52 +7,28 @@ # # The name "STATIC" is used to avoid naming collisions for other 3rdparty CMake # files (e.g. PyTorch) that also depends on MKL. -# FIXME: anaconda.org URLs don't work anymore. include(ExternalProject) +# These files are created from the pip MKL devel packages, and only contain +# headers, static libraries, and cmake export files. Shared libraries are +# excluded to reduce download size. Alternately, use: +# pip download -d mkl_static/win_amd64 --platform win_amd64 --no-deps mkl-include==2024.1 mkl-devel==2024.1 mkl-static==2024.1 +# pip download -d mkl_static/linux_x86_64 --platform manylinux1_x86_64 --no-deps mkl-include==2024.1 mkl-devel==2024.1 mkl-static==2024.1 +# pip download -d mkl_static/macosx_x86_64 --platform macosx_11_0_x86_64 --no-deps mkl-include==2023.2.2 mkl-devel==2023.2.2 mkl-static==2023.2.2 +# Extract all files: +# cd mkl_static/win_amd64 && for whl in *.whl; do wheel unpack $whl; done; +# Arrange in the standard layout: bin, include, lib (cmake, pkgconfig), share (cmake) +# Archive and upload to GitHub releases open3d_downloads. if(WIN32) - set(MKL_INCLUDE_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-include-2020.1-intel_216-win-64.tar.bz2 - https://anaconda.org/intel/mkl-include/2020.1/download/win-64/mkl-include-2020.1-intel_216.tar.bz2 - ) - set(MKL_INCLUDE_SHA256 65cedb770358721fd834224cd8be1fe1cc10b37ef2a1efcc899fc2fefbeb5b31) - - set(MKL_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-static-2020.1-intel_216-win-64.tar.bz2 - https://anaconda.org/intel/mkl-static/2020.1/download/win-64/mkl-static-2020.1-intel_216.tar.bz2 - ) - set(MKL_SHA256 c6f037aa9e53501d91d5245b6e65020399ebf34174cc4d03637818ebb6e6b6b9) + set(MKL_URL https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/mkl_static-2024.1.0-win_amd64.zip) + set(MKL_SHA256 524de5395db5b7a9d9f0d9a76b2223c6edac429d4492c6a1cc79a5c22c4f3346) elseif(APPLE) - set(MKL_INCLUDE_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-include-2020.1-intel_216-osx-64.tar.bz2 - https://anaconda.org/intel/mkl-include/2020.1/download/osx-64/mkl-include-2020.1-intel_216.tar.bz2 - ) - set(MKL_INCLUDE_SHA256 d4d025bd17ce75b92c134f70759b93ae1dee07801d33bcc59e40778003f05de5) - - set(MKL_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-static-2020.1-intel_216-osx-64.tar.bz2 - https://anaconda.org/intel/mkl-static/2020.1/download/osx-64/mkl-static-2020.1-intel_216.tar.bz2 - ) - set(MKL_SHA256 ca94ab8933cf58cbb7b42ac1bdc8671a948490fd1e0e9cea71a5b4d613b21be4) + set(MKL_URL https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/mkl_static-2023.2.2.9-macosx_x86_64.tar.xz) + set(MKL_SHA256 6cd93bf1d37527d3ab3657e22c1a8a409729d6c6f422c7c381c7a145aa588d6c) else() - set(MKL_INCLUDE_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-include-2020.1-intel_217-linux-64.tar.bz2 - https://anaconda.org/intel/mkl-include/2020.1/download/linux-64/mkl-include-2020.1-intel_217.tar.bz2 - ) - set(MKL_INCLUDE_SHA256 c0c4e7f261aa9182d811b91132c622211e55a5f3dfb8afb65a5377804f39eb61) - - set(MKL_URL - https://github.com/isl-org/Open3D/releases/download/v0.12.0/mkl-static-2020.1-intel_217-linux-64.tar.bz2 - https://anaconda.org/intel/mkl-static/2020.1/download/linux-64/mkl-static-2020.1-intel_217.tar.bz2 - ) - set(MKL_SHA256 44fe60fa895c8967fe7c70fd1b680700f23ecac6ae038b267aa0a0c48dce3d59) - - # URL for merged libmkl_merged.a for Ubuntu. - set(MKL_MERGED_URL - https://github.com/isl-org/Open3D/releases/download/v0.10.0/linux-merged-mkl-static-2020.1-intel_217.zip - ) - set(MKL_MERGED_SHA256 027c2b0d89c554479edbe5faecb93c26528877c1b682f939f8e1764d96860064) + set(MKL_URL https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/mkl_static-2024.1.0-linux_x86_64.tar.xz) + set(MKL_SHA256 f37c9440e3d664d21889a4607effcd47472bcce347da6c2bfc7aae991971b499) endif() # Where MKL and TBB headers and libs will be installed. @@ -62,17 +38,6 @@ set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/include/") set(STATIC_MKL_LIB_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_LIB_DIR}") if(WIN32) - ExternalProject_Add( - ext_mkl_include - PREFIX mkl_include - URL ${MKL_INCLUDE_URL} - URL_HASH SHA256=${MKL_INCLUDE_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mkl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /Library/include ${MKL_INSTALL_PREFIX}/include - ) ExternalProject_Add( ext_mkl PREFIX mkl @@ -83,6 +48,7 @@ if(WIN32) CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /Library/lib ${STATIC_MKL_LIB_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory /Library/include ${MKL_INSTALL_PREFIX}/include BUILD_BYPRODUCTS ${STATIC_MKL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}mkl_intel_ilp64${CMAKE_STATIC_LIBRARY_SUFFIX} ${STATIC_MKL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}mkl_core${CMAKE_STATIC_LIBRARY_SUFFIX} @@ -97,23 +63,10 @@ if(WIN32) mkl_core mkl_sequential mkl_tbb_thread - tbb_static - ) - list(REMOVE_ITEM MKL_LIBRARIES "$<$:mkl_tbb_thread>") - list(REMOVE_ITEM MKL_LIBRARIES "$<$:tbb_static>") - list(REMOVE_ITEM MKL_LIBRARIES "$<$:mkl_sequential>") -elseif(APPLE) - ExternalProject_Add( - ext_mkl_include - PREFIX mkl_include - URL ${MKL_INCLUDE_URL} - URL_HASH SHA256=${MKL_INCLUDE_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mkl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${MKL_INSTALL_PREFIX}/include ) + list(REMOVE_ITEM STATIC_MKL_LIBRARIES "$<$:mkl_tbb_thread>") + list(REMOVE_ITEM STATIC_MKL_LIBRARIES "$<$:mkl_sequential>") +else() ExternalProject_Add( ext_mkl PREFIX mkl @@ -124,75 +77,11 @@ elseif(APPLE) CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /lib ${STATIC_MKL_LIB_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${MKL_INSTALL_PREFIX}/include BUILD_BYPRODUCTS ${STATIC_MKL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}mkl_intel_ilp64${CMAKE_STATIC_LIBRARY_SUFFIX} ${STATIC_MKL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}mkl_tbb_thread${CMAKE_STATIC_LIBRARY_SUFFIX} ${STATIC_MKL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}mkl_core${CMAKE_STATIC_LIBRARY_SUFFIX} ) - set(STATIC_MKL_LIBRARIES mkl_intel_ilp64 mkl_tbb_thread mkl_core tbb_static) -else() - ExternalProject_Add( - ext_mkl_include - PREFIX mkl_include - URL ${MKL_INCLUDE_URL} - URL_HASH SHA256=${MKL_INCLUDE_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mkl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${MKL_INSTALL_PREFIX}/include - ) - option(USE_LINUX_MKL_FROM_CONDA_REPO "On linux, use MKL from official conda repo" OFF) - if(USE_LINUX_MKL_FROM_CONDA_REPO) - # Resolving static library circular dependencies. - # - Approach 1: Add `-Wl,--start-group` `-Wl,--end-group` around, but this - # is not friendly with CMake. - # - Approach 2: Set LINK_INTERFACE_MULTIPLICITY to 3. However this does not - # work directly with interface library, and requires big - # changes to the build system. See discussions in: - # - https://gitlab.kitware.com/cmake/cmake/-/issues/17964 - # - https://gitlab.kitware.com/cmake/cmake/-/issues/18415 - # - https://stackoverflow.com/q/50166553/1255535 - # - Approach 3: Merge libmkl_intel_ilp64.a, libmkl_tbb_thread.a and - # libmkl_core.a into libmkl_merged.a. This is the most simple - # approach to integrate with the build system. However, extra - # time is required to merge the libraries and the merged - # library size can be large. We choose to use approach 3. - ExternalProject_Add( - ext_mkl - PREFIX mkl - URL ${MKL_URL} - URL_HASH SHA256=${MKL_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mkl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE ON - BUILD_COMMAND echo "Extracting static libs..." - COMMAND ar x lib/libmkl_intel_ilp64.a - COMMAND ar x lib/libmkl_tbb_thread.a - COMMAND ar x lib/libmkl_core.a - COMMAND echo "Merging static libs..." - COMMAND bash -c "ar -qc lib/libmkl_merged.a *.o" - COMMAND echo "Cleaning up *.o files..." - COMMAND bash -c "rm *.o" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy lib/libmkl_merged.a ${STATIC_MKL_LIB_DIR}/libmkl_merged.a - BUILD_BYPRODUCTS ${STATIC_MKL_LIB_DIR}/libmkl_merged.a - ) - else() - # We also provide a direct download for libmkl_merged.a. - ExternalProject_Add( - ext_mkl - PREFIX mkl - URL ${MKL_MERGED_URL} - URL_HASH SHA256=${MKL_MERGED_SHA256} - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/mkl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE ON - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy lib/libmkl_merged.a ${STATIC_MKL_LIB_DIR}/libmkl_merged.a - BUILD_BYPRODUCTS ${STATIC_MKL_LIB_DIR}/libmkl_merged.a - ) - endif() - set(STATIC_MKL_LIBRARIES mkl_merged tbb_static) + set(STATIC_MKL_LIBRARIES mkl_intel_ilp64 mkl_tbb_thread mkl_core) endif() diff --git a/3rdparty/mkl/tbb.cmake b/3rdparty/mkl/tbb.cmake index b87ef79fe3b..385af4b644b 100644 --- a/3rdparty/mkl/tbb.cmake +++ b/3rdparty/mkl/tbb.cmake @@ -1,50 +1,40 @@ # TBB build scripts. -# -# - STATIC_TBB_INCLUDE_DIR -# - STATIC_TBB_LIB_DIR -# - STATIC_TBB_LIBRARIES -# -# Notes: -# The name "STATIC" is used to avoid naming collisions for other 3rdparty CMake -# files (e.g. PyTorch) that also depends on MKL. -include(ExternalProject) +include(FetchContent) +cmake_policy(SET CMP0077 NEW) # Where MKL and TBB headers and libs will be installed. # This needs to be consistent with mkl.cmake. set(MKL_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/mkl_install) -set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/include/") +set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_INCLUDE_DIR}/") set(STATIC_MKL_LIB_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_LIB_DIR}") -# TBB variables exported for PyTorch Ops and TensorFlow Ops -set(STATIC_TBB_INCLUDE_DIR "${STATIC_MKL_INCLUDE_DIR}") -set(STATIC_TBB_LIB_DIR "${STATIC_MKL_LIB_DIR}") -set(STATIC_TBB_LIBRARIES tbb_static tbbmalloc_static) - -find_package(Git QUIET REQUIRED) - -ExternalProject_Add( +# Save and restore BUILD_SHARED_LIBS since TBB must be built as a shared library +set(_build_shared_libs ${BUILD_SHARED_LIBS}) +set(BUILD_SHARED_LIBS ON) +set(_win_exp_all_syms ${CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS}) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF) # ON interferes with TBB symbols +FetchContent_Declare( ext_tbb - PREFIX tbb - URL https://github.com/wjakob/tbb/archive/141b0e310e1fb552bdca887542c9c1a8544d6503.tar.gz # Sept 2020 - URL_HASH SHA256=bb29b76eabf7549660e3dba2feb86ab501469432a15fb0bf2c21e24d6fbc4c72 + URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.12.0.tar.gz # April 2024 + URL_HASH SHA256=c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/tbb" - UPDATE_COMMAND "" - PATCH_COMMAND ${GIT_EXECUTABLE} init - COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace - ${CMAKE_CURRENT_LIST_DIR}/0001-Allow-selecttion-of-static-dynamic-MSVC-runtime.patch - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${MKL_INSTALL_PREFIX} - -DSTATIC_WINDOWS_RUNTIME=${STATIC_WINDOWS_RUNTIME} - -DTBB_BUILD_TBBMALLOC=ON - -DTBB_BUILD_TBBMALLOC_PROXYC=OFF - -DTBB_BUILD_SHARED=OFF - -DTBB_BUILD_STATIC=ON - -DTBB_BUILD_TESTS=OFF - -DTBB_INSTALL_ARCHIVE_DIR=${Open3D_INSTALL_LIB_DIR} - -DTBB_CMAKE_PACKAGE_INSTALL_DIR=${Open3D_INSTALL_LIB_DIR}/cmake/tbb - ${ExternalProject_CMAKE_ARGS_hidden} - BUILD_BYPRODUCTS - ${STATIC_TBB_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}tbb_static${CMAKE_STATIC_LIBRARY_SUFFIX} - ${STATIC_TBB_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}tbbmalloc_static${CMAKE_STATIC_LIBRARY_SUFFIX} +) +set(TBBMALLOC_BUILD OFF CACHE BOOL "Enable tbbmalloc build.") +set(TBBMALLOC_PROXY_BUILD OFF CACHE BOOL "Enable tbbmalloc_proxy build.") +set(TBB_TEST OFF CACHE BOOL "Build TBB tests.") +set(TBB_INSTALL OFF CACHE BOOL "Enable installation") +set(TBB_STRICT OFF CACHE BOOL "Treat compiler warnings as errors") +FetchContent_MakeAvailable(ext_tbb) +set(BUILD_SHARED_LIBS ${_build_shared_libs}) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ${_win_exp_all_syms}) + +# TBB is built and linked as a shared library - this is different from all other Open3D dependencies. +install(TARGETS tbb EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${Open3D_INSTALL_LIB_DIR} # Windows .lib files + COMPONENT tbb + LIBRARY DESTINATION ${Open3D_INSTALL_LIB_DIR} + COMPONENT tbb + RUNTIME DESTINATION ${Open3D_INSTALL_BIN_DIR} + COMPONENT tbb ) diff --git a/3rdparty/parallelstl/LICENSE b/3rdparty/parallelstl/LICENSE deleted file mode 100644 index bd8b243dfa0..00000000000 --- a/3rdparty/parallelstl/LICENSE +++ /dev/null @@ -1,218 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ---- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. diff --git a/3rdparty/parallelstl/parallelstl.cmake b/3rdparty/parallelstl/parallelstl.cmake deleted file mode 100644 index 981b564fcbc..00000000000 --- a/3rdparty/parallelstl/parallelstl.cmake +++ /dev/null @@ -1,16 +0,0 @@ -include(ExternalProject) - -ExternalProject_Add( - ext_parallelstl - PREFIX parallelstl - URL https://github.com/oneapi-src/oneDPL/archive/refs/tags/20190522.tar.gz - URL_HASH SHA256=40d78c3405a42f781348b5bc9038cb0ce1147591e07fca7329538c9842d36a7b - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/parallelstl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) - -ExternalProject_Get_Property(ext_parallelstl SOURCE_DIR) -set(PARALLELSTL_INCLUDE_DIRS ${SOURCE_DIR}/include/) # "/" is critical. diff --git a/3rdparty/qhull/qhull.cmake b/3rdparty/qhull/qhull.cmake index fe15e83ca6f..3a02500dfe8 100644 --- a/3rdparty/qhull/qhull.cmake +++ b/3rdparty/qhull/qhull.cmake @@ -8,10 +8,6 @@ FetchContent_Declare( URL_HASH SHA256=8774e9a12c70b0180b95d6b0b563c5aa4bea8d5960c15e18ae3b6d2521d64f8b DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/qhull" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" ) FetchContent_Populate(ext_qhull) diff --git a/3rdparty/stdgpu/stdgpu.cmake b/3rdparty/stdgpu/stdgpu.cmake index 8a543d11a33..4ee85e32730 100644 --- a/3rdparty/stdgpu/stdgpu.cmake +++ b/3rdparty/stdgpu/stdgpu.cmake @@ -9,7 +9,7 @@ ExternalProject_Add( PREFIX stdgpu # Aug 2024 URL https://github.com/stotko/stdgpu/archive/d57a4905f64fea0e06c56194131ad7a1c7291a16.tar.gz - URL_HASH SHA256=7bb2733b099f7cedc86d2aee7830d128ac1222cfafa34cbaa4e818483c0a93f6 + URL_HASH SHA256=c96775aafb44f5a36af96a4b7ec8b2de6b0587c0cf9ed76705306b6dc3b950b5 DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/stdgpu" UPDATE_COMMAND "" CMAKE_ARGS diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d5a7ca509e..a9d0e3b0ee1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ endif() option(BUILD_COMMON_ISPC_ISAS "Build for common ISPC ISAs (for release)" OFF) option(BUILD_GUI "Builds new GUI" ON ) option(WITH_OPENMP "Use OpenMP multi-threading" ON ) -option(WITH_IPPICV "Use Intel Performance Primitives" ON ) +option(WITH_IPP "Use Intel Integrated Performance Primitives" ON ) option(ENABLE_HEADLESS_RENDERING "Use OSMesa for headless rendering" OFF) if(BUILD_SHARED_LIBS) option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF) @@ -253,6 +253,8 @@ string(CONCAT OPEN3D_VERSION ) set(OPEN3D_VERSION_FULL "${OPEN3D_VERSION}${OPEN3D_VERSION_DEVHASH}" CACHE STRING "Open3D full version.") +set(OPEN3D_ABI_VERSION "${OPEN3D_VERSION_MAJOR}.${OPEN3D_VERSION_MINOR}" CACHE + STRING "Open3D ABI version / SOVERSION (for releases only).") # Set additional info set(PROJECT_EMAIL "open3d@intel.com") set(PROJECT_DOCS "https://www.open3d.org/docs") @@ -292,28 +294,11 @@ endif() # Global flag to set CXX standard. # This does not affect 3rd party libraries. -# Tensorflow 2.9+ requires cxx_17, but MSVC 19.29 throws errors with C++17 -# enabled. ATen in Pytorch 2.2 requires cxx_17 -if (BUILD_SYCL_MODULE OR BUILD_TENSORFLOW_OPS OR BUILD_PYTORCH_OPS) - set(CMAKE_CXX_STANDARD 17) -else() - set(CMAKE_CXX_STANDARD 14) -endif() +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS OFF) # Improved compatibility -# FIXME: Remove this workaround once a fixed Visual Studio 16.10 version is released. -if (BUILD_CUDA_MODULE - AND CMAKE_CXX_COMPILER MATCHES "MSVC" - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29" -) - # Keep C++14 standard for unaffected C++ files, but use C++17 for CUDA files. - set(CMAKE_CUDA_STANDARD 17) - # Suppress warnings for deprecated C++17 functions. - add_compile_definitions($<$:_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING>) - message(WARNING "Visual Studio 16.10 (MSVC 19.29) introduced a compiler bug when compiling CUDA code with C++14. " - "Workaround this bug by setting the CUDA standard to C++17.") -endif() - +# Suppress warnings for deprecated C++17 functions (stdgpu->thrust with CUDA 11 for MSVC). +add_compile_definitions($<$:_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING>) # CMake modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmake") @@ -443,6 +428,7 @@ if(BUILD_CUDA_MODULE) endif() endif() enable_language(CUDA) + set(CMAKE_CUDA_STANDARD 17) if (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "10.1") message(FATAL_ERROR "CUDA 10.0 and older are not supported. Please upgrade to CUDA 10.1 or newer.") endif() @@ -526,7 +512,7 @@ endmacro() if (LINUX_AARCH64) # Fix for ImportError: ... /pybind.cpython-310-aarch64-linux-gnu.so: cannot allocate memory in static TLS block # https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1889851 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftls-model=global-dynamic") + add_compile_options("-ftls-model=global-dynamic") endif() # Include convenience functions diff --git a/README.md b/README.md index c024b8b1689..d559c76c26d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For more, please visit the [Open3D documentation](https://www.open3d.org/docs). ## Python quick start -Pre-built pip packages support Ubuntu 18.04+, macOS 10.15+ and Windows 10+ +Pre-built pip packages support Ubuntu 20.04+, macOS 10.15+ and Windows 10+ (64-bit) with Python 3.8-3.11. ```bash diff --git a/cmake/Open3DPrintConfigurationSummary.cmake b/cmake/Open3DPrintConfigurationSummary.cmake index c8e8a891a8b..3e3d42da11e 100644 --- a/cmake/Open3DPrintConfigurationSummary.cmake +++ b/cmake/Open3DPrintConfigurationSummary.cmake @@ -61,7 +61,7 @@ function(open3d_print_configuration_summary) GLFW googletest imgui - ippicv + ipp JPEG jsoncpp liblzf diff --git a/cmake/Open3DSetGlobalProperties.cmake b/cmake/Open3DSetGlobalProperties.cmake index 251f046ca70..03e43212a8b 100644 --- a/cmake/Open3DSetGlobalProperties.cmake +++ b/cmake/Open3DSetGlobalProperties.cmake @@ -25,12 +25,24 @@ function(open3d_enable_strip target) endif() endfunction() +# RPATH handling (for TBB DSO). Check current folder, one folder above and the lib sibling folder +set(CMAKE_BUILD_RPATH_USE_ORIGIN ON) +if (APPLE) +# Add options to cover the various ways in which open3d shaed lib or apps can be installed wrt TBB DSO + set(CMAKE_INSTALL_RPATH "@loader_path;@loader_path/../;@loader_path/../lib/") +# pybind with open3d shared lib is copied, not cmake-installed, so we need to add .. to build rpath + set(CMAKE_BUILD_RPATH "@loader_path/../") +elseif(UNIX) + set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../;$ORIGIN/../lib/") + set(CMAKE_BUILD_RPATH "$ORIGIN/../") +endif() + # open3d_set_global_properties(target) # # Sets important project-related properties to . function(open3d_set_global_properties target) - # Tell CMake we want a compiler that supports C++14 features - target_compile_features(${target} PUBLIC cxx_std_14) + # Tell CMake we want a compiler that supports C++17 features + target_compile_features(${target} PUBLIC cxx_std_17) # Detect compiler id and version for utility::CompilerInfo # - OPEN3D_CXX_STANDARD @@ -118,8 +130,8 @@ function(open3d_set_global_properties target) if (USE_BLAS) target_compile_definitions(${target} PRIVATE USE_BLAS) endif() - if (WITH_IPPICV) - target_compile_definitions(${target} PRIVATE WITH_IPPICV) + if (WITH_IPP) + target_compile_definitions(${target} PRIVATE WITH_IPP) endif() if (GLIBCXX_USE_CXX11_ABI) target_compile_definitions(${target} PUBLIC _GLIBCXX_USE_CXX11_ABI=1) @@ -183,10 +195,6 @@ function(open3d_set_global_properties target) target_compile_options(${target} PRIVATE $<$,$>>:-fno-fast-math>) - # TBB static version is used - # See: https://github.com/wjakob/tbb/commit/615d690c165d68088c32b6756c430261b309b79c - target_compile_definitions(${target} PRIVATE __TBB_LIB_NAME=tbb_static) - # Enable strip open3d_enable_strip(${target}) @@ -194,4 +202,5 @@ function(open3d_set_global_properties target) target_compile_options(${target} PRIVATE "$<$:${HARDENING_CFLAGS}>") target_link_options(${target} PRIVATE "$<$:${HARDENING_LDFLAGS}>") target_compile_definitions(${target} PRIVATE "$<$:${HARDENING_DEFINITIONS}>") + endfunction() diff --git a/cpp/apps/CMakeLists.txt b/cpp/apps/CMakeLists.txt index 8b718c9968c..9a3cdea35bb 100644 --- a/cpp/apps/CMakeLists.txt +++ b/cpp/apps/CMakeLists.txt @@ -116,7 +116,7 @@ macro(open3d_add_app_common SRC_DIR APP_NAME TARGET_NAME) MACOSX_BUNDLE_INFO_PLIST "${INFO_PLIST}" XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" # disable OUTPUT_NAME ${APP_NAME} - ) + INSTALL_RPATH "@loader_path;@loader_path/../lib/") elseif (WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../${APP_NAME}") add_executable(${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) @@ -125,10 +125,10 @@ macro(open3d_add_app_common SRC_DIR APP_NAME TARGET_NAME) add_executable(${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME ${APP_NAME} - ) + INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib/") endif() - target_link_libraries(${TARGET_NAME} PRIVATE Open3D::Open3D ${ARGN}) + target_link_libraries(${TARGET_NAME} PRIVATE Open3D::Open3D TBB::tbb ${ARGN}) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "apps") open3d_link_3rdparty_libraries(${TARGET_NAME}) diff --git a/cpp/apps/Open3DViewer/Debian/CMakeLists.in.txt b/cpp/apps/Open3DViewer/Debian/CMakeLists.in.txt index b7bce43f4c6..bb96becca4d 100644 --- a/cpp/apps/Open3DViewer/Debian/CMakeLists.in.txt +++ b/cpp/apps/Open3DViewer/Debian/CMakeLists.in.txt @@ -33,7 +33,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open3D Viewer for 3D files") set(CPACK_PACKAGE_CONTACT "Open3D team <@PROJECT_EMAIL@>") set(CPACK_DEBIAN_PACKAGE_SECTION "Graphics") set(CPACK_PACKAGE_VERSION "@OPEN3D_VERSION_FULL@") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1, libgomp1, libpng16-16, libglfw3") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1, libgomp1, libpng16-16, libglfw3, libtbb12") set(CPACK_PACKAGE_HOMEPAGE_URL "@PROJECT_HOMEPAGE_URL@") include(CPack) diff --git a/cpp/apps/fixup_macosx_bundle.sh b/cpp/apps/fixup_macosx_bundle.sh index a0388ac1c60..a69a0ca70f1 100755 --- a/cpp/apps/fixup_macosx_bundle.sh +++ b/cpp/apps/fixup_macosx_bundle.sh @@ -7,13 +7,13 @@ # within the bundle. if [[ $(uname) != "Darwin" ]]; then - echo "This script is only useful for macOS" - exit 1 + echo "This script is only useful for macOS" + exit 1 fi if [[ $# != 1 ]]; then - echo "Usage: $0 path/to/name.app" - exit 1 + echo "Usage: $0 path/to/name.app" + exit 1 fi # Find the path to the actual executable in the app bundle @@ -21,17 +21,17 @@ appBundle=$1 exeDir="$appBundle/Contents/MacOS" exe=$(find "$exeDir" -type f -perm +111 | grep -v dylib) if [[ ! -f $exe ]]; then - echo "No executable file in app bundle ($appBundle/Contents/MacOS)" - exit 1 + echo "No executable file in app bundle ($appBundle/Contents/MacOS)" + exit 1 fi # Find the rpath paths rpaths=$(otool -l "$exe" | grep "path " | awk '{print $2}') if [[ $rpath != "" ]]; then - echo "@rpath:" - for rp in $rpaths; do - echo " $rp" - done + echo "@rpath:" + for rp in $rpaths; do + echo " $rp" + done fi # Set IFS so that newlines don't become spaces; helps parsing the otool -L output @@ -41,35 +41,34 @@ IFS=' # Copy any external libraries and change the library paths to @executable_path libs=$(otool -L "$exe" | grep -v "$exe" | grep -v /usr/lib | grep -v /System | awk '{ print $1; }') for lib in $libs; do - if [[ ${lib:0:1} != "@" ]]; then # external library with a regular path - # copy the external library - cp -aL "$lib" "$exeDir" + if [[ ${lib:0:1} != "@" ]]; then # external library with a regular path + libname=$(basename $lib) + # copy the external library, resolve symlink chain + cp -aRL "$lib" "$exeDir/$lib" + # change its path in the executable + newpath="@executable_path/$libname" + echo "$lib -> $newpath" + install_name_tool -change "$lib" "$newpath" "$exe" - # change its path in the executable - libname=$(basename $lib) - newpath="@executable_path/$libname" - echo "$lib -> $newpath" - install_name_tool -change "$lib" "$newpath" "$exe" + elif [[ $lib == @rpath/* ]]; then # external library with @rpath + libname=${lib:7} + # copy the external library. Since it uses an rpath, we need to + # prepend each rpath to see which one gives a valid path + for rp in $rpaths; do + if [[ -f "$rp/$libname" ]]; then + cp -aRL "$rp/$libname" "$exeDir/$libname" + break + fi + done - elif [[ $lib == @rpath/* ]]; then # external library with @rpath - libname=${lib:7} - # copy the external library. Since it uses an rpath, we need to - # prepend each rpath to see which one gives a valid path - for rp in $rpaths; do - if [[ -f "$rp/$libname" ]]; then - cp -a "$rp/$libname" "$exeDir" - break - fi - done - - # change its path in the executable - newpath="@executable_path/$libname" - echo "$lib -> $newpath" - install_name_tool -change "$lib" "$newpath" $exe - fi + # change its path in the executable + newpath="@executable_path/$libname" + echo "$lib -> $newpath" + install_name_tool -change "$lib" "$newpath" $exe + fi done # Remove rpaths for rp in $rpaths; do - install_name_tool -delete_rpath "$rp" "$exe" + install_name_tool -delete_rpath "$rp" "$exe" done diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 50dba5a6808..89178ce97cd 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -23,7 +23,7 @@ if (BUILD_CUDA_MODULE) target_include_directories(benchmarks SYSTEM PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) endif() -if (WITH_IPPICV) +if (WITH_IPP) target_compile_definitions(benchmarks PRIVATE IPP_CONDITIONAL_TEST_STR=) # Empty string (test not disabled) else() target_compile_definitions(benchmarks PRIVATE IPP_CONDITIONAL_TEST_STR=DISABLED_) diff --git a/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp b/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp index d79cfc0d18a..6b27492a20d 100644 --- a/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp +++ b/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp @@ -36,7 +36,7 @@ static core::Tensor CreateIntrisicTensor() { static void ComputeOdometryResultPointToPlane(benchmark::State& state, const core::Device& device) { - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } @@ -97,7 +97,7 @@ static void RGBDOdometryMultiScale( benchmark::State& state, const core::Device& device, const t::pipelines::odometry::Method& method) { - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } diff --git a/cpp/open3d/CMakeLists.txt b/cpp/open3d/CMakeLists.txt index 6da3581e509..e31bb2b83f3 100644 --- a/cpp/open3d/CMakeLists.txt +++ b/cpp/open3d/CMakeLists.txt @@ -5,6 +5,10 @@ # lib, and targets that links to the Open3D lib, e.g pybind, unit tests, etc. function(open3d_set_open3d_lib_properties target) cmake_parse_arguments(arg "HIDDEN" "" "" ${ARGN}) + set_target_properties(${target} PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${OPEN3D_ABI_VERSION} + ) if(NOT BUILD_SHARED_LIBS) target_compile_definitions(${target} PUBLIC OPEN3D_STATIC) endif() @@ -191,7 +195,7 @@ Description: @PROJECT_DESCRIPTION@ URL: @PROJECT_HOMEPAGE_URL@ Version: @PROJECT_VERSION@ Cflags: -std=c++@CMAKE_CXX_STANDARD@ -isystem${includedir} -isystem${includedir}/open3d/3rdparty -D$, -D> -Libs: -L${libdir} -Wl,-rpath,${libdir} -lOpen3D]=] @ONLY NEWLINE_STYLE LF) +Libs: -L${libdir} -Wl,-rpath,${libdir} -lOpen3D -ltbb]=] @ONLY NEWLINE_STYLE LF) file(GENERATE OUTPUT Open3D.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/Open3D.pc.in" TARGET "Open3D::Open3D") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Open3D.pc" diff --git a/cpp/open3d/cmake_uninstall.cmake.in b/cpp/open3d/cmake_uninstall.cmake.in index 846acdfbccb..9c8b4a68fd7 100644 --- a/cpp/open3d/cmake_uninstall.cmake.in +++ b/cpp/open3d/cmake_uninstall.cmake.in @@ -8,15 +8,12 @@ string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval) - + execute_process(COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" + RESULT_VARIABLE rm_retval) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + else() message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) + endif() +endforeach() diff --git a/cpp/open3d/geometry/TriangleMeshSimplification.cpp b/cpp/open3d/geometry/TriangleMeshSimplification.cpp index 90a2a166ce7..081d0842a2c 100644 --- a/cpp/open3d/geometry/TriangleMeshSimplification.cpp +++ b/cpp/open3d/geometry/TriangleMeshSimplification.cpp @@ -298,7 +298,8 @@ std::shared_ptr TriangleMesh::SimplifyQuadricDecimation( const auto& vert1 = mesh->vertices_[vidx1]; const auto& vert2 = mesh->vertices_[vidx2]; Eigen::Vector3d vert2p = (vert2 - vert0).cross(vert2 - vert1); - Eigen::Vector4d plane = ComputeTrianglePlane(vert0, vert1, vert2p); + Eigen::Vector4d plane = + ComputeTrianglePlane(vert0, vert1, vert0 + vert2p); Quadric quad(plane, area * boundary_weight); Qs[vidx0] += quad; Qs[vidx1] += quad; diff --git a/cpp/open3d/io/file_format/FileASSIMP.cpp b/cpp/open3d/io/file_format/FileASSIMP.cpp index a797b8aa1d3..990e66f948c 100644 --- a/cpp/open3d/io/file_format/FileASSIMP.cpp +++ b/cpp/open3d/io/file_format/FileASSIMP.cpp @@ -170,7 +170,8 @@ bool ReadTriangleMeshUsingASSIMP( const auto* scene = importer.ReadFile(filename.c_str(), post_process_flags); if (!scene) { - utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", importer.GetErrorString()); + utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", + importer.GetErrorString()); return false; } @@ -326,7 +327,8 @@ bool ReadModelUsingAssimp(const std::string& filename, const auto* scene = importer.ReadFile(filename.c_str(), kPostProcessFlags_fast); if (!scene) { - utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", importer.GetErrorString()); + utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", + importer.GetErrorString()); return false; } diff --git a/cpp/open3d/ml/pytorch/CMakeLists.txt b/cpp/open3d/ml/pytorch/CMakeLists.txt index 3cb75e531de..76e40b82791 100644 --- a/cpp/open3d/ml/pytorch/CMakeLists.txt +++ b/cpp/open3d/ml/pytorch/CMakeLists.txt @@ -128,6 +128,12 @@ set_target_properties(open3d_torch_ops PROPERTIES # Do not add "lib" prefix set_target_properties(open3d_torch_ops PROPERTIES PREFIX "") set_target_properties(open3d_torch_ops PROPERTIES DEBUG_POSTFIX "_debug") +# Set BUILD_RPATH to find tbb. We don't install through cmake. +if (APPLE) + set_target_properties(open3d_torch_ops PROPERTIES BUILD_RPATH "@loader_path/..") +elseif (UNIX) + set_target_properties(open3d_torch_ops PROPERTIES BUILD_RPATH "$ORIGIN/..") +endif() target_include_directories(open3d_torch_ops SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/cpp @@ -140,7 +146,7 @@ target_link_libraries(open3d_torch_ops PRIVATE Open3D::3rdparty_eigen3 Open3D::3rdparty_fmt Open3D::3rdparty_nanoflann - Open3D::3rdparty_tbb + TBB::tbb ) if (TARGET Open3D::3rdparty_parallelstl) target_link_libraries(open3d_torch_ops PRIVATE @@ -185,7 +191,7 @@ URL: @PROJECT_HOMEPAGE_URL@ Version: @PROJECT_VERSION@ Requires: Open3D = @PROJECT_VERSION@ Cflags: -Libs: -lopen3d_torch_ops]=] @ONLY NEWLINE_STYLE LF) +Libs: -lopen3d_torch_ops -ltbb]=] @ONLY NEWLINE_STYLE LF) file(GENERATE OUTPUT open3d_torch_ops.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/open3d_torch_ops.pc.in" TARGET open3d_torch_ops) diff --git a/cpp/open3d/ml/tensorflow/CMakeLists.txt b/cpp/open3d/ml/tensorflow/CMakeLists.txt index cecd4152c49..41fd4c3eeeb 100644 --- a/cpp/open3d/ml/tensorflow/CMakeLists.txt +++ b/cpp/open3d/ml/tensorflow/CMakeLists.txt @@ -135,6 +135,12 @@ set_target_properties(open3d_tf_ops PROPERTIES # Do not add "lib" prefix set_target_properties(open3d_tf_ops PROPERTIES PREFIX "") set_target_properties(open3d_tf_ops PROPERTIES DEBUG_POSTFIX "_debug") +# Set BUILD_RPATH to find tbb. We don't install through cmake. +if (APPLE) + set_target_properties(open3d_tf_ops PROPERTIES BUILD_RPATH "@loader_path/..") +elseif (UNIX) + set_target_properties(open3d_tf_ops PROPERTIES BUILD_RPATH "$ORIGIN/..") +endif() # _GLIBCXX_USER_CXX11_ABI is set separately list(REMOVE_ITEM Tensorflow_DEFINITIONS "_GLIBCXX_USE_CXX11_ABI=0" @@ -159,8 +165,7 @@ target_link_libraries(open3d_tf_ops PRIVATE Open3D::Open3D Open3D::3rdparty_fmt Open3D::3rdparty_nanoflann - Open3D::3rdparty_parallelstl - Open3D::3rdparty_tbb + TBB::tbb ) if (BUILD_CUDA_MODULE) @@ -194,7 +199,7 @@ URL: @PROJECT_HOMEPAGE_URL@ Version: @PROJECT_VERSION@ Requires: Open3D = @PROJECT_VERSION@ Cflags: -Libs: -lopen3d_tf_ops]=] @ONLY NEWLINE_STYLE LF) +Libs: -lopen3d_tf_ops -ltbb]=] @ONLY NEWLINE_STYLE LF) file(GENERATE OUTPUT open3d_tf_ops.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/open3d_tf_ops.pc.in" TARGET open3d_tf_ops) diff --git a/cpp/open3d/t/geometry/Image.cpp b/cpp/open3d/t/geometry/Image.cpp index 3af4fc20b42..853bc6b6a09 100644 --- a/cpp/open3d/t/geometry/Image.cpp +++ b/cpp/open3d/t/geometry/Image.cpp @@ -104,7 +104,7 @@ Image Image::To(core::Dtype dtype, dst_im.data_ = core::Tensor::Empty( {GetRows(), GetCols(), GetChannels()}, dtype, GetDevice()); } - if (HAVE_IPPICV && // Check for IPP fast implementation. + if (HAVE_IPP && // Check for IPP fast implementation. data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), GetDtype()) > 0 && @@ -140,7 +140,7 @@ Image Image::RGBToGray() const { std::count(npp_supported.begin(), npp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::RGBToGray, data_, dst_im.data_); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::RGBToGray, data_, dst_im.data_); @@ -180,7 +180,7 @@ Image Image::Resize(float sampling_rate, InterpType interp_type) const { std::count(npp_supported.begin(), npp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::Resize, data_, dst_im.data_, interp_type); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::Resize, data_, dst_im.data_, interp_type); @@ -217,7 +217,7 @@ Image Image::Dilate(int kernel_size) const { std::count(npp_supported.begin(), npp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::Dilate, data_, dst_im.data_, kernel_size); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::Dilate, data_, dst_im.data_, kernel_size); @@ -254,7 +254,7 @@ Image Image::FilterBilateral(int kernel_size, std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::FilterBilateral, data_, dst_im.data_, kernel_size, value_sigma, dist_sigma); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::FilterBilateral, data_, dst_im.data_, kernel_size, @@ -286,7 +286,7 @@ Image Image::Filter(const core::Tensor &kernel) const { std::count(npp_supported.begin(), npp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::Filter, data_, dst_im.data_, kernel); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::Filter, data_, dst_im.data_, kernel); @@ -322,7 +322,7 @@ Image Image::FilterGaussian(int kernel_size, float sigma) const { std::count(npp_supported.begin(), npp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::FilterGaussian, data_, dst_im.data_, kernel_size, sigma); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::FilterGaussian, data_, dst_im.data_, kernel_size, sigma); @@ -371,7 +371,7 @@ std::pair Image::FilterSobel(int kernel_size) const { std::make_pair(GetDtype(), GetChannels())) > 0) { CUDA_CALL(npp::FilterSobel, data_, dst_im_dx.data_, dst_im_dy.data_, kernel_size); - } else if (HAVE_IPPICV && data_.IsCPU() && + } else if (HAVE_IPP && data_.IsCPU() && std::count(ipp_supported.begin(), ipp_supported.end(), std::make_pair(GetDtype(), GetChannels())) > 0) { IPP_CALL(ipp::FilterSobel, data_, dst_im_dx.data_, dst_im_dy.data_, diff --git a/cpp/open3d/t/geometry/Image.h b/cpp/open3d/t/geometry/Image.h index 105bff8db82..5181c94ebb9 100644 --- a/cpp/open3d/t/geometry/Image.h +++ b/cpp/open3d/t/geometry/Image.h @@ -326,11 +326,11 @@ class Image : public Geometry { /// \brief Text description. std::string ToString() const; - /// Do we use IPP ICV for accelerating image processing operations? -#ifdef WITH_IPPICV - static constexpr bool HAVE_IPPICV = true; + /// Do we use IPP for accelerating image processing operations? +#ifdef WITH_IPP + static constexpr bool HAVE_IPP = true; #else - static constexpr bool HAVE_IPPICV = false; + static constexpr bool HAVE_IPP = false; #endif protected: diff --git a/cpp/open3d/t/geometry/kernel/CMakeLists.txt b/cpp/open3d/t/geometry/kernel/CMakeLists.txt index 081d24a6b96..d7a4f364b09 100644 --- a/cpp/open3d/t/geometry/kernel/CMakeLists.txt +++ b/cpp/open3d/t/geometry/kernel/CMakeLists.txt @@ -26,7 +26,7 @@ if (BUILD_CUDA_MODULE) ) endif() -if (WITH_IPPICV) +if (WITH_IPP) target_sources(tgeometry_kernel PRIVATE IPPImage.cpp ) diff --git a/cpp/open3d/t/geometry/kernel/IPPImage.cpp b/cpp/open3d/t/geometry/kernel/IPPImage.cpp index 275d15b560b..b8287468cb2 100644 --- a/cpp/open3d/t/geometry/kernel/IPPImage.cpp +++ b/cpp/open3d/t/geometry/kernel/IPPImage.cpp @@ -7,10 +7,17 @@ #include "open3d/t/geometry/kernel/IPPImage.h" +#ifdef APPLE // macOS IPP <=v2021.9 uses old directory layout #include #include #include #include +#else // Linux and Windows IPP >=v2021.10 uses new directory layout +#include +#include +#include +#include +#endif #include "open3d/core/Dtype.h" #include "open3d/core/ParallelFor.h" @@ -48,7 +55,7 @@ void To(const core::Tensor &src_im, try { ::ipp::iwiScale(ipp_src_im, ipp_dst_im, scale, offset); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -71,7 +78,7 @@ void RGBToGray(const core::Tensor &src_im, core::Tensor &dst_im) { ::ipp::iwiColorConvert(ipp_src_im, ::ipp::iwiColorRGB, ipp_dst_im, ::ipp::iwiColorGray); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -111,7 +118,7 @@ void Resize(const open3d::core::Tensor &src_im, try { ::ipp::iwiResize(ipp_src_im, ipp_dst_im, it->second); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -148,7 +155,7 @@ void Dilate(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size) { ::ipp::IwDefault(), /* Do not use IwiFilterMorphologyParams() */ ippBorderRepl); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -180,7 +187,7 @@ void Filter(const open3d::core::Tensor &src_im, try { ::ipp::iwiFilter(ipp_src_im, ipp_dst_im, ipp_kernel); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } }; @@ -211,7 +218,7 @@ void FilterBilateral(const core::Tensor &src_im, value_sigma * value_sigma, distance_sigma * distance_sigma); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -239,7 +246,7 @@ void FilterGaussian(const core::Tensor &src_im, try { ::ipp::iwiFilterGaussian(ipp_src_im, ipp_dst_im, kernel_size, sigma); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } @@ -287,7 +294,7 @@ void FilterSobel(const core::Tensor &src_im, // so we need to negate it in-place. dst_im_dx.Neg_(); } catch (const ::ipp::IwException &e) { - // See comments in icv/include/ippicv_types.h for m_status meaning + // See comments in ipp/ipptypes.h for m_status meaning utility::LogError("IPP-IW error {}: {}", e.m_status, e.m_string); } } diff --git a/cpp/open3d/t/geometry/kernel/IPPImage.h b/cpp/open3d/t/geometry/kernel/IPPImage.h index b861dd4d920..12430f04e4c 100644 --- a/cpp/open3d/t/geometry/kernel/IPPImage.h +++ b/cpp/open3d/t/geometry/kernel/IPPImage.h @@ -6,13 +6,17 @@ // ---------------------------------------------------------------------------- #pragma once -#ifdef WITH_IPPICV +#ifdef WITH_IPP +// Auto-enable multi-threaded implementations +#define IPP_ENABLED_THREADING_LAYER_REDEFINITIONS 1 #define IPP_CALL(ipp_function, ...) ipp_function(__VA_ARGS__); -// Required by IPPICV headers, defined here to keep other compile commands clean -#define ICV_BASE -#define IW_BUILD +#if IPP_VERSION_INT < \ + 20211000 // macOS IPP v2021.9.11 uses old directory layout #include +#else // Linux and Windows IPP v2021.10+ uses new directory layout +#include +#endif #include "open3d/core/Dtype.h" #include "open3d/core/Tensor.h" @@ -85,4 +89,4 @@ void FilterSobel(const open3d::core::Tensor &srcim, #else #define IPP_CALL(ipp_function, ...) \ utility::LogError("Not built with IPP-IW, cannot call " #ipp_function); -#endif // WITH_IPPICV +#endif // WITH_IPP diff --git a/cpp/open3d/t/io/file_format/FileASSIMP.cpp b/cpp/open3d/t/io/file_format/FileASSIMP.cpp index 90378622621..551d261579d 100644 --- a/cpp/open3d/t/io/file_format/FileASSIMP.cpp +++ b/cpp/open3d/t/io/file_format/FileASSIMP.cpp @@ -58,7 +58,8 @@ bool ReadTriangleMeshUsingASSIMP( const auto* scene = importer.ReadFile(filename.c_str(), post_process_flags); if (!scene) { - utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", importer.GetErrorString()); + utility::LogWarning("ReadTriangleMeshUsingASSIMP error: {}", + importer.GetErrorString()); return false; } @@ -470,7 +471,8 @@ bool WriteTriangleMeshUsingASSIMP(const std::string& filename, // Export if (exporter.Export(ai_scene.get(), "glb2", filename.c_str()) == AI_FAILURE) { - utility::LogWarning("WriteTriangleMeshUsingASSIMP error: {}", exporter.GetErrorString()); + utility::LogWarning("WriteTriangleMeshUsingASSIMP error: {}", + exporter.GetErrorString()); return false; } diff --git a/cpp/open3d/utility/ParallelScan.h b/cpp/open3d/utility/ParallelScan.h index 0479d611eb5..47f114bb26b 100644 --- a/cpp/open3d/utility/ParallelScan.h +++ b/cpp/open3d/utility/ParallelScan.h @@ -10,42 +10,6 @@ #include #include -// clang-format off -#if TBB_INTERFACE_VERSION >= 10000 - #ifdef OPEN3D_USE_ONEAPI_PACKAGES - #ifdef _PSTL_UDR_PRESENT - #undef _PSTL_UDR_PRESENT - #endif - #define _PSTL_UDR_PRESENT 0 - #ifdef _PSTL_UDS_PRESENT - #undef _PSTL_UDS_PRESENT - #endif - #define _PSTL_UDS_PRESENT 0 - #include - #include - #else - // Check if the C++ standard library implements parallel algorithms - // and use this over parallelstl to avoid conflicts. - // Clang does not implement it so far, so checking for C++17 is not sufficient. - #ifdef __cpp_lib_parallel_algorithm - #include - #include - #else - #include - #include - // parallelstl incorrectly assumes MSVC to unconditionally implement - // parallel algorithms even if __cpp_lib_parallel_algorithm is not - // defined. So manually include the header which pulls all - // "pstl::execution" definitions into the "std" namespace. - #if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT - #include - #endif - #endif - #endif -#endif - -// clang-format on - namespace open3d { namespace utility { @@ -77,19 +41,9 @@ class ScanSumBody { template void InclusivePrefixSum(const Tin* first, const Tin* last, Tout* out) { -#if TBB_INTERFACE_VERSION >= 10000 - // use parallelstl if we have TBB 2018 or later -#ifdef OPEN3D_USE_ONEAPI_PACKAGES - std::inclusive_scan(oneapi::dpl::execution::par_unseq, first, last, out); - -#else - std::inclusive_scan(std::execution::par_unseq, first, last, out); -#endif -#else ScanSumBody body(out, first); size_t n = std::distance(first, last); tbb::parallel_scan(tbb::blocked_range(0, n), body); -#endif } } // namespace utility diff --git a/cpp/pybind/CMakeLists.txt b/cpp/pybind/CMakeLists.txt index 11c4d3ea16a..e7a534a3eb3 100644 --- a/cpp/pybind/CMakeLists.txt +++ b/cpp/pybind/CMakeLists.txt @@ -75,14 +75,35 @@ endif() # `build/lib/${CMAKE_BUILD_TYPE}/Python/{cpu|cuda}` set(PYTHON_COMPILED_MODULE_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Python/$,cuda,cpu>") + +# Set BUILD_RPATH to find tbb (and a shared libOpen3D). We don't install through cmake. +if (APPLE) + set_target_properties(pybind PROPERTIES BUILD_RPATH "@loader_path;@loader_path/..") +elseif (UNIX) + set_target_properties(pybind PROPERTIES BUILD_RPATH "$ORIGIN;$ORIGIN/..") +endif() set_target_properties(pybind PROPERTIES FOLDER "Python" LIBRARY_OUTPUT_DIRECTORY "${PYTHON_COMPILED_MODULE_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${PYTHON_COMPILED_MODULE_DIR}") + +if (BUILD_SHARED_LIBS) + if (WIN32) # CMake does not add soversion suffix to WIN32 DLLs + set(_libopen3d_soname "Open3D.dll") + elseif(APPLE) + set(_libopen3d_soname "libOpen3D.${OPEN3D_ABI_VERSION}.dylib") + else() + set(_libopen3d_soname "libOpen3D.so.${OPEN3D_ABI_VERSION}") + endif() + add_custom_command(TARGET pybind POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ $/${_libopen3d_soname} + ) +endif() # Include additional libraries that may be absent from the user system -# eg: libc++.so and libc++abi.so (needed by filament) for Linux. +# eg: libc++.so, libc++abi.so (needed by filament) for Linux. # libc++.so is a linker script including libc++.so.1 and libc++abi.so, so append 1 to libc++.so -set(PYTHON_EXTRA_LIBRARIES "") +set(PYTHON_EXTRA_LIBRARIES $) if (BUILD_GUI AND CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND PYTHON_EXTRA_LIBRARIES ${CPP_LIBRARY}.1 ${CPPABI_LIBRARY}) endif() @@ -101,7 +122,7 @@ if (WITH_OPENMP AND APPLE AND NOT BUILD_SHARED_LIBS) file(GENERATE OUTPUT update_pybind_libomp.sh CONTENT [=[libomp_library=$(dyld_info -dependents "$" | grep libomp | tr -d '[:space:]') -install_name_tool -change $libomp_library @loader_path/../libomp.dylib \ +install_name_tool -change $libomp_library @rpath/$(basename $libomp_library) \ "$"]=]) add_custom_command(TARGET pybind POST_BUILD COMMAND bash update_pybind_libomp.sh @@ -121,6 +142,10 @@ message(STATUS "PYPI_PACKAGE_NAME: ${PYPI_PACKAGE_NAME}") # add the open3d python module first set(COMPILED_MODULE_PATH_LIST $) +# add the open3d DSO / DLL if shared +if (BUILD_SHARED_LIBS) + list(APPEND COMPILED_MODULE_PATH_LIST $/${_libopen3d_soname}) +endif() set(GENERATED_OUTPUTS "") diff --git a/cpp/pybind/make_python_package.cmake b/cpp/pybind/make_python_package.cmake index dee6e394d36..01e0d5663f5 100644 --- a/cpp/pybind/make_python_package.cmake +++ b/cpp/pybind/make_python_package.cmake @@ -37,7 +37,11 @@ endforeach() foreach(PYTHON_EXTRA_LIB ${PYTHON_EXTRA_LIBRARIES}) get_filename_component(PYTHON_EXTRA_LIB_REAL ${PYTHON_EXTRA_LIB} REALPATH) get_filename_component(SO_VER_NAME ${PYTHON_EXTRA_LIB_REAL} NAME) - string(REGEX REPLACE "\\.so\\.1\\..*" ".so.1" SO_1_NAME ${SO_VER_NAME}) + if (APPLE) + string(REGEX REPLACE "\\.([0-9]+)\\..*.dylib" ".\\1.dylib" SO_1_NAME ${SO_VER_NAME}) + elseif (UNIX) + string(REGEX REPLACE "\\.so\\.([0-9]+)\\..*" ".so.\\1" SO_1_NAME ${SO_VER_NAME}) + endif() configure_file(${PYTHON_EXTRA_LIB_REAL} ${PYTHON_PACKAGE_DST_DIR}/open3d/${SO_1_NAME} COPYONLY) endforeach() diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 9d8d118e792..3d58a53ad84 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -28,7 +28,7 @@ else() target_compile_definitions(tests PRIVATE GPU_CONDITIONAL_TEST_STR=DISABLED_) endif() -if (WITH_IPPICV) +if (WITH_IPP) target_compile_definitions(tests PRIVATE IPP_CONDITIONAL_TEST_STR=) # Empty string (test not disabled) else() target_compile_definitions(tests PRIVATE IPP_CONDITIONAL_TEST_STR=DISABLED_) @@ -51,6 +51,14 @@ endif() open3d_show_and_abort_on_warning(tests) open3d_set_global_properties(tests) +# On Windows, running tests from the build folder needs tbb.dll to be in the same folder. +if (WIN32) + add_custom_command( + TARGET tests + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/" + ) +endif() if (BUILD_AZURE_KINECT) # K4A headers are directly used in test. Currently we don't need to link diff --git a/cpp/tests/t/geometry/Image.cpp b/cpp/tests/t/geometry/Image.cpp index 1b9fa2112ea..2e270261106 100644 --- a/cpp/tests/t/geometry/Image.cpp +++ b/cpp/tests/t/geometry/Image.cpp @@ -264,7 +264,7 @@ TEST_P(ImagePermuteDevices, FilterBilateral) { core::Tensor(input_data, {5, 5, 1}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterBilateral(3, 10, 10), std::runtime_error); } else { im = im.FilterBilateral(3, 10, 10); @@ -304,7 +304,7 @@ TEST_P(ImagePermuteDevices, FilterBilateral) { core::Tensor(input_data, {5, 5, 1}, core::UInt8, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterBilateral(3, 5, 5), std::runtime_error); } else { im = im.FilterBilateral(3, 5, 5); @@ -343,7 +343,7 @@ TEST_P(ImagePermuteDevices, FilterGaussian) { core::Tensor data = core::Tensor(input_data, {5, 5, 1}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterGaussian(3), std::runtime_error); } else { im = im.FilterGaussian(3); @@ -377,7 +377,7 @@ TEST_P(ImagePermuteDevices, FilterGaussian) { core::Tensor data = core::Tensor(input_data, {5, 5, 1}, core::UInt8, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterGaussian(3), std::runtime_error); } else { im = im.FilterGaussian(3); @@ -417,7 +417,7 @@ TEST_P(ImagePermuteDevices, Filter) { core::Tensor kernel = core::Tensor(kernel_data, {5, 5}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.Filter(kernel), std::runtime_error); } else { t::geometry::Image im_new = im.Filter(kernel); @@ -463,7 +463,7 @@ TEST_P(ImagePermuteDevices, Filter) { core::Tensor kernel = core::Tensor(kernel_data, {5, 5}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.Filter(kernel), std::runtime_error); } else { im = im.Filter(kernel); @@ -507,7 +507,7 @@ TEST_P(ImagePermuteDevices, FilterSobel) { core::Tensor(input_data, {5, 5, 1}, core::Float32, device); t::geometry::Image im(data); t::geometry::Image dx, dy; - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterSobel(3), std::runtime_error); } else { std::tie(dx, dy) = im.FilterSobel(3); @@ -525,7 +525,7 @@ TEST_P(ImagePermuteDevices, FilterSobel) { .To(core::UInt8); t::geometry::Image im(data); t::geometry::Image dx, dy; - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.FilterSobel(3), std::runtime_error); } else { std::tie(dx, dy) = im.FilterSobel(3); @@ -563,7 +563,7 @@ TEST_P(ImagePermuteDevices, Resize) { core::Tensor data = core::Tensor(input_data, {6, 6, 1}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW( im.Resize(0.5, t::geometry::Image::InterpType::Nearest), std::runtime_error); @@ -595,7 +595,7 @@ TEST_P(ImagePermuteDevices, Resize) { core::Tensor data = core::Tensor(input_data, {6, 6, 1}, core::UInt8, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.Resize(0.5, t::geometry::Image::InterpType::Super), std::runtime_error); } else { @@ -611,7 +611,7 @@ TEST_P(ImagePermuteDevices, Resize) { EXPECT_TRUE(im_low.AsTensor().AllClose(core::Tensor( output_ref_npp, {3, 3, 1}, core::UInt8, device))); - // Check output in the CI to see if other inteprolations works + // Check output in the CI to see if other interpolations works // with other platforms im_low = im.Resize(0.5, t::geometry::Image::InterpType::Linear); utility::LogInfo("Linear(impl. dependent): {}", @@ -652,7 +652,7 @@ TEST_P(ImagePermuteDevices, PyrDown) { core::Tensor(input_data, {6, 6, 1}, core::Float32, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.PyrDown(), std::runtime_error); } else { im = im.PyrDown(); @@ -684,7 +684,7 @@ TEST_P(ImagePermuteDevices, PyrDown) { core::Tensor(input_data, {6, 6, 1}, core::UInt8, device); t::geometry::Image im(data); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { ASSERT_THROW(im.PyrDown(), std::runtime_error); } else { im = im.PyrDown(); @@ -732,8 +732,7 @@ TEST_P(ImagePermuteDevices, Dilate) { core::Tensor t_input_uint8_t = t_input.To(core::UInt8); // normal static_cast is OK t::geometry::Image input_uint8_t(t_input_uint8_t); - if (!t::geometry::Image::HAVE_IPPICV && - device.IsCPU()) { // Not Implemented + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { // Not Implemented ASSERT_THROW(input_uint8_t.Dilate(kernel_size), std::runtime_error); } else { output = input_uint8_t.Dilate(kernel_size); @@ -748,8 +747,7 @@ TEST_P(ImagePermuteDevices, Dilate) { core::Tensor t_input_uint16_t = t_input.To(core::UInt16); // normal static_cast is OK t::geometry::Image input_uint16_t(t_input_uint16_t); - if (!t::geometry::Image::HAVE_IPPICV && - device.IsCPU()) { // Not Implemented + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { // Not Implemented ASSERT_THROW(input_uint16_t.Dilate(kernel_size), std::runtime_error); } else { output = input_uint16_t.Dilate(kernel_size); @@ -761,8 +759,7 @@ TEST_P(ImagePermuteDevices, Dilate) { } // Float32 - if (!t::geometry::Image::HAVE_IPPICV && - device.IsCPU()) { // Not Implemented + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { // Not Implemented ASSERT_THROW(input.Dilate(kernel_size), std::runtime_error); } else { output = input.Dilate(kernel_size); @@ -886,8 +883,7 @@ TEST_P(ImagePermuteDevices, DISABLED_CreateNormalMap_Visual) { // We have to apply a bilateral filter, otherwise normals would be too // noisy. auto depth_clipped = depth.ClipTransform(1000.0, 0.0, 3.0, invalid_fill); - if (!t::geometry::Image::HAVE_IPPICV && - device.IsCPU()) { // Not Implemented + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { // Not Implemented ASSERT_THROW(depth_clipped.FilterBilateral(5, 5.0, 10.0), std::runtime_error); } else { diff --git a/cpp/tests/t/geometry/PointCloud.cpp b/cpp/tests/t/geometry/PointCloud.cpp index 0b4d7365de6..6fb8e72d2ed 100644 --- a/cpp/tests/t/geometry/PointCloud.cpp +++ b/cpp/tests/t/geometry/PointCloud.cpp @@ -692,10 +692,10 @@ TEST_P(PointCloudPermuteDevices, CreateFromRGBDImage) { TEST_P(PointCloudPermuteDevices, CreateFromRGBDOrDepthImageWithNormals) { core::Device device = GetParam(); - if (!t::geometry::Image::HAVE_IPPICV && + if (!t::geometry::Image::HAVE_IPP && device.GetType() == core::Device::DeviceType::CPU) { // FilterBilateral on CPU - // needs IPPICV + // needs IPP return; } diff --git a/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp b/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp index aed406fb98e..614499fe43f 100644 --- a/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp +++ b/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp @@ -39,7 +39,7 @@ core::Tensor CreateIntrisicTensor() { TEST_P(OdometryPermuteDevices, ComputeOdometryResultPointToPlane) { core::Device device = GetParam(); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } @@ -106,7 +106,7 @@ TEST_P(OdometryPermuteDevices, ComputeOdometryResultPointToPlane) { TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScalePointToPlane) { core::Device device = GetParam(); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } @@ -173,7 +173,7 @@ TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScalePointToPlane) { TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScaleIntensity) { core::Device device = GetParam(); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } @@ -240,7 +240,7 @@ TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScaleIntensity) { TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScaleHybrid) { core::Device device = GetParam(); - if (!t::geometry::Image::HAVE_IPPICV && device.IsCPU()) { + if (!t::geometry::Image::HAVE_IPP && device.IsCPU()) { return; } diff --git a/docker/Dockerfile.ci b/docker/Dockerfile.ci index 81379352f41..cd52a838882 100644 --- a/docker/Dockerfile.ci +++ b/docker/Dockerfile.ci @@ -212,7 +212,7 @@ RUN \ && make install -j$(nproc) \ && if [ "${PACKAGE}" = "ON" ]; then make package; fi \ && if [ "${PACKAGE}" = "VIEWER" ]; then make package-Open3DViewer-deb; fi \ - && if [ "${CI:-}a" != "a" ]; then rm -rf _deps assimp embree ippicv mkl mkl_install webrtc; fi + && if [ "${CI:-}a" != "a" ]; then rm -rf _deps assimp embree ipp mkl mkl_install webrtc; fi # If CI is not null or unset, remove all large build folders to save disk space # Compress ccache folder, move to / directory diff --git a/docker/README.md b/docker/README.md index 732eebf4bda..0501f0a3caa 100644 --- a/docker/README.md +++ b/docker/README.md @@ -48,7 +48,7 @@ To verify that the ARM64 environment is working, run: # The following warning message is expected: "WARNING: The requested image's # platform (linux/arm64/v8) does not match the detected host platform # (linux/amd64) and no specific platform was requested aarch64." -docker run --rm arm64v8/ubuntu:18.04 uname -p +docker run --rm arm64v8/ubuntu:24.04 uname -p ``` ## Build and test Docker diff --git a/docs/_static/docker/Dockerfile b/docs/_static/docker/Dockerfile index ea7e5344f3f..33065b3143b 100644 --- a/docs/_static/docker/Dockerfile +++ b/docs/_static/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 # ENV http_proxy "" # ENV HTTP_PROXY "" diff --git a/docs/compilation.rst b/docs/compilation.rst index c0c2d1cda16..270c928b327 100644 --- a/docs/compilation.rst +++ b/docs/compilation.rst @@ -8,15 +8,15 @@ Build from source System requirements ------------------- -* C++14 compiler: +* C++17 compiler: - * Ubuntu 18.04+: GCC 5+, Clang 7+ + * Ubuntu 20.04+: GCC 5+, Clang 7+ * macOS 10.15+: XCode 8.0+ * Windows 10 (64-bit): Visual Studio 2019+ -* CMake: 3.19+ +* CMake: 3.24+ - * Ubuntu (18.04 / 20.04): + * Ubuntu (20.04+): * Install with ``apt-get``: see `official APT repository `_ * Install with ``snap``: ``sudo snap install cmake --classic`` @@ -238,12 +238,6 @@ The visualization module depends on the Filament rendering engine and, by defaul Open3D uses a prebuilt version of it. You can also build Filament from source by setting ``BUILD_FILAMENT_FROM_SOURCE=ON``. -.. note:: - Whereas Open3D only requires a C++14 compiler, Filament needs a C++17 compiler - and only supports Clang 7+, the most recent version of Xcode, and Visual Studio 2019, - see `their building instructions `_. - Make sure to use one of these compiler if you build Open3D with ``BUILD_FILAMENT_FROM_SOURCE=ON``. - ML Module ````````` @@ -390,8 +384,8 @@ After installing ``ccache``, simply reconfigure and recompile the Open3D library. Open3D's CMake script can detect and use it automatically. You don't need to setup additional paths except for the ``ccache`` program itself. -Ubuntu 18.04, 20.04 -``````````````````` +Ubuntu 20.04+ +````````````` If you install ``ccache`` via ``sudo apt install ccache``, the 3.x version will be installed. To cache CUDA compilations, you'll need the 4.0+ version. Here, we diff --git a/docs/contribute/contribution_recipes.rst b/docs/contribute/contribution_recipes.rst index f03434c461b..eee2b7ca3c8 100644 --- a/docs/contribute/contribution_recipes.rst +++ b/docs/contribute/contribution_recipes.rst @@ -29,7 +29,7 @@ Dos +-------------------------------------------------------------------------------------------------------------+ | [DO] Follow the :ref:`style_guide` and install the required tools | +-------------------------------------------------------------------------------------------------------------+ -| [DO] Use C++14 features when contributing C++ code | +| [DO] Use C++17 features when contributing C++ code | +-------------------------------------------------------------------------------------------------------------+ | [DO] Remember to provide Python bindings when adding new C++ core functionalities | +-------------------------------------------------------------------------------------------------------------+ diff --git a/docs/contribute/styleguide.rst b/docs/contribute/styleguide.rst index 2da3aa4f0b4..d655993b3b9 100644 --- a/docs/contribute/styleguide.rst +++ b/docs/contribute/styleguide.rst @@ -58,7 +58,7 @@ We generally follow the `Google C++ Style Guide `_. diff --git a/docs/docker.in.rst b/docs/docker.in.rst index 17c7055b809..989c9289cd6 100644 --- a/docs/docker.in.rst +++ b/docs/docker.in.rst @@ -57,7 +57,7 @@ To run GUI applications from the docker container, add these options to the - NVIDIA: ``--gpus 'all,"capabilities=compute,utility,graphics"'`` - - No GPU (CPU rendering): ``--env OPEN3D_CPU_RENDERING=true`` on Ubuntu 18.04. Later versions automaticaly select CPU rendering if a GPU is not available. + - No GPU (CPU rendering): CPU rendering is automaticaly selected if a GPU is not available. 2. X server: ``-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY`` diff --git a/docs/getting_started.in.rst b/docs/getting_started.in.rst index c53591c6188..efa04016fce 100644 --- a/docs/getting_started.in.rst +++ b/docs/getting_started.in.rst @@ -13,7 +13,7 @@ interact with it. You can download the latest stable release app from `Github releases `__. The latest development version (``HEAD`` of ``main`` branch) viewer app is provided here [#]_: -* `Linux (Ubuntu 18.04+ or glibc 2.27+) `__ [#]_ +* `Linux (Ubuntu 20.04+ or glibc 2.31+) `__ [#]_ * `MacOSX v10.15+ (Intel or Apple Silicon) `__ * `Windows 10+ (64-bit) `__ @@ -54,7 +54,7 @@ Pip (PyPI) .. warning:: Versions of ``numpy>=2.0.0`` require ``Open3D>0.18.0`` or the latest development - version of Open3D. If you are using an older version of Open3D, downgrade ``numpy`` + version of Open3D. If you are using an older version of Open3D, downgrade ``numpy`` with .. code-block:: bash @@ -96,18 +96,18 @@ version (``HEAD`` of ``main`` branch): :widths: auto * - Linux - - `Python 3.8 `__ - - `Python 3.9 `__ - - `Python 3.10 `__ - - `Python 3.11 `__ - - `Python 3.12 `__ + - `Python 3.8 `__ + - `Python 3.9 `__ + - `Python 3.10 `__ + - `Python 3.11 `__ + - `Python 3.12 `__ * - Linux (CPU) - - `Python 3.8 `__ - - `Python 3.9 `__ - - `Python 3.10 `__ - - `Python 3.11 `__ - - `Python 3.12 `__ + - `Python 3.8 `__ + - `Python 3.9 `__ + - `Python 3.10 `__ + - `Python 3.11 `__ + - `Python 3.12 `__ * - MacOS - `Python 3.8 (x86_64) `__ @@ -188,7 +188,7 @@ rendering resources. These are built with all supported features and are available for the main supported platforms. Also, the latest development version (``HEAD`` of ``main`` branch) binary package archives are provided here [#]_: -:Linux (Ubuntu 18.04+ or glibc 2.27+ [#]_): +:Linux (Ubuntu 20.04+ or glibc 2.31+ [#]_): .. hlist:: :columns: 2 diff --git a/docs/release.md b/docs/release.md index 514114f5a04..90ea6144074 100644 --- a/docs/release.md +++ b/docs/release.md @@ -17,12 +17,12 @@ Collect all release artifacts in the [Github draft release page](https://github. Configure: `cmake -DCMAKE_BUILD_TYPE=Release -DDEVELOPER_BUILD=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_TENSORFLOW_OPS=ON -DBUILD_PYTORCH_OPS=ON -DBUNDLE_OPEN3D_ML=ON ..` - - [ ] Ubuntu 18.04 Python (all versions) (follow docs/arm.rst) (desktop) + - [ ] Ubuntu 20.04 Python (all versions) (follow docs/arm.rst) (desktop) Build command: `cd docker; ./docker_build.sh openblas-arm64-py311; ...` - [ ] Build Open3D app - - [ ] Ubuntu 18.04, Windows 10, macOS 10.15 x86_64: (CI) + - [ ] Ubuntu 20.04, Windows 10, macOS 10.15 x86_64: (CI) - [ ] macOS 12 arm64 (desktop) - [ ] macOS (x86_64, arm64) sign (desktop): diff --git a/examples/cmake/open3d-cmake-external-project/CMakeLists.txt b/examples/cmake/open3d-cmake-external-project/CMakeLists.txt index 37ed1f3d6dd..a26a7de64c2 100644 --- a/examples/cmake/open3d-cmake-external-project/CMakeLists.txt +++ b/examples/cmake/open3d-cmake-external-project/CMakeLists.txt @@ -1,5 +1,5 @@ -# On Ubuntu 18.04, get the latest CMake from https://apt.kitware.com/. -cmake_minimum_required(VERSION 3.18) +# On Ubuntu 20.04, get the latest CMake from https://apt.kitware.com/. +cmake_minimum_required(VERSION 3.24) project(Open3DCMakeExternalProject LANGUAGES C CXX) diff --git a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt index ea3773b1550..ca4835515b7 100644 --- a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt +++ b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt @@ -1,5 +1,5 @@ -# On Ubuntu 18.04, get the latest CMake from https://apt.kitware.com/. -cmake_minimum_required(VERSION 3.18) +# On Ubuntu 20.04, get the latest CMake from https://apt.kitware.com/. +cmake_minimum_required(VERSION 3.24) project(Open3DCMakeFindPackage LANGUAGES C CXX) @@ -24,10 +24,13 @@ target_link_libraries(Draw PRIVATE Open3D::Open3D) if(WIN32) get_target_property(open3d_type Open3D::Open3D TYPE) if(open3d_type STREQUAL "SHARED_LIBRARY") - message(STATUS "Copying Open3D.dll to ${CMAKE_CURRENT_BINARY_DIR}/$") - add_custom_command(TARGET Draw POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_INSTALL_PREFIX}/bin/Open3D.dll - ${CMAKE_CURRENT_BINARY_DIR}/$) + set(copy_dlls "${CMAKE_INSTALL_PREFIX}/bin/tbb12$<$:_debug>.dll" + "${CMAKE_INSTALL_PREFIX}/bin/Open3D.dll") + else() + set(copy_dlls "${CMAKE_INSTALL_PREFIX}/bin/tbb12$<$:_debug>.dll") endif() + add_custom_command(TARGET Draw POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${copy_dlls} + ${CMAKE_CURRENT_BINARY_DIR}/$ + COMMENT "Copying Open3D DLLs to ${CMAKE_CURRENT_BINARY_DIR}/$") endif() diff --git a/examples/python/visualization/non_english.py b/examples/python/visualization/non_english.py index 54c17d4df6a..0b926b70f70 100644 --- a/examples/python/visualization/non_english.py +++ b/examples/python/visualization/non_english.py @@ -39,7 +39,7 @@ hanzi = "c:/windows/fonts/msyh.ttc" # YaHei UI chess = "c:/windows/fonts/seguisym.ttf" # Segoe UI Symbol else: - # Assumes Ubuntu 18.04 + # Assumes Ubuntu 20.04 serif = "DejaVuSerif" hanzi = "NotoSansCJK" chess = "/usr/share/fonts/truetype/freefont/FreeSerif.ttf" diff --git a/python/README.rst b/python/README.rst index bf046cc2b11..e266c2904ab 100644 --- a/python/README.rst +++ b/python/README.rst @@ -38,7 +38,7 @@ Supported platforms The package has been tested on: -* Ubuntu 18.04 and 20.04 +* Ubuntu 20.04 and 22.04 * Windows 10 64-bit * macOS High Sierra and above diff --git a/python/open3d/__init__.py b/python/open3d/__init__.py index e67c146a949..141bf426c50 100644 --- a/python/open3d/__init__.py +++ b/python/open3d/__init__.py @@ -15,7 +15,11 @@ # https://github.com/dmlc/xgboost/issues/1715 import os import sys + os.environ["KMP_DUPLICATE_LIB_OK"] = "True" +# Enable thread composability manager to coordinate Intel OpenMP and TBB threads. Only works with Intel OpenMP. +# TBB must not be already loaded. +os.environ["TCM_ENABLE"] = "1" from ctypes import CDLL from ctypes.util import find_library from pathlib import Path @@ -31,13 +35,16 @@ def load_cdll(path): if not path.is_file(): raise FileNotFoundError(f"Shared library file not found: {path}.") - if sys.platform == 'win32' and sys.version_info >= (3, 8): + if sys.platform == "win32" and sys.version_info >= (3, 8): # https://stackoverflow.com/a/64472088/1255535 return CDLL(str(path), winmode=0) else: return CDLL(str(path)) +if sys.platform == "win32": # Unix: Use rpath to find libraries + _win32_dll_dir = os.add_dll_directory(str(Path(__file__).parent)) + if _build_config["BUILD_GUI"] and not (find_library("c++abi") or find_library("c++")): try: # Preload libc++.so and libc++abi.so (required by filament) @@ -56,35 +63,59 @@ def load_cdll(path): warnings.warn( "Open3D was built with CUDA support, but Open3D CPU Python " "bindings were not found. Open3D will not work on systems without" - " CUDA devices.", ImportWarning) + " CUDA devices.", + ImportWarning, + ) try: # Check CUDA availability without importing CUDA pybind symbols to # prevent "symbol already registered" errors if first import fails. _pybind_cuda = load_cdll( str(next((Path(__file__).parent / "cuda").glob("pybind*")))) if _pybind_cuda.open3d_core_cuda_device_count() > 0: - from open3d.cuda.pybind import (core, camera, data, geometry, io, - pipelines, utility, t) + from open3d.cuda.pybind import ( + core, + camera, + data, + geometry, + io, + pipelines, + utility, + t, + ) from open3d.cuda import pybind + __DEVICE_API__ = "cuda" else: warnings.warn( "Open3D was built with CUDA support, but no suitable CUDA " "devices found. If your system has CUDA devices, check your " - "CUDA drivers and runtime.", ImportWarning) + "CUDA drivers and runtime.", + ImportWarning, + ) except OSError as os_error: warnings.warn( - f'Open3D was built with CUDA support, but an error ocurred while loading the Open3D CUDA Python bindings. This is usually because the CUDA libraries could not be found. Check your CUDA installation. Falling back to the CPU pybind library. Reported error: {os_error}.', - ImportWarning) + f"Open3D was built with CUDA support, but an error ocurred while loading the Open3D CUDA Python bindings. This is usually because the CUDA libraries could not be found. Check your CUDA installation. Falling back to the CPU pybind library. Reported error: {os_error}.", + ImportWarning, + ) except StopIteration: warnings.warn( "Open3D was built with CUDA support, but Open3D CUDA Python " "binding library not found! Falling back to the CPU Python " - "binding library.", ImportWarning) + "binding library.", + ImportWarning, + ) if __DEVICE_API__ == "cpu": - from open3d.cpu.pybind import (core, camera, data, geometry, io, pipelines, - utility, t) + from open3d.cpu.pybind import ( + core, + camera, + data, + geometry, + io, + pipelines, + utility, + t, + ) from open3d.cpu import pybind @@ -103,6 +134,7 @@ def _insert_pybind_names(skip_names=()): import open3d.visualization + _insert_pybind_names(skip_names=("ml",)) __version__ = "@PROJECT_VERSION@" @@ -110,9 +142,10 @@ def _insert_pybind_names(skip_names=()): if int(sys.version_info[0]) < 3: raise Exception("Open3D only supports Python 3.") -if _build_config["BUILD_JUPYTER_EXTENSION"] and os.environ.get( - "OPEN3D_DISABLE_WEB_VISUALIZER", "False").lower() != "true": +if (_build_config["BUILD_JUPYTER_EXTENSION"] and os.environ.get( + "OPEN3D_DISABLE_WEB_VISUALIZER", "False").lower() != "true"): import platform + if not (platform.machine().startswith("arm") or platform.machine().startswith("aarch")): try: @@ -181,8 +214,10 @@ def _jupyter_nbextension_paths(): "section": "notebook", "src": "nbextension", "dest": "open3d", - "require": "open3d/extension" + "require": "open3d/extension", }] +if sys.platform == "win32": + _win32_dll_dir.close() del os, sys, CDLL, load_cdll, find_library, Path, warnings, _insert_pybind_names diff --git a/util/check_style.py b/util/check_style.py index 34442dec310..8a5b3ca7983 100644 --- a/util/check_style.py +++ b/util/check_style.py @@ -78,8 +78,13 @@ def _check_style(file_path, clang_format_bin): """ Returns (true, true) if (style, header) is valid. """ - with open(file_path, 'r', encoding='utf-8') as f: - is_valid_header = f.read().startswith(CppFormatter.standard_header) + try: + with open(file_path, 'r', encoding='utf-8') as f: + is_valid_header = (f.read(len(CppFormatter.standard_header)) == + CppFormatter.standard_header) + except Exception as exp: + print(f"Error reading file header {file_path}: {exp}") + is_valid_header = False cmd = [ clang_format_bin, @@ -156,10 +161,14 @@ def _check_style(file_path, style_config): Returns (true, true) if (style, header) is valid. """ - with open(file_path, 'r', encoding='utf-8') as f: - content = f.read() - is_valid_header = (len(content) == 0 or content.startswith( - PythonFormatter.standard_header)) + try: + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read() + is_valid_header = (len(content) == 0 or content.startswith( + PythonFormatter.standard_header)) + except Exception as exp: + print(f"Error reading file header {file_path}: {exp}") + is_valid_header = False _, _, changed = yapf.yapflib.yapf_api.FormatFile( file_path, style_config=style_config, in_place=False) @@ -296,7 +305,9 @@ def _glob_files(directories, extensions): for extension in extensions: extension_regex = "*." + extension file_paths.extend(directory.rglob(extension_regex)) - file_paths = [str(file_path) for file_path in file_paths] + file_paths = [ + str(file_path) for file_path in file_paths if file_path.name[0] != '.' + ] file_paths = sorted(list(set(file_paths))) return file_paths diff --git a/util/install_deps_ubuntu.sh b/util/install_deps_ubuntu.sh index 1613372b2ce..3e359a1a6e7 100755 --- a/util/install_deps_ubuntu.sh +++ b/util/install_deps_ubuntu.sh @@ -11,6 +11,7 @@ else fi deps=( + git # Open3D xorg-dev libxcb-shm0 @@ -39,11 +40,11 @@ eval $( echo DISTRIB_RELEASE="$DISTRIB_RELEASE" ) if [ "$DISTRIB_ID" == "Ubuntu" -a "$DISTRIB_RELEASE" == "20.04" ]; then - # Ubuntu 20.04's clang/libc++-dev/libc++abi-dev are version 10. - # To build Filament from source, we need version 12+. - deps=("${deps[@]/clang/clang-12}") - deps=("${deps[@]/libc++-dev/libc++-12-dev}") - deps=("${deps[@]/libc++abi-dev/libc++abi-12-dev}") + # Ubuntu 20.04's clang/libc++-dev/libc++abi-dev are version 8, 10 or 12. + # To avoid dependence on libunwind, we don't want to use versions later than 10. + deps=("${deps[@]/clang/clang-10}") + deps=("${deps[@]/libc++-dev/libc++-10-dev}") + deps=("${deps[@]/libc++abi-dev/libc++abi-10-dev}") fi # Special case for ARM64