Overview
PyPi module | N/A |
git repository | https://bitbucket.org/arrizza-public/cpip-common |
git command | git clone git@bitbucket.org:arrizza-public/cpip-common.git |
Verification Report | https://arrizza.com/web-ver/cpip-common-report.html |
Version Info |
|
- installation: see https://arrizza.com/setup-common
Summary
This project generates C/C++ packages that can be used by other projects.
Future
If possible, this mechanism can be used to shared python generated executables, FPGA components, Arduino source or objects, etc.
Scenarios
There are 3 components in the tests:
1) src-proj: a project that creates a shared package e.g. this one. These have source files that are compiled and unit tested independently of other projects.
2) user-proj: a project that uses a shared package e.g. devcpp-app-template. These name the packages in their local xplat.cfg file and then use ./do_build. That creates a Findcpip.cmake file and generates cmake variables to use the named packages.
3) server: my web server (<https://arrizza.com)
Note: the local shared directory can be anywhere in your system. It is named in the xplat.cfg file:
[cpip]
root_dir = ~/projects/cpip <=== this is the local shared directory
packages = logger
In the scenarios below, I use "~/projects/cpip"
Scenario: Refresh from Server
- Go to a user-proj or src-proj
- ./do_update: copies from remote to ~/projects/cpip
- follow instructions in "Use a package" below
Scenario: Use a package
- go to a user-proj
- update xplat.cfg to indicate the package(s) to use
[cpip]
root_dir = ~/projects/cpip
packages = logger # an example package
- update CMakeLists.txt as necessary for the new package *
- use CPIP_SRC to set up source files for compilation
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
${CPIP_SRC}
... other source files here ...
)
- use CPIP_INCLUDE_DIR to set up include directory
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
${CPIP_INCLUDE_DIR}
... other include dirs here ...
)
- ./do_build: generates the Findcpip.cmake file. This contains the definitions needed by CMakeLists.txt
set(CPIP_ROOT_DIR /your_dir/cpip)
set(CPIP_INCLUDE_DIR /your_dir/cpip)
message(STATUS "home dir : ${HOME_DIR}")
message(STATUS "cpip root dir : ${CPIP_ROOT_DIR}")
message(STATUS "cpip include dir: ${CPIP_INCLUDE_DIR}")
set(CPIP_SRC
${CPIP_INCLUDE_DIR}/cpip/logger/logger.h
${CPIP_INCLUDE_DIR}/cpip/logger/logger.cpp
)
- run to verify the new package is used correctly
Scenario: Create a package
- in the src-proj:
- set up the source files and unit tests.
- build and run UTs to verify the package is correct
- publish the package:
- update lib/packages.json with the new target info
- ./do_publish:
- merges lib/packages.json into ~/projects/cpip
- copies all source/exes etc. named for that target from this project to ~/projects/cpip
- Use the package:
- go to a user-proj
- follow instructions in "Use a package" above
- verify package works correctly
Notes:
- assumes two src-projs don't use the same pkg name
Scenario: Publish to server
Not available for public use since it uses private components and knowledge of my website.
In short, it does this:
- goes through the ~/projects/cpip/cpip.json file and generates an HTML page with all the known packages
- For each source or other type of file, it creates link to the package file that resides on the server
- Then the HTML page and all the packages files are copied to the web server