lz4 prep work; get linux and windows ready

pull/2992/head
Bret Curtis 4 years ago committed by Alexei Dobrohotov
parent 66c884be65
commit 7954dccb44

@ -13,7 +13,7 @@ stages:
before_script:
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
- apt-get update -yq
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev ccache git clang
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev liblz4-dev ccache git clang
stage: build
script:
- export CCACHE_BASEDIR="`pwd`"

@ -23,8 +23,8 @@ addons:
# FFmpeg
libavcodec-dev, libavformat-dev, libavutil-dev, libswresample-dev, libswscale-dev,
# Audio, Video and Misc. deps
libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev,
# The other ones from OpenMW ppa
libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev, liblz4-dev
# The other ones from OpenMW ppa
libbullet-dev, libopenscenegraph-dev, libmygui-dev
]
coverity_scan: # TODO: currently takes too long, disabled openmw/openmw-cs for now.

@ -571,6 +571,11 @@ if [ -z $SKIP_DOWNLOAD ]; then
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/SDL2-2.0.12.zip" \
"SDL2-2.0.12.zip"
# LZ4
download "LZ4 1.9.2" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/lz4_win${BITS}_v1_9_2.zip" \
"lz4_win${BITS}_v1_9_2.zip"
# Google test and mock
if [ ! -z $TEST_FRAMEWORK ]; then
echo "Google test 1.10.0..."
@ -901,6 +906,25 @@ printf "SDL 2.0.12... "
}
cd $DEPS
echo
# LZ4
printf "LZ4 1.9.2... "
{
if [ -d LZ4-1.9.2 ]; then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
rm -rf LZ4-1.9.2
eval 7z x -y lz4_win${BITS}_v1.9.2.zip $STRIP
fi
export LZ4DIR="$(real_pwd)/LZ4-1.9.2"
add_cmake_opts -DLZ4_INCLUDE_DIR="${LZ4DIR}/include" \
-DLZ4_LIBRARY="${LZ4DIR}/static/liblz4_static.lib"
for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/LZ4-1.9.2/dll/liblz4.dll.a"
done
echo Done.
}
cd $DEPS
echo
# Google Test and Google Mock
if [ ! -z $TEST_FRAMEWORK ]; then
printf "Google test 1.10.0 ..."

@ -152,6 +152,8 @@ endif()
# Dependencies
find_package(OpenGL REQUIRED)
find_package(LZ4 REQUIRED)
if (USE_QT)
find_package(Qt5Core 5.12 REQUIRED)
find_package(Qt5Widgets REQUIRED)

@ -0,0 +1,130 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLZ4
-------
Find the LZ4 include directory and library.
Use this module by invoking find_package with the form::
.. code-block:: cmake
find_package(LZ4
[version] # Minimum version e.g. 1.8.0
[REQUIRED] # Fail with error if LZ4 is not found
)
Imported targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
.. variable:: LZ4::LZ4
Imported target for using the LZ4 library, if found.
Result variables
^^^^^^^^^^^^^^^^
.. variable:: LZ4_FOUND
Set to true if LZ4 library found, otherwise false or undefined.
.. variable:: LZ4_INCLUDE_DIRS
Paths to include directories listed in one variable for use by LZ4 client.
.. variable:: LZ4_LIBRARIES
Paths to libraries to linked against to use LZ4.
.. variable:: LZ4_VERSION
The version string of LZ4 found.
Cache variables
^^^^^^^^^^^^^^^
For users who wish to edit and control the module behavior, this module
reads hints about search locations from the following variables::
.. variable:: LZ4_INCLUDE_DIR
Path to LZ4 include directory with ``lz4.h`` header.
.. variable:: LZ4_LIBRARY
Path to LZ4 library to be linked.
NOTE: The variables above should not usually be used in CMakeLists.txt files!
#]=======================================================================]
### Find library ##############################################################
if(NOT LZ4_LIBRARY)
find_library(LZ4_LIBRARY_RELEASE NAMES lz4)
find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)
include(SelectLibraryConfigurations)
select_library_configurations(LZ4)
else()
file(TO_CMAKE_PATH "${LZ4_LIBRARY}" LZ4_LIBRARY)
endif()
### Find include directory ####################################################
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
if(LZ4_INCLUDE_DIR AND EXISTS "${LZ4_INCLUDE_DIR}/lz4.h")
file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" _lz4_h_contents
REGEX "#define LZ4_VERSION_[A-Z]+[ ]+[0-9]+")
string(REGEX REPLACE "#define LZ4_VERSION_MAJOR[ ]+([0-9]+).+" "\\1"
LZ4_VERSION_MAJOR "${_lz4_h_contents}")
string(REGEX REPLACE ".+#define LZ4_VERSION_MINOR[ ]+([0-9]+).+" "\\1"
LZ4_VERSION_MINOR "${_lz4_h_contents}")
string(REGEX REPLACE ".+#define LZ4_VERSION_RELEASE[ ]+([0-9]+).*" "\\1"
LZ4_VERSION_RELEASE "${_lz4_h_contents}")
set(LZ4_VERSION "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}")
unset(_lz4_h_contents)
endif()
### Set result variables ######################################################
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_VERSION)
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
set(LZ4_LIBRARIES ${LZ4_LIBRARY})
set(LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR})
### Import targets ############################################################
if(LZ4_FOUND)
if(NOT TARGET LZ4::LZ4)
add_library(LZ4::LZ4 UNKNOWN IMPORTED)
set_target_properties(LZ4::LZ4 PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
if(LZ4_LIBRARY_RELEASE)
set_property(TARGET LZ4::LZ4 APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(LZ4::LZ4 PROPERTIES
IMPORTED_LOCATION_RELEASE "${LZ4_LIBRARY_RELEASE}")
endif()
if(LZ4_LIBRARY_DEBUG)
set_property(TARGET LZ4::LZ4 APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(LZ4::LZ4 PROPERTIES
IMPORTED_LOCATION_DEBUG "${LZ4_LIBRARY_DEBUG}")
endif()
if(NOT LZ4_LIBRARY_RELEASE AND NOT LZ4_LIBRARY_DEBUG)
set_property(TARGET LZ4::LZ4 APPEND PROPERTY
IMPORTED_LOCATION "${LZ4_LIBRARY}")
endif()
endif()
endif()
Loading…
Cancel
Save