Skip to content

Commit 7a4a7b1

Browse files
committed
* Added Dockerfile
* Added docker image to README.md * Added target install ( make install for linux)
1 parent e5d6f76 commit 7a4a7b1

File tree

9 files changed

+152
-37
lines changed

9 files changed

+152
-37
lines changed

.gitlab-ci.yml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ stages:
66
- check_typos
77
- run_cppcheck
88
- build_minor_compiler_arm
9+
- install_deb_file
10+
- install_rpm_file
911

1012
build_gcc10:
1113
tags:
@@ -23,7 +25,7 @@ build_gcc10:
2325
- apt-get install libboost-test-dev -y
2426
- cd build
2527
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCPPINCLUDE_BUILD_WITH_TESTS=ON
26-
- cmake --build . --config Release -j4
28+
- cmake --build . --config Release -j$(nproc)
2729
# Run tests
2830
- ctest . -C Release
2931

@@ -39,7 +41,7 @@ build_gcc8:
3941
- export CXX=g++-8
4042
- cd build
4143
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCPPINCLUDE_BUILD_WITH_TESTS=ON
42-
- cmake --build . --config Release -j4
44+
- cmake --build . --config Release -j$(nproc)
4345
# Run tests
4446
- ctest . -C Release
4547
needs: [build_gcc10]
@@ -56,7 +58,7 @@ build_gcc7:
5658
- export CXX=g++-7
5759
- cd build
5860
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCPPINCLUDE_BUILD_WITH_TESTS=ON
59-
- cmake --build . --config Release -j4
61+
- cmake --build . --config Release -j$(nproc)
6062
# Run tests
6163
- ctest . -C Release
6264
needs: [build_gcc8]
@@ -73,7 +75,7 @@ build_clang:
7375
- export CXX=/usr/bin/clang++
7476
- cd build
7577
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCPPINCLUDE_BUILD_WITH_TESTS=ON
76-
- cmake --build . --config Release -j4
78+
- cmake --build . --config Release -j$(nproc)
7779
# Run tests
7880
- ctest . -C Release
7981
needs: [build_gcc7]
@@ -134,7 +136,7 @@ build_arm_linux:
134136
script:
135137
- cd build
136138
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCPPINCLUDE_BUILD_WITH_TESTS=ON
137-
- cmake --build . --config Release -j4
139+
- cmake --build . --config Release -j$(nproc)
138140
# Run tests
139141
- ctest . -C Release
140142
needs: [build_gcc10]
@@ -167,5 +169,43 @@ cppcheck:
167169
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCPPINCLUDE_BUILD_WITH_TESTS=ON
168170
- cppcheck --project=compile_commands.json --enable=all --suppressions-list=../.cppcheck-suppressions-list --error-exitcode=1 --quiet
169171
needs: [check_typos]
172+
173+
generate_deb_file:
174+
tags:
175+
- vm_linux
176+
stage: install_deb_file
177+
image: ubuntu
178+
script:
179+
- apt-get update
180+
- apt-get install -y gcc-10 g++-10 cmake file
181+
- export CC=gcc-10
182+
- export CXX=g++-10
183+
- cd build
184+
- cmake .. -DCMAKE_BUILD_TYPE=Release
185+
- cmake --build . --config Release -j$(nproc)
186+
# Generate deb file
187+
- cpack -G DEB
188+
- dpkg -i *.deb
189+
- cd ..
190+
- cppinclude --version
191+
needs: [cppcheck]
192+
193+
generate_rpm_file:
194+
tags:
195+
- vm_linux
196+
stage: install_rpm_file
197+
image: centos
198+
script:
199+
- yum group install "Development Tools" -y
200+
- yum install cmake3 -y
201+
- cd build
202+
- cmake3 .. -DCMAKE_BUILD_TYPE=Release
203+
- cmake3 --build . --config Release
204+
# Generate rpm file
205+
- cpack -G RPM
206+
- rpm -i *.rpm
207+
- cd ..
208+
- cppinclude --version
209+
needs: [build_gcc10]
170210

171211

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(cppinclude)
3+
project(cppinclude
4+
VERSION 0.4.0
5+
DESCRIPTION "Tool for analyzing includes in C++"
6+
LANGUAGES CXX
7+
)
48

59
include_directories(src/)
610
include_directories(src/3rd-part/fmt/include/)
@@ -66,3 +70,6 @@ if(MSVC)
6670
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
6771
endif()
6872

73+
include(InstallConfig)
74+
include(CPack)
75+

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update
4+
5+
ENV DEBIAN_FRONTEND noninteractive
6+
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
7+
RUN apt-get install -y gcc-10 g++-10 cmake
8+
9+
ADD ./ /cppinclude
10+
11+
WORKDIR /cppinclude/
12+
RUN rm -rf ./build || true
13+
14+
ENV CC gcc-10
15+
ENV CXX g++-10
16+
RUN mkdir -p build && cd build && \
17+
cmake .. -DCMAKE_BUILD_TYPE=Release && \
18+
cmake --build . --config Release -j$(nproc) && \
19+
make install && \
20+
cd .. && \
21+
rm -rf ./build
22+
23+
WORKDIR /

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ include that file will be recompiled and sometime it takes a lot of time.
2828
* [show_std_files](#show_std_files)
2929
* [show_only_std_headers](#show_only_std_headers)
3030
* [Build](#build)
31+
* [Docker image](#docker-image)
3132
* [Presentations](#presentations)
3233
* [Tips for optimization includes](#tips-for-optimization-includes)
3334
* [Third-party libraries](#third-party-libraries)
@@ -552,6 +553,37 @@ on Unix:
552553

553554
[Back to top](#cppinclude)
554555

556+
## Docker image
557+
558+
Pull image:
559+
560+
```sh
561+
docker pull cppinclude/cppinclude
562+
```
563+
564+
Or build docker image from source:
565+
566+
```sh
567+
docker build -t cppinclude/cppinclude .
568+
```
569+
570+
Test image:
571+
572+
```sh
573+
docker run -it cppinclude/cppinclude bash
574+
cppinclude --version
575+
```
576+
577+
Analyze your sources in docker image:
578+
579+
```sh
580+
docker run -v /tmp/project_src:/src/project_src -it cppinclude/cppinclude
581+
cd /src/project_src
582+
cppinclude
583+
```
584+
585+
[Back to top](#cppinclude)
586+
555587
## Presentations
556588

557589
* 2020, Lightning Talk on CppCon 2020, cppinclude - Tool for analyzing includes in C++

docs/versions/VERSION_0.4.0.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ Start report results ...
1717
Most impact files:
1818
1 : "luaconf.h" impact on 62 file(s)
1919
Included by:
20-
1 : "lua.h" line 16, impact on 61 file(s)
21-
2 : "onelua.c" line 49
20+
1 : "lua.h" line 16, impact on 61 file(s)
21+
2 : "onelua.c" line 49
2222
2 : "lua.h" impact on 61 file(s)
2323
Included by:
24-
1 : "llimits.h" line 15, impact on 40 file(s)
25-
2 : "lobject.h" line 16, impact on 34 file(s)
26-
3 : "lstate.h" line 10, impact on 26 file(s)
27-
... 3 of 44 details
24+
1 : "llimits.h" line 15, impact on 40 file(s)
25+
2 : "lobject.h" line 16, impact on 34 file(s)
26+
3 : "lstate.h" line 10, impact on 26 file(s)
27+
... 3 of 44 details
2828
3 : "llimits.h" impact on 40 file(s)
2929
Included by:
30-
1 : "lobject.h" line 15, impact on 34 file(s)
31-
2 : "lmem.h" line 13, impact on 15 file(s)
32-
3 : "lopcodes.h" line 10, impact on 9 file(s)
33-
... 3 of 8 details
30+
1 : "lobject.h" line 15, impact on 34 file(s)
31+
2 : "lmem.h" line 13, impact on 15 file(s)
32+
3 : "lopcodes.h" line 10, impact on 9 file(s)
33+
... 3 of 8 details
3434
4 : "lprefix.h" impact on 35 file(s)
3535
Included by:
36-
1 : "lapi.c" line 10, impact on 1 file(s)
37-
2 : "lauxlib.c" line 10, impact on 1 file(s)
38-
3 : "lbaselib.c" line 10, impact on 1 file(s)
39-
... 3 of 35 details
36+
1 : "lapi.c" line 10, impact on 1 file(s)
37+
2 : "lauxlib.c" line 10, impact on 1 file(s)
38+
3 : "lbaselib.c" line 10, impact on 1 file(s)
39+
... 3 of 35 details
4040
...
4141
4242
```
@@ -52,25 +52,25 @@ Start report results ...
5252
Most impact files:
5353
1 : "assert.h" impact on 64 file(s)
5454
Included by:
55-
1 : "luaconf.h" line 701, impact on 62 file(s)
56-
2 : "lutf8lib.c" line 13, impact on 1 file(s)
57-
3 : "ltests.h" line 24
58-
... 3 of 4 details
55+
1 : "luaconf.h" line 701, impact on 62 file(s)
56+
2 : "lutf8lib.c" line 13, impact on 1 file(s)
57+
3 : "ltests.h" line 24
58+
... 3 of 4 details
5959
2 : "stddef.h" impact on 64 file(s)
6060
Included by:
61-
1 : "luaconf.h" line 12, impact on 62 file(s)
62-
2 : "lua.h" line 13, impact on 61 file(s)
63-
3 : "llimits.h" line 12, impact on 40 file(s)
64-
... 3 of 15 details
61+
1 : "luaconf.h" line 12, impact on 62 file(s)
62+
2 : "lua.h" line 13, impact on 61 file(s)
63+
3 : "llimits.h" line 12, impact on 40 file(s)
64+
... 3 of 15 details
6565
3 : "limits.h" impact on 63 file(s)
6666
Included by:
67-
1 : "luaconf.h" line 11, impact on 62 file(s)
68-
2 : "llimits.h" line 11, impact on 40 file(s)
69-
3 : "lctype.h" line 34, impact on 5 file(s)
70-
... 3 of 16 details
67+
1 : "luaconf.h" line 11, impact on 62 file(s)
68+
2 : "llimits.h" line 11, impact on 40 file(s)
69+
3 : "lctype.h" line 34, impact on 5 file(s)
70+
... 3 of 16 details
7171
4 : "stdint.h" impact on 63 file(s)
7272
Included by:
73-
1 : "luaconf.h" line 660, impact on 62 file(s)
73+
1 : "luaconf.h" line 660, impact on 62 file(s)
7474
...
7575
7676
```

src/application/app_con.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ void ConcoleApplication::showVersion()
413413
version::VersionFormat,
414414
version::Major,
415415
version::Minor,
416-
version::Path
416+
version::Patch
417417
);
418418
}
419419

src/application/resources/app_resources_version.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace application::resources::version {
77
//------------------------------------------------------------------------------
88

99
const int Major = 0;
10-
const int Minor = 4;
11-
const int Path = 0;
10+
const int Minor = 4;
11+
const int Patch = 0;
1212

1313
const char * const VersionFormat = "{}.{}.{}\n";
1414

src/application/resources/app_resources_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace application::resources::version {
88

99
extern const int Major;
1010
extern const int Minor;
11-
extern const int Path;
11+
extern const int Patch;
1212

1313
extern const char * const VersionFormat;
1414

src/cmake/InstallConfig.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set(CPACK_PACKAGE_CONTACT "cppinclude@yandex.com")
2+
set(CPACK_PACKAGE_DESCRIPTION "")
3+
set(CPACK_PACKAGE_VENDOR "cppinclude")
4+
5+
set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_PROJECT_VERSION}")
6+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT} )
7+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
8+
9+
if(NOT DEFINED CMAKE_INSTALL_PREFIX AND NOT WIN32)
10+
set(CMAKE_INSTALL_PREFIX "/usr/bin/")
11+
endif()
12+
13+
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

0 commit comments

Comments
 (0)