-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-make.sh
executable file
·50 lines (42 loc) · 1.11 KB
/
build-make.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
#!/bin/bash
# Usage: build-make.sh [output directory]
#
# The output directory will be created if it does not exist.
# If not specified, it defaults to "build-make-output".
set -e
if [ -z "$1" ]; then
readonly outputDir="build-make-output"
else
readonly outputDir="$1"
fi
readonly relSourceDir=`dirname $0`
readonly sourceDir=`cd $relSourceDir; pwd`
mkdir -p "$outputDir"
pushd "$outputDir"
for c in debug release; do
fmuDir="fmu"
for w in 32 64; do
mFlag="-m$w"
buildDir="build-$w-$c"
mkdir -p "$buildDir"
pushd "$buildDir"
cmake -DCMAKE_BUILD_TYPE=$c \
-DCMAKE_C_FLAGS=$mFlag \
-DCMAKE_CXX_FLAGS=$mFlag \
-DCMAKE_SHARED_LINKER_FLAGS=$mFlag \
-DFMU_OUTPUT_DIR="../$fmuDir" \
$sourceDir
make
popd # $buildDir
done
pushd "$fmuDir/$c"
for d in `find . -maxdepth 1 -mindepth 1 -type d -printf '%f\n'`; do
echo " "
echo "Building $d.fmu"
pushd "$d"
zip -r "../$d.fmu" * || exit 4
popd
done
popd # $fmuDir
done
popd # $outputDir