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
26 changes: 26 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,29 @@ target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES})

DEAL_II_SETUP_TARGET("${PROJECT_NAME}")
DEAL_II_SETUP_TARGET(cpackexamplelib)

# Install targets
include(GNUInstallDirs)

# Install executable to bin/
install(TARGETS "${PROJECT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Install library to lib/
install(TARGETS cpackexamplelib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

# Install header files to include/cpackexamplelib/
install(FILES
fem/fem.hpp
filesystem/filesystem.hpp
flatset/flatset.hpp
yamlParser/yamlParser.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib
)

# Include CPack configuration
include(cmake/CPackConfig.cmake)
55 changes: 55 additions & 0 deletions cmake/CPackConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# CPack Configuration for cpackexample
# This module configures the packaging process for tar.gz and deb packages

# General CPack settings
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")

# Package metadata
set(CPACK_PACKAGE_VENDOR "BobSolyman")
set(CPACK_PACKAGE_CONTACT "Shehabeldin Solyman <shehabsolyman134@gmail.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CPack Example - CMake packaging demo")
set(CPACK_PACKAGE_DESCRIPTION "CMake and CPack packaging example with deal.II, Boost, and yaml-cpp.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/BobSolyman/cpack-exercise-wt2526")

# Debian-specific maintainer (must have Name <email> format)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Shehabeldin Solyman <shehabsolyman134@gmail.com>")

# License and documentation
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")

# Strip binaries to reduce size
set(CPACK_STRIP_FILES TRUE)

# Only generate TGZ and DEB packages
set(CPACK_GENERATOR "TGZ;DEB")

# ============================================================================
# Debian Package Configuration
# ============================================================================

# Use Debian naming convention: <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

# Package architecture
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")

# Section for the package (optional categorization)
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")

# Priority of the package
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")

# Dependencies - these packages must be installed for cpackexample to work
# Using shlibdeps to auto-detect shared library dependencies
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

# Explicitly specify some dependencies that might not be auto-detected
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-filesystem1.83.0, libdeal.ii-dev")

# Include CPack module
include(CPack)