* [PATCH] Add toolchain file generation to cmake bbclass
@ 2009-08-25 5:35 Matthew Dombroski
2009-08-25 9:07 ` Valentin Longchamp
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Dombroski @ 2009-08-25 5:35 UTC (permalink / raw)
To: openembedded dev
It is possible to make cmake use a toolchain file that defines flags, search
paths and any other cmake options.
The main reason for making openembedded generate a toolchain file is
to enable the building of complex packages. Without it a package
requiring Qt4 or boost (or one of many other packages) probably wont find
the right libs and won't build properly.
I have added compiler flags mainly for use outside of openembedded, so I
can copy the generated toolchain file and use it manually.
---
classes/cmake.bbclass | 67
++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass
index b5b7b86..38bed63 100644
--- a/classes/cmake.bbclass
+++ b/classes/cmake.bbclass
@@ -11,6 +11,67 @@ OECMAKE_SOURCEPATH ?= "."
# "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles.
OECMAKE_BUILDPATH ?= ""
+# C/C++ Compiler (without cpu arch/tune arguments)
+OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
+OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
+
+# Compiler flags
+OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${BUILD_CPPFLAGS}"
+OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
${BUILD_CPPFLAGS} -fpermissive"
+OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
+OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
+
+
+#
+# Generate cmake toolchain file
+#
+cmake_generate_toolchain_file() {
+ rm -f ${WORKDIR}/toolchain.cmake
+ touch ${WORKDIR}/toolchain.cmake
+
+# CMake system name must be something like "Linux".
+# This is important for cross-compiling.
+ echo "set( CMAKE_SYSTEM_NAME" `echo ${SDK_OS} | sed 's/^./\u&/'` ")"
>> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )" >>
${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )" >>
${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_FLAGS \"${OECMAKE_C_FLAGS}\" CACHE STRING
\"OpenEmbedded CFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_FLAGS \"${OECMAKE_CXX_FLAGS}\" CACHE STRING
\"OpenEmbedded CXXFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_FLAGS_RELEASE \"${OECMAKE_C_FLAGS_RELEASE}\" CACHE
STRING \"CFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_FLAGS_RELEASE \"${OECMAKE_CXX_FLAGS_RELEASE}\"
CACHE STRING \"CXXFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
+
+# only search in the paths provided (from openembedded) so cmake doesnt
pick
+# up libraries and tools from the native build machine
+ echo "set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST}
${STAGING_DIR_NATIVE} ${CROSS_DIR} )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )" >>
${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )" >>
${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )" >>
${WORKDIR}/toolchain.cmake
+# Use native cmake modules
+ echo "set( CMAKE_MODULE_PATH
${STAGING_DIR_NATIVE}/usr/share/cmake-2.6/Modules/ )" >>
${WORKDIR}/toolchain.cmake
+
+# Boost libraries have an unusual naming convention thanks to bjam
+ echo "set( Boost_COMPILER \"-gcc\" CACHE STRING \"Boost gcc string\"
)" >> ${WORKDIR}/toolchain.cmake
+
+# Qt4 support is complex because FindQt4.cmake requires a lot of
information
+# about the Qt environment.
+ if [ ${QMAKESPEC} ]
+ then
+# In the bbfile inherit one of qmake2/qt4e/qt4x11 and this section will be
+# filled out
+ echo "set( QT_HEADERS_DIR ${OE_QMAKE_INCDIR_QT} CACHE STRING \"Qt4
include dir\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_LIBRARY_DIR ${OE_QMAKE_LIBDIR_QT} CACHE STRING \"Qt4
library dir\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_QMAKE_EXECUTABLE ${OE_QMAKE_QMAKE} CACHE STRING
\"qmake2 binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_MOC_EXECUTABLE ${OE_QMAKE_MOC} CACHE STRING \"Qt4 moc
binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_UIC_EXECUTABLE ${OE_QMAKE_UIC} CACHE STRING \"Qt4 uic
binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_UIC3_EXECUTABLE ${OE_QMAKE_UIC3} CACHE STRING \"Qt4
uic3 binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_RCC_EXECUTABLE ${OE_QMAKE_RCC} CACHE STRING \"Qt4 rcc
binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_DBUSXML2CPP_EXECUTABLE ${OE_QMAKE_QDBUSXML2CPP} CACHE
STRING \"Qt4 dbus xml2cpp binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_DBUSCPP2XML_EXECUTABLE ${OE_QMAKE_QDBUSCPP2XML} CACHE
STRING \"Qt4 dbus cpp2xml binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_LRELEASE_EXECUTABLE ${OE_QMAKE_LRELEASE} CACHE STRING
\"Qt4 lrelease binary\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( QT_LUPDATE_EXECUTABLE ${OE_QMAKE_LUPDATE} CACHE STRING
\"Qt4 lupdate binary\" )" >> ${WORKDIR}/toolchain.cmake
+ fi
+}
+
+
cmake_do_configure() {
if [ ${OECMAKE_BUILDPATH} ]
then
@@ -18,9 +79,13 @@ cmake_do_configure() {
cd ${OECMAKE_BUILDPATH}
fi
+ cmake_generate_toolchain_file
+
cmake ${OECMAKE_SOURCEPATH} \
+ -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
- -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+ -DCMAKE_VERBOSE_MAKEFILE=1 \
+ -DCMAKE_BUILD_TYPE=Release \
${EXTRA_OECMAKE} \
-Wno-dev
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-25 5:35 [PATCH] Add toolchain file generation to cmake bbclass Matthew Dombroski
@ 2009-08-25 9:07 ` Valentin Longchamp
2009-08-25 11:03 ` Holger Hans Peter Freyther
2009-08-25 22:12 ` Matthew Dombroski
0 siblings, 2 replies; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-25 9:07 UTC (permalink / raw)
To: openembedded-devel
Matthew Dombroski wrote:
> It is possible to make cmake use a toolchain file that defines flags,
> search
> paths and any other cmake options.
>
> The main reason for making openembedded generate a toolchain file is
> to enable the building of complex packages. Without it a package
> requiring Qt4 or boost (or one of many other packages) probably wont find
> the right libs and won't build properly.
I have had no problem with boost and with Qt4, I have been able to
achieve similar results without the toolchain file, only by using a
qt.conf file as Zecke had suggested to me.
Although the toolchain file is the preferred value according to the
cmake documentation, it has not been necessary to me.
I attach the recipe I use below (and have added a small comment in your
patch inline):
> DESCRIPTION = "aseba is an event-based architecture for distributed robots control"
> HOMEPAGE = "http://mobots.epfl.ch/aseba.html"
> LICENCE = "GPL"
> PR = "r1"
>
> PV = "svn${SRCDATE}"
> DEPENDS = "dashel qt4-embedded"
> LEAD_SONAME = "libasebacore.so"
>
> SRC_URI = "svn://svn.gna.org/svn/aseba;module=trunk"
>
> S = "${WORKDIR}/trunk"
>
> inherit qt4e cmake
>
> EXTRA_OECMAKE += "-DSHARED_LIBS:BOOL=ON -DCMD_LINE:BOOL=ON \
> -DQT_LIBRARY_DIR=${OE_QMAKE_LIBDIR_QT} \
> -DQT_INSTALL_LIBS=${OE_QMAKE_LIBDIR_QT} \
> -DQT_INCLUDE_DIR=${OE_QMAKE_INCDIR_QT} \
> -DQT_MOC_EXECUTABLE=${OE_QMAKE_MOC} \
> -DQT_UIC_EXECUTABLE=${OE_QMAKE_UIC} \
> -DQT_UIC3_EXECUTABLE=${OE_QMAKE_UIC3} \
> -DQT_RCC_EXECUTABLE=${OE_QMAKE_RCC} \
> -DQT_QMAKE_EXECUTABLE=${OE_QMAKE_QMAKE} \
> -DQT_QTCORE_INCLUDE_DIR=${OE_QMAKE_INCDIR_QT}/QtCore \
> -DQT_DBUSXML2CPP_EXECUTABLE=/usr/bin/qdbusxml2cpp \
> -DQT_DBUSCPP2XML_EXECUTABLE=/usr/bin/qdbuscpp2xml \
> "
>
> export QT_CONF_PATH="${WORKDIR}/trunk/qt.conf"
>
> do_configure_prepend() {
> echo "[Paths]" > $QT_CONF_PATH
> echo "Prefix=${STAGING_DIR}/${HOST_SYS}/usr" >> $QT_CONF_PATH
> echo "Documentation=${docdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Headers=${STAGING_INCDIR}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Libraries=${STAGING_LIBDIR}" >> $QT_CONF_PATH
> echo "Binaries=${STAGING_BINDIR_NATIVE}" >> $QT_CONF_PATH
> echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins" >> $QT_CONF_PATH
> echo "Data=${datadir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Translations=${datadir}/${QT_DIR_NAME}/translations" >> $QT_CONF_PATH
> echo "Settings=${sysconfdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Examples=${bindir}/${QT_DIR_NAME}/examples" >> $QT_CONF_PATH
> echo "Demos=${bindir}/${QT_DIR_NAME}/demos" >> $QT_CONF_PATH
> }
>
> do_stage() {
> oe_libinstall -so libasebacore ${STAGING_LIBDIR}
> oe_libinstall -so libasebacompiler ${STAGING_LIBDIR}
> oe_libinstall -so libasebavm ${STAGING_LIBDIR}
>
> install -d ${STAGING_INCDIR}/aseba
> install -d ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/consts.h ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/types.h ${STAGING_INCDIR}/aseba/common
> install -d ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/descriptions-manager.h ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/msg.h ${STAGING_INCDIR}/aseba/msg
> install -d ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/FormatableString.h ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/utils.h ${STAGING_INCDIR}/aseba/utils
> }
>
> FILES_${PN} += "${libdir}/libasebacore.so"
> FILES_${PN} += "${libdir}/libasebacompiler.so"
> FILES_${PN} += "${libdir}/libasebavm.so"
>
> I have added compiler flags mainly for use outside of openembedded, so I
> can copy the generated toolchain file and use it manually.
> ---
> classes/cmake.bbclass | 67
> ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 66 insertions(+), 1 deletions(-)
>
> diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass
> index b5b7b86..38bed63 100644
> --- a/classes/cmake.bbclass
> +++ b/classes/cmake.bbclass
> @@ -11,6 +11,67 @@ OECMAKE_SOURCEPATH ?= "."
> # "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles.
> OECMAKE_BUILDPATH ?= ""
>
> +# C/C++ Compiler (without cpu arch/tune arguments)
> +OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
> +OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
> +
> +# Compiler flags
> +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> ${BUILD_CPPFLAGS}"
> +OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> ${BUILD_CPPFLAGS} -fpermissive"
> +OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
> +OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
> +
> +
> +#
> +# Generate cmake toolchain file
> +#
> +cmake_generate_toolchain_file() {
> + rm -f ${WORKDIR}/toolchain.cmake
> + touch ${WORKDIR}/toolchain.cmake
> +
> +# CMake system name must be something like "Linux".
> +# This is important for cross-compiling.
> + echo "set( CMAKE_SYSTEM_NAME" `echo ${SDK_OS} | sed 's/^./\u&/'` ")"
> >> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )" >>
> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )" >>
> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_C_FLAGS \"${OECMAKE_C_FLAGS}\" CACHE STRING
> \"OpenEmbedded CFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_CXX_FLAGS \"${OECMAKE_CXX_FLAGS}\" CACHE STRING
> \"OpenEmbedded CXXFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_C_FLAGS_RELEASE \"${OECMAKE_C_FLAGS_RELEASE}\" CACHE
> STRING \"CFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_CXX_FLAGS_RELEASE \"${OECMAKE_CXX_FLAGS_RELEASE}\"
> CACHE STRING \"CXXFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
> +
> +# only search in the paths provided (from openembedded) so cmake doesnt
> pick
> +# up libraries and tools from the native build machine
> + echo "set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST}
> ${STAGING_DIR_NATIVE} ${CROSS_DIR} )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )" >>
> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )" >>
> ${WORKDIR}/toolchain.cmake
> + echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )" >>
> ${WORKDIR}/toolchain.cmake
> +# Use native cmake modules
> + echo "set( CMAKE_MODULE_PATH
> ${STAGING_DIR_NATIVE}/usr/share/cmake-2.6/Modules/ )" >>
> ${WORKDIR}/toolchain.cmake
> +
> +# Boost libraries have an unusual naming convention thanks to bjam
> + echo "set( Boost_COMPILER \"-gcc\" CACHE STRING \"Boost gcc string\"
> )" >> ${WORKDIR}/toolchain.cmake
> +
> +# Qt4 support is complex because FindQt4.cmake requires a lot of
> information
> +# about the Qt environment.
> + if [ ${QMAKESPEC} ]
> + then
> +# In the bbfile inherit one of qmake2/qt4e/qt4x11 and this section will be
> +# filled out
> + echo "set( QT_HEADERS_DIR ${OE_QMAKE_INCDIR_QT} CACHE STRING \"Qt4
> include dir\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_LIBRARY_DIR ${OE_QMAKE_LIBDIR_QT} CACHE STRING \"Qt4
> library dir\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_QMAKE_EXECUTABLE ${OE_QMAKE_QMAKE} CACHE STRING
> \"qmake2 binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_MOC_EXECUTABLE ${OE_QMAKE_MOC} CACHE STRING \"Qt4 moc
> binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_UIC_EXECUTABLE ${OE_QMAKE_UIC} CACHE STRING \"Qt4 uic
> binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_UIC3_EXECUTABLE ${OE_QMAKE_UIC3} CACHE STRING \"Qt4
> uic3 binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_RCC_EXECUTABLE ${OE_QMAKE_RCC} CACHE STRING \"Qt4 rcc
> binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_DBUSXML2CPP_EXECUTABLE ${OE_QMAKE_QDBUSXML2CPP} CACHE
> STRING \"Qt4 dbus xml2cpp binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_DBUSCPP2XML_EXECUTABLE ${OE_QMAKE_QDBUSCPP2XML} CACHE
> STRING \"Qt4 dbus cpp2xml binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_LRELEASE_EXECUTABLE ${OE_QMAKE_LRELEASE} CACHE STRING
> \"Qt4 lrelease binary\" )" >> ${WORKDIR}/toolchain.cmake
> + echo "set( QT_LUPDATE_EXECUTABLE ${OE_QMAKE_LUPDATE} CACHE STRING
> \"Qt4 lupdate binary\" )" >> ${WORKDIR}/toolchain.cmake
> + fi
> +}
> +
> +
> cmake_do_configure() {
> if [ ${OECMAKE_BUILDPATH} ]
> then
> @@ -18,9 +79,13 @@ cmake_do_configure() {
> cd ${OECMAKE_BUILDPATH}
> fi
>
> + cmake_generate_toolchain_file
> +
> cmake ${OECMAKE_SOURCEPATH} \
> + -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
> -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
> - -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
> + -DCMAKE_VERBOSE_MAKEFILE=1 \
> + -DCMAKE_BUILD_TYPE=Release \
> ${EXTRA_OECMAKE} \
> -Wno-dev
With my above config file, here is what I have to the cmake command:
> cmake ${OECMAKE_SOURCEPATH} \
> -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
> -DCMAKE_FIND_ROOT_PATH="${STAGING_DIR_HOST};${STAGING_DIR_NATIVE}" \
> -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
> -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
> -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
> ${EXTRA_OECMAKE} \
> -Wno-dev
which is similar to what you had in your toolchain.cmake file.
> }
> --
> 1.6.3.3
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-25 9:07 ` Valentin Longchamp
@ 2009-08-25 11:03 ` Holger Hans Peter Freyther
2009-08-25 15:48 ` Valentin Longchamp
2009-08-25 22:12 ` Matthew Dombroski
1 sibling, 1 reply; 12+ messages in thread
From: Holger Hans Peter Freyther @ 2009-08-25 11:03 UTC (permalink / raw)
To: openembedded-devel
On Tuesday 25 August 2009 11:07:47 Valentin Longchamp wrote:
> Matthew Dombroski wrote:
> > It is possible to make cmake use a toolchain file that defines flags,
> > search
> > paths and any other cmake options.
> >
> > The main reason for making openembedded generate a toolchain file is
> > to enable the building of complex packages. Without it a package
> > requiring Qt4 or boost (or one of many other packages) probably wont find
> > the right libs and won't build properly.
>
> I have had no problem with boost and with Qt4, I have been able to
> achieve similar results without the toolchain file, only by using a
> qt.conf file as Zecke had suggested to me.
Hey,
could you come up with a patch or help me to work on a patch?
z.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-25 11:03 ` Holger Hans Peter Freyther
@ 2009-08-25 15:48 ` Valentin Longchamp
0 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-25 15:48 UTC (permalink / raw)
To: openembedded-devel
Holger Hans Peter Freyther wrote:
> On Tuesday 25 August 2009 11:07:47 Valentin Longchamp wrote:
>> Matthew Dombroski wrote:
>>> It is possible to make cmake use a toolchain file that defines flags,
>>> search
>>> paths and any other cmake options.
>>>
>>> The main reason for making openembedded generate a toolchain file is
>>> to enable the building of complex packages. Without it a package
>>> requiring Qt4 or boost (or one of many other packages) probably wont find
>>> the right libs and won't build properly.
>> I have had no problem with boost and with Qt4, I have been able to
>> achieve similar results without the toolchain file, only by using a
>> qt.conf file as Zecke had suggested to me.
>
> Hey,
>
> could you come up with a patch or help me to work on a patch?
With great pleasure.
I have already posted the recipe I use for qt4/cmake build, the
FindQt4.cmake module patch is the same Matthew posted earlier today, and
here is my cmake patch.
Don't hesitate to ask if you need more info (I'll try to be on IRC,
Longfield)
Val
From 290226efcab3375808924efb03d264534ab97984 Mon Sep 17 00:00:00 2001
From: Valentin Longchamp <valentin.longchamp@epfl.ch>
Date: Thu, 18 Jun 2009 18:49:04 +0200
Subject: [PATCH 1/1] render cmake search path stricter
The search is only done in the STAGING directy: all the needed tools
should be there (already built) and all the libs and header are there
too. With this, we are sure that we do not mix with the host libs,
headers or tools.
Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
classes/cmake.bbclass | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass
index b5b7b86..08a4ab5 100644
--- a/classes/cmake.bbclass
+++ b/classes/cmake.bbclass
@@ -20,7 +20,10 @@ cmake_do_configure() {
cmake ${OECMAKE_SOURCEPATH} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
- -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+ -DCMAKE_FIND_ROOT_PATH="${STAGING_DIR_HOST};${STAGING_DIR_NATIVE}" \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
${EXTRA_OECMAKE} \
-Wno-dev
}
--
1.6.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-25 9:07 ` Valentin Longchamp
2009-08-25 11:03 ` Holger Hans Peter Freyther
@ 2009-08-25 22:12 ` Matthew Dombroski
2009-08-26 6:47 ` Valentin Longchamp
1 sibling, 1 reply; 12+ messages in thread
From: Matthew Dombroski @ 2009-08-25 22:12 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]
> I have had no problem with boost and with Qt4, I have been able to
> achieve similar results without the toolchain file, only by using a
> qt.conf file as Zecke had suggested to me.
I'm using boost-1.39 and found i needed to set Boost_COMPILER or it
wouldn't find libraries. (Oh how I hate bjam, but thats another story...)
Setting Qt environment data in cmake.bbclass may seem a bit out of
place. When you consider that cmake is distributed with scripts for
configuring/detecting Qt it doesn't seem too bad.
It is definitly tidier than generating a qt.conf in every recipe. Adding
all the Qt info in EXTRA_OECMAKE is doing the same work twice.
> Although the toolchain file is the preferred value according to the
> cmake documentation, it has not been necessary to me.
The effect of a toolchain file is the same as that of defining lots of
options in EXTRA_OECMAKE.
personally, I think it is cleaner. The ability to use it outside of
openembedded is really useful to me also.
~Matt
[-- Attachment #2: matthew.vcf --]
[-- Type: text/x-vcard, Size: 319 bytes --]
begin:vcard
fn:Matthew Dombroski
n:Dombroski;Matthew
org:4D Electronics Limited
adr:Sydenham;;54 Wordsworth St;Christchurch;;8013;New Zealand
email;internet:mdombroski@4d-electronics.co.nz
tel;work:(643) 982 1113
tel;cell:0211321773
x-mozilla-html:FALSE
url:www.4d-electronics.co.nz
version:2.1
end:vcard
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-25 22:12 ` Matthew Dombroski
@ 2009-08-26 6:47 ` Valentin Longchamp
2009-08-26 11:04 ` Valentin Longchamp
2009-08-26 17:21 ` Valentin Longchamp
0 siblings, 2 replies; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-26 6:47 UTC (permalink / raw)
To: openembedded-devel
Matthew Dombroski wrote:
>> I have had no problem with boost and with Qt4, I have been able to
>> achieve similar results without the toolchain file, only by using a
>> qt.conf file as Zecke had suggested to me.
> I'm using boost-1.39 and found i needed to set Boost_COMPILER or it
> wouldn't find libraries. (Oh how I hate bjam, but thats another story...)
Ok, I think I had 1.36.
>
> Setting Qt environment data in cmake.bbclass may seem a bit out of
> place. When you consider that cmake is distributed with scripts for
> configuring/detecting Qt it doesn't seem too bad.
> It is definitly tidier than generating a qt.conf in every recipe. Adding
> all the Qt info in EXTRA_OECMAKE is doing the same work twice.
Well that's a point of view. From my point of view, not all cmake based
programs need that qt info, that's why I find it's cleaner to enable it
in the recipes that need these libraries.
About adding the EXTRA_OECMAKE, I have to check, but I think I needed to
define some so that the right qmake is found. I will try without or by
adding only the needed definitions.
>
>> Although the toolchain file is the preferred value according to the
>> cmake documentation, it has not been necessary to me.
>
> The effect of a toolchain file is the same as that of defining lots of
> options in EXTRA_OECMAKE.
> personally, I think it is cleaner. The ability to use it outside of
> openembedded is really useful to me also.
I agree that it is the same. It's just that it was done until now like
that in OE, so I chose that way. However one advantage that I see of
defining things directly in the recipes and not in a toolchain file, is
that you can easily add definitions using EXTRA_OECMAKE in every recipe.
Is cmake able to take two toolchain files (one from cmake.bbclass and
one from the recipes with the needed libraries) without having to
rewrite the do_configure in the recipe ?
This comes back to the point above: do we need to define all the
libraries that could come with cmake-based programs in cmake.bbclass ?
From my point of view, this is definitely something related to the recipes.
Val
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-26 6:47 ` Valentin Longchamp
@ 2009-08-26 11:04 ` Valentin Longchamp
2009-08-26 21:36 ` Matthew Dombroski
2009-08-26 17:21 ` Valentin Longchamp
1 sibling, 1 reply; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-26 11:04 UTC (permalink / raw)
To: openembedded-devel@lists.openembedded.org
Valentin Longchamp wrote:
> Matthew Dombroski wrote:
>>
>> Setting Qt environment data in cmake.bbclass may seem a bit out of
>> place. When you consider that cmake is distributed with scripts for
>> configuring/detecting Qt it doesn't seem too bad.
>> It is definitly tidier than generating a qt.conf in every recipe.
>> Adding all the Qt info in EXTRA_OECMAKE is doing the same work twice.
>
> Well that's a point of view. From my point of view, not all cmake based
> programs need that qt info, that's why I find it's cleaner to enable it
> in the recipes that need these libraries.
>
> About adding the EXTRA_OECMAKE, I have to check, but I think I needed to
> define some so that the right qmake is found. I will try without or by
> adding only the needed definitions.
>
I have tried it, and the only thing I now have in the EXTRA_OECMAKE is
QT_QMAKE_EXECUTABLE to be sure that it takes the one from staging and
not the one from my system.
> DESCRIPTION = "aseba is an event-based architecture for distributed robots control"
> HOMEPAGE = "http://mobots.epfl.ch/aseba.html"
> LICENCE = "GPL"
> PR = "r1"
>
> PV = "svn${SRCDATE}"
> DEPENDS = "dashel qt4-embedded"
> LEAD_SONAME = "libasebacore.so"
>
> SRC_URI = "svn://svn.gna.org/svn/aseba;module=trunk"
>
> S = "${WORKDIR}/trunk"
>
> inherit qt4e cmake
>
> EXTRA_OECMAKE += "-DSHARED_LIBS:BOOL=ON -DCMD_LINE:BOOL=ON \
> -DQT_QMAKE_EXECUTABLE=${OE_QMAKE_QMAKE} \
> "
>
> export QT_CONF_PATH="${WORKDIR}/trunk/qt.conf"
>
> do_configure_prepend() {
> echo "[Paths]" > $QT_CONF_PATH
> echo "Prefix=${STAGING_DIR}/${HOST_SYS}/usr" >> $QT_CONF_PATH
> echo "Documentation=${docdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Headers=${STAGING_INCDIR}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Libraries=${STAGING_LIBDIR}" >> $QT_CONF_PATH
> echo "Binaries=${STAGING_BINDIR_NATIVE}" >> $QT_CONF_PATH
> echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins" >> $QT_CONF_PATH
> echo "Data=${datadir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Translations=${datadir}/${QT_DIR_NAME}/translations" >> $QT_CONF_PATH
> echo "Settings=${sysconfdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
> echo "Examples=${bindir}/${QT_DIR_NAME}/examples" >> $QT_CONF_PATH
> echo "Demos=${bindir}/${QT_DIR_NAME}/demos" >> $QT_CONF_PATH
> }
>
> do_stage() {
> oe_libinstall -so libasebacore ${STAGING_LIBDIR}
> oe_libinstall -so libasebacompiler ${STAGING_LIBDIR}
> oe_libinstall -so libasebavm ${STAGING_LIBDIR}
>
> install -d ${STAGING_INCDIR}/aseba
> install -d ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/consts.h ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/types.h ${STAGING_INCDIR}/aseba/common
> install -d ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/descriptions-manager.h ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/msg.h ${STAGING_INCDIR}/aseba/msg
> install -d ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/FormatableString.h ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/utils.h ${STAGING_INCDIR}/aseba/utils
> }
>
> FILES_${PN} += "${libdir}/libasebacore.so"
> FILES_${PN} += "${libdir}/libasebacompiler.so"
> FILES_${PN} += "${libdir}/libasebavm.so"
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-26 11:04 ` Valentin Longchamp
@ 2009-08-26 21:36 ` Matthew Dombroski
2009-08-26 22:38 ` Matthew Dombroski
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Dombroski @ 2009-08-26 21:36 UTC (permalink / raw)
To: openembedded-devel
> I have tried it, and the only thing I now have in the EXTRA_OECMAKE is
> QT_QMAKE_EXECUTABLE to be sure that it takes the one from staging and
> not the one from my system.
>
>> inherit qt4e cmake
>> EXTRA_OECMAKE += "-DSHARED_LIBS:BOOL=ON -DCMD_LINE:BOOL=ON \
>> -DQT_QMAKE_EXECUTABLE=${OE_QMAKE_QMAKE} \
>> "
>>
>> export QT_CONF_PATH="${WORKDIR}/trunk/qt.conf"
>>
>> do_configure_prepend() {
>> echo "[Paths]" > $QT_CONF_PATH
>> echo "Prefix=${STAGING_DIR}/${HOST_SYS}/usr" >> $QT_CONF_PATH
>> echo "Documentation=${docdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>> echo "Headers=${STAGING_INCDIR}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>> echo "Libraries=${STAGING_LIBDIR}" >> $QT_CONF_PATH
>> echo "Binaries=${STAGING_BINDIR_NATIVE}" >> $QT_CONF_PATH
>> echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins" >> $QT_CONF_PATH
>> echo "Data=${datadir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>> echo "Translations=${datadir}/${QT_DIR_NAME}/translations" >>
>> $QT_CONF_PATH
>> echo "Settings=${sysconfdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>> echo "Examples=${bindir}/${QT_DIR_NAME}/examples" >> $QT_CONF_PATH
>> echo "Demos=${bindir}/${QT_DIR_NAME}/demos" >> $QT_CONF_PATH
>> }
>>
That looks quite good now, maybe it's a good idea to add a
generate_qt_conf() to qmake2.bbclass.
That way it's independent of what build system we're using.
~Matt
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-26 21:36 ` Matthew Dombroski
@ 2009-08-26 22:38 ` Matthew Dombroski
2009-08-27 4:28 ` Roman I Khimov
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Dombroski @ 2009-08-26 22:38 UTC (permalink / raw)
To: openembedded-devel
>
>> I have tried it, and the only thing I now have in the EXTRA_OECMAKE
>> is QT_QMAKE_EXECUTABLE to be sure that it takes the one from staging
>> and not the one from my system.
>>
>>> inherit qt4e cmake
>>> EXTRA_OECMAKE += "-DSHARED_LIBS:BOOL=ON -DCMD_LINE:BOOL=ON \
>>> -DQT_QMAKE_EXECUTABLE=${OE_QMAKE_QMAKE} \
>>> "
>>>
>>> export QT_CONF_PATH="${WORKDIR}/trunk/qt.conf"
>>>
>>> do_configure_prepend() {
>>> echo "[Paths]" > $QT_CONF_PATH
>>> echo "Prefix=${STAGING_DIR}/${HOST_SYS}/usr" >> $QT_CONF_PATH
>>> echo "Documentation=${docdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>>> echo "Headers=${STAGING_INCDIR}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>>> echo "Libraries=${STAGING_LIBDIR}" >> $QT_CONF_PATH
>>> echo "Binaries=${STAGING_BINDIR_NATIVE}" >> $QT_CONF_PATH
>>> echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins" >> $QT_CONF_PATH
>>> echo "Data=${datadir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>>> echo "Translations=${datadir}/${QT_DIR_NAME}/translations" >>
>>> $QT_CONF_PATH
>>> echo "Settings=${sysconfdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
>>> echo "Examples=${bindir}/${QT_DIR_NAME}/examples" >> $QT_CONF_PATH
>>> echo "Demos=${bindir}/${QT_DIR_NAME}/demos" >> $QT_CONF_PATH
>>> }
>>>
> That looks quite good now, maybe it's a good idea to add a
> generate_qt_conf() to qmake2.bbclass.
> That way it's independent of what build system we're using.
Have tried it, didn't work.
cmake is able to find libs, headers and some executables but a lot of
stuff is unfound.
~Matt
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add toolchain file generation to cmake bbclass
2009-08-26 6:47 ` Valentin Longchamp
2009-08-26 11:04 ` Valentin Longchamp
@ 2009-08-26 17:21 ` Valentin Longchamp
2009-08-26 17:28 ` [PATCH 1/1] add toolchain file for cmake compilations Valentin Longchamp
1 sibling, 1 reply; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-26 17:21 UTC (permalink / raw)
To: openembedded-devel
Valentin Longchamp wrote:
> Matthew Dombroski wrote:
>>
>>> Although the toolchain file is the preferred value according to the
>>> cmake documentation, it has not been necessary to me.
>>
>> The effect of a toolchain file is the same as that of defining lots of
>> options in EXTRA_OECMAKE.
>> personally, I think it is cleaner. The ability to use it outside of
>> openembedded is really useful to me also.
>
> I agree that it is the same. It's just that it was done until now like
> that in OE, so I chose that way. However one advantage that I see of
> defining things directly in the recipes and not in a toolchain file, is
> that you can easily add definitions using EXTRA_OECMAKE in every recipe.
> Is cmake able to take two toolchain files (one from cmake.bbclass and
> one from the recipes with the needed libraries) without having to
> rewrite the do_configure in the recipe ?
>
> This comes back to the point above: do we need to define all the
> libraries that could come with cmake-based programs in cmake.bbclass ?
> From my point of view, this is definitely something related to the
> recipes.
>
I have been thinking about this today I here is a proposition that takes
the better of both our approaches. I agree that having the toolchain
file is much cleaner, however it should be possible to add things to
this toolchain file in the recipes according to what libraries are needed.
So I have added a task that generates a generic toolchain file, and the
idea is to add all the needed defines for additionnal libraries in the
recipe, in a do_generate_toolchain_file_append() function.
Here is my example recipe, sending the patch with git.
Val
> DESCRIPTION = "aseba is an event-based architecture for distributed robots control"
> HOMEPAGE = "http://mobots.epfl.ch/aseba.html"
> LICENCE = "GPL"
> PR = "r1"
>
> PV = "svn${SRCDATE}"
> DEPENDS = "dashel qt4-embedded"
> LEAD_SONAME = "libasebacore.so"
>
> SRC_URI = "svn://svn.gna.org/svn/aseba;module=trunk"
>
> S = "${WORKDIR}/trunk"
>
> inherit qt4e cmake
>
> EXTRA_OECMAKE += "-DSHARED_LIBS:BOOL=ON -DCMD_LINE:BOOL=ON"
>
> do_generate_toolchain_file_append() {
> echo "set( QT_HEADERS_DIR ${OE_QMAKE_INCDIR_QT} CACHE STRING \"Qt4 include dir\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_LIBRARY_DIR ${OE_QMAKE_LIBDIR_QT} CACHE STRING \"Qt4 library dir\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_QMAKE_EXECUTABLE ${OE_QMAKE_QMAKE} CACHE STRING \"qmake2 binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_MOC_EXECUTABLE ${OE_QMAKE_MOC} CACHE STRING \"Qt4 moc binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_UIC_EXECUTABLE ${OE_QMAKE_UIC} CACHE STRING \"Qt4 uic binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_UIC3_EXECUTABLE ${OE_QMAKE_UIC3} CACHE STRING \"Qt4 uic3 binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_RCC_EXECUTABLE ${OE_QMAKE_RCC} CACHE STRING \"Qt4 rcc binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_DBUSXML2CPP_EXECUTABLE ${OE_QMAKE_QDBUSXML2CPP} CACHE STRING \"Qt4 dbus xml2cpp binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_DBUSCPP2XML_EXECUTABLE ${OE_QMAKE_QDBUSCPP2XML} CACHE STRING \"Qt4 dbus cpp2xml binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_LRELEASE_EXECUTABLE ${OE_QMAKE_LRELEASE} CACHE STRING \"Qt4 lrelease binary\" )" >> ${WORKDIR}/toolchain.cmake
> echo "set( QT_LUPDATE_EXECUTABLE ${OE_QMAKE_LUPDATE} CACHE STRING \"Qt4 lupdate binary\" )" >> ${WORKDIR}/toolchain.cmake
> }
>
> do_stage() {
> oe_libinstall -so libasebacore ${STAGING_LIBDIR}
> oe_libinstall -so libasebacompiler ${STAGING_LIBDIR}
> oe_libinstall -so libasebavm ${STAGING_LIBDIR}
>
> install -d ${STAGING_INCDIR}/aseba
> install -d ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/consts.h ${STAGING_INCDIR}/aseba/common
> install -m 0644 common/types.h ${STAGING_INCDIR}/aseba/common
> install -d ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/descriptions-manager.h ${STAGING_INCDIR}/aseba/msg
> install -m 0644 msg/msg.h ${STAGING_INCDIR}/aseba/msg
> install -d ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/FormatableString.h ${STAGING_INCDIR}/aseba/utils
> install -m 0644 utils/utils.h ${STAGING_INCDIR}/aseba/utils
> }
>
> FILES_${PN} += "${libdir}/libasebacore.so"
> FILES_${PN} += "${libdir}/libasebacompiler.so"
> FILES_${PN} += "${libdir}/libasebavm.so"
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/1] add toolchain file for cmake compilations
2009-08-26 17:21 ` Valentin Longchamp
@ 2009-08-26 17:28 ` Valentin Longchamp
0 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2009-08-26 17:28 UTC (permalink / raw)
To: openembedded-devel; +Cc: Valentin Longchamp
Based on work done by Matthew Dombroski.
We want to generate a toolchain file for cmake compilations. This
adds a task that is performed before the configure task.
Additional defines can be made in the toolchain file directly in
the recipe file by using a do_generate_toolchain_file_append().
This is especially interesting for recipes that need to define
values for additionnal libraries.
Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
classes/cmake.bbclass | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass
index b5b7b86..36ed709 100644
--- a/classes/cmake.bbclass
+++ b/classes/cmake.bbclass
@@ -11,6 +11,29 @@ OECMAKE_SOURCEPATH ?= "."
# "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles.
OECMAKE_BUILDPATH ?= ""
+cmake_do_generate_toolchain_file() {
+# CMake system name must be something like "Linux".
+# This is important for cross-compiling.
+ echo "set( CMAKE_SYSTEM_NAME" `echo ${SDK_OS} | sed 's/^./\u&/'` ")" > ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_FLAGS \"${OECMAKE_C_FLAGS}\" CACHE STRING \"OpenEmbedded CFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_FLAGS \"${OECMAKE_CXX_FLAGS}\" CACHE STRING \"OpenEmbedded CXXFLAGS\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_C_FLAGS_RELEASE \"${OECMAKE_C_FLAGS_RELEASE}\" CACHE STRING \"CFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_CXX_FLAGS_RELEASE \"${OECMAKE_CXX_FLAGS_RELEASE}\" CACHE STRING \"CXXFLAGS for release\" )" >> ${WORKDIR}/toolchain.cmake
+
+# only search in the paths provided (from openembedded) so cmake doesnt pick
+# up libraries and tools from the native build machine
+ echo "set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )" >> ${WORKDIR}/toolchain.cmake
+ echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )" >> ${WORKDIR}/toolchain.cmake
+# Use native cmake modules
+ echo "set( CMAKE_MODULE_PATH ${STAGING_DIR_NATIVE}/usr/share/cmake-2.6/Modules/ )" >> ${WORKDIR}/toolchain.cmake
+}
+
+addtask generate_toolchain_file after do_patch before do_configure
+
cmake_do_configure() {
if [ ${OECMAKE_BUILDPATH} ]
then
@@ -20,9 +43,10 @@ cmake_do_configure() {
cmake ${OECMAKE_SOURCEPATH} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
- -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+ -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
+ -DCMAKE_VERBOSE_MAKEFILE=1 \
${EXTRA_OECMAKE} \
-Wno-dev
}
-EXPORT_FUNCTIONS do_configure
+EXPORT_FUNCTIONS do_configure do_generate_toolchain_file
--
1.6.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-08-27 4:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25 5:35 [PATCH] Add toolchain file generation to cmake bbclass Matthew Dombroski
2009-08-25 9:07 ` Valentin Longchamp
2009-08-25 11:03 ` Holger Hans Peter Freyther
2009-08-25 15:48 ` Valentin Longchamp
2009-08-25 22:12 ` Matthew Dombroski
2009-08-26 6:47 ` Valentin Longchamp
2009-08-26 11:04 ` Valentin Longchamp
2009-08-26 21:36 ` Matthew Dombroski
2009-08-26 22:38 ` Matthew Dombroski
2009-08-27 4:28 ` Roman I Khimov
2009-08-26 17:21 ` Valentin Longchamp
2009-08-26 17:28 ` [PATCH 1/1] add toolchain file for cmake compilations Valentin Longchamp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.