-
Notifications
You must be signed in to change notification settings - Fork 6
/
cppbuild.bash
executable file
·62 lines (53 loc) · 2.18 KB
/
cppbuild.bash
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
#!/bin/bash
# This build script is designed to work on Linux and Windows. For Windows, run from a bash shell launched with launchBashWindows.bat
REPO_ROOT=$(realpath "$(dirname "$0")")
BUILD_ROOT=$REPO_ROOT/ihmc-pub-sub/buildc
rm -rf $BUILD_ROOT # Optional clean
mkdir -p $BUILD_ROOT
#### Update git submodules ####
cd $REPO_ROOT
git submodule update --init --recursive
cd $REPO_ROOT/ihmc-pub-sub/thirdparty/Fast-RTPS
cd $REPO_ROOT
#### Apply patches ####
patch $REPO_ROOT/ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd $REPO_ROOT/ihmc-pub-sub/patches/fastRTPS_profiles.patch
# Generate Java from eprosima XML
if command -v xjc &> /dev/null; then
xjc -no-header -p com.eprosima.xmlschemas.fastrtps_profiles -d $REPO_ROOT/ihmc-pub-sub/src/xjc/java $REPO_ROOT/ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd
find "$REPO_ROOT/ihmc-pub-sub/src/xjc/java" -type f -name "*.java" -print0 | while IFS= read -r -d '' file; do
# Replace javax.xml.* with jakarta.xml.*, but ignore javax.xml.namespace.QName
# Replace @javax.xml.bind.annotation.* with @jakarta.xml.bind.annotation.*
sed -i '
/import javax\.xml\.namespace\.QName/!s/import javax\.xml\./import jakarta.xml./g
s/@javax\.xml\.bind\.annotation\./@jakarta.xml.bind.annotation./g
s/javax\.xml\.bind\.annotation\.XmlNsForm/jakarta.xml.bind.annotation.XmlNsForm/g
' "$file"
if command -v dos2unix &> /dev/null; then
dos2unix "$file"
fi
done
else
echo "Not generated Java from eprosima XML. xjc not found."
fi
if [ "$ONLY_CLONE_AND_PATCH" == "1" ]; then
exit 0
fi
#### Building FastDDS, ihmc-pub-sub natives ####
cd $BUILD_ROOT
if [ "$MAC_CROSS_COMPILE_ARM" == "1" ]; then
cmake -DCMAKE_BUILD_TYPE=Release \
-DSTANDALONE_PLUGIN=ON \
-DCMAKE_TOOLCHAIN_FILE=../macos-aarch64-toolchain.cmake \
..
elif [ "$LINUX_CROSS_COMPILE_ARM" == "1" ]; then
cmake -DCMAKE_BUILD_TYPE=Release \
-DSTANDALONE_PLUGIN=ON \
-DCMAKE_TOOLCHAIN_FILE=../linux-aarch64-toolchain.cmake \
..
else
cmake -DCMAKE_BUILD_TYPE=Release \
-DSTANDALONE_PLUGIN=ON \
..
fi
cmake --build . --config Release --target install
cd $REPO_ROOT