* [Buildroot] [PATCH v3 0/8] Misc. CMake fixes
@ 2016-10-15 9:44 Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags Samuel Martin
` (7 more replies)
0 siblings, 8 replies; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Hi all,
Here is a short series reworking the way the Buildroot's CMake
infrastructure handles compiler/linker flags.
Patch 1 fixes the optimization and debug flags passed/set by CMake.
Patches 2 to 6 clean up CMake-based package regarding {C,CXX,LD}FLAGS.
Patch 7 reworks the way the compiler/linker flags are set in
toolchainfile.cmake.
Regards,
Sam
Max Filippov (1):
package/opencv3: fix CMAKE_CXX_FLAGS
Samuel Martin (7):
package/pkg-cmake.mk: fix build type and optimization flags
package/assimp: wrap long lines
package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS
package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS
package/libcec: includes TARGET_{C,CXX}FLAGS to the overloaded
{C,CXX}FLAGS
package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS
toochainfile.cmake: rework the way Buildroot sets flags
CHANGES | 6 ++++++
package/assimp/assimp.mk | 3 ++-
package/gflags/gflags.mk | 3 ++-
package/gnuradio/gnuradio.mk | 2 +-
package/libcec/libcec.mk | 5 +++--
package/opencv3/opencv3.mk | 2 +-
package/pkg-cmake.mk | 12 +++++++++++-
package/rpi-userland/rpi-userland.mk | 3 ++-
support/misc/toolchainfile.cmake.in | 14 ++++++++++----
9 files changed, 38 insertions(+), 12 deletions(-)
--
2.10.0
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 10:25 ` Thomas Petazzoni
2016-10-15 9:44 ` [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines Samuel Martin
` (6 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
tl;dr:
Before applying this patch, CMake packages are built with the following
options:
* if BR2_ENABLE_DEBUG is set:
The CMake build type is set to RelWithDebInfo, which means:
- Optimization level is forced to: -O2;
- no log nor assert due to -DNDEBUG;
- BR2_DEBUG_{1..3} effect is unchanged;
* otherwise:
The CMake build type is set to Release, which means:
- Optimization level is forced to: -O3;
- no log nor assert due to -DNDEBUG (as expected).
In any case, the optimization WRT the binary size is always ignored and
forced.
This change chooses the build type doing the closest thing to what
Buildroot attempts to do.
Long version:
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_n | -On -gx
n | BR2_OPTIMIZE_S | -Os
n | BR2_OPTIMIZE_G | -Og
n | BR2_OPTIMIZE_n | -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
Since CMake appends its own build type flags and because of the gcc
option parser, the CMake flags takes precedence over the Buildroot
flags.
So, this change sets the correct build type depending on the
BR2_ENABLE_DEBUG and BR2_OPTIMIZE_* options.
Note:
If CMake-based project forces using a given build type and/or
redefined the compiler and/or linker flags (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: Charles Hardin <ckhardin@exablox.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
package/pkg-cmake.mk | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index aca9e61..eb4ec7a 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -79,6 +79,16 @@ endif
ifndef $(2)_CONFIGURE_CMDS
ifeq ($(4),target)
+# Here we choose the CMake build type which matches the best the build
+# configuration set in Buildroot.
+ifeq ($(BR2_ENABLE_DEBUG),y)
+BR_CMAKE_BUILD_TYPE=Debug
+else ifeq ($(BR2_OPTIMIZE_S),y)
+BR_CMAKE_BUILD_TYPE=MinSizeRel
+else
+BR_CMAKE_BUILD_TYPE=Release
+endif
+
# Configure package for target
define $(2)_CONFIGURE_CMDS
(mkdir -p $$($$(PKG)_BUILDDIR) && \
@@ -87,7 +97,7 @@ define $(2)_CONFIGURE_CMDS
PATH=$$(BR_PATH) \
$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
- -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),RelWithDebInfo,Release) \
+ -DCMAKE_BUILD_TYPE="$(BR_CMAKE_BUILD_TYPE)" \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_COLOR_MAKEFILE=OFF \
-DBUILD_DOC=OFF \
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 10:26 ` Thomas Petazzoni
2016-10-15 9:44 ` [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS Samuel Martin
` (5 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/assimp/assimp.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/assimp/assimp.mk b/package/assimp/assimp.mk
index cda02dd..08893ff 100644
--- a/package/assimp/assimp.mk
+++ b/package/assimp/assimp.mk
@@ -16,6 +16,7 @@ ifeq ($(BR2_m68k),y)
ASSIMP_CXXFLAGS += -mxgot
endif
-ASSIMP_CONF_OPTS += -DASSIMP_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) $(ASSIMP_CXXFLAGS)"
+ASSIMP_CONF_OPTS += -DASSIMP_BUILD_TESTS=OFF \
+ -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) $(ASSIMP_CXXFLAGS)"
$(eval $(cmake-package))
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:25 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
` (4 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/gflags/gflags.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/gflags/gflags.mk b/package/gflags/gflags.mk
index 9dc4e15..89111ed 100644
--- a/package/gflags/gflags.mk
+++ b/package/gflags/gflags.mk
@@ -11,7 +11,8 @@ GFLAGS_LICENSE = BSD-3c
GFLAGS_LICENSE_FILES = COPYING.txt
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
-GFLAGS_CONF_OPTS = -DBUILD_gflags_LIB=OFF -DCMAKE_CXX_FLAGS=-DNO_THREADS
+GFLAGS_CONF_OPTS = -DBUILD_gflags_LIB=OFF \
+ -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -DNO_THREADS"
endif
$(eval $(cmake-package))
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
` (2 preceding siblings ...)
2016-10-15 9:44 ` [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:25 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS Samuel Martin
` (3 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/gnuradio/gnuradio.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/gnuradio/gnuradio.mk b/package/gnuradio/gnuradio.mk
index 972f7a4..5cb00d2 100644
--- a/package/gnuradio/gnuradio.mk
+++ b/package/gnuradio/gnuradio.mk
@@ -36,7 +36,7 @@ GNURADIO_INSTALL_STAGING = YES
# CFLAGS to decide whether to build the NEON functions or not, and
# wants to see the string 'armv7' in the CFLAGS.
ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_ARM_CPU_HAS_NEON),yy)
-GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="-march=armv7-a"
+GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -march=armv7-a"
endif
# As soon as -mfpu=neon is supported by the compiler, gnuradio will try
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
` (3 preceding siblings ...)
2016-10-15 9:44 ` [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:30 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS Samuel Martin
` (2 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/libcec/libcec.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/libcec/libcec.mk b/package/libcec/libcec.mk
index b762d88..55c5fbb 100644
--- a/package/libcec/libcec.mk
+++ b/package/libcec/libcec.mk
@@ -29,8 +29,9 @@ endif
ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
LIBCEC_DEPENDENCIES += rpi-userland
LIBCEC_CONF_OPTS += \
- -DCMAKE_C_FLAGS="-lvcos -lvchiq_arm" \
- -DCMAKE_CXX_FLAGS="-I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux \
+ -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -lvcos -lvchiq_arm" \
+ -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) \
+ -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux \
-I$(STAGING_DIR)/usr/include/interface/vcos/pthreads"
endif
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
` (4 preceding siblings ...)
2016-10-15 9:44 ` [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:35 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags Samuel Martin
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
From: Max Filippov <jcmvbkbc@gmail.com>
The commit 4904c4c "package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC"
overrides CMAKE_CXX_FLAGS with the single -latomic, losing all ABI
CFLAGS that are passed there by default. This breaks build on xtensa
where ABI CFLAGS contain important code generation options.
Append $(TARGET_CXXFLAGS) to CMAKE_CXX_FLAGS along with -latomic.
Fixes:
http://autobuild.buildroot.net/results/7f1c96abd8fbb5b358a07100ab623316e9bb9dcd
http://autobuild.buildroot.net/results/e0c93d0f6d1da0d62d4dbba211a275bfe75e9645
http://autobuild.buildroot.net/results/53e7e4b4b6a7b48b8012799d7507f7594dbf01b2
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
package/opencv3/opencv3.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/opencv3/opencv3.mk b/package/opencv3/opencv3.mk
index 2529de9..10660a9 100644
--- a/package/opencv3/opencv3.mk
+++ b/package/opencv3/opencv3.mk
@@ -12,7 +12,7 @@ OPENCV3_LICENSE_FILES = LICENSE
# Uses __atomic_fetch_add_4
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
endif
# OpenCV component options
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
` (5 preceding siblings ...)
2016-10-15 9:44 ` [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:37 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags Samuel Martin
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
package/rpi-userland/rpi-userland.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/rpi-userland/rpi-userland.mk b/package/rpi-userland/rpi-userland.mk
index 86cde87..4a6eb41 100644
--- a/package/rpi-userland/rpi-userland.mk
+++ b/package/rpi-userland/rpi-userland.mk
@@ -10,7 +10,8 @@ RPI_USERLAND_LICENSE = BSD-3c
RPI_USERLAND_LICENSE_FILES = LICENCE
RPI_USERLAND_INSTALL_STAGING = YES
RPI_USERLAND_CONF_OPTS = -DVMCS_INSTALL_PREFIX=/usr \
- -DCMAKE_C_FLAGS="-DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
+ -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) \
+ -DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
RPI_USERLAND_PROVIDES = libegl libgles libopenmax libopenvg
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
` (6 preceding siblings ...)
2016-10-15 9:44 ` [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
@ 2016-10-15 9:44 ` Samuel Martin
2016-10-15 15:52 ` Arnout Vandecappelle
7 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 9:44 UTC (permalink / raw)
To: buildroot
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.
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>
---
CHANGES | 6 ++++++
support/misc/toolchainfile.cmake.in | 15 +++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/CHANGES b/CHANGES
index b4bd5fe..9a5dd50 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+2016.11-rc1,
+
+ toolchainfile.cmake: when used outside of Buildroot with custom
+ compiler/linker flags, the Buildroot flags should be set along side
+ with the custom ones.
+
2016.08, Released September 1st, 2016
Minor fixes.
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index 649b52d..7747199 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -13,9 +13,15 @@ string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
-set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS")
-set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
-set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
+# Buildroot defaults flags.
+# If you are using this toolchainfile.cmake file outside of Buildroot and
+# want to customize the compiler/linker flags, set them all on the cmake command
+# line, e.g.:
+# cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ...
+set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@")
+set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@")
+set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@")
+
set(CMAKE_INSTALL_SO_NO_EXE 0)
set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
@@ -31,6 +37,7 @@ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
if(@@TOOLCHAIN_HAS_FORTRAN@@)
- set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@ ${CMAKE_Fortran_FLAGS}" CACHE STRING "Buildroot FCFLAGS")
+ # Buildroot defaults flags.
+ set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@")
set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
endif()
--
2.10.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags
2016-10-15 9:44 ` [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags Samuel Martin
@ 2016-10-15 10:25 ` Thomas Petazzoni
2016-10-15 10:34 ` Samuel Martin
0 siblings, 1 reply; 20+ messages in thread
From: Thomas Petazzoni @ 2016-10-15 10:25 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 15 Oct 2016 11:44:30 +0200, Samuel Martin wrote:
> Before applying this patch, CMake packages are built with the following
> options:
> * if BR2_ENABLE_DEBUG is set:
> The CMake build type is set to RelWithDebInfo, which means:
> - Optimization level is forced to: -O2;
> - no log nor assert due to -DNDEBUG;
> - BR2_DEBUG_{1..3} effect is unchanged;
> * otherwise:
> The CMake build type is set to Release, which means:
> - Optimization level is forced to: -O3;
> - no log nor assert due to -DNDEBUG (as expected).
> In any case, the optimization WRT the binary size is always ignored and
> forced.
>
> This change chooses the build type doing the closest thing to what
> Buildroot attempts to do.
>
> Long version:
>
> 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_n | -On -gx
> n | BR2_OPTIMIZE_S | -Os
> n | BR2_OPTIMIZE_G | -Og
> n | BR2_OPTIMIZE_n | -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
>
> Since CMake appends its own build type flags and because of the gcc
> option parser, the CMake flags takes precedence over the Buildroot
> flags.
>
> So, this change sets the correct build type depending on the
> BR2_ENABLE_DEBUG and BR2_OPTIMIZE_* options.
Can't we tell CMake to not do all this crap, and simply not add
-g/-O<x> options by itself ?
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines
2016-10-15 9:44 ` [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines Samuel Martin
@ 2016-10-15 10:26 ` Thomas Petazzoni
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-10-15 10:26 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 15 Oct 2016 11:44:31 +0200, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> ---
> package/assimp/assimp.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags
2016-10-15 10:25 ` Thomas Petazzoni
@ 2016-10-15 10:34 ` Samuel Martin
2016-10-15 10:44 ` Thomas Petazzoni
0 siblings, 1 reply; 20+ messages in thread
From: Samuel Martin @ 2016-10-15 10:34 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, Oct 15, 2016 at 12:25 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Sat, 15 Oct 2016 11:44:30 +0200, Samuel Martin wrote:
>
>> Before applying this patch, CMake packages are built with the following
>> options:
>> * if BR2_ENABLE_DEBUG is set:
>> The CMake build type is set to RelWithDebInfo, which means:
>> - Optimization level is forced to: -O2;
>> - no log nor assert due to -DNDEBUG;
>> - BR2_DEBUG_{1..3} effect is unchanged;
>> * otherwise:
>> The CMake build type is set to Release, which means:
>> - Optimization level is forced to: -O3;
>> - no log nor assert due to -DNDEBUG (as expected).
>> In any case, the optimization WRT the binary size is always ignored and
>> forced.
>>
>> This change chooses the build type doing the closest thing to what
>> Buildroot attempts to do.
>>
>> Long version:
>>
>> 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_n | -On -gx
>> n | BR2_OPTIMIZE_S | -Os
>> n | BR2_OPTIMIZE_G | -Og
>> n | BR2_OPTIMIZE_n | -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
>>
>> Since CMake appends its own build type flags and because of the gcc
>> option parser, the CMake flags takes precedence over the Buildroot
>> flags.
>>
>> So, this change sets the correct build type depending on the
>> BR2_ENABLE_DEBUG and BR2_OPTIMIZE_* options.
>
> Can't we tell CMake to not do all this crap, and simply not add
> -g/-O<x> options by itself ?
As discussed IRL, this solution is kind of the optimal one, not the
best one but the one that is the closest to what BR is trying to do in
all cases.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
--
Samuel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags
2016-10-15 10:34 ` Samuel Martin
@ 2016-10-15 10:44 ` Thomas Petazzoni
2016-10-15 15:17 ` Arnout Vandecappelle
0 siblings, 1 reply; 20+ messages in thread
From: Thomas Petazzoni @ 2016-10-15 10:44 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 15 Oct 2016 12:34:29 +0200, Samuel Martin wrote:
> > Can't we tell CMake to not do all this crap, and simply not add
> > -g/-O<x> options by itself ?
>
> As discussed IRL, this solution is kind of the optimal one, not the
> best one but the one that is the closest to what BR is trying to do in
> all cases.
Just to expand on that, a few more details from our discussions:
- If we don't pass a CMAKE_BUILD_TYPE, then CMake doesn't pass any
compiler flags. This would be ideal, but unfortunately some packages
force their own build type in their CMakeLists.txt), and in this case
CMake passes its own compiler flags. Which would mean some packages
may always be built in debug mode, or always be built in release,
depending on what they have chosen in their CMakeLists.txt to be the
default, and this wouldn't be affected by the Buildroot
configuration.
Due to this, we *want* to force CMAKE_BUILD_TYPE, as it ensures all
CMake packages are built in a way that is as close as possible to
the selected Buildroot configuration.
- There is no way to tell CMake to not pass compiler flags and to
ignore the build type written in the CMakeLists.txt file. We could
patch CMake for that, but we are now using the system-provided cmake
when it's available, so we can hardly relying on cmake patching.
Bottom line: your patch is indeed the best we can do. It's not perfect,
but we can't easily do better.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags
2016-10-15 10:44 ` Thomas Petazzoni
@ 2016-10-15 15:17 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:17 UTC (permalink / raw)
To: buildroot
On 15-10-16 12:44, Thomas Petazzoni wrote:
> Hello,
>
> On Sat, 15 Oct 2016 12:34:29 +0200, Samuel Martin wrote:
>
>>> Can't we tell CMake to not do all this crap, and simply not add
>>> -g/-O<x> options by itself ?
>>
>> As discussed IRL, this solution is kind of the optimal one, not the
>> best one but the one that is the closest to what BR is trying to do in
>> all cases.
>
> Just to expand on that, a few more details from our discussions:
>
> - If we don't pass a CMAKE_BUILD_TYPE, then CMake doesn't pass any
> compiler flags. This would be ideal, but unfortunately some packages
> force their own build type in their CMakeLists.txt), and in this case
> CMake passes its own compiler flags. Which would mean some packages
> may always be built in debug mode, or always be built in release,
> depending on what they have chosen in their CMakeLists.txt to be the
> default, and this wouldn't be affected by the Buildroot
> configuration.
>
> Due to this, we *want* to force CMAKE_BUILD_TYPE, as it ensures all
> CMake packages are built in a way that is as close as possible to
> the selected Buildroot configuration.
>
> - There is no way to tell CMake to not pass compiler flags and to
> ignore the build type written in the CMakeLists.txt file. We could
> patch CMake for that, but we are now using the system-provided cmake
> when it's available, so we can hardly relying on cmake patching.
>
> Bottom line: your patch is indeed the best we can do. It's not perfect,
> but we can't easily do better.
We can do better :-)
My proposal:
- Set build type either to Debug or Release depending on the chosen options. It
might make sense to use MinSizeRel if the user chose no debug and -Os and
RelWithDebInfo if the user chose debug and -O2 or -O3.
- Override the flags that CMake adds with our debug/optimize flags in the
toolchain.cmake file. CMake uses the variables
CMAKE_${lang}_FLAGS_${buildtype}_INIT which are defined in
Modules/Compiler/GNU.cmake and AFAICS we can override these.
I'm not sure if we should override all the flags, or just the one for the
default buildtype we chose. I lean towards the latter.
Regards,
Arnout
>
> Thanks,
>
> Thomas
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS
2016-10-15 9:44 ` [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS Samuel Martin
@ 2016-10-15 15:25 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:25 UTC (permalink / raw)
To: buildroot
On 15-10-16 11:44, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Regards,
Arnout
> ---
> package/gflags/gflags.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/gflags/gflags.mk b/package/gflags/gflags.mk
> index 9dc4e15..89111ed 100644
> --- a/package/gflags/gflags.mk
> +++ b/package/gflags/gflags.mk
> @@ -11,7 +11,8 @@ GFLAGS_LICENSE = BSD-3c
> GFLAGS_LICENSE_FILES = COPYING.txt
>
> ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
> -GFLAGS_CONF_OPTS = -DBUILD_gflags_LIB=OFF -DCMAKE_CXX_FLAGS=-DNO_THREADS
> +GFLAGS_CONF_OPTS = -DBUILD_gflags_LIB=OFF \
> + -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -DNO_THREADS"
> endif
>
> $(eval $(cmake-package))
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS
2016-10-15 9:44 ` [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
@ 2016-10-15 15:25 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:25 UTC (permalink / raw)
To: buildroot
On 15-10-16 11:44, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Regards,
Arnout
> ---
> package/gnuradio/gnuradio.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/gnuradio/gnuradio.mk b/package/gnuradio/gnuradio.mk
> index 972f7a4..5cb00d2 100644
> --- a/package/gnuradio/gnuradio.mk
> +++ b/package/gnuradio/gnuradio.mk
> @@ -36,7 +36,7 @@ GNURADIO_INSTALL_STAGING = YES
> # CFLAGS to decide whether to build the NEON functions or not, and
> # wants to see the string 'armv7' in the CFLAGS.
> ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_ARM_CPU_HAS_NEON),yy)
> -GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="-march=armv7-a"
> +GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -march=armv7-a"
> endif
>
> # As soon as -mfpu=neon is supported by the compiler, gnuradio will try
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS
2016-10-15 9:44 ` [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS Samuel Martin
@ 2016-10-15 15:30 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:30 UTC (permalink / raw)
To: buildroot
On 15-10-16 11:44, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Regards,
Arnout
> ---
> package/libcec/libcec.mk | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/package/libcec/libcec.mk b/package/libcec/libcec.mk
> index b762d88..55c5fbb 100644
> --- a/package/libcec/libcec.mk
> +++ b/package/libcec/libcec.mk
> @@ -29,8 +29,9 @@ endif
> ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
> LIBCEC_DEPENDENCIES += rpi-userland
> LIBCEC_CONF_OPTS += \
> - -DCMAKE_C_FLAGS="-lvcos -lvchiq_arm" \
> - -DCMAKE_CXX_FLAGS="-I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux \
> + -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -lvcos -lvchiq_arm" \
> + -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) \
> + -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux \
> -I$(STAGING_DIR)/usr/include/interface/vcos/pthreads"
> endif
>
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS
2016-10-15 9:44 ` [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS Samuel Martin
@ 2016-10-15 15:35 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:35 UTC (permalink / raw)
To: buildroot
On 15-10-16 11:44, Samuel Martin wrote:
> From: Max Filippov <jcmvbkbc@gmail.com>
>
> The commit 4904c4c "package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC"
> overrides CMAKE_CXX_FLAGS with the single -latomic, losing all ABI
> CFLAGS that are passed there by default. This breaks build on xtensa
> where ABI CFLAGS contain important code generation options.
Really, these important ABI flags should be added to the wrapper and not just
passed as CFLAGS. Still, this patch is correct, so:
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Regards,
Arnout
>
> Append $(TARGET_CXXFLAGS) to CMAKE_CXX_FLAGS along with -latomic.
>
> Fixes:
> http://autobuild.buildroot.net/results/7f1c96abd8fbb5b358a07100ab623316e9bb9dcd
> http://autobuild.buildroot.net/results/e0c93d0f6d1da0d62d4dbba211a275bfe75e9645
> http://autobuild.buildroot.net/results/53e7e4b4b6a7b48b8012799d7507f7594dbf01b2
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> package/opencv3/opencv3.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/opencv3/opencv3.mk b/package/opencv3/opencv3.mk
> index 2529de9..10660a9 100644
> --- a/package/opencv3/opencv3.mk
> +++ b/package/opencv3/opencv3.mk
> @@ -12,7 +12,7 @@ OPENCV3_LICENSE_FILES = LICENSE
>
> # Uses __atomic_fetch_add_4
> ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> -OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
> +OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
> endif
>
> # OpenCV component options
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS
2016-10-15 9:44 ` [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
@ 2016-10-15 15:37 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:37 UTC (permalink / raw)
To: buildroot
Just noticed now: in the subject, s/includes/include/
On 15-10-16 11:44, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Regards,
Arnout
> ---
> package/rpi-userland/rpi-userland.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/rpi-userland/rpi-userland.mk b/package/rpi-userland/rpi-userland.mk
> index 86cde87..4a6eb41 100644
> --- a/package/rpi-userland/rpi-userland.mk
> +++ b/package/rpi-userland/rpi-userland.mk
> @@ -10,7 +10,8 @@ RPI_USERLAND_LICENSE = BSD-3c
> RPI_USERLAND_LICENSE_FILES = LICENCE
> RPI_USERLAND_INSTALL_STAGING = YES
> RPI_USERLAND_CONF_OPTS = -DVMCS_INSTALL_PREFIX=/usr \
> - -DCMAKE_C_FLAGS="-DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
> + -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) \
> + -DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
>
> RPI_USERLAND_PROVIDES = libegl libgles libopenmax libopenvg
>
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags
2016-10-15 9:44 ` [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags Samuel Martin
@ 2016-10-15 15:52 ` Arnout Vandecappelle
0 siblings, 0 replies; 20+ messages in thread
From: Arnout Vandecappelle @ 2016-10-15 15:52 UTC (permalink / raw)
To: buildroot
On 15-10-16 11:44, Samuel Martin wrote:
>>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.
>
> 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>
> ---
> CHANGES | 6 ++++++
> support/misc/toolchainfile.cmake.in | 15 +++++++++++----
> 2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/CHANGES b/CHANGES
> index b4bd5fe..9a5dd50 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -1,3 +1,9 @@
> +2016.11-rc1,
> +
> + toolchainfile.cmake: when used outside of Buildroot with custom
> + compiler/linker flags, the Buildroot flags should be set along side
> + with the custom ones.
> +
> 2016.08, Released September 1st, 2016
>
> Minor fixes.
> diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
> index 649b52d..7747199 100644
> --- a/support/misc/toolchainfile.cmake.in
> +++ b/support/misc/toolchainfile.cmake.in
> @@ -13,9 +13,15 @@ string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST
> set(CMAKE_SYSTEM_NAME Linux)
> set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
>
> -set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS")
> -set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
> -set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
> +# Buildroot defaults flags.
> +# If you are using this toolchainfile.cmake file outside of Buildroot and
> +# want to customize the compiler/linker flags, set them all on the cmake command
> +# line, e.g.:
# line or in the CMakeLists.txt, e.g.:
> +# cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ...
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_custom_flag")
Otherwise looks OK to me but I'm not so confident so no official tag.
Regards,
Arnout
> +set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@")
> +set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@")
> +set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@")
> +
> set(CMAKE_INSTALL_SO_NO_EXE 0)
>
> set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
> @@ -31,6 +37,7 @@ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> if(@@TOOLCHAIN_HAS_FORTRAN@@)
> - set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@ ${CMAKE_Fortran_FLAGS}" CACHE STRING "Buildroot FCFLAGS")
> + # Buildroot defaults flags.
> + set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@")
> set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
> endif()
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-10-15 15:52 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-15 9:44 [Buildroot] [PATCH v3 0/8] Misc. CMake fixes Samuel Martin
2016-10-15 9:44 ` [Buildroot] [PATCH v3 1/8] package/pkg-cmake.mk: fix build type and optimization flags Samuel Martin
2016-10-15 10:25 ` Thomas Petazzoni
2016-10-15 10:34 ` Samuel Martin
2016-10-15 10:44 ` Thomas Petazzoni
2016-10-15 15:17 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 2/8] package/assimp: wrap long lines Samuel Martin
2016-10-15 10:26 ` Thomas Petazzoni
2016-10-15 9:44 ` [Buildroot] [PATCH v3 3/8] package/gflags: includes TARGET_CXXFLAGS to the overloaded CXXFLAGS Samuel Martin
2016-10-15 15:25 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 4/8] package/gnuradio: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
2016-10-15 15:25 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 5/8] package/libcec: includes TARGET_{C, CXX}FLAGS to the overloaded {C, CXX}FLAGS Samuel Martin
2016-10-15 15:30 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 6/8] package/opencv3: fix CMAKE_CXX_FLAGS Samuel Martin
2016-10-15 15:35 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 7/8] package/rpi-userland: includes TARGET_CFLAGS to the overloaded CFLAGS Samuel Martin
2016-10-15 15:37 ` Arnout Vandecappelle
2016-10-15 9:44 ` [Buildroot] [PATCH v3 8/8] toochainfile.cmake: rework the way Buildroot sets flags Samuel Martin
2016-10-15 15:52 ` Arnout Vandecappelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox