Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.26)

project(rolldice
VERSION 1.16
LANGUAGES C
DESCRIPTION "rolls virtual dice")

add_executable(rolldice rolldice.c main.c)
target_include_directories(rolldice PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rolldice PUBLIC readline)

# man page with sed
add_custom_command(
OUTPUT rolldice.6.gz
COMMAND sed s/__VERSION__/${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}/ ${CMAKE_CURRENT_SOURCE_DIR}/rolldice.6.src > rolldice.6
COMMAND gzip -n -9 -c ${CMAKE_CURRENT_BINARY_DIR}/rolldice.6 > rolldice.6.gz
COMMENT "Running sed to generate man page"
VERBATIM
)
add_custom_target(generate_man ALL
DEPENDS rolldice.6.gz)

include(GNUInstallDirs)
set(CMAKE_INSTALL_GAMEDIR "${CMAKE_INSTALL_PREFIX}/games"
CACHE PATH "Installation directory for games" FORCE)
install(TARGETS rolldice
RUNTIME DESTINATION ${CMAKE_INSTALL_GAMEDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rolldice.6.gz
DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)

# CPack options
set(CPACK_PACKAGE_VENDOR "Stevie Strickland")
set(CPACK_PACKAGE_CONTACT "sstrickl@gmail.com")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/sstrickl/rolldice")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/DESCRIPTION")

set(CPACK_RPM_PACKAGE_LICENSE "GPL-2.0-only")
set(CPACK_RPM_PACKAGE_REQUIRES "readline")

set(CPACK_DEBIAN_PACKAGE_DEPENDS "libreadline8 | libreadline7")
include(CPack)
4 changes: 4 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rolls virtual dice.

The dice strings passed on the command line contain information on the dice to roll in a format comparable to the format used in
most role playing games.