2016-01-07 10:37:00 +00:00
|
|
|
# ################################################################
|
2017-01-02 01:05:45 +00:00
|
|
|
# * Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
|
|
|
|
# * All rights reserved.
|
|
|
|
# *
|
|
|
|
# * This source code is licensed under the BSD-style license found in the
|
|
|
|
# * LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# * of patent rights can be found in the PATENTS file in the same directory.
|
2016-01-07 10:37:00 +00:00
|
|
|
#
|
|
|
|
# You can contact the author at :
|
2016-02-12 02:50:05 +00:00
|
|
|
# - zstd homepage : http://www.zstd.net/
|
2016-01-07 10:37:00 +00:00
|
|
|
# ################################################################
|
|
|
|
|
2016-01-10 11:20:52 +00:00
|
|
|
PROJECT(programs)
|
2016-01-07 10:37:00 +00:00
|
|
|
|
2016-01-10 11:20:52 +00:00
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
|
|
|
|
|
2016-01-11 16:50:57 +00:00
|
|
|
# Define programs directory, where sources and header files are located
|
2017-03-16 13:03:54 +00:00
|
|
|
SET(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib)
|
|
|
|
SET(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs)
|
2017-01-27 18:27:29 +00:00
|
|
|
INCLUDE_DIRECTORIES(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRARY_DIR}/compress ${LIBRARY_DIR}/dictBuilder)
|
2016-01-11 16:50:57 +00:00
|
|
|
|
2016-01-07 10:37:00 +00:00
|
|
|
IF (ZSTD_LEGACY_SUPPORT)
|
2016-01-10 11:20:52 +00:00
|
|
|
SET(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy)
|
2016-05-31 15:19:05 +00:00
|
|
|
INCLUDE_DIRECTORIES(${PROGRAMS_LEGACY_DIR} ${LIBRARY_DIR}/legacy)
|
2016-01-10 11:20:52 +00:00
|
|
|
ENDIF (ZSTD_LEGACY_SUPPORT)
|
2016-01-07 10:37:00 +00:00
|
|
|
|
2016-12-19 08:28:55 +00:00
|
|
|
IF (MSVC)
|
2017-03-16 13:03:54 +00:00
|
|
|
SET(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/zstd)
|
2016-12-19 08:28:55 +00:00
|
|
|
SET(PlatformDependResources ${MSVC_RESOURCE_DIR}/zstd.rc)
|
|
|
|
ENDIF (MSVC)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/bench.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PlatformDependResources})
|
2017-03-17 13:12:28 +00:00
|
|
|
TARGET_LINK_LIBRARIES(zstd libzstd_shared)
|
2017-03-17 13:13:47 +00:00
|
|
|
INSTALL(TARGETS zstd RUNTIME DESTINATION "bin")
|
|
|
|
|
2016-01-10 11:20:52 +00:00
|
|
|
IF (UNIX)
|
2017-03-20 14:47:02 +00:00
|
|
|
INSTALL(FILES ${PROGRAMS_DIR}/zstd.1 DESTINATION "share/man/man1")
|
|
|
|
|
2016-02-12 02:50:05 +00:00
|
|
|
ADD_EXECUTABLE(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/fileio.c)
|
2017-03-17 13:12:28 +00:00
|
|
|
TARGET_LINK_LIBRARIES(zstd-frugal libzstd_shared)
|
2016-02-12 02:50:05 +00:00
|
|
|
SET_TARGET_PROPERTIES(zstd-frugal PROPERTIES COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT")
|
2016-01-10 11:20:52 +00:00
|
|
|
ENDIF (UNIX)
|
2017-02-09 14:11:05 +00:00
|
|
|
|
|
|
|
IF (ZSTD_MULTITHREAD_SUPPORT)
|
|
|
|
ADD_EXECUTABLE(zstdmt ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/bench.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PlatformDependResources})
|
|
|
|
SET_TARGET_PROPERTIES(zstdmt PROPERTIES COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
|
2017-03-17 13:12:28 +00:00
|
|
|
TARGET_LINK_LIBRARIES(zstdmt libzstd_shared)
|
2017-03-17 13:27:01 +00:00
|
|
|
|
|
|
|
SET(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
FIND_PACKAGE(Threads REQUIRED)
|
|
|
|
IF (CMAKE_USE_PTHREADS_INIT)
|
|
|
|
TARGET_LINK_LIBRARIES(zstdmt ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
ELSE()
|
|
|
|
MESSAGE(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
|
|
|
|
ENDIF()
|
2017-03-20 14:47:02 +00:00
|
|
|
|
|
|
|
INSTALL(TARGETS zstdmt RUNTIME DESTINATION "bin")
|
2017-02-09 14:11:05 +00:00
|
|
|
ENDIF (ZSTD_MULTITHREAD_SUPPORT)
|