@@ -146,8 +146,8 @@ Linux to Windows
146146 A **bin/example.exe ** for Win64 platform has been built.
147147
148148
149- Windows to Raspberry PI
150- .......................
149+ Windows to Raspberry PI (Linux/ARM)
150+ ...................................
151151
152152- Install the toolchain: http://gnutoolchains.com/raspberry/
153153 You can choose different versions of the GCC cross compiler, choose one and adjust the following
@@ -157,22 +157,41 @@ Windows to Raspberry PI
157157
158158.. code-block :: text
159159
160+ target_host=arm-linux-gnueabihf
161+ standalone_toolchain=C:/sysgcc/raspberry
162+ cc_compiler=gcc
163+ cxx_compiler=g++
164+
160165 [settings]
161166 os_build=Windows
162167 arch_build=x86_64
163168 os=Linux
164- arch=armv7hf
169+ arch=armv7 # Change to armv6 if you are using Raspberry 1
165170 compiler=gcc
166- compiler.version=6.3 # We have chosen gcc 6.3 installer
171+ compiler.version=6
167172 compiler.libcxx=libstdc++11
168173 build_type=Release
169174
170175 [env]
171- CC=arm-linux-gnueabihf-gcc
172- CXX=arm-linux-gnueabihf-g++
176+ CONAN_CMAKE_FIND_ROOT_PATH=$standalone_toolchain/$target_host/sysroot
177+ PATH=[$standalone_toolchain/bin]
178+ CHOST=$target_host
179+ AR=$target_host-ar
180+ AS=$target_host-as
181+ RANLIB=$target_host-ranlib
182+ LD=$target_host-ld
183+ STRIP=$target_host-strip
184+ CC=$target_host-$cc_compiler
185+ CXX=$target_host-$cxx_compiler
186+ CXXFLAGS=-I"$standalone_toolchain/$target_host/lib/include"
187+
188+ The profiles to target Linux are all very similar, probably you just need to adjust the variables
189+ declared in the top of the profile:
190+
191+ - **target_host **: All the executables in the toolchain starts with this prefix.
192+ - **standalone_toolchain **: Path to the toolchain installation.
193+ - **cc_compiler/cxx_compiler **: In this case ``gcc ``/``g++ ``, but could be ``clang ``/``clang++ ``.
173194
174- The downloaded toolchain is an installer that puts the compilers in the path, so we can just specify
175- the executable name in the ``CC `` and ``CXX `` variables.
176195
177196- Clone an example recipe or use your own recipe:
178197
@@ -214,7 +233,7 @@ for you:
214233.. code-block :: bash
215234
216235 $ cd build/tools
217- $ python make_standalone_toolchain.py --arch=arm --api=21 --stl=libc++ --install-dir=/tmp /arm_21_toolchain
236+ $ python make_standalone_toolchain.py --arch=arm --api=21 --stl=libc++ --install-dir=/myfolder /arm_21_toolchain
218237
219238
220239 .. note ::
@@ -224,12 +243,15 @@ for you:
224243 Check the Android docs: `standalone toolchain <https://developer.android.com/ndk/guides/standalone_toolchain.html >`_
225244
226245
227- To use the ``clang `` compiler, create a profile ``android_21_arm_clang `` with the following contents:
246+ To use the ``clang `` compiler, create a profile ``android_21_arm_clang ``. Once again, the profile is very similar to the
247+ RPI one:
228248
229249.. code-block :: text
230250
231- standalone_toolchain=/tmp /arm_21_toolchain # Adjust this path
251+ standalone_toolchain=/myfolder /arm_21_toolchain # Adjust this path
232252 target_host=arm-linux-androideabi
253+ cc_compiler=clang
254+ cxx_compiler=clang++
233255
234256 [settings]
235257 compiler=clang
@@ -247,21 +269,26 @@ To use the ``clang`` compiler, create a profile ``android_21_arm_clang`` with th
247269 AR=$target_host-ar
248270 AS=$target_host-as
249271 RANLIB=$target_host-ranlib
250- CC=$target_host-clang
251- CXX=$target_host-clang++
272+ CC=$target_host-$cc_compiler
273+ CXX=$target_host-$cxx_compiler
252274 LD=$target_host-ld
253275 STRIP=$target_host-strip
254276 CFLAGS= -fPIE -fPIC
255277 CXXFLAGS= -fPIE -fPIC
256278 LDFLAGS= -pie
257279
258- You could also use ``gcc `` using this profile ``arm_21_toolchain_gcc ``:
280+
281+ You could also use ``gcc `` using this profile ``arm_21_toolchain_gcc ``, changing the ``cc_compiler `` and
282+ ``cxx_compiler `` variables, removing ``-fPIE `` flag and, of course, changing the ``[settings] `` to
283+ match the gcc toolchain compiler:
259284
260285
261286.. code-block :: text
262287
263- standalone_toolchain=/tmp /arm_21_toolchain # Adjust this path
288+ standalone_toolchain=/myfolder /arm_21_toolchain
264289 target_host=arm-linux-androideabi
290+ cc_compiler=gcc
291+ cxx_compiler=g++
265292
266293 [settings]
267294 compiler=gcc
@@ -278,13 +305,13 @@ You could also use ``gcc`` using this profile ``arm_21_toolchain_gcc``:
278305 CHOST=$target_host
279306 AR=$target_host-ar
280307 AS=$target_host-as
281- CC=$target_host-gcc
282- CXX=$target_host-g++
283308 RANLIB=$target_host-ranlib
309+ CC=$target_host-$cc_compiler
310+ CXX=$target_host-$cxx_compiler
284311 LD=$target_host-ld
285312 STRIP=$target_host-strip
286- CFLAGS=-fPIC
287- CXXFLAGS=-fPIC
313+ CFLAGS= -fPIC
314+ CXXFLAGS= -fPIC
288315 LDFLAGS=
289316
290317 - Clone, for example, the zlib library to try to build it to Android
@@ -392,7 +419,9 @@ Here is a table with some typical ARM platorms:
392419+--------------------------------+------------------------------------------------------------------------------------------------+
393420| Platform | Conan setting |
394421+================================+================================================================================================+
395- | Raspberry PI 1 and 2 | ``armv7 `` or ``armv7hf `` if we want to use the float point hard support |
422+ | Raspberry PI 1 | ``armv6 `` |
423+ +--------------------------------+------------------------------------------------------------------------------------------------+
424+ | Raspberry PI 2 | ``armv7 `` or ``armv7hf `` if we want to use the float point hard support |
396425+--------------------------------+------------------------------------------------------------------------------------------------+
397426| Raspberry PI 3 | ``armv8 `` also known as armv64-v8a |
398427+--------------------------------+------------------------------------------------------------------------------------------------+
0 commit comments