1# ################################################################
2# Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
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
10project(gen_html)
11include(GetZstdLibraryVersion)
12
13set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
14
15# Define programs directory, where sources and header files are located
16set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib)
17set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs)
18set(GENHTML_DIR ${ZSTD_SOURCE_DIR}/contrib/gen_html)
19set(GENHTML_BINARY ${PROJECT_BINARY_DIR}/gen_html${CMAKE_EXECUTABLE_SUFFIX})
20include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${GENHTML_DIR})
21
22add_executable(gen_html ${GENHTML_DIR}/gen_html.cpp)
23
24GetZstdLibraryVersion(${LIBRARY_DIR}/zstd.h VMAJOR VMINOR VRELEASE)
25set(LIBVERSION "${VMAJOR}.${VMINOR}.${VRELEASE}")
26add_custom_target(zstd_manual.html ALL
27                  ${GENHTML_BINARY} "${LIBVERSION}" "${LIBRARY_DIR}/zstd.h" "${PROJECT_BINARY_DIR}/zstd_manual.html"
28                  DEPENDS gen_html COMMENT "Update zstd manual")
29
30install(FILES "${PROJECT_BINARY_DIR}/zstd_manual.html" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
31