summaryrefslogtreecommitdiffstats
path: root/support/misc/toolchainfile.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* toochainfile.cmake: rework the way Buildroot sets flagsSamuel Martin2016-10-221-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the build configuration, Buildroot defines and set some compiler and linker flags that should be passed to any packages build-system. For package using the cmake-package infrastructure, this is achieved via the toolchainfile.cmake. This change simplifies the way the toolchainfile.cmake file handles these flags: it now just sets them, without any attempt to extend them with those Buildroot defined. This change still allows overriding these flags from the configure command line. So, now, when a CMake-based package needs to extend them, they should be fully set from the package *.mk file. This behavior is consistent with what is done for others package infrastructures. This change should not pull any regression WRT the bug #7280 [1]. However, now, when someone uses the toolchainfile.cmake file outside of Buildroot, he/she must overload all compiler/linker flags (including the ones Buildroot sets since they no longer get automatically added). [1] https://bugs.busybox.net/show_bug.cgi?id=7280 Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* toolchainfile.cmake: set per-config appended {C, CXX}FLAGSSamuel Martin2016-10-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a build type is set, CMake does append some flags that can override those set by Buildroot due to the gcc option parser (in which the last argument controling an option wins). Hereafter is a summary of the optimization and debug flags set by Buildroot and appended by CMake. * Flags set by Buildroot depending on the configuration: BR2_ENABLE_DEBUG | Optim. level | Buildroot {C,CXX}FLAGS =================+=====================+======================= y | BR2_OPTIMIZE_S | -Os -gx y | BR2_OPTIMIZE_G | -Og -gx y | BR2_OPTIMIZE_{0..3} | -On -gx n | BR2_OPTIMIZE_S | -Os n | BR2_OPTIMIZE_G | -Og n | BR2_OPTIMIZE_{0..3} | -On * Default flags appended by CMake depending on the build type: Build type | Flags | Effects on {C,CXX}FLAGS ===============+=================+=========================================== Debug | -g | Force -g, compatible with BR2_ENABLE_DEBUG MinSizeRel | -Os -DNDEBUG | Set -Os, compatible with BR2_OPTIMIZE_S Release | -O3 -DNDEBUG | Set -O3, closest to the others cases, | | though the optimization level is forced. RelWithDebInfo | -O2 -g -DNDEBUG | Force -g and set -O2, not friendly with BR To avoid the CMake flags take precedence over the Buildroot ones, this change sets in toolchainfile.cmake the per-config compiler flags CMake can append depending on the build type Buildroot defined. So, CMake does not mess up with the compilation flags Buildroot sets. It is still possible to override these per-config flags on the cmake command line. Note: If a CMake-based project forces the compiler and/or linker flag definitions (the default ones or the per-config ones - e.g. CMAKE_C_FLAGS/CMAKE_C_FLAGS_{DEBUG,RELEASE}), there is not much Buildroot can do about it. So, the flags will be overwritten anyway in these cases. Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Thomas: - adjust comment in toolchainfile.cmake.in, as suggested by Arnout. - also handle CMAKE_Fortran_FLAGS_*, as suggested by Arnout.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* package/pkg-cmake.mk: move CMAKE_BUILD_TYPE definition into toolchainfile.cmakeSamuel Martin2016-10-221-0/+3
| | | | | | | | | | | | | | | | The chosen CMAKE_BUILD_TYPE encodes an option of the Buildroot configuration, so it makes more sense to save it in the toolchainfile.cmake than to pass it during configure. It is still possible to override the build type on the cmake command line. Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Thomas: reword description in the CHANGES file.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* pkg-cmake.mk: set CMAKE_SYSROOT variable in toolchainfile.cmakeSamuel Martin2016-08-181-0/+1
| | | | | | | | | | | | | | | | | | This change enforces the CMAKE_SYSROOT value set in the toolchainfile.cmake. This fix overrides the CMake heuristics used to guess it, and turns off some non-desirable behavior adding "-isystem ..." flags to the compiler command line, misleading the compiler and making the build failed due to some unfound standard headers. Fixes: http://autobuild.buildroot.net/results/f7e/f7e92678e91a6cb15ccf32d4a7d75b39f49d6000/defconfig (and others) Cc: Ben Boeckel <mathstuf@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* pkg-cmake.mk: export the fortran compiler path in the CMake toolchain fileSamuel Martin2016-07-031-0/+4
| | | | | | | | | Since the fortran support is conditional, only enable it when needed. Signed-off-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Cc: Benjamin Kamath <bkamath@spaceflight.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* package-cmake: remove now-redundant target ccache supportArnout Vandecappelle2015-10-041-30/+2
| | | | | | | | | | | | All the complexity with the different ways that CMAKE_C_COMPILER and CMAKE_C_COMPILER_ARG1 can be set are no longer needed, it's all handled by the toolchain wrapper now. Note that it is still necessary to handle this for the host build. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reviewed-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* toolchainfile.cmake: only search the sysroot for CMake moduleSamuel Martin2015-03-161-0/+1
| | | | | | | | | This change prevents CMake from searching outside the sysroot location for CMake modules when cross-compiling. Signed-off-by: Samuel Martin <s.martin49@gmail.com> Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* pkg-cmake.mk: Set CMAKE_SYSTEM_PROCESSOR.Volker Krause2014-12-091-0/+1
| | | | | | | | | | | | | | | | This is rarely needed by packages, but convenient to have when it is. [Thomas: - don't define ARM_VARIANT as this name is too global, use CMAKE_SYSTEM_PROCESSOR_ARM_VARIANT instead. - don't use ifndef, but a more traditional else clause, for the non-ARM cases.] Signed-off-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Bernd Kuhls <bernd.kuhls@t-online.de> Reviewed-by: Romain Naour <romain.naour@openwide.fr> Acked-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* toolchainfile.cmake.in: do not force the CMAKE_{C, CXX}_FLAGS to the cacheSamuel Martin2014-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | Fix #7280 [1] When the FORCE option is passed to the set command, the variable is added/updated in the CMake cache every single time CMake processes this command. Because the toolchainfile.cmake prepends architecture/toolchain flags to the CMAKE_{C,CXX}_FLAGS, this makes the CFLAGS being updated in the generated Makefiles each time one reconfigures its project. So it forces the compilation of everything, even when nothing has changed. [1] https://bugs.busybox.net/show_bug.cgi?id=7280 Signed-off-by: Samuel Martin <s.martin49@gmail.com> Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> (tested the SimpleApp reproduction scenario described in the bug report) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* toolchainfile.cmake.in: set linker flagsSamuel Martin2014-09-281-0/+1
| | | | | | | | | The linker flags are part of the toolchain configuration, so set them for the CMake-based packages. Signed-off-by: Samuel Martin <s.martin49@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* pkg-cmake.mk: enable ccache for cmake packagesSamuel Martin2014-06-011-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates the generated toolchainfile.cmake to use ccache. When toolchainfile.cmake is used inside Buildroot, using ccache during the build is driven by a CMake knob: USE_CCACHE, automatically set by the cmake-package infrastructure and reflecting the BR2_CCACHE value. Since this toolchainefile.cmake file can be used outside Buildroot, and this file also set a couple of things (among these: the sysroot cflag, some pkg-config environment variables), it is important to set the compiler variables as well to keep the consistency of the cross-compilation configuration. So, when it is used outside Buildroot, using ccache for the build is driven by the ccache program availability. Note that using ccache for the build is achieved by setting the *_ARG1 CMake variables to let CMake use ccache without failing in detecting the compiler. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Luca Ceresoli <luca@lucaceresoli.net> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmakeSamuel Martin2014-06-011-5/+12
| | | | | | | | | | | | | | | The patch allows sharing or moving the toolchains. This is a step toward making the toolchain/sdk relocatable. Closes #6818 [Peter: reword comment as suggested by Thomas] Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Uwe Strempel <u.strempel@googlemail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* pkg-cmake.mk: refactor the toolchainfile.cmake generationSamuel Martin2014-06-011-0/+20
This patch introduces a toolchainfile.cmake.in template which is filled by Buildroot. Using a toolchainfile.cmake.in template file allows to avoid overloading quoting and/or escaping and it becomes much more similar to the resulting file. This patch also cleans up the quoting style. [Peter: drop stdin redirect as suggested by Thomas] Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
OpenPOWER on IntegriCloud