Misc: Update CMakeLists.txt
Update CMakeLists.txt to support Asciidoc man page / HTML doc generation, with various small changes.
This commit is contained in:
parent
59d6979612
commit
b47205db08
|
@ -5,6 +5,8 @@ set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
|||
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
||||
|
||||
add_subdirectory(man)
|
||||
|
||||
set(compton_SRCS src/compton.c)
|
||||
add_executable(compton ${compton_SRCS})
|
||||
|
||||
|
@ -85,6 +87,12 @@ if (CONFIG_LIBCONFIG)
|
|||
endif ()
|
||||
endif ()
|
||||
|
||||
# --- Find libdrm ---
|
||||
if (CONFIG_VSYNC_DRM)
|
||||
pkg_check_modules(LIBDRM REQUIRED libdrm)
|
||||
# We only use its header file
|
||||
endif ()
|
||||
|
||||
# == Install ==
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
@ -92,10 +100,6 @@ install(TARGETS compton
|
|||
DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT prog)
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/bin/compton-trans"
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT prog)
|
||||
install(FILES
|
||||
"${PROJECT_SOURCE_DIR}/man/compton.1"
|
||||
"${PROJECT_SOURCE_DIR}/man/compton-trans.1"
|
||||
DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT doc)
|
||||
install(FILES
|
||||
"${PROJECT_SOURCE_DIR}/README.md"
|
||||
"${PROJECT_SOURCE_DIR}/LICENSE"
|
||||
|
@ -150,11 +154,11 @@ set(CPACK_SOURCE_IGNORE_FILES
|
|||
# --- DEB package config ---
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "x11")
|
||||
# The dependencies are unreliable, just an example here
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libx11-6, libxext6, libxcomposite1, libxrender1, libxdamage1, libxfixes3, libpcre3, libconfig8")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libx11-6, libxext6, libxcomposite1, libxrender1, libxdamage1, libxfixes3, libpcre3, libconfig8, libdrm2")
|
||||
|
||||
# --- RPM package config ---
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "unknown")
|
||||
# The dependencies are unreliable, just an example here
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libx11, libxext, libxcomposite, libxrender, libxdamage, libxfixes, libpcre, libconfig")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libx11, libxext, libxcomposite, libxrender, libxdamage, libxfixes, libpcre, libconfig, libdrm")
|
||||
|
||||
include(CPack)
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
option(NEW_DOC "Build new man pages and HTML documentation" ON)
|
||||
|
||||
# == Build documentation ==
|
||||
# Stolen from https://issues.apache.org/jira/secure/attachment/12455612/AVRO-470.patch
|
||||
if (NEW_DOC)
|
||||
set (MAN_SRC
|
||||
compton.1.asciidoc
|
||||
compton-trans.1.asciidoc
|
||||
)
|
||||
|
||||
find_program(ASCIIDOC_EXEC asciidoc)
|
||||
find_program(ASCIIDOC_A2X_EXEC a2x)
|
||||
if (ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
|
||||
foreach(_file ${MAN_SRC})
|
||||
# get_filename_component() does not handle ".1.asciidoc"
|
||||
# correctly
|
||||
string(REPLACE ".asciidoc" "" _file_we "${_file}")
|
||||
set(_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
|
||||
set(_html_out "${_file_we}.html")
|
||||
set(_man_out "${_file_we}")
|
||||
add_custom_target(compton_man_${_file_we} ALL
|
||||
COMMAND ${ASCIIDOC_A2X_EXEC} --format manpage
|
||||
"${_file_path}"
|
||||
DEPENDS "${_file_path}"
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${_html_out}"
|
||||
COMMAND ${ASCIIDOC_EXEC} -o "${_html_out}" "${_file_path}"
|
||||
DEPENDS "${_file_path}"
|
||||
)
|
||||
add_custom_target(compton_html_${_file_we} ALL
|
||||
DEPENDS "${_html_out}"
|
||||
)
|
||||
endforeach(_file)
|
||||
else(ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
|
||||
message(WARNING "asciidoc/a2x not found. New man pages and HTML documentation will not be built.")
|
||||
endif(ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
|
||||
endif(NEW_DOC)
|
||||
|
||||
# == Install ==
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(FILES
|
||||
"compton.1"
|
||||
"compton-trans.1"
|
||||
DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT doc)
|
Loading…
Reference in New Issue