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

[14849] Fixing CMakeLists.txt to avoid using curl (fails on windows installer ci (backport #2749) #2750

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,6 @@ if(BUILD_DOCUMENTATION)
endif()

if(NOT CHECK_DOCUMENTATION)
find_program(CURL_EXE curl)
if(CURL_EXE)
message(STATUS "Found cURL: ${CURL_EXE}")
else()
message(FATAL_ERROR "curl is needed to build the documentation. Please install it correctly")
endif()
find_program(UNZIP_EXE unzip)
if(UNZIP_EXE)
message(STATUS "Found Unzip: ${UNZIP_EXE}")
Expand Down Expand Up @@ -405,12 +399,23 @@ if(BUILD_DOCUMENTATION)

### ReadTheDocs ########################
if(NOT CHECK_DOCUMENTATION)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/readthedocs_custom_template.cmake [=[

file(DOWNLOAD "https://fast-dds.docs.eprosima.com/_/downloads/en/v${PROJECT_VERSION}/htmlzip/" "eprosima-fast-rtps.zip")
# TODO: when windows ci CMake version surpasses 17 favor file() instead of UNZIP as in the next line
# file(ARCHIVE_EXTRACT INPUT "eprosima-fast-rtps.zip" DESTINATION "${PROJECT_BINARY_DIR}/doc/")
execute_process(COMMAND "${UNZIP_EXE}" "eprosima-fast-rtps.zip" -d "${PROJECT_BINARY_DIR}/doc/")
file(REMOVE_RECURSE "${PROJECT_BINARY_DIR}/doc/manual")
file(RENAME "${PROJECT_BINARY_DIR}/doc/eprosima-fast-rtps-v${PROJECT_VERSION}" "${PROJECT_BINARY_DIR}/doc/manual")
file(REMOVE "eprosima-fast-rtps.zip")

]=])

configure_file(${CMAKE_CURRENT_BINARY_DIR}/readthedocs_custom_template.cmake ${CMAKE_CURRENT_BINARY_DIR}/readthedocs_custom.cmake)

add_custom_target(readthedocs
COMMAND "${CURL_EXE}" "https://fast-dds.docs.eprosima.com/_/downloads/en/v${PROJECT_VERSION}/htmlzip/" "--silent" "--output" "eprosima-fast-rtps.zip"
COMMAND "${UNZIP_EXE}" "eprosima-fast-rtps.zip" -d "${PROJECT_BINARY_DIR}/doc/"
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_BINARY_DIR}/doc/manual"
COMMAND ${CMAKE_COMMAND} -E rename "${PROJECT_BINARY_DIR}/doc/eprosima-fast-rtps-v${PROJECT_VERSION}" "${PROJECT_BINARY_DIR}/doc/manual"
COMMAND ${CMAKE_COMMAND} -E remove "eprosima-fast-rtps.zip"
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/readthedocs_custom.cmake
)

add_dependencies(readthedocs docdirs)
Expand Down