648db22b |
1 | # ################################################################ |
2 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | # All rights reserved. |
4 | # |
5 | # This source code is licensed under both the BSD-style license (found in the |
6 | # LICENSE file in the root directory of this source tree) and the GPLv2 (found |
7 | # in the COPYING file in the root directory of this source tree). |
8 | # ################################################################ |
9 | |
10 | project(pzstd) |
11 | |
12 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) |
13 | |
14 | # Define programs directory, where sources and header files are located |
15 | set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) |
16 | set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) |
17 | set(PZSTD_DIR ${ZSTD_SOURCE_DIR}/contrib/pzstd) |
18 | include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${PZSTD_DIR}) |
19 | |
20 | add_executable(pzstd ${PROGRAMS_DIR}/util.c ${PZSTD_DIR}/main.cpp ${PZSTD_DIR}/Options.cpp ${PZSTD_DIR}/Pzstd.cpp ${PZSTD_DIR}/SkippableFrame.cpp) |
21 | set_property(TARGET pzstd APPEND PROPERTY COMPILE_DEFINITIONS "NDEBUG") |
22 | set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow") |
23 | |
24 | if (ZSTD_BUILD_SHARED) |
25 | set(ZSTD_LIB libzstd_shared) |
26 | else() |
27 | set(ZSTD_LIB libzstd_static) |
28 | endif() |
29 | |
30 | set(THREADS_PREFER_PTHREAD_FLAG ON) |
31 | find_package(Threads REQUIRED) |
32 | if (CMAKE_USE_PTHREADS_INIT) |
33 | target_link_libraries(pzstd ${ZSTD_LIB} ${CMAKE_THREAD_LIBS_INIT}) |
34 | else() |
35 | message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") |
36 | endif() |
37 | |
38 | install(TARGETS pzstd RUNTIME DESTINATION "bin") |