44 lines
1.8 KiB
CMake
44 lines
1.8 KiB
CMake
# cmake/FetchDependencies.cmake
|
|
|
|
set(THIRDPARTY_DIR "${CMAKE_CURRENT_LIST_DIR}/../thirdparty")
|
|
|
|
if(NOT EXISTS "${THIRDPARTY_DIR}")
|
|
file(MAKE_DIRECTORY "${THIRDPARTY_DIR}")
|
|
endif()
|
|
|
|
macro(check_and_download URL ARCHIVE_NAME EXTRACTED_DIR_NAME CHECK_FILE)
|
|
set(ARCHIVE_PATH "${THIRDPARTY_DIR}/${ARCHIVE_NAME}")
|
|
set(SRC_PATH "${THIRDPARTY_DIR}/${EXTRACTED_DIR_NAME}")
|
|
|
|
if(NOT EXISTS "${ARCHIVE_PATH}")
|
|
message(STATUS "Downloading ${ARCHIVE_NAME}...")
|
|
file(DOWNLOAD "${URL}" "${ARCHIVE_PATH}" SHOW_PROGRESS)
|
|
endif()
|
|
|
|
if(NOT EXISTS "${SRC_PATH}/${CHECK_FILE}")
|
|
message(STATUS "Extracting ${ARCHIVE_NAME}...")
|
|
execute_process(
|
|
COMMAND ${CMAKE_COMMAND} -E tar xvf "${ARCHIVE_PATH}"
|
|
WORKING_DIRECTORY "${THIRDPARTY_DIR}"
|
|
)
|
|
endif()
|
|
endmacro()
|
|
|
|
# 1) ZLIB (Нужна только для инклудов, если не используете emscripten порты)
|
|
check_and_download("https://www.zlib.net/zlib131.zip" "zlib131.zip" "zlib-1.3.1" "CMakeLists.txt")
|
|
|
|
# 2) SDL2
|
|
check_and_download("https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.10.zip" "release-2.32.10.zip" "SDL-release-2.32.10" "CMakeLists.txt")
|
|
|
|
# 3) LibPNG
|
|
check_and_download("https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.51.zip" "v1.6.51.zip" "libpng-1.6.51" "CMakeLists.txt")
|
|
|
|
# 4) LibZip
|
|
check_and_download("https://github.com/nih-at/libzip/archive/refs/tags/v1.11.4.zip" "v1.11.4.zip" "libzip-1.11.4" "CMakeLists.txt")
|
|
|
|
# 5) Eigen
|
|
check_and_download("https://gitlab.com/libeigen/eigen/-/archive/5.0.0/eigen-5.0.0.zip" "eigen-5.0.0.zip" "eigen-5.0.0" "signature_of_eigen3_matrix_library")
|
|
|
|
# 6) Boost
|
|
check_and_download("https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip" "boost_1_90_0.zip" "boost_1_90_0" "boost")
|