Fix dependencies downloading on Windows.

This commit is contained in:
Thibaut Cuvelier 2021-01-27 20:13:42 +01:00
parent 83a4384b27
commit b3e3404f06

View File

@ -247,7 +247,49 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
LYX_OPTION(DMG "Build as Mac bundle, needed for .dmg (experimental) " OFF MAC)
LYX_OPTION(COCOA "Use Cocoa on Mac" OFF MAC)
# Try to get some informations from configure.ac
# On Windows, download the dependencies if need be.
if(LYX_DEPENDENCIES_DOWNLOAD)
message(STATUS)
# Do not check for bitness against CMAKE_SIZEOF_VOID_P, as it relates to the bitness of the CMake executable,
# not that of the compiler.
if(MSVC_VERSION GREATER_EQUAL 1920 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64")
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps-64)
set(deps_files lyx-windows-deps-msvc2019_64.zip)
set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps)
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019-64)
elseif(MSVC_VERSION GREATER_EQUAL 1920)
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps)
set(deps_files lyx-windows-deps-msvc2019_32.zip)
set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps)
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019)
elseif(MSVC_VERSION GREATER_EQUAL 1900 AND NOT "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64")
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps)
set(deps_files lyx-windows-deps-msvc2015.zip)
set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps)
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015)
else()
message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.")
endif()
message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}")
foreach(it ${deps_files})
set(already_downloaded already_downloaded-NOTFOUND CACHE PATH "downloaded" FORCE)
find_file(already_downloaded ${it} "${LYX_DEPENDENCIES_DIR}/download")
if(NOT already_downloaded)
message(STATUS "Downloading ${it} ...")
file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS STATUS status LOG log)
list(GET status 0 status_code)
list(GET status 1 status_string)
if(NOT status_code EQUAL 0)
file(REMOVE ${LYX_DEPENDENCIES_DIR}/${it})
message(FATAL_ERROR "error: downloading '${it}' failed. status_code: ${status_code}, status_string: ${status_string}. \nLog: ${log} ")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it}
WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR})
endif()
endforeach()
endif()
# Try to get some information from configure.ac
include(LyXPaths)
@ -309,40 +351,6 @@ else()
set(LYX_MERGE_REBUILD OFF)
endif()
if(LYX_DEPENDENCIES_DOWNLOAD)
message(STATUS)
if(MSVC14)
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps)
set(deps_files lyx-windows-deps-msvc2015.zip)
set(deps_server http://ftp.lyx.de/LyX-Windows-Deps)
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015)
elseif(MSVC10)
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
set(deps_files lyx-windows-deps-msvc2010.zip)
set(deps_server http://ftp.lyx.de/LyX-Windows-Deps)
set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2010)
else()
message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.")
endif()
message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}")
foreach(it ${deps_files})
set(already_downloaded already_downloaded-NOTFOUND CACHE PATH "downloaded" FORCE)
find_file(already_downloaded ${it} "${LYX_DEPENDENCIES_DIR}/download")
if(NOT already_downloaded)
message(STATUS "Downloading ${it} ...")
file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS STATUS status LOG log)
list(GET status 0 status_code)
list(GET status 1 status_string)
if(NOT status_code EQUAL 0)
file(REMOVE ${LYX_DEPENDENCIES_DIR}/${it})
message(FATAL_ERROR "error: downloading '${it}' failed. status_code: ${status_code}, status_string: ${status_string}. \nLog: ${log} ")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it}
WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR})
endif()
endforeach()
endif()
message(STATUS)
set(EXECUTABLE_OUTPUT_PATH ${TOP_BINARY_DIR}/bin)