Skip to content

Commit

Permalink
add html and include installation options
Browse files Browse the repository at this point in the history
  • Loading branch information
goatshriek committed May 22, 2024
1 parent 6882484 commit bde7dc6
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 84 deletions.
65 changes: 19 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ option(ENABLE_SQLITE3_TARGETS "support sqlite3 targets" ON)
option(ENABLE_WINDOWS_EVENT_LOG_TARGETS "support windows event log targets" ON)

option(INSTALL_EXAMPLES "install examples" ON)
option(INSTALL_HEADERS "install header files" ON)
option(INSTALL_HTML "install html documentation" ON)
option(INSTALL_MANPAGES "install generated manpages" ON)

option(COVERAGE "Include coverage information" OFF)
Expand Down Expand Up @@ -268,18 +270,24 @@ set(DOXYGEN_MANPAGES
)

if(DOXYGEN_FOUND)
set(INCLUDE_HTML_IN_INSTALL ${INSTALL_HTML})
set(INCLUDE_MANPAGES_IN_INSTALL ${INSTALL_MANPAGES})
else()
if(INSTALL_HTML)
message("doxygen is required to generate and install html documentation")
endif()

if(INSTALL_MANPAGES)
message("doxygen is required to generate and install manpages")
endif()

set(INCLUDE_HTML_IN_INSTALL FALSE)
set(INCLUDE_MANPAGES_IN_INSTALL FALSE)
endif()

if(${INCLUDE_MANPAGES_IN_INSTALL})
if(${INCLUDE_HTML_IN_INSTALL} OR ${INCLUDE_MANPAGES_IN_INSTALL})
# we need to do this before any other install commands that depend on the
# manpages generated by doxygen, so that they are generated before use
# html or manpages generated by doxygen, so that they are generated before use
install(CODE
"execute_process(COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target docs)"
)
Expand Down Expand Up @@ -593,7 +601,6 @@ endif()
# library definition
add_library(stumpless ${STUMPLESS_SOURCES})
set_target_properties(stumpless PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(stumpless PROPERTIES PUBLIC_HEADER include/stumpless.h)

target_link_libraries(stumpless PRIVATE ${STUMPLESS_LINK_LIBRARIES})

Expand Down Expand Up @@ -767,49 +774,9 @@ install(TARGETS stumpless
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(FILES
${PROJECT_BINARY_DIR}/include/stumpless/config.h
${PROJECT_SOURCE_DIR}/include/stumpless/element.h
${PROJECT_SOURCE_DIR}/include/stumpless/entry.h
${PROJECT_SOURCE_DIR}/include/stumpless/error.h
${PROJECT_SOURCE_DIR}/include/stumpless/facility.h
${PROJECT_SOURCE_DIR}/include/stumpless/filter.h
${PROJECT_SOURCE_DIR}/include/stumpless/generator.h
${PROJECT_SOURCE_DIR}/include/stumpless/id.h
${PROJECT_SOURCE_DIR}/include/stumpless/log.h
${PROJECT_SOURCE_DIR}/include/stumpless/memory.h
${PROJECT_SOURCE_DIR}/include/stumpless/option.h
${PROJECT_SOURCE_DIR}/include/stumpless/param.h
${PROJECT_SOURCE_DIR}/include/stumpless/severity.h
${PROJECT_SOURCE_DIR}/include/stumpless/target.h
${PROJECT_SOURCE_DIR}/include/stumpless/version.h
${PROJECT_SOURCE_DIR}/include/stumpless/priority.h
${PROJECT_SOURCE_DIR}/include/stumpless/prival.h
DESTINATION "include/stumpless"
)

install(FILES
"${PROJECT_BINARY_DIR}/include/stumpless/level/alert.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/crit.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/debug.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/emerg.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/err.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/info.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/level/mask.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/notice.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/level/trace.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/warning.h"
DESTINATION "include/stumpless/level"
)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/target/buffer.h
${PROJECT_SOURCE_DIR}/include/stumpless/target/file.h
${PROJECT_SOURCE_DIR}/include/stumpless/target/function.h
${PROJECT_SOURCE_DIR}/include/stumpless/target/sqlite3.h
${PROJECT_SOURCE_DIR}/include/stumpless/target/stream.h
DESTINATION "include/stumpless/target"
)
if(INSTALL_HEADERS)
include(tools/cmake/install_headers.cmake)
endif()

include(tools/cmake/cpack.cmake)

Expand All @@ -835,6 +802,12 @@ if(INSTALL_EXAMPLES)
endif()


# installation of html if enabled and supported
if(INCLUDE_HTML_IN_INSTALL)
include(tools/cmake/install_html.cmake)
endif()


# installation of manpages if enabled and supported
if(INCLUDE_MANPAGES_IN_INSTALL)
include(tools/cmake/install_manpages.cmake)
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rpm -i stumpless-2.2.0-x86_64.rpm
```


## FreeBSD Pkg
## FreeBSD Package
A `.pkg` package is provided for use in FreeBSD environments. Of course, it is
installed just as any other pkg would be:

Expand Down
10 changes: 6 additions & 4 deletions tools/cmake/chain.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
list(APPEND STUMPLESS_SOURCES "${PROJECT_SOURCE_DIR}/src/target/chain.c")
list(APPEND WRAPTURE_SPECS "${PROJECT_SOURCE_DIR}/tools/wrapture/chain_target.yml")

install(FILES
"${PROJECT_SOURCE_DIR}/include/stumpless/target/chain.h"
DESTINATION "include/stumpless/target"
)
if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/chain.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
endif()

list(APPEND DOXYGEN_MANPAGES "${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/chain.h.3")

Expand Down
17 changes: 11 additions & 6 deletions tools/cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ target_include_directories(stumplesscpp
set_target_properties(stumplesscpp
PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER ${cpp_rollup_header}
)

if(WIN32)
Expand Down Expand Up @@ -271,14 +270,20 @@ add_custom_target(run-example-cpp
install(TARGETS stumplesscpp
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include"
ARCHIVE DESTINATION "lib"
)

install(
FILES ${GENERATED_CPP_LIB_HEADERS}
DESTINATION "include/stumpless"
)
if(INSTALL_HEADERS)
install(
FILES "${cpp_rollup_header}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

install(
FILES ${GENERATED_CPP_LIB_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless"
)
endif()

#documentation generation
if(DOXYGEN_FOUND)
Expand Down
53 changes: 53 additions & 0 deletions tools/cmake/install_headers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

install(
FILES
"${PROJECT_BINARY_DIR}/include/stumpless/config.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/element.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/entry.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/error.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/facility.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/filter.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/generator.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/id.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/log.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/memory.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/option.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/param.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/priority.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/prival.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/severity.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/target.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/version.h"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/stumpless"
)

install(
FILES
"${PROJECT_BINARY_DIR}/include/stumpless/level/alert.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/crit.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/debug.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/emerg.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/err.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/info.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/level/mask.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/notice.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/level/trace.h"
"${PROJECT_BINARY_DIR}/include/stumpless/level/warning.h"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/stumpless/level"
)

install(
FILES
"${PROJECT_SOURCE_DIR}/include/stumpless/target/buffer.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/target/file.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/target/function.h"
"${PROJECT_SOURCE_DIR}/include/stumpless/target/stream.h"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
5 changes: 5 additions & 0 deletions tools/cmake/install_html.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(HTML_BUILD_DIR "${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/html")

install(DIRECTORY "${HTML_BUILD_DIR}"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
18 changes: 10 additions & 8 deletions tools/cmake/journald.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ list(APPEND STUMPLESS_SOURCES ${PROJECT_SOURCE_DIR}/src/target/journald.c)
list(APPEND STUMPLESS_SOURCES ${PROJECT_SOURCE_DIR}/src/config/journald_supported.c)
list(APPEND WRAPTURE_SPECS ${PROJECT_SOURCE_DIR}/tools/wrapture/journald_target.yml)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/target/journald.h
DESTINATION "include/stumpless/target"
)
if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/journald.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/config/journald_supported.h
DESTINATION "include/stumpless/config"
)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/config/journald_supported.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/config"
)
endif()

list(APPEND DOXYGEN_MANPAGES ${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/journald.h.3)
list(APPEND DOXYGEN_MANPAGES ${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/journald_supported.h.3)
Expand Down
10 changes: 6 additions & 4 deletions tools/cmake/network.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ elseif(HAVE_WINSOCK2_H)
find_library(WINSOCK2 NAMES Ws2_32)
endif()

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/target/network.h
DESTINATION "include/stumpless/target"
)
if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/network.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
endif()

list(APPEND DOXYGEN_MANPAGES ${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/network.h.3)

Expand Down
10 changes: 6 additions & 4 deletions tools/cmake/socket.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ list(APPEND STUMPLESS_SOURCES ${PROJECT_SOURCE_DIR}/src/config/socket_supported.

list(APPEND WRAPTURE_SPECS ${PROJECT_SOURCE_DIR}/tools/wrapture/socket_target.yml)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/target/socket.h
DESTINATION "include/stumpless/target"
)
if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/socket.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
endif()

list(APPEND DOXYGEN_MANPAGES ${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/socket.h.3)

Expand Down
7 changes: 7 additions & 0 deletions tools/cmake/sqlite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ list(APPEND STUMPLESS_SOURCES "${PROJECT_SOURCE_DIR}/src/target/sqlite3.c")
list(APPEND WRAPTURE_SPECS "${PROJECT_SOURCE_DIR}/tools/wrapture/sqlite3_target.yml")
list(APPEND DOXYGEN_MANPAGES "${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/sqlite3.h.3")

if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/sqlite3.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
endif()

if(INCLUDE_MANPAGES_IN_INSTALL)
install(FILES
"${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/sqlite3.h.3"
Expand Down
18 changes: 10 additions & 8 deletions tools/cmake/wel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ list(APPEND STUMPLESS_SOURCES ${PROJECT_SOURCE_DIR}/src/config/wel_supported.c)
list(INSERT WRAPTURE_SPECS 0 ${PROJECT_SOURCE_DIR}/tools/wrapture/have_wel_templates.yml)
list(APPEND WRAPTURE_SPECS ${PROJECT_SOURCE_DIR}/tools/wrapture/wel_target.yml)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/config/wel_supported.h
DESTINATION "include/stumpless/config"
)
if(INSTALL_HEADERS)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/config/wel_supported.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/config"
)

install(FILES
${PROJECT_SOURCE_DIR}/include/stumpless/target/wel.h
DESTINATION "include/stumpless/target"
)
install(
FILES "${PROJECT_SOURCE_DIR}/include/stumpless/target/wel.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/stumpless/target"
)
endif()

list(APPEND DOXYGEN_MANPAGES ${PROJECT_BINARY_DIR}/docs/${STUMPLESS_LANGUAGE}/man/man3/wel.h.3)

Expand Down
9 changes: 6 additions & 3 deletions tools/portage/stumpless.ebuild.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ fi

LICENSE="Apache-2.0"
KEYWORDS="~amd64 ~x86"
IUSE="chain-targets doc examples sockets sqlite systemd test threads"
IUSE="chain-targets doc examples man sockets sqlite systemd test threads"

DEPEND="test? ( dev-cpp/gtest )
sqlite? ( >=dev-db/sqlite )
systemd? ( sys-apps/systemd )"
RDEPEND="${DEPEND}"
BDEPEND="doc? ( app-text/doxygen )"
BDEPEND="doc? ( app-text/doxygen )
man? ( app-text/doxygen )"

# disable test phase if the test USE flag is disabled
RESTRICT="!test? ( test )"
Expand All @@ -36,7 +38,8 @@ src_configure() {
-DENABLE_SQLITE3_TARGETS="$(usex sqlite)"
-DENABLE_THREAD_SAFETY="$(usex threads)"
-DINSTALL_EXAMPLES="$(usex examples)"
-DINSTALL_MANPAGES="$(usex doc)"
-DINSTALL_HTML="$(usex doc)"
-DINSTALL_MANPAGES="$(usex man)"
)
cmake_src_configure
}
Expand Down

0 comments on commit bde7dc6

Please sign in to comment.