Skip to content

C++ & Python project template using my libraries (CECS / CCEXP / MVECTOR / PThreadPool / vkpLibs) for Win and Ubuntu

License

Notifications You must be signed in to change notification settings

terablade2001/vp-cpp-template

Repository files navigation

Table Of Contents

Warning: The following notes may not be valid after (0.057) version...

What is vp-cpp-template?

Table Of Contents

It's a C++ & Python framework which includes my most important libraries (CECS / CCEXP / MVECTOR / vkp_Config / PThreadPool / vkpLibs), in a ready-to-be-compiled scheme, under two BuildSystems: Windows and Ubuntu.

You can use this ready-to-work-on framework with the combined aforementioned libraries, in order to setup and build quick different C++ / Python projects, for different platforms. These libraries can help you achieve different things, from integrated advanced error control, easy binary data importing/exporting for debuging and integration issues, easy access to configuration files where multiple parameters can be set during development/testing, easy access to thread-pooling mechanisms, CSV files read/write, e.t.c. Regarding the different platforms the vp-cpp-template project provides a BuildSystems/ folder where developers can add specific cmake setups for different targeted platforms. By default the project provides Windows (TDM-GCC) and Ubuntu support.

The vp-cpp-template project also provides some technologies / know-how (i.e. contains examples of APIs where the generated C/C++ dynamic files can be accessed via Python) for the users. The file structure is designed to support easy implementation and testing of libraries, which mean it's possible to use the vp-cpp-template project to generate and test different libraries, which you can later use elsewhere as dynamic libraries.

The included libraries can be compiled directly in the project, providing some technologies, like integrated Error Control System, pthreads thread pool, checking and reading of configuration files easily, projects common build versioning between C++ and Python parts, data sharing via dynamic format, etc. The libraries are referred below.

Table Of Contents

Quick build and testing

Table Of Contents

This section shows how to quickly clone, build and test the template, in both windows (TDM-GCC) and ubuntu systems. In both cases the vp-cpp-template project will execute a Modules-Test and provide the results that passed (all 3 modules / tests should pass).

Windows system

## clone project.
git clone https://github.com/terablade2001/vp-cpp-template.git

# Detach and autoprepare project: Use commands from bash-shell (i.e. after installing git), not windows CMD shell.
cd vp-cpp-template/BuildSystems/my-win64
./detachProjectFromGit.sh

## Now use windows CMD shell in the clone vp-cpp-template/ folder.
## Start building the sub-modules/libraries (.dll files)
cd BuildSystems\my-win64\Libs\vp-cpp-template-extlibs
cmake-build.cmd
rmake-build.cmd
cd ..\ExampleCTypes
cmake-build.cmd
rmake-build.cmd
cd ..\ExampleCAPI
cmake-build.cmd
rmake-build.cmd
## Build the main project (Main + ModulesTesting)
cd ..\..
cmake-build.cmd
rmake-build.cmd

## Module Testing (C/C++)
cd ..\..\workdir
vp-cpp-template.exe confModuleTesting-Windows.cfg

Ubuntu system

## clone project
git clone https://github.com/terablade2001/vp-cpp-template.git

# Detach and autoprepare project
cd vp-cpp-template/BuildSystems/my-ubuntu64
./detachProjectFromGit.sh

## Start building the sub-modules/libraries (.so files)
cd Libs/vp-cpp-template-extlibs
./cmake-build.cmd
./rmake-build.cmd
cd ../ExampleCTypes
./cmake-build.cmd
./rmake-build.cmd
cd ../ExampleCAPI
./cmake-build.cmd
./rmake-build.cmd
## Build the main project (Main + ModulesTesting)
cd ../..
./cmake-build.cmd
./rmake-build.cmd

## Module Testing (C/C++)
cd ../../workdir
./vp-cpp-template confModuleTesting-Ubuntu.cfg

Expected similar test-run results like:

<63, DummyClass.cpp, L-6>: libExampleCAPI.dll:: DummyClass - constructor

=======================================================================
= VP-CPP-TEMPLATE (https://github.com/terablade2001/vp-cpp-template)  =
= Program version: [0.057]                                            =
=======================================================================
ProcessType: ModuleTesting
=======================================================================
Enabled Tests = 11 / 11

>>>>>>> TEST RESULTS <<<<<<<
MODULE-TESTING: Total Tests = [11]
MODULE-TESTING: - Enabled Tests = [11]
   [+](-)[Passed]: TestID = [1] > Testing default example of vp-cpp-template where different utilities are working together as a working example.
   [+](-)[Passed]: TestID = [2] > Testing the CAPI library that is compiled as an example in vp-cpp-template project.
   [+](+)[Passed]: TestID = [3] > Testing the vkpCSVHandler utility.
   [+](+)[Passed]: TestID = [4] > Testing CLI test id 0 (Test_CLIReader())
   [+](+)[Passed]: TestID = [5] > Testing CLI test id 0 (Test_CLIReader())
   [+](-)[Passed]: TestID = [6] > Testing CLI test id 0 (Test_CLIReader()): No --cli command -> should fail!
   [+](-)[Passed]: TestID = [7] > Testing CLI test id 0 (Test_CLIReader()): Not -testId -> should fail
   [+](-)[Passed]: TestID = [8] > Testing CLI test id 0 (Test_CLIReader()): Not supported -testId -> should fail
   [+](-)[Passed]: TestID = [9] > Testing CLI test id 0 (Test_CLIReader()): --cli command would require testId=0 too -> should fail
   [+](+)[Passed]: TestID = [10] > Testing CLI test id 0 (Test_CLIReader()): Should pass. Two argv[0] should be visible
   [+](+)[Passed]: TestID = [11] > Testing CLI test id 0 (Test_CLIReader()): Should pass (vkpLibs-0.220 tests)
MODULE-TESTING: - Passed Tests = [11] out of 11
MODULE-TESTING: - Timer [Total Testing Time]: Avg = 2020.13 ms. (2020.13 / 1)
>>>>>>>==============<<<<<<<

=*-*= Program completed =*-*=

• The intermediate results of the three individual Module-Tests can be also seen in the generated moduleTestsLog_Passed.log file.

Table Of Contents

TODOs

Table Of Contents

Things that are expected to be added in the project, over time.

  • Update vkpProgressBar (resolve some issues)
  • Adding some support functions
    • makeDir()
    • Support functions for OpenCV

Completed TODOs - versioning

versions (0.064) - (0.066)

  • Easy support for integration with OpenCV. Read Documentation for more info.
  • Updated Links with vkpLibs(0.222) and CCEXP(0.108)

version (0.063)

  • Updated the ModuleTesting.cpp to support execution ordering of Tests. This is useful for the cases where some tests depends on other test's results. The execution order can be defined in a new column on the CSV file called Depends On. The value of -1 means no dependency, while multiple tests Ids can be used separated with comma. Check the default moduleTestsList.csv file for examples.

version (0.062)

  • Minor fix at Main.cpp of folder emptyProject/. Fix to use by default info_(0,...) instead of info(1,...).

version (0.061)

  • At ModuleTesting.cpp, find() instead of compare() is used, as info_() may also print verbose level.

version (0.060)

  • All CMakeLists.txt files include a common BuildConfigurations.cmake file, where global compilation definitions can be set.
  • Link with vkpLibs (0.221) and CECS (0.133): Fix in vkpTimer and update of info_() macro to also show the verbose level if it's > 0.
  • Main.cpp : Rearrange the code regarding the info_() references.

version (0.059)

  • Adding ubuntu / win scripts to reset the project, by deleted examples etc.
    • Use emptyProject.sh / emptyProject.cmd files in BuildSystems/ subdirectories.

version (0.058)

  • Merged Main.cpp's MainCLIReader and processType parameter (comments removed).
  • Main.cpp: Parse the input first and print later via info_() macro based on the -v <level>.
  • Main.cpp: use --version to display the version string

version (0.057)

version (0.056)

  • vkpLibs (0.220) - Updates regarding the vkpConfigReader and the CLI relative code (for more info check vkpLibs repository)

version (0.055)

  • vkpLibs (0.219) - Support CLI input parsing with vkpConfigReader update (Support a CLI reader/analyzer integrated with vkpConfigReader).
    • vkpConfigReader can be used also without the CECS (see self-contained working example code at: ExtLibs/vkpLibs/vkpConfigReader/test/main.cpp)
  • Main.cpp updated to support Module tests either via CLI input or via Configuration Files. For CLI input use --cli and -testId <test number>. The example uses -testId 0. For configuration files (previous behaviour) don't use the --cli flag.
  • Module ModuleTesting.cpp updated to also show the actual test result. For instance the (-) in the result: [+](-)[Passed]: TestID = [6] > Testing CLI test id 0 (Test_CLIReader()): No --cli command -> should fail! indicates that the test is indeed failed (see generated fle moduleTestsLog_Failed.log ), but we expected it to fail thus it passed, and so it has the symbols [+].
  • Including a number of CLI unit tests, reaching up to 10 enabled tests for the whole project.
    • Setting DbgVerboseLevel to 1 for Modules Testing

version (0.054)

  • CECS (0.132) - including helper macro info_(level,string).

version (0.053)

  • Document an example of adding and testing a new Module with GitLab CI (see Documentation.pdf :: page 19)

version (0.052)

  • Updated GitLab CI pipeline to also delete previous images/containers (cleaning)
  • The ModuleTesting module is now comparing against the expected result status of tests. This gives the ability for the user to define in the testing CSV file which tests are expected to completed correctly and which are expected to generate errors. If a test produce what the user expects then it considered as Passed. If not, it's considered as Failed.

version (0.051)

  • Added GitLab CI pipeline for offline runners.
    • Document an example with GitLab CI integration.
  • Export and provide Documentation.odt also as a PDF.

version (0.050)

  • Update template of Documentation.odt
  • Update documentation with more info regarding template's file structure, main() and processed and the ModuleTesting support.

version (0.049.01)

  • Fix README.md anchor links to be displayed correctly.

version (0.049)

  • Integrated ModuleTesting
  • Move all intermediate builds to build/ folder instead of C++/ folder.
    • Ubuntu build
    • Windows build
  • Re-write Quick Installation and Testing notes here.
  • Update / re-design README.md file
  • Some cleaning ...
    • Removing tasks for vscode.
    • Removing make-build.{cmd/sh} and build-all.{cmd/sh} commands.

Table Of Contents

LICENSE

Table Of Contents

MIT License

Copyright (c) 2016 - 2022 Vasileios Kon. Pothos (terablade2001)
https://github.com/terablade2001/vp-cpp-template

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.

Table Of Contents