Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Martin <s.martin49@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 01/11] pkg-cmake.mk: refactor the toolchainfile.cmake generation
Date: Sun,  1 Jun 2014 11:24:23 +0200	[thread overview]
Message-ID: <1401614673-3703-2-git-send-email-s.martin49@gmail.com> (raw)
In-Reply-To: <1401614673-3703-1-git-send-email-s.martin49@gmail.com>

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.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Baruch Siach <baruch@tkos.co.il>

---
changes v3 -> v4:
- rebase
- introduce toolchainfile.cmake template
- squash csets (Baruch, Arnout)
- cleanup quoting (Arnout)

changes v2 -> v3:
- new patch
---
 package/pkg-cmake.mk                | 23 +++++++++--------------
 support/misc/toolchainfile.cmake.in | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 support/misc/toolchainfile.cmake.in

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index edda14a..a7a9380 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -160,17 +160,12 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
-	@printf "\
-	set(CMAKE_SYSTEM_NAME Linux)\n\
-	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
-	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
-	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
-	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
-	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
-	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
-	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
-	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
-	" > $@
+	sed \
+		-e 's:@@HOST_DIR@@:$(call qstrip,$(HOST_DIR)):' \
+		-e 's:@@STAGING_DIR@@:$(call qstrip,$(STAGING_DIR)):' \
+		-e 's:@@TARGET_CFLAGS@@:$(call qstrip,$(TARGET_CFLAGS)):' \
+		-e 's:@@TARGET_CXXFLAGS@@:$(call qstrip,$(TARGET_CXXFLAGS)):' \
+		-e 's:@@TARGET_CC_NOCCACHE@@:$(call qstrip,$(TARGET_CC_NOCCACHE)):' \
+		-e 's:@@TARGET_CXX_NOCCACHE@@:$(call qstrip,$(TARGET_CXX_NOCCACHE)):' \
+		< $(TOPDIR)/support/misc/toolchainfile.cmake.in \
+		> $@
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
new file mode 100644
index 0000000..e8cc378
--- /dev/null
+++ b/support/misc/toolchainfile.cmake.in
@@ -0,0 +1,20 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# CMake toolchain file for Buildroot
+#
+
+set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS" FORCE)
+set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS" FORCE)
+set(CMAKE_INSTALL_SO_NO_EXE 0)
+
+set(CMAKE_PROGRAM_PATH "@@HOST_DIR@@/usr/bin")
+set(CMAKE_FIND_ROOT_PATH "@@STAGING_DIR@@")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(ENV{PKG_CONFIG_SYSROOT_DIR} "@@STAGING_DIR@@")
+
+set(CMAKE_C_COMPILER "@@TARGET_CC_NOCCACHE@@")
+set(CMAKE_CXX_COMPILER "@@TARGET_CXX_NOCCACHE@@")
-- 
1.9.2

  reply	other threads:[~2014-06-01  9:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01  9:24 [Buildroot] [PATCH v4 00/11] CMake infrastructure refactoring Samuel Martin
2014-06-01  9:24 ` Samuel Martin [this message]
2014-06-01 10:54   ` [Buildroot] [PATCH v4 01/11] pkg-cmake.mk: refactor the toolchainfile.cmake generation Thomas Petazzoni
2014-06-01 20:12   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 02/11] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
2014-06-01 10:57   ` Thomas Petazzoni
2014-06-01 20:16   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 03/11] pkg-cmake.mk: enable ccache for cmake packages Samuel Martin
2014-06-01 10:57   ` Thomas Petazzoni
2014-06-01 20:17   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 04/11] rpi-userland: cleanup *_CONF_OPT Samuel Martin
2014-06-01 11:04   ` Thomas Petazzoni
2014-06-01  9:24 ` [Buildroot] [PATCH v4 05/11] xbmc: fix missing libraries from rpi-userland Samuel Martin
2014-06-01  9:24 ` [Buildroot] [PATCH v4 06/11] pkg-cmake.mk: globally disable BUILD_TESTING flag Samuel Martin
2014-06-01 11:05   ` Thomas Petazzoni
2014-06-01 20:18   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 07/11] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG Samuel Martin
2014-06-01 11:06   ` Thomas Petazzoni
2014-06-01 20:18   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 08/11] openpowerlink: do not override CMAKE_BUILD_TYPE Samuel Martin
2014-06-01 11:07   ` Thomas Petazzoni
2014-06-01 20:19   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 09/11] opencv: " Samuel Martin
2014-06-01 11:07   ` Thomas Petazzoni
2014-06-01 20:20   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 10/11] flann: " Samuel Martin
2014-06-01 11:07   ` Thomas Petazzoni
2014-06-01 20:20   ` Peter Korsgaard
2014-06-01  9:24 ` [Buildroot] [PATCH v4 11/11] qhull: " Samuel Martin
2014-06-01 11:07   ` Thomas Petazzoni
2014-06-01 20:20   ` Peter Korsgaard
2014-06-01 11:08 ` [Buildroot] [PATCH v4 00/11] CMake infrastructure refactoring Thomas Petazzoni
2014-06-01 20:20   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401614673-3703-2-git-send-email-s.martin49@gmail.com \
    --to=s.martin49@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox