-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·97 lines (82 loc) · 2.23 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
CUR_DIR=$(cd $(dirname $0) && pwd)
cd $CUR_DIR
# build all example modules
cmake -E make_directory build
cd build
# dynamic libraries
# base
cmake -E make_directory base
cd base
if [ ! -f CMakeCache.txt ]
then
cmake \
-G "${CMAKE_GENERATOR:-"Unix Makefiles"}" \
-D CMAKE_INSTALL_PREFIX=${CUR_DIR}/install \
-D CMAKE_PREFIX_PATH=${CUR_DIR}/install \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_BUILD_TYPE=Release \
../../modules/base/
fi
cmake --build ./ --target all
cmake --build ./ --target install
cd ..
# upstream A
cmake -E make_directory upstreamA
cd upstreamA
if [ ! -f CMakeCache.txt ]
then
cmake \
-G "${CMAKE_GENERATOR:-"Unix Makefiles"}" \
-D CMAKE_INSTALL_PREFIX=${CUR_DIR}/install \
-D CMAKE_PREFIX_PATH=${CUR_DIR}/install \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_BUILD_TYPE=Release \
../../modules/upstreamA/
fi
cmake --build ./ --target all
cmake --build ./ --target install
cd ..
# my app 1
cmake -E make_directory myapp1
cd myapp1
if [ ! -f CMakeCache.txt ]
then
cmake \
-G "${CMAKE_GENERATOR:-"Unix Makefiles"}" \
-D CMAKE_INSTALL_PREFIX=${CUR_DIR}/install \
-D CMAKE_PREFIX_PATH=${CUR_DIR}/install \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_BUILD_TYPE=Release \
../../modules/myApp1/
fi
cmake --build ./ --target all
cmake --build ./ --target install
cd ..
# static libraries
# of course this app can also be build with shared libraries
# my static app
cmake -E make_directory mystaticapp
cd mystaticapp
if [ ! -f CMakeCache.txt ]
then
cmake \
-G "${CMAKE_GENERATOR:-"Unix Makefiles"}" \
-D CMAKE_INSTALL_PREFIX=${CUR_DIR}/install \
-D CMAKE_BUILD_TYPE=Release \
../../modules/myStaticApp/
fi
cmake --build ./ --target all
# Do not override the installed shared libraries in this example
# cmake --build ./ --target install
# Only install the Runtime component and not the development ones
cmake -D COMPONENT=MySApp -P cmake_install.cmake
cd ..
cd ..
# create packages as TGZ
cmake -E make_directory dist
cd dist
cpack -G TGZ --config ../build/base/CPackConfig.cmake
cpack -G TGZ --config ../build/upstreamA/CPackConfig.cmake
cpack -G TGZ --config ../build/myapp1/CPackConfig.cmake
cpack -G TGZ --config ../build/mystaticapp/CPackConfig.cmake