Add cmake download replays. fix win download

This commit is contained in:
duncanspumpkin 2019-07-15 18:50:52 +01:00
parent 870f931a44
commit 38d97a6ee3
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# CMAKE project for openrct2
# CMAKE project for openrct2
cmake_minimum_required(VERSION 3.9)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
@ -26,11 +26,15 @@ set(TITLE_SEQUENCE_SHA1 "19263f8ca383345959473e64da4785a60f00f420")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.11/objects.zip")
set(OBJECTS_SHA1 "8674120086929f9196560d77cada631fb478d7c0")
set(REPLAYS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.11/objects.zip")
set(REPLAYS_SHA1 "8612DACA1FFE63BE4731C048CCB2411C5C45E9B4")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")
option(PORTABLE "Create a portable build (-rpath=$ORIGIN)" OFF)
option(DOWNLOAD_TITLE_SEQUENCES "Download title sequences during installation." ON)
option(DOWNLOAD_OBJECTS "Download objects during installation." ON)
option(DOWNLOAD_REPLAYS "Download replays during installation." ON)
# Options
option(STATIC "Create a static build.")
@ -287,6 +291,12 @@ if (DOWNLOAD_OBJECTS)
file(REMOVE \$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT}/object/objects.zip)\n\
endif ()")
endif ()
if (DOWNLOAD_REPLAYS)
set(REPLAY_DIR "\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT}/testdata/replays")
install(CODE "file(DOWNLOAD ${REPLAYS_URL} ${REPLAY_DIR}/replays.zip EXPECTED_HASH SHA1=${REPLAYS_SHA1} SHOW_PROGRESS)")
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir ${REPLAY_DIR}/ \"${CMAKE_COMMAND}\" -E tar xvf replays.zip)")
install(CODE "file(REMOVE ${REPLAY_DIR}/replays.zip)")
endif ()
install(TARGETS "libopenrct2" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(NOT DISABLE_GUI)

View File

@ -73,7 +73,7 @@
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.0.11/objects.zip</ObjectsUrl>
<ObjectsSha1>8674120086929f9196560d77cada631fb478d7c0</ObjectsSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.1/replays.zip</ReplaysUrl>
<ObjectsSha1>8612DACA1FFE63BE4731C048CCB2411C5C45E9B4</ObjectsSha1>
<ReplaysSha1>8612DACA1FFE63BE4731C048CCB2411C5C45E9B4</ReplaysSha1>
</PropertyGroup>
<ItemGroup>