Merge pull request #110 from mailagentrus/dev

Set CMake 2.8.7 version as minimal supported
dev
Yann Collet 2016-01-12 20:08:32 +01:00
commit e06e1e9dc7
5 changed files with 16 additions and 102 deletions

View File

@ -1,9 +1,6 @@
language: c language: c
before_install: before_install:
- "wget https://launchpad.net/ubuntu/+source/cmake/2.8.8-2ubuntu1/+build/3441442/+files/cmake_2.8.8-2ubuntu1_amd64.deb"
- "wget https://launchpad.net/ubuntu/+archive/primary/+files/cmake-data_2.8.8-2ubuntu1_all.deb"
- "sudo apt-get remove cmake-data cmake"
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq gcc-arm-linux-gnueabi - sudo apt-get install -qq gcc-arm-linux-gnueabi
- sudo apt-get install -qq clang - sudo apt-get install -qq clang
@ -11,9 +8,6 @@ before_install:
- sudo apt-get install -qq gcc-multilib - sudo apt-get install -qq gcc-multilib
- sudo apt-get install -qq valgrind - sudo apt-get install -qq valgrind
install:
- "sudo dpkg --install cmake-data_2.8.8-2ubuntu1_all.deb cmake_2.8.8-2ubuntu1_amd64.deb"
env: env:
- ZSTD_TRAVIS_CI_ENV=travis-install - ZSTD_TRAVIS_CI_ENV=travis-install
- ZSTD_TRAVIS_CI_ENV=cmaketest - ZSTD_TRAVIS_CI_ENV=cmaketest

View File

@ -32,7 +32,7 @@
# ################################################################ # ################################################################
PROJECT(zstd) PROJECT(zstd)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF) OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
@ -44,14 +44,12 @@ ELSE (ZSTD_LEGACY_SUPPORT)
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0) ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0)
ENDIF (ZSTD_LEGACY_SUPPORT) ENDIF (ZSTD_LEGACY_SUPPORT)
INCLUDE(CMakeModules/CompareVersion.cmake) # TARGET_INCLUDE_DIRECTORIES can use in version 2.8.11 and greate
COMPARE_VERSION_STRINGS("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" "2.8.8" CMP_RESULT) IF ((${CMAKE_MAJOR_VERSION} EQUAL 2) AND (${CMAKE_MINOR_VERSION} EQUAL 8) AND (${CMAKE_PATCH_VERSION} LESS 11))
SET(WORKAROUND_OUTDATED_CODE_STYLE TRUE)
IF ((CMP_RESULT LESS 0) OR (CMP_RESULT EQUAL 0))
SET(USE_DEPRECATED_CODE_STYLE TRUE)
ELSE () ELSE ()
SET(USE_DEPRECATED_CODE_STYLE FALSE) SET(WORKAROUND_OUTDATED_CODE_STYLE FALSE)
ENDIF ((CMP_RESULT LESS 0) OR (CMP_RESULT EQUAL 0)) ENDIF ((${CMAKE_MAJOR_VERSION} EQUAL 2) AND (${CMAKE_MINOR_VERSION} EQUAL 8) AND (${CMAKE_PATCH_VERSION} LESS 11))
ADD_SUBDIRECTORY(lib) ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(programs) ADD_SUBDIRECTORY(programs)

View File

@ -1,70 +0,0 @@
# Computes the realtionship between two version strings. A version
# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
# You can feed version strings with different number of dot versions,
# and the shorter version number will be padded with zeros: 9.2 <
# 9.2.1 will actually compare 9.2.0 < 9.2.1.
#
# Input: a_in - value, not variable
# b_in - value, not variable
# result_out - variable with value:
# -1 : a_in < b_in
# 0 : a_in == b_in
# 1 : a_in > b_in
#
# Written by James Bigler.
MACRO(COMPARE_VERSION_STRINGS a_in b_in result_out)
# Since SEPARATE_ARGUMENTS using ' ' as the separation token,
# replace '.' with ' ' to allow easy tokenization of the string.
STRING(REPLACE "." " " a ${a_in})
STRING(REPLACE "." " " b ${b_in})
SEPARATE_ARGUMENTS(a)
SEPARATE_ARGUMENTS(b)
# Check the size of each list to see if they are equal.
LIST(LENGTH a a_length)
LIST(LENGTH b b_length)
# Pad the shorter list with zeros.
# Note that range needs to be one less than the length as the for
# loop is inclusive (silly CMake).
IF (a_length LESS b_length)
# a is shorter
SET(shorter a)
MATH(EXPR range "${b_length} - 1")
MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
ELSE (a_length LESS b_length)
# b is shorter
SET(shorter b)
MATH(EXPR range "${a_length} - 1")
MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
ENDIF (a_length LESS b_length)
# PAD out if we need to
IF (NOT pad_range LESS 0)
FOREACH (pad RANGE ${pad_range})
# Since shorter is an alias for b, we need to get to it by by dereferencing shorter.
LIST(APPEND ${shorter} 0)
ENDFOREACH (pad RANGE ${pad_range})
ENDIF (NOT pad_range LESS 0)
SET(result 0)
FOREACH (index RANGE ${range})
IF (result EQUAL 0)
# Only continue to compare things as long as they are equal
LIST(GET a ${index} a_version)
LIST(GET b ${index} b_version)
# LESS
IF (a_version LESS b_version)
SET(result -1)
ENDIF (a_version LESS b_version)
# GREATER
IF (a_version GREATER b_version)
SET(result 1)
ENDIF (a_version GREATER b_version)
ENDIF (result EQUAL 0)
ENDFOREACH (index)
# Copy out the return result
SET(${result_out} ${result})
ENDMACRO(COMPARE_VERSION_STRINGS)

View File

@ -31,12 +31,6 @@
# - Public forum : https://groups.google.com/forum/#!forum/lz4c # - Public forum : https://groups.google.com/forum/#!forum/lz4c
# ################################################################ # ################################################################
IF (USE_DEPRECATED_CODE_STYLE)
IF (POLICY CMP0021)
cmake_policy(SET CMP0021 OLD)
ENDIF ()
ENDIF (USE_DEPRECATED_CODE_STYLE)
# Get library version based on information from input content (use regular exp) # Get library version based on information from input content (use regular exp)
function(GetLibraryVersion _content _outputVar1 _outputVar2 _outputVar3) function(GetLibraryVersion _content _outputVar1 _outputVar2 _outputVar3)
string(REGEX MATCHALL ".*define ZSTD_VERSION_MAJOR+.* ([0-9]+).*define ZSTD_VERSION_MINOR+.* ([0-9]+).*define ZSTD_VERSION_RELEASE+.* ([0-9]+)" VERSION_REGEX "${_content}") string(REGEX MATCHALL ".*define ZSTD_VERSION_MAJOR+.* ([0-9]+).*define ZSTD_VERSION_MINOR+.* ([0-9]+).*define ZSTD_VERSION_RELEASE+.* ([0-9]+)" VERSION_REGEX "${_content}")
@ -115,17 +109,15 @@ IF (MSVC)
SET_TARGET_PROPERTIES(libzstd_shared PROPERTIES COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS") SET_TARGET_PROPERTIES(libzstd_shared PROPERTIES COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS")
ENDIF (MSVC) ENDIF (MSVC)
IF (NOT USE_DEPRECATED_CODE_STYLE) # Define include directories
IF (NOT WORKAROUND_OUTDATED_CODE_STYLE)
TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_DIR}) TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_DIR})
TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_DIR}) TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_DIR})
ENDIF (NOT USE_DEPRECATED_CODE_STYLE) IF (ZSTD_LEGACY_SUPPORT)
IF (ZSTD_LEGACY_SUPPORT)
IF (NOT USE_DEPRECATED_CODE_STYLE)
TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_LEGACY_DIR}) TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_LEGACY_DIR})
TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_LEGACY_DIR}) TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_LEGACY_DIR})
ENDIF (NOT USE_DEPRECATED_CODE_STYLE) ENDIF (ZSTD_LEGACY_SUPPORT)
ENDIF (ZSTD_LEGACY_SUPPORT) ENDIF (NOT WORKAROUND_OUTDATED_CODE_STYLE)
# Define library base name # Define library base name
IF (UNIX) IF (UNIX)

View File

@ -42,19 +42,19 @@ SET(ROOT_DIR ../../..)
SET(PROGRAMS_DIR ${ROOT_DIR}/programs) SET(PROGRAMS_DIR ${ROOT_DIR}/programs)
INCLUDE_DIRECTORIES(${PROGRAMS_DIR}) INCLUDE_DIRECTORIES(${PROGRAMS_DIR})
IF (USE_DEPRECATED_CODE_STYLE) IF (WORKAROUND_OUTDATED_CODE_STYLE)
# Define library directory, where sources and header files are located # Define library directory, where sources and header files are located
SET(LIBRARY_DIR ${ROOT_DIR}/lib) SET(LIBRARY_DIR ${ROOT_DIR}/lib)
INCLUDE_DIRECTORIES(${LIBRARY_DIR}) INCLUDE_DIRECTORIES(${LIBRARY_DIR})
ENDIF (USE_DEPRECATED_CODE_STYLE) ENDIF (WORKAROUND_OUTDATED_CODE_STYLE)
IF (ZSTD_LEGACY_SUPPORT) IF (ZSTD_LEGACY_SUPPORT)
SET(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy) SET(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy)
INCLUDE_DIRECTORIES(${PROGRAMS_LEGACY_DIR}) INCLUDE_DIRECTORIES(${PROGRAMS_LEGACY_DIR})
IF (USE_DEPRECATED_CODE_STYLE) IF (WORKAROUND_OUTDATED_CODE_STYLE)
INCLUDE_DIRECTORIES(${LIBRARY_DIR}/legacy) INCLUDE_DIRECTORIES(${LIBRARY_DIR}/legacy)
ENDIF (USE_DEPRECATED_CODE_STYLE) ENDIF (WORKAROUND_OUTDATED_CODE_STYLE)
SET(ZSTD_FILEIO_LEGACY ${PROGRAMS_LEGACY_DIR}/fileio_legacy.c) SET(ZSTD_FILEIO_LEGACY ${PROGRAMS_LEGACY_DIR}/fileio_legacy.c)
ENDIF (ZSTD_LEGACY_SUPPORT) ENDIF (ZSTD_LEGACY_SUPPORT)