2016-01-07 02:37:00 -08:00
|
|
|
# ################################################################
|
2016-09-02 22:11:49 -07:00
|
|
|
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
2016-01-07 02:37:00 -08:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
2017-08-31 11:24:54 -07:00
|
|
|
# This source code is licensed under both the BSD-style license (found in the
|
|
|
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
# in the COPYING file in the root directory of this source tree).
|
2016-01-07 02:37:00 -08:00
|
|
|
# ################################################################
|
2016-01-10 03:20:52 -08:00
|
|
|
|
|
|
|
PROJECT(zstd)
|
2017-04-19 10:20:27 -07:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
|
2017-04-20 15:35:56 -07:00
|
|
|
SET(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
2017-04-20 15:46:44 -07:00
|
|
|
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
2016-01-07 02:37:00 -08:00
|
|
|
|
2017-03-17 07:36:37 -07:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add extra compilation flags
|
|
|
|
#-----------------------------------------------------------------------------
|
2017-04-20 15:46:44 -07:00
|
|
|
INCLUDE(AddZstdCompilationFlags)
|
|
|
|
ADD_ZSTD_COMPILATION_FLAGS()
|
2017-03-17 07:36:37 -07:00
|
|
|
|
2017-05-24 01:48:10 -07:00
|
|
|
# Always hide XXHash symbols
|
|
|
|
ADD_DEFINITIONS(-DXXH_NAMESPACE=ZSTD_)
|
|
|
|
|
2017-03-17 07:36:37 -07:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Options
|
|
|
|
#-----------------------------------------------------------------------------
|
2016-01-07 02:37:00 -08:00
|
|
|
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
|
2017-03-21 05:00:05 -07:00
|
|
|
IF (UNIX)
|
|
|
|
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON)
|
|
|
|
ELSE (UNIX)
|
|
|
|
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" OFF)
|
|
|
|
ENDIF (UNIX)
|
2017-03-20 07:47:28 -07:00
|
|
|
OPTION(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
|
2017-02-09 06:10:24 -08:00
|
|
|
OPTION(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
|
2017-03-20 07:47:28 -07:00
|
|
|
OPTION(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
|
2017-05-24 01:48:10 -07:00
|
|
|
if (MSVC)
|
|
|
|
OPTION(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF)
|
|
|
|
endif ()
|
2016-01-07 02:37:00 -08:00
|
|
|
|
|
|
|
IF (ZSTD_LEGACY_SUPPORT)
|
2016-01-10 03:20:52 -08:00
|
|
|
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT defined!")
|
2017-03-13 14:44:08 -07:00
|
|
|
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=4)
|
2016-01-07 02:37:00 -08:00
|
|
|
ELSE (ZSTD_LEGACY_SUPPORT)
|
2016-01-10 03:20:52 -08:00
|
|
|
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT not defined!")
|
|
|
|
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0)
|
2016-01-07 02:37:00 -08:00
|
|
|
ENDIF (ZSTD_LEGACY_SUPPORT)
|
|
|
|
|
2017-03-17 07:36:37 -07:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add source directories
|
|
|
|
#-----------------------------------------------------------------------------
|
2016-01-10 03:20:52 -08:00
|
|
|
ADD_SUBDIRECTORY(lib)
|
2017-03-20 07:47:28 -07:00
|
|
|
|
|
|
|
IF (ZSTD_BUILD_PROGRAMS)
|
2017-05-24 01:48:10 -07:00
|
|
|
IF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
MESSAGE(SEND_ERROR "You need to build static library to build zstd CLI")
|
|
|
|
ENDIF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
|
2017-03-20 07:47:28 -07:00
|
|
|
ADD_SUBDIRECTORY(programs)
|
|
|
|
ENDIF (ZSTD_BUILD_PROGRAMS)
|
|
|
|
|
|
|
|
IF (ZSTD_BUILD_TESTS)
|
|
|
|
IF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
MESSAGE(SEND_ERROR "You need to build static library to build tests")
|
|
|
|
ENDIF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(tests)
|
|
|
|
ENDIF (ZSTD_BUILD_TESTS)
|
|
|
|
|
2017-02-09 06:10:24 -08:00
|
|
|
IF (ZSTD_BUILD_CONTRIB)
|
|
|
|
ADD_SUBDIRECTORY(contrib)
|
|
|
|
ENDIF (ZSTD_BUILD_CONTRIB)
|
2016-01-07 02:37:00 -08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2017-03-17 07:36:37 -07:00
|
|
|
# Add clean-all target
|
2016-01-07 02:37:00 -08:00
|
|
|
#-----------------------------------------------------------------------------
|
2016-06-03 01:24:00 -07:00
|
|
|
ADD_CUSTOM_TARGET(clean-all
|
|
|
|
COMMAND ${CMAKE_BUILD_TOOL} clean
|
|
|
|
COMMAND rm -rf ${CMAKE_BINARY_DIR}/
|
|
|
|
)
|