Skip to content

Commit 6ef6ec7

Browse files
committed
[projmgr] MVP prototype initial commit
1 parent e614229 commit 6ef6ec7

24 files changed

Lines changed: 2526 additions & 1 deletion

.github/workflows/projmgr.yml

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
name: projmgr
2+
on:
3+
pull_request:
4+
paths:
5+
- '.github/workflows/projmgr.yml'
6+
- 'CMakeLists.txt'
7+
- 'libs/crossplatform/**'
8+
- 'libs/rtefsutils/**'
9+
- 'libs/xmlreader/**'
10+
- 'libs/xmltree/**'
11+
- 'libs/xmltreeslim/**'
12+
- 'tools/projmgr/**'
13+
release:
14+
types: [published]
15+
16+
jobs:
17+
build:
18+
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/')) }}
19+
runs-on: ${{ matrix.os }}
20+
timeout-minutes: 15
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
os: [ macos-10.15, ubuntu-20.04, windows-2019 ]
25+
include:
26+
- os: macos-10.15
27+
target: darwin64
28+
binary: projmgr
29+
- os: ubuntu-20.04
30+
target: linux64
31+
binary: projmgr
32+
- os: windows-2019
33+
target: windows64
34+
binary: projmgr.exe
35+
36+
steps:
37+
- name: Install macos deps
38+
if: ${{ startsWith(matrix.os, 'macos') }}
39+
run: |
40+
brew install \
41+
ninja \
42+
python \
43+
swig
44+
45+
- name: Install linux deps
46+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
47+
run: |
48+
sudo apt update
49+
sudo apt-get install \
50+
bc \
51+
build-essential \
52+
ninja-build \
53+
python-dev \
54+
swig
55+
56+
- name: Install windows deps
57+
if: ${{ startsWith(matrix.os, 'windows') }}
58+
run: choco install -y ninja python swig
59+
60+
- name: Checkout devtools
61+
uses: actions/checkout@v2
62+
with:
63+
submodules: true
64+
65+
- name: Create build folders
66+
run: |
67+
mkdir build
68+
mkdir buildswig
69+
70+
- name: Configure windows build for amd64
71+
if: ${{ startsWith(matrix.os, 'windows') }}
72+
uses: ilammy/msvc-dev-cmd@v1
73+
with:
74+
arch: amd64
75+
76+
- uses: ammaraskar/gcc-problem-matcher@master
77+
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
78+
- uses: ammaraskar/msvc-problem-matcher@master
79+
if: ${{ startsWith(matrix.os, 'windows') }}
80+
81+
- name: Build projmgr
82+
run: |
83+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
84+
cmake --build . --target projmgr
85+
working-directory: ./build
86+
87+
- name: Archive projmgr
88+
uses: actions/upload-artifact@v2
89+
with:
90+
name: projmgr-${{ matrix.target }}
91+
path: ./build/tools/projmgr/${{ matrix.target }}/Release/${{ matrix.binary }}
92+
retention-days: 1
93+
if-no-files-found: error
94+
95+
- name: Build projmgr swig libs
96+
run: |
97+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSWIG_LIBS=ON ..
98+
cmake --build . --target projmgr --config Release
99+
working-directory: ./buildswig
100+
101+
- name: Archive projmgr swig libs windows
102+
if: ${{ startsWith(matrix.os, 'windows') }}
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: projmgr-swig-${{ matrix.target }}
106+
path: |
107+
./buildswig/tools/projmgr/swig/projmgr.py
108+
./buildswig/tools/projmgr/swig/_projmgr.pyd
109+
retention-days: 1
110+
111+
- name: Archive projmgr swig libs macos ubuntu
112+
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
113+
uses: actions/upload-artifact@v2
114+
with:
115+
name: projmgr-swig-${{ matrix.target }}
116+
path: |
117+
./buildswig/tools/projmgr/swig/projmgr.py
118+
./buildswig/tools/projmgr/swig/_projmgr.so
119+
retention-days: 1
120+
121+
release:
122+
if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/') }}
123+
needs: [ build, unittest ]
124+
runs-on: ubuntu-20.04
125+
timeout-minutes: 15
126+
127+
steps:
128+
- name: Checkout devtools
129+
uses: actions/checkout@v2
130+
131+
- name: Create distribution folders
132+
run: |
133+
mkdir -p tools/projmgr/distribution/bin tools/projmgr/distribution/lib tools/projmgr/distribution/doc
134+
cp tools/projmgr/docs/LICENSE.txt tools/projmgr/distribution/
135+
cp tools/projmgr/docs/README.md tools/projmgr/distribution/doc/
136+
137+
- name: Download projmgr linux
138+
uses: actions/download-artifact@v2
139+
with:
140+
name: projmgr-linux64
141+
path: tools/projmgr/distribution/bin/linux64/
142+
143+
- name: Download projmgr macos
144+
uses: actions/download-artifact@v2
145+
with:
146+
name: projmgr-darwin64
147+
path: tools/projmgr/distribution/bin/darwin64/
148+
149+
- name: Download projmgr windows
150+
uses: actions/download-artifact@v2
151+
with:
152+
name: projmgr-windows64
153+
path: tools/projmgr/distribution/bin/windows64/
154+
155+
- name: Download projmgr-swig linux
156+
uses: actions/download-artifact@v2
157+
with:
158+
name: projmgr-swig-linux64
159+
path: tools/projmgr/distribution/lib/linux64/
160+
161+
- name: Download projmgr-swig macos
162+
uses: actions/download-artifact@v2
163+
with:
164+
name: projmgr-swig-darwin64
165+
path: tools/projmgr/distribution/lib/darwin64/
166+
167+
- name: Download projmgr-swig windows
168+
uses: actions/download-artifact@v2
169+
with:
170+
name: projmgr-swig-windows64
171+
path: tools/projmgr/distribution/lib/windows64/
172+
173+
- name: Zip distribution folder
174+
run: zip -r projmgr.zip *
175+
working-directory: tools/projmgr/distribution
176+
177+
- name: Attach zip archive to release assets
178+
uses: svenstaro/upload-release-action@v2
179+
with:
180+
repo_token: ${{ secrets.GITHUB_TOKEN }}
181+
file: tools/projmgr/distribution/projmgr.zip
182+
tag: ${{ github.ref }}
183+
overwrite: true
184+
asset_name: projmgr.zip
185+
186+
unittest:
187+
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/projmgr/')) }}
188+
runs-on: ${{ matrix.os }}
189+
timeout-minutes: 15
190+
strategy:
191+
fail-fast: true
192+
matrix:
193+
os: [ macos-10.15, ubuntu-20.04, windows-2019 ]
194+
include:
195+
- os: macos-10.15
196+
target: darwin64
197+
- os: ubuntu-20.04
198+
target: linux64
199+
- os: windows-2019
200+
target: windows64
201+
202+
steps:
203+
- name: Install macos deps
204+
if: ${{ startsWith(matrix.os, 'macos') }}
205+
run: |
206+
brew install \
207+
ninja
208+
209+
- name: Install linux deps
210+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
211+
run: |
212+
sudo apt update
213+
sudo apt-get install \
214+
bc \
215+
build-essential \
216+
ninja-build
217+
218+
- name: Install windows deps
219+
if: ${{ startsWith(matrix.os, 'windows') }}
220+
run: choco install -y ninja
221+
222+
- name: Checkout devtools
223+
uses: actions/checkout@v2
224+
with:
225+
submodules: true
226+
227+
- name: Create build folder
228+
run: mkdir build
229+
230+
- name: Configure windows build for amd64
231+
if: ${{ startsWith(matrix.os, 'windows') }}
232+
uses: ilammy/msvc-dev-cmd@v1
233+
with:
234+
arch: amd64
235+
236+
- uses: ammaraskar/gcc-problem-matcher@master
237+
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
238+
- uses: ammaraskar/msvc-problem-matcher@master
239+
if: ${{ startsWith(matrix.os, 'windows') }}
240+
241+
- name: Build and run projmgr unit tests
242+
run: |
243+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
244+
cmake --build . --target ProjMgrUnitTests
245+
ctest -C Debug -R ProjMgrUnitTests
246+
working-directory: ./build
247+
248+
- name: Archive unit tests results
249+
uses: actions/upload-artifact@v2
250+
with:
251+
name: unittest-${{ matrix.target }}
252+
path: ./build/Testing/Temporary/LastTest.log
253+
retention-days: 1
254+
if-no-files-found: error
255+
if: ${{ always() }}
256+
257+
- name: Publish projmgr unit test results
258+
uses: mikepenz/action-junit-report@v2
259+
with:
260+
check_name: "projmgr unit tests [${{ matrix.target }}]"
261+
report_paths: build/projmgr_unit_test_report.xml
262+

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repos:
1212
(?x)^(
1313
tools/buildmgr/test/testinput/|
1414
tools/packgen/test/data/|
15+
tools/projmgr/test/data/|
1516
libs/crossplatform/include/win|
1617
tools/buildmgr/cbuildgen/include/Resource.h|
1718
libs/crossplatform/test/src/TestProg.cpp)

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ cmake_policy(SET CMP0091 NEW)
77

88
option(COVERAGE "Enable code coverage" OFF)
99
option(LIBS_ONLY "Build only libraries" OFF)
10+
option(SWIG_LIBS "Build SWIG libraries" OFF)
1011

1112
if(LIBS_ONLY)
1213
message("LIBS_ONLY is active. Build only libraries")
@@ -37,6 +38,10 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
3738
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
3839
endif()
3940

41+
if(SWIG_LIBS)
42+
message("SWIG_LIBS is active. Build SWIG libraries")
43+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
44+
endif(SWIG_LIBS)
4045

4146
if(COVERAGE)
4247
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
@@ -78,6 +83,7 @@ add_subdirectory(libs/xmltreeslim)
7883
if(NOT LIBS_ONLY)
7984
add_subdirectory(tools/buildmgr)
8085
add_subdirectory(tools/packgen)
86+
add_subdirectory(tools/projmgr)
8187
endif()
8288

8389
# Google Test Framework

tools/buildmgr/cbuild/include/CbuildLayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CbuildLayer {
8787
* @param saveBackup if true save the original file with extension '.bak'
8888
* @return true if xml file is written successfully, otherwise false
8989
*/
90-
bool WriteXmlFile(const std::string &file, XMLTree* tree, const bool saveBackup=false);
90+
static bool WriteXmlFile(const std::string &file, XMLTree* tree, const bool saveBackup=false);
9191

9292
/**
9393
* @brief initialize header (tool and timestamp) information

tools/projmgr/CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
include(DumpCMakeProjectVersion)
4+
include(ProjectVersionFromGitTag)
5+
get_version_from_git_tag("tools/projmgr/")
6+
7+
project(ProjMgr VERSION "${PROJECT_VERSION}")
8+
dump_cmake_project_version()
9+
10+
configure_file(src/ProductInfo.h.in ProductInfo.h)
11+
12+
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT projmgr)
13+
14+
# projmgr library
15+
SET(PROJMGR_SOURCE_FILES ProjMgr.cpp ProjMgrKernel.cpp ProjMgrCallback.cpp)
16+
SET(PROJMGR_HEADER_FILES ProjMgr.h ProjMgrKernel.h ProjMgrCallback.h)
17+
18+
list(TRANSFORM PROJMGR_SOURCE_FILES PREPEND src/)
19+
list(TRANSFORM PROJMGR_HEADER_FILES PREPEND include/)
20+
21+
add_library(projmgrlib OBJECT ${PROJMGR_SOURCE_FILES} ${PROJMGR_HEADER_FILES})
22+
target_link_libraries(projmgrlib PUBLIC CrossPlatform RteFsUtils RteUtils XmlTree XmlTreeSlim XmlReader RteModel cbuild cxxopts yaml-cpp)
23+
target_include_directories(projmgrlib PRIVATE include ${PROJECT_BINARY_DIR})
24+
25+
if(SWIG_LIBS)
26+
# projmgr swig
27+
add_subdirectory(swig)
28+
else()
29+
# projmgr target
30+
add_executable(projmgr src/ProjMgrMain.cpp include/ProjMgr.h)
31+
if(MSVC)
32+
target_link_options(projmgr PUBLIC "$<$<CONFIG:Debug>:/SAFESEH:NO>")
33+
endif(MSVC)
34+
set_property(TARGET projmgr PROPERTY
35+
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
36+
target_link_libraries(projmgr projmgrlib)
37+
target_include_directories(projmgr PRIVATE include)
38+
endif()
39+
40+
# projmgr test
41+
enable_testing()
42+
add_subdirectory(test)

0 commit comments

Comments
 (0)