Skip to contentSkip to conversation

package/pkg-cmake: use MinSizeRel for size optimized build

PATCH Superseded Jörg Krause 2 participants 2 messages Jan 17, 2016 – Jan 18, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-cmake: use MinSizeRel for size optimized build

MinSizeRel sets the gcc compiler optimization level to '-Os' whereas Release sets it to '-O3'.

---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +1 -1
index 81dcfcc..dc2dc93 100644
@@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
-		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \
+		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,$$(if $$(BR2_OPTIMIZE_S),MinSizeRel,Release) \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_DOC=OFF \
Signature · 1 line
2.7.0
#1 lore raw

PATCH 1/1 package/pkg-cmake: use MinSizeRel for size optimized build

Dear J?rg Krause,

Quoted 13 lines · J?rg Krause

MinSizeRel sets the gcc compiler optimization level to '-Os' whereas Release sets it to '-O3'.

---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +0 -0
index 81dcfcc..dc2dc93 100644

package/pkg-cmake.mk define $(2)_CONFIGURE_CMDS · line 90

Quoted 5 lines
package/pkg-cmake.mk +1 -1
@@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
-		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \
+		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,$$(if $$(BR2_OPTIMIZE_S),MinSizeRel,Release) \

Looks good, but instead of this, can't CMake be taught to use Buildroot CFLAGS, which have our own -O<value> ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com