Skip to contentSkip to conversation

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

PATCH New Jörg Krause 2 participants 2 messages Jan 17, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 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'.

---
Changes v2:
- fix typo

---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +1 -1
index 81dcfcc..43da079 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 v2 1/1 package/pkg-cmake: use MinSizeRel for size optimized build

Hi J?rg,

Quoted 16 lines · J?rg Krause

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

---
Changes v2:
- fix typo

---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +0 -0
index 81dcfcc..43da079 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)) \

This looks good! :-)
Could you update the doc [1] as well?

[1] https://git.busybox.net/buildroot/tree/docs/manual/adding-packages-cmake.txt#n103

Regards,

Signature · 1 line
Samuel