@@ -20,6 +20,10 @@ export PATH=$ros2SystemDependenciesPath/bin:$PATH
20
20
export PKG_CONFIG=$ros2SystemDependenciesPath /bin/pkg-config
21
21
export PKG_CONFIG_PATH=$ros2SystemDependenciesPath /lib/pkgconfig
22
22
23
+ platformExtraCMakeArgs=(-DCMAKE_INSTALL_PREFIX=$ros2SystemDependenciesPath -DCMAKE_PREFIX_PATH=$ros2SystemDependenciesPath )
24
+ platformBasicConfigureArgs=(--prefix=$ros2SystemDependenciesPath ) # Configure args for regular situation
25
+ platformBasicConfigureArgsPixmanCairo=(--prefix=$ros2SystemDependenciesPath ) # Special configure args for pixman and cairo
26
+
23
27
function getSource() {
24
28
mkdir -p $ros2DependenciesSourceDownloadPath
25
29
cd $ros2DependenciesSourceDownloadPath
@@ -78,17 +82,17 @@ function setupPlatform() {
78
82
" iOS" )
79
83
targetArch=arm64
80
84
targetSysroot=` xcodebuild -version -sdk iphoneos Path`
81
- targetHostTripleForPixmanAndCairo=arm-apple-darwin # For pixman and cairo we must use arm -apple and not arm64-apple thank to https://gist.github.com/jvcleave/9d78de9bb27434bde2b0c3a1af355d9c
82
- targetHostTriple=aarch64- apple-darwin
83
- platformExtraCMakeArgs=(-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT /cmake/$targetPlatform .cmake);;
85
+ platformBasicConfigureArgs+=(--host=aarch64 -apple-darwin)
86
+ platformBasicConfigureArgsPixmanCairo+=(--host=arm- apple-darwin) # For pixman and cairo we must use arm-apple thank to https://gist.github.com/jvcleave/9d78de9bb27434bde2b0c3a1af355d9c
87
+ platformExtraCMakeArgs+ =(-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT /cmake/$targetPlatform .cmake);;
84
88
" iOS_Simulator" )
85
89
target=x86_64
86
90
targetSysroot=` xcodebuild -version -sdk iphonesimulator Path`
87
- platformExtraCMakeArgs=(-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT /cmake/$targetPlatform .cmake);;
91
+ platformExtraCMakeArgs+ =(-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT /cmake/$targetPlatform .cmake);;
88
92
" macOS" )
89
93
targetArch=x86_64
90
94
targetSysroot=` xcodebuild -version -sdk macosx Path`
91
- platformExtraCMakeArgs=(-DCMAKE_OSX_ARCHITECTURES=$targetArch );;
95
+ platformExtraCMakeArgs+ =(-DCMAKE_OSX_ARCHITECTURES=$targetArch );;
92
96
esac
93
97
}
94
98
@@ -100,50 +104,20 @@ function setCompilerFlags() {
100
104
101
105
function buildCMake() {
102
106
rm -rf _build && mkdir _build && cd _build
103
- cmake -DCMAKE_INSTALL_PREFIX= $ros2SystemDependenciesPath -DCMAKE_PREFIX_PATH= $ros2SystemDependenciesPath " ${platformExtraCMakeArgs[@]} " " $@ " .. # >/dev/null 2>&1
107
+ cmake " ${platformExtraCMakeArgs[@]} " " $@ " .. # >/dev/null 2>&1
104
108
cmake --build . --target install # >/dev/null 2>&1 --parallel 1
105
109
}
106
110
107
- function configureThenMakeArm() {
108
- setCompilerFlags
109
-
110
- if [ -z " $targetHostTripleForPixmanAndCairo " ]
111
- then
112
- ./configure --prefix=$ros2SystemDependenciesPath " $@ " # >/dev/null 2>&1
113
- else
114
- ./configure --prefix=$ros2SystemDependenciesPath --host=$targetHostTripleForPixmanAndCairo " $@ " # >/dev/null 2>&1
115
- fi
116
-
117
- make && make install # >/dev/null 2>&1
118
-
119
- export -n CFLAGS
120
- export -n CXXFLAGS
121
- }
122
-
123
111
function configureThenMake() {
124
112
setCompilerFlags
125
-
126
- if [ -z " $targetHostTriple " ]
127
- then
128
- ./configure --prefix=$ros2SystemDependenciesPath " $@ " # >/dev/null 2>&1
129
- else
130
- ./configure --prefix=$ros2SystemDependenciesPath --host=$targetHostTriple " $@ " # >/dev/null 2>&1
131
- fi
132
-
113
+ ./configure " ${platformBasicConfigureArgs[@]} " " $@ " # >/dev/null 2>&1
133
114
make && make install # >/dev/null 2>&1
134
-
135
- export -n CFLAGS
136
- export -n CXXFLAGS
137
115
}
138
116
139
- function configureThenMakeNoHost () {
117
+ function configureThenMakeArm () {
140
118
setCompilerFlags
141
-
142
- ./configure --prefix=$ros2SystemDependenciesPath " $@ " # >/dev/null 2>&1
143
- make && make install # >/dev/null 2>&1
144
-
145
- export -n CFLAGS
146
- export -n CXXFLAGS
119
+ ./configure " ${platformBasicConfigureArgsPixmanCairo[@]} " " $@ " # >/dev/null 2>&1
120
+ make && make install # >/dev/null 2>&1
147
121
}
148
122
149
123
function buildHostTools() {
@@ -172,7 +146,11 @@ function buildHostTools() {
172
146
function buildZlib() {
173
147
echo " Build zlib"
174
148
cd $ros2DependenciesSourceExtractionPath /zlib-1.2.12
175
- configureThenMakeNoHost # Note that zlib's configure does not set --host
149
+
150
+ # Note that zlib's configure does not set --host but relies on compiler flags environment variables
151
+ setCompilerFlags
152
+ ./configure --prefix=$ros2SystemDependenciesPath " $@ " # >/dev/null 2>&1
153
+ make && make install # >/dev/null 2>&1
176
154
}
177
155
178
156
function buildTinyXML2() {
0 commit comments