Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] pkg-cmake.mk: Set CMAKE_SYSTEM_PROCESSOR.
@ 2014-11-17 20:02 Volker Krause
  2014-11-18 17:06 ` Bernd Kuhls
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Volker Krause @ 2014-11-17 20:02 UTC (permalink / raw)
  To: buildroot

This is rarely needed by packages, but convenient to have when it is.

Signed-off-by: Volker Krause <volker.krause@kdab.com>
---
Changes v2 -> v3:
  - fixed endianess handling for ARM v4-v7
  - coding style

Changes v1 -> v2:
  - added missing qstrip
  - set the correct ARM variant as done in
    http://patchwork.ozlabs.org/patch/408501/

 package/pkg-cmake.mk                | 22 ++++++++++++++++++++++
 support/misc/toolchainfile.cmake.in |  1 +
 2 files changed, 23 insertions(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index c8735ef..85fda86 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -180,6 +180,27 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 # Generation of the CMake toolchain file
 ################################################################################
 
+# CMAKE_SYSTEM_PROCESSOR should match uname -m
+ifeq ($(BR2_ARM_CPU_ARMV4),y)
+ARM_VARIANT = armv4
+else ifeq ($(BR2_ARM_CPU_ARMV5),y)
+ARM_VARIANT = armv5
+else ifeq ($(BR2_ARM_CPU_ARMV6),y)
+ARM_VARIANT = armv6
+else ifeq ($(BR2_ARM_CPU_ARMV7A),y)
+ARM_VARIANT = armv7
+endif
+
+ifeq ($(BR2_arm),y)
+CMAKE_SYSTEM_PROCESSOR = $(ARM_VARIANT)l
+else ifeq ($(BR2_armeb),y)
+CMAKE_SYSTEM_PROCESSOR = $(ARM_VARIANT)b
+endif
+
+ifndef CMAKE_SYSTEM_PROCESSOR
+CMAKE_SYSTEM_PROCESSOR = $(BR2_ARCH)
+endif
+
 # In order to allow the toolchain to be relocated, we calculate the HOST_DIR
 # based on the toolchainfile.cmake file's location: $(HOST_DIR)/usr/share/buildroot
 # In all the other variables, HOST_DIR will be replaced by RELOCATED_HOST_DIR,
@@ -193,5 +214,6 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 		-e 's:@@TARGET_LDFLAGS@@:$(call qstrip,$(TARGET_LDFLAGS)):' \
 		-e 's:@@TARGET_CC_NOCCACHE@@:$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CC_NOCCACHE))):' \
 		-e 's:@@TARGET_CXX_NOCCACHE@@:$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CXX_NOCCACHE))):' \
+		-e 's:@@CMAKE_SYSTEM_PROCESSOR@@:$(call qstrip,$(CMAKE_SYSTEM_PROCESSOR)):' \
 		$(TOPDIR)/support/misc/toolchainfile.cmake.in \
 		> $@
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index 4ca3d35..816af13 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -11,6 +11,7 @@
 string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 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")
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-09 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 20:02 [Buildroot] [PATCH v3] pkg-cmake.mk: Set CMAKE_SYSTEM_PROCESSOR Volker Krause
2014-11-18 17:06 ` Bernd Kuhls
2014-11-22  0:22 ` Romain Naour
2014-12-09 21:53 ` Samuel Martin
2014-12-09 22:59 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox