diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d6c2c..954661d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,3 +20,61 @@ target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES}) DEAL_II_SETUP_TARGET("${PROJECT_NAME}") DEAL_II_SETUP_TARGET(cpackexamplelib) + +set_target_properties(cpackexamplelib PROPERTIES + PUBLIC_HEADER "fem/fem.hpp;filesystem/filesystem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp" +) + +include(GNUInstallDirs) + +target_include_directories(cpackexamplelib + PRIVATE + # where the library itself will look for its internal headers + ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC + # where top-level project will look for the library's public headers + $ + # where external projects will look for the library's public headers + $ +) + +# compress changelog +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz" + COMMAND gzip -c -9 "${CMAKE_CURRENT_SOURCE_DIR}/changelog" > "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/changelog" +) +add_custom_target(changelog ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz") + +# compress man page +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpackexample.1.gz" + COMMAND gzip -c -9 -n "${CMAKE_CURRENT_SOURCE_DIR}/manual.1" > "${CMAKE_CURRENT_BINARY_DIR}/cpackexample.1.gz" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/manual.1" +) +add_custom_target(manpage ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpackexample.1.gz") + +install(TARGETS cpackexample cpackexamplelib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib +) + +install( + FILES "LICENSE" DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME "copyright" +) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz" DESTINATION "${CMAKE_INSTALL_DOCDIR}" +) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/cpackexample.1.gz" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" +) + +# Adding other cmake modules (standard like this) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +# Include our packaging module (standard like this) +include(CPackConfig) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bd5207d..df3df6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,13 +13,8 @@ RUN apt-get -qq update && \ tree \ lintian \ unzip + libyaml-cpp-dev -# Get, unpack, build, and install yaml-cpp -RUN mkdir software && cd software && \ - wget https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.zip && unzip yaml-cpp-0.6.3.zip && \ - cd yaml-cpp-yaml-cpp-0.6.3 && mkdir build && cd build && \ - cmake -DYAML_BUILD_SHARED_LIBS=ON .. && make -j4 && make install - # This is some strange Docker feature. Normally, you don't need to add /usr/local to these ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib/ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib/ diff --git a/changelog b/changelog new file mode 100644 index 0000000..2d70842 --- /dev/null +++ b/changelog @@ -0,0 +1,5 @@ +cpackexample (0.1.0) unstable; urgency=low + [ Initial Package Release ] + * Added CPack configuration to create .deb and .tar.gz files. + * Added installation procedure to default paths. + -- Fabio Tucciarone Sat, 06 Dec 2025 16:30:00 +0100 \ No newline at end of file diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake new file mode 100644 index 0000000..eb7974d --- /dev/null +++ b/cmake/CPackConfig.cmake @@ -0,0 +1,23 @@ +# Debian packaging section +set(CPACK_GENERATOR "TGZ;DEB") +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) + +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SSE ppackaging example project") + +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION +"This package contains and tests some packages +and generates .deb and .tar.gz files itself." +) + +set(CPACK_PACKAGE_VENDOR "SSE Student") +set(CPACK_PACKAGE_CONTACT "st177167@stud.uni-stuttgart.de") +set(CPACK_PACKAGE_MAINTAINER "FabioTucciarone ${CPACK_PACKAGE_CONTACT}") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "FabioTucciarone <${CPACK_PACKAGE_CONTACT}>") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/FabioTucciarone/cpack-exercise-wt2526") + +set(CPACK_STRIP_FILES true) + +include(CPack) \ No newline at end of file diff --git a/manual.1 b/manual.1 new file mode 100644 index 0000000..a30ae6f --- /dev/null +++ b/manual.1 @@ -0,0 +1,7 @@ +.TH cpackexample 1 "Dec 2025" "cpackexample 0.1.0" +.SH NAME +cpackexample \- executable +.SH SYNOPSIS +Runs some example code for boost, deal.ii and yaml-cpp +.SH DESCRIPTION +SSE packaging example project