Skip to content

Commit

Permalink
Add packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
renn0xtek9 committed May 13, 2024
2 parents 7e72e95 + 81ab854 commit 0766c8a
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ubuntu_2204_build_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ jobs:
run: ./scripts/build.sh
- name: Tests
run: ./scripts/test.sh --stop-on-failure
- name: Packaging
run: ./scripts/packaging.sh
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
PROJECT (cpp-quality-project)
PROJECT (cpp-quality-project VERSION 0.0.1)
ENABLE_TESTING ()

LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/)
Expand Down
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CONTRIBUTING

## How-to
- Install dependencies:
It is recomended to use the VSCode with the `.devcontainer`.
If you want to defvelop natively on an Ubuntu 22 distribution, you can run
```bash
./.devcontainer/setup_build_environment_on_ubuntu_22.sh
./.devcontainer/setup_documentation_environment_on_ubuntu_22.sh
```
- Format all files of the repository using relevant `pre-commit` hook
```bash
./scripts/format.sh
```

- Configure the project
```bash
./scripts/configure.sh
```

- Build the project
```bash
./scripts/build.sh
```

- Run all tests
```bash
./scripts/test.sh
```

- Generate the project documentation
```bash
./scripts/document.sh
```

- Create a debian package of the project
```bash
./scripts/packaging.sh
```
21 changes: 21 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [YEAR] [COPYRIGHT HOLDER]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cpp Project Template
59 changes: 0 additions & 59 deletions Readme.md

This file was deleted.

12 changes: 12 additions & 0 deletions cmake_modules/Packaging.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
INCLUDE (InstallRequiredSystemLibraries)
SET (CPACK_PACKAGE_NAME "${PROJECT_NAME}")
SET (CPACK_PACKAGE_VENDOR "company-name")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME} - Brief description")
SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
SET (CPACK_PACKAGE_HOMEPAGE_URL "http://company-url")
SET (CPACK_PACKAGE_CONTACT "author@company-email.com")
SET (CPACK_DEBIAN_PACKAGE_DEPENDS "")
SET (CPACK_GENERATOR DEB)
SET (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/License.txt)

INCLUDE (CPack)
2 changes: 2 additions & 0 deletions project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ TARGET_LINK_LIBRARIES (${EXENAME} PUBLIC probe)

INSTALL (TARGETS ${EXENAME} RUNTIME DESTINATION bin)

INCLUDE (Packaging)

ADD_CUSTOM_TARGET (
disassemble
COMMAND /usr/bin/objdump -S $<TARGET_FILE:testcpp> >
Expand Down
8 changes: 3 additions & 5 deletions project/version.hpp.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#define VERSION @SHORT_HASH@
#define VERSION @SHORT_HASH @


const char* getVersion()
{
return "@SHORT_HASH@";
const char* getVersion() {
return "@CMAKE_PROJECT_VERSION@ - @SHORT_HASH@";
}
5 changes: 5 additions & 0 deletions scripts/packaging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euxo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"/../build || exit 1
make package

0 comments on commit 0766c8a

Please sign in to comment.