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
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,33 @@ find_package(Boost 1.83 COMPONENTS filesystem REQUIRED)
find_package(yaml-cpp 0.6 REQUIRED)

add_library(cpackexamplelib filesystem/filesystem.cpp fem/fem.cpp flatset/flatset.cpp yamlParser/yamlParser.cpp)

set_target_properties(cpackexamplelib PROPERTIES VERSION 0.1.0 SOVERSION 1 PUBLIC_HEADER "filesystem/filesystem.hpp;fem/fem.hpp;flatset/flatset.hpp;yamlParser/yamlParser.hpp")

target_include_directories(cpackexamplelib
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cpackexamplelib>
)

add_executable("${PROJECT_NAME}" main.cpp)

target_link_libraries("${PROJECT_NAME}" cpackexamplelib)
target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES})

include(GNUInstallDirs)
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
)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CPackConfig)

DEAL_II_SETUP_TARGET("${PROJECT_NAME}")
DEAL_II_SETUP_TARGET(cpackexamplelib)
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# Packaging with CPack

Repository for the [CPack exercise](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/03_building_and_packaging/cpack_exercise.md). The code is a slightly modified version of the [code used in the CMake exercise](https://github.com/Simulation-Software-Engineering/cmake-exercise).

## Building the package

```bash
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
make -j && make install
cpack -G "TGZ;DEB"
```

## Installing the package

```bash
apt install ./cpackexample_0.1.0_amd64.deb
```

## Unpacking the package and running the binary

```bash
dpkg-deb -R cpackexample_0.1.0_amd64.deb /cpackexample-debian
cd /cpackexample-debian/usr/bin && ./cpackexample
```
17 changes: 17 additions & 0 deletions cmake/CPackConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This file configures the cpack packaging process."
CACHE STRING "Extended summary.")

set(CPACK_PACKAGE_VENDOR "Zara Zlatanova")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Zara Zlatanova <${CPACK_PACKAGE_CONTACT}>")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/zezl7/cpack-exercise-wt2526")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS YES)
set(CPACK_STRIP_FILES TRUE)

set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Once unpacked, the binary cpackexample prints the SSE course work.")

include(CPack)
10 changes: 10 additions & 0 deletions lintian_final_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$ lintian ./cpackexample_0.1.0_amd64.deb
running with root privileges is not recommended!
E: cpackexample: lacks-ldconfig-trigger usr/lib/libcpackexamplelib.so.0.1.0
E: cpackexample: no-changelog usr/share/doc/cpackexample/changelog.gz (native package)
E: cpackexample: no-copyright-file
W: cpackexample: link-to-shared-library-in-wrong-package usr/lib/libcpackexamplelib.so.0.1.0 [usr/lib/libcpackexamplelib.so]
W: cpackexample: maintscript-calls-ldconfig [postinst]
W: cpackexample: maintscript-calls-ldconfig [postrm]
W: cpackexample: no-manual-page [usr/bin/cpackexample]
W: cpackexample: package-name-doesnt-match-sonames libcpackexamplelib1
12 changes: 12 additions & 0 deletions lintian_initial_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$ lintian ./cpackexample_0.1.0_amd64.deb
running with root privileges is not recommended!
E: cpackexample: extended-description-is-empty
E: cpackexample: lacks-ldconfig-trigger usr/lib/libcpackexamplelib.so
E: cpackexample: no-changelog usr/share/doc/cpackexample/changelog.gz (native package)
E: cpackexample: no-copyright-file
E: cpackexample: no-phrase Maintainer [email protected]
W: cpackexample: no-manual-page [usr/bin/cpackexample]
W: cpackexample: package-name-doesnt-match-sonames libcpackexamplelib
W: cpackexample: shared-library-lacks-version usr/lib/libcpackexamplelib.so libcpackexamplelib.so
W: cpackexample: undeclared-elf-prerequisites (libboost_filesystem.so.1.83.0 libc.so.6 libdeal.ii.so.9.5.1 libgcc_s.so.1 libm.so.6 libmpi.so.40 libmpi_cxx.so.40 libstdc++.so.6 libtbb.so.12 libyaml-cpp.so.0.6) [usr/lib/libcpackexamplelib.so]
W: cpackexample: undeclared-elf-prerequisites (libc.so.6 libcpackexamplelib.so libdeal.ii.so.9.5.1 libgcc_s.so.1 libmpi.so.40 libmpi_cxx.so.40 libstdc++.so.6 libtbb.so.12) [usr/bin/cpackexample]