-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sh
129 lines (115 loc) · 4.81 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# !!! For Windows builds, the environment variables VCPKG_DEFAULT_TRIPLET and CMAKE_TOOLCHAIN_FILE need to be set so
# that CMake can pick them up automatically. !!!
# root directory of this repository
ROOT_DIR=`pwd`
# where to install geoflow (and also where dependencies can be found)
# we need to have write permissions!
if [[ "$OSTYPE" == "msys" ]]; then
INSTALL_PREFIX=D:/opt
else
INSTALL_PREFIX=/opt
fi
# where to put the geoflow plugin files
# we need to have write permissions!
if [[ "$OSTYPE" == "msys" ]]; then
GF_PLUGIN_FOLDER=D:/opt/geoflow-plugins
else
GF_PLUGIN_FOLDER=/opt/geoflow-plugins
fi
# how many parallel threads to use for building
N_PARALLEL=`getconf _NPROCESSORS_ONLN`
# exit on error of any command
set -e
# show commands
set -x
# update git modules
cd $ROOT_DIR
# create necesary directories if needed
mkdir -p $INSTALL_PREFIX
mkdir -p "$GF_PLUGIN_FOLDER"
# build and install geoflow and plugins
mkdir -p "$ROOT_DIR"/geoflow/build
cd $ROOT_DIR/geoflow/build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DGF_PLUGIN_FOLDER=$GF_PLUGIN_FOLDER \
-DGF_BUILD_GUI=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build . --parallel $N_PARALLEL --config Release --target install
mkdir -p "$ROOT_DIR"/plugins/gfp-gdal/build
cd "$ROOT_DIR"/plugins/gfp-gdal/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
cmake --build . --parallel $N_PARALLEL --config Release
ls "$ROOT_DIR"/plugins/gfp-gdal/build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cp gfp_gdal.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "darwin"* ]]; then
cp gfp_gdal.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Lightweight shell and GNU utilities compiled for Windows (part of MinGW)"
mkdir -p "$GF_PLUGIN_FOLDER"/gfp-gdal/deps
mkdir -p "$GF_PLUGIN_FOLDER"/gfp-gdal/gdal-data
mkdir -p "$GF_PLUGIN_FOLDER"/gfp-gdal/proj-data
cp Release/gfp_gdal.dll "$GF_PLUGIN_FOLDER"/gfp-gdal/
cp "$VCPKG_ROOT"/packages/gdal_x64-windows/share/gdal/* "$GF_PLUGIN_FOLDER"/gfp-gdal/gdal-data/
cp "$VCPKG_ROOT"/packages/proj4_x64-windows/share/proj4/* "$GF_PLUGIN_FOLDER"/gfp-gdal/proj-data/
cp "$VCPKG_ROOT"/packages/gdal_x64-windows/bin/*.dll "$GF_PLUGIN_FOLDER"/gfp-gdal/deps/
cp "$VCPKG_ROOT"/packages/geos_x64-windows/bin/geos_c.dll "$GF_PLUGIN_FOLDER"/gfp-gdal/deps/
cp "$VCPKG_ROOT"/packages/geos_x64-windows/bin/geos.dll "$GF_PLUGIN_FOLDER"/gfp-gdal/deps/
fi
mkdir -p "$ROOT_DIR"/plugins/gfp-val3dity/build
cd "$ROOT_DIR"/plugins/gfp-val3dity/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
cmake --build . --parallel $N_PARALLEL --config Release
ls "$ROOT_DIR"/plugins/gfp-val3dity/build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cp gfp_val3dity.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "darwin"* ]]; then
cp gfp_val3dity.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Lightweight shell and GNU utilities compiled for Windows (part of MinGW)"
mkdir -p "$GF_PLUGIN_FOLDER"/deps
cp Release/gfp_val3dity.dll "$GF_PLUGIN_FOLDER"/gfp-val3dity/
cp "$VCPKG_ROOT"/packages/geos_x64-windows/bin/geos_c.dll gfp-val3dity/deps/
cp "$VCPKG_ROOT"/packages/geos_x64-windows/bin/geos.dll gfp-val3dity/deps/
fi
mkdir -p "$ROOT_DIR"/plugins/gfp-basic3d/build
cd "$ROOT_DIR"/plugins/gfp-basic3d/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
cmake --build . --parallel $N_PARALLEL --config Release
ls "$ROOT_DIR"/plugins/gfp-basic3d/build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cp gfp_core_io.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "darwin"* ]]; then
cp gfp_core_io.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Lightweight shell and GNU utilities compiled for Windows (part of MinGW)"
mkdir -p "$GF_PLUGIN_FOLDER"/gfp-core_io
cp Release/gfp_core_io.dll "$GF_PLUGIN_FOLDER"/gfp-core_io/
fi
mkdir -p "$ROOT_DIR"/plugins/gfp-building-reconstruction/build
cd "$ROOT_DIR"/plugins/gfp-building-reconstruction/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DGFP_WITH_PDAL=OFF
cmake --build . --parallel $N_PARALLEL --config Release
ls "$ROOT_DIR"/plugins/gfp-building-reconstruction/build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cp gfp_buildingreconstruction.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "darwin"* ]]; then
cp gfp_buildingreconstruction.so $GF_PLUGIN_FOLDER
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Lightweight shell and GNU utilities compiled for Windows (part of MinGW)"
mkdir -p "$GF_PLUGIN_FOLDER"/gfp-building-reconstruction/deps
cp Release/gfp_buildingreconstruction.dll "$GF_PLUGIN_FOLDER"/gfp-building-reconstruction/
cp "$VCPKG_ROOT"/installed/x64-windows/bin/mpfr.dll "$GF_PLUGIN_FOLDER"/gfp-building-reconstruction/deps/
cp "$VCPKG_ROOT"/installed/x64-windows/bin/mpir.dll "$GF_PLUGIN_FOLDER"/gfp-building-reconstruction/deps/
fi