Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade curl latest version #7021

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ As an alternative, you can modify 3rdparty/zeromq/zeromq_build.cmake to fetch
zeromq from our fork
https://github.com/isl-org/libzmq
--------------------------------------------------------------------------------
curl 7.88.0 Curl license
curl 8.10.1 Curl license
Curl is a command-line tool for transferring data specified with URL syntax.
https://github.com/curl/curl
--------------------------------------------------------------------------------
Expand Down
151 changes: 79 additions & 72 deletions 3rdparty/curl/curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,84 +11,91 @@ else()
set(curl_lib_name curl)
endif()

if(UNIX AND NOT APPLE AND NOT LINUX_AARCH64)
# For ubuntu x86, we do not compile from source. Instead, we use the
# downloaded libcurl binaries.
option(BUILD_CURL_FROM_SOURCE "Build CURL from source" OFF)
else()
option(BUILD_CURL_FROM_SOURCE "Build CURL from source" ON)
endif()
# Ending hosting of new curl binaries to allow easy version updates.
# Keep config comments for future reference.
#
# if(UNIX AND NOT APPLE AND NOT LINUX_AARCH64)
# # For ubuntu x86, we do not compile from source. Instead, we use the
# # downloaded libcurl binaries.
# option(BUILD_CURL_FROM_SOURCE "Build CURL from source" OFF)
# else()
# option(BUILD_CURL_FROM_SOURCE "Build CURL from source" ON)
# endif()
#
# mark_as_advanced(BUILD_CURL_FROM_SOURCE)
#
# if((MSVC OR APPLE OR LINUX_AARCH64) AND NOT BUILD_CURL_FROM_SOURCE)
# message(FATAL_ERROR "BUILD_CURL_FROM_SOURCE is required to be ON.")
# endif()

mark_as_advanced(BUILD_CURL_FROM_SOURCE)

if((MSVC OR APPLE OR LINUX_AARCH64) AND NOT BUILD_CURL_FROM_SOURCE)
message(FATAL_ERROR "BUILD_CURL_FROM_SOURCE is required to be ON.")
if (APPLE) # homebrew does not package libidn2
set(curl_cmake_extra_args -DUSE_APPLE_IDN=ON -DUSE_LIBIDN2=OFF)
endif()

if(BUILD_CURL_FROM_SOURCE)
ExternalProject_Add(
ext_curl
PREFIX curl
URL https://github.com/curl/curl/releases/download/curl-7_88_0/curl-7.88.0.tar.xz
URL_HASH SHA256=fd17432cf28714a4cf39d89e26b8ace0d8901199fe5d01d75eb0ae3bbfcc731f
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/curl"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DBUILD_SHARED_LIBS=OFF
-DBUILD_CURL_EXE=OFF
-DBUILD_TESTING=OFF
-DCURL_DISABLE_LDAP=ON
-DCURL_DISABLE_LDAPS=ON
-DCURL_DISABLE_IMAP=ON
-DCURL_DISABLE_MQTT=ON
-DCURL_DISABLE_POP3=ON
-DCURL_DISABLE_SMTP=ON
-DCURL_DISABLE_TELNET=ON
-DCURL_USE_LIBSSH2=OFF
-DCURL_USE_OPENSSL=ON
-DOPENSSL_ROOT_DIR=${BORINGSSL_ROOT_DIR}
${curl_cmake_extra_args}
${ExternalProject_CMAKE_ARGS_hidden}
BUILD_BYPRODUCTS
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
)
# if(BUILD_CURL_FROM_SOURCE)
ExternalProject_Add(
ext_curl
PREFIX curl
URL https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz
URL_HASH SHA256=73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/curl"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DBUILD_SHARED_LIBS=OFF
-DBUILD_CURL_EXE=OFF
-DBUILD_TESTING=OFF
-DCURL_DISABLE_LDAP=ON
-DCURL_DISABLE_LDAPS=ON
-DCURL_DISABLE_IMAP=ON
-DCURL_DISABLE_MQTT=ON
-DCURL_DISABLE_POP3=ON
-DCURL_DISABLE_SMTP=ON
-DCURL_DISABLE_TELNET=ON
-DCURL_USE_LIBSSH2=OFF
-DCURL_USE_OPENSSL=ON
-DOPENSSL_ROOT_DIR=${BORINGSSL_ROOT_DIR}
${curl_cmake_extra_args}
${ExternalProject_CMAKE_ARGS_hidden}
BUILD_BYPRODUCTS
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_curl INSTALL_DIR)
set(CURL_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(CURL_LIB_DIR ${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR})
if(MSVC)
set(CURL_LIBRARIES ${curl_lib_name}$<$<CONFIG:Debug>:-d>)
else()
set(CURL_LIBRARIES ${curl_lib_name})
endif()
ExternalProject_Get_Property(ext_curl INSTALL_DIR)
set(CURL_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(CURL_LIB_DIR ${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR})
if(MSVC)
set(CURL_LIBRARIES ${curl_lib_name}$<$<CONFIG:Debug>:-d>)
else()
# Optimize for Ubuntu x86. Curl can take a long time to configure.
#
# To generate pre-compiled curl:
# 1. Use oldest supported Ubuntu (eg. in docker), not the latest.
# 2. -DBUILD_CURL_FROM_SOURCE=ON, build Open3D: make ext_curl
# 3. cd build/curl
# 4. tar -czvf curl_7.88.0_linux_x86_64.tar.gz include lib
ExternalProject_Add(
ext_curl
PREFIX curl
URL https://github.com/isl-org/open3d_downloads/releases/download/boringssl-bin/curl_7.88.0_linux_x86_64.tar.bz2
URL_HASH SHA256=745f33ad65c550e1885a5341945a8a952123565cfb83b477433f3784857ec0ea
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/curl"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS
<SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
<SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_curl SOURCE_DIR)
set(CURL_INCLUDE_DIRS ${SOURCE_DIR}/include/) # "/" is critical.
set(CURL_LIB_DIR ${SOURCE_DIR}/lib)
set(CURL_LIBRARIES ${curl_lib_name})
endif()
# else()
# # Optimize for Ubuntu x86. Curl can take a long time to configure.
# #
# # To generate pre-compiled curl:
# # 1. Use oldest supported Ubuntu (eg. in docker), not the latest.
# # 2. -DBUILD_CURL_FROM_SOURCE=ON, build Open3D: make ext_curl
# # 3. cd build/curl
# # 4. tar -czvf curl_8.10.1_linux_x86_64.tar.gz include lib
# ExternalProject_Add(
# ext_curl
# PREFIX curl
# URL https://github.com/isl-org/open3d_downloads/releases/download/boringssl-bin/curl_8.10.1_linux_x86_64.tar.bz2
# URL_HASH SHA256=4977fc20d00b22ab36e3bebd556f06c720b6c03316cd476487ab37fc79d44163
# DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/curl"
# UPDATE_COMMAND ""
# CONFIGURE_COMMAND ""
# BUILD_COMMAND ""
# INSTALL_COMMAND ""
# BUILD_BYPRODUCTS
# <SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
# <SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
# )
#
# ExternalProject_Get_Property(ext_curl SOURCE_DIR)
# set(CURL_INCLUDE_DIRS ${SOURCE_DIR}/include/) # "/" is critical.
# set(CURL_LIB_DIR ${SOURCE_DIR}/lib)
# set(CURL_LIBRARIES ${curl_lib_name})
# endif()

add_dependencies(ext_curl ext_boringssl)
3 changes: 3 additions & 0 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ if(NOT USE_SYSTEM_CURL)
# ```
# The "Foundation" framework is already linked by GLFW.
target_link_libraries(3rdparty_curl INTERFACE "-framework SystemConfiguration")
elseif(UNIX)
find_library(LIBIDN2 NAMES idn2 libidn2 libidn2.so.0 )
target_link_libraries(3rdparty_curl INTERFACE ${LIBIDN2})
endif()
target_link_libraries(3rdparty_curl INTERFACE 3rdparty_openssl)
endif()
Expand Down
Loading