Skip to content

Conversation

@jkhanGitHub
Copy link

This description is just a copy of the updated README.md file:

Packaging with CPack

Repository for the CPack exercise. The code is a slightly modified version of the code used in the CMake exercise.

How to Test the Code

  1. Clone the directory and go inside the root of the directory
    git clone https://github.com/jkhanGitHub/cpack-exercise-wt2526.git
    cd cpack-exercise-wt2526

To test the changes made for the CPack exercise, follow these steps:

  1. Build the Docker Image:
    First, build the Docker image which provides the necessary build environment.

    docker build -t cpack-exercise .
  2. Run the Docker Container:
    Run the Docker container, mounting the current directory to /mnt/cpack-exercise.

    docker run --rm -it --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpack-exercise

    inside the Docker container cd into /mnt/cpack-exercise.

    cd /mnt/cpack-exercise
  3. Configure and Build the Project (Inside the Container):
    Once inside the container, configure CMake and build the project.

    cmake -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
    cmake --build build
  4. Install the Project (Inside the Container):
    Run the install target to place the executable, library, and headers in the designated installation directories.

    cmake --install build

    You can verify the installation by checking the /usr/local/bin, /usr/local/lib, and /usr/local/include/cpackexamplelib directories.

  5. Generate Packages (Inside the Container):
    Build the package target to generate both .tar.gz and Debian (.deb) packages.

    cmake --build build --target package

    The generated packages will be in the build/ directory, e.g., cpackexample-0.1.0-Linux.tar.gz and cpackexample_0.1.0_amd64.deb.

  6. Install the Debian Package (Inside the Container):
    Install the generated Debian package using apt.

    apt install ./build/cpackexample_0.1.0_amd64.deb
  7. Run the Installed Executable (Inside the Container):
    Verify that the executable is in the system's PATH and runs correctly.

    which cpackexample
    cpackexample yamlParser/config.yml

    The output should show the program executing its various modules.

  8. Check the Debian Package with Lintian (Inside the Container):
    Inspect the generated Debian package for common errors and policy violations using lintian.

    lintian build/cpackexample_0.1.0_amd64.deb

    Note: Several warnings and errors are expected from lintian as per the exercise instructions, and no fixes for these were implemented as they were optional tasks.

Optional Tasks

No optional tasks were completed as part of this exercise.

jkhanGitHub and others added 4 commits December 3, 2025 20:16
… test and executions by the TA, CMakeLists.txt updated to automate packaging, cmake dir created containing CPackConfig.cmake file
Updated step numbers in the README for clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant