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(gen_html) 11 include(GetZstdLibraryVersion) 12 13 set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 14 15 # Define programs directory, where sources and header files are located 16 set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib) 17 set(PROGRAMS_DIR ${ZSTD_SOURCE_DIR}/programs) 18 set(GENHTML_DIR ${ZSTD_SOURCE_DIR}/contrib/gen_html) 19 set(GENHTML_BINARY ${PROJECT_BINARY_DIR}/gen_html${CMAKE_EXECUTABLE_SUFFIX}) 20 include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${GENHTML_DIR}) 21 22 add_executable(gen_html ${GENHTML_DIR}/gen_html.cpp) 23 24 GetZstdLibraryVersion(${LIBRARY_DIR}/zstd.h VMAJOR VMINOR VRELEASE) 25 set(LIBVERSION "${VMAJOR}.${VMINOR}.${VRELEASE}") 26 add_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 30 install(FILES "${PROJECT_BINARY_DIR}/zstd_manual.html" DESTINATION "${CMAKE_INSTALL_DOCDIR}") 31