[yocto] [meta-mingw][PATCH 2/2] cmake: add support for building nativesdk-cmake

Joshua Watt jpewhacker at gmail.com
Mon Nov 19 13:31:53 PST 2018


On Fri, Nov 16, 2018 at 12:33 AM Samuli Piippo <samuli.piippo at qt.io> wrote:

> I've been testing cmake with Qt Creator integration which explicitly uses
> -G "MinGW Makefiles", while cmake defaults to NMake Makefiles. I'm not
> sure if it's possible to set generator in the toolchain file.
>

Hmm, so perhaps Qt creator isn't using %CC% %CFLAGS% & friends? Did you
manually configure it to pass the right arguments to the compiler (e.g.
path to sysroot and such)? That might explain why it works for you since
AFAIK, cmake can't handle "\" as a path separator, and that is what our
environment setup script uses.

I'm not specifically opposed to adding cmake to the SDK (I think it's
probably a good idea even), but if we are adding it to the default SDK (
nativesdk-packagegroup-sdk-host) I think it would be wise for it to work as
expected (e.g. work like it does in the Linux SDK). Fortunately, your
patches sent me off on a deeper tangent in my quest for automated testing
of the MinGW SDK, and I believe I have actually done a significant amount
of the work required to facilitate getting cmake working "as expected". You
can take a look at my patches on the jpew/oeqa branch in
meta-mingw-contrib. For the most part, the changes aren't too bad; the only
one that really scares me is the change to make the toolchain batch files
use the unix path seperator (/) instead of the Windows separator (\)
("classes/toolchain-scripts-mingw32: Use Unix path separators"). I don't
really know enough about cmake, so perhaps there is some better (cmake
specific) mechanism that we can use instead?

Just to be clear, I don't mind the changes you made to make cmake build,
but I would prefer to not add it to the SDK by default until it actually
works with the SDK (and preferably has some test cases ;).



>
> ------------------------------
> *From:* Joshua Watt <jpewhacker at gmail.com>
> *Sent:* 16 November 2018 05:35:50
> *To:* Samuli Piippo
> *Cc:* Yocto list discussion
> *Subject:* Re: [yocto] [meta-mingw][PATCH 2/2] cmake: add support for
> building nativesdk-cmake
>
> On Thu, Nov 15, 2018 at 7:22 PM Samuli Piippo <samuli.piippo at qt.io> wrote:
> >
> > Build nativesdk-cmake and dependency libs without without openssl.
> >
> > Signed-off-by: Samuli Piippo <samuli.piippo at qt.io>
> > ---
> >  .../nativesdk-packagegroup-sdk-host.bbappend              | 1 +
> >  recipes-devtools/cmake/cmake_%.bbappend                   | 8 ++++++++
> >  recipes-extended/libarchive/libarchive_%.bbappend         | 1 +
> >  recipes-support/curl/curl_%.bbappend                      | 2 ++
> >  4 files changed, 12 insertions(+)
> >  create mode 100644 recipes-devtools/cmake/cmake_%.bbappend
> >  create mode 100644 recipes-extended/libarchive/libarchive_%.bbappend
> >  create mode 100644 recipes-support/curl/curl_%.bbappend
> >
> > diff --git
> a/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
> b/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
> > index ad69b13..9544ffb 100644
> > --- a/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
> > +++ b/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
> > @@ -2,4 +2,5 @@ RDEPENDS_${PN}_mingw32 = "\
> >      nativesdk-pkgconfig \
> >      nativesdk-libtool \
> >      nativesdk-qemu \
> > +    nativesdk-cmake \
>
> Have you been successful at getting cmake to work properly in MinGW?
> I've been working on automated tests for the SDK, and for kicks I
> pulled in your changes and tried to write a test for cmake (heavily
> borrowed from the cmake/assimp test in oe-core). When I ran the test,
> I got the following:
>
> --- snip ---
>
> -- Building for: NMake Makefiles
> -- The C compiler identification is GNU 8.2.0
> CMake Error at
> Z:/projects/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/testimage-sdk/CMakeTest-zljaq7x7/build/CMakeFiles/3.12.2/CMakeCCompiler.cmake:2
> (set):
>   Syntax error in cmake code at
>
>
> Z:/projects/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/testimage-sdk/CMakeTest-zljaq7x7/build/CMakeFiles/3.12.2/CMakeCCompiler.cmake:2
>
>   when parsing string
>
>       -m32 -march=i586
>
> --sysroot=Z:\projects\poky\build\tmp\work\QEMU~ELC\CORE~B5D\1~~~~N25.0-R\TEST~Y0Z\\sysroots\i586-poky-linux
>
>   Invalid escape sequence \p
> Call Stack (most recent call first):
>   CMakeLists.txt:38 (PROJECT)
>
> --- snip ---
>
> It looks like cmake doesn't like the Windows style slashes in CFLAGS.
>
> You can see my test branch at jpew/oeqa in meta-mingw-contrib... it's
> still in progress so it might be a bit of work if you want to try it
> yourself.
>
> >      "
> > diff --git a/recipes-devtools/cmake/cmake_%.bbappend
> b/recipes-devtools/cmake/cmake_%.bbappend
> > new file mode 100644
> > index 0000000..f76cd82
> > --- /dev/null
> > +++ b/recipes-devtools/cmake/cmake_%.bbappend
> > @@ -0,0 +1,8 @@
> > +DEPENDS_remove_mingw32 = "ncurses"
> > +
> > +cmake_do_generate_toolchain_file_append_mingw32() {
> > +    cat >> ${WORKDIR}/toolchain.cmake <<EOF
> > +set( CMAKE_SYSTEM_NAME Windows )
> > +EOF
> > +}
> > +
> > diff --git a/recipes-extended/libarchive/libarchive_%.bbappend
> b/recipes-extended/libarchive/libarchive_%.bbappend
> > new file mode 100644
> > index 0000000..a411b40
> > --- /dev/null
> > +++ b/recipes-extended/libarchive/libarchive_%.bbappend
> > @@ -0,0 +1 @@
> > +EXTRA_OECONF_append_mingw32 = " --without-cng"
> > diff --git a/recipes-support/curl/curl_%.bbappend
> b/recipes-support/curl/curl_%.bbappend
> > new file mode 100644
> > index 0000000..7865b46
> > --- /dev/null
> > +++ b/recipes-support/curl/curl_%.bbappend
> > @@ -0,0 +1,2 @@
> > +PACKAGECONFIG_remove_class-nativesdk_mingw32 = "ssl"
> > +RRECOMMENDS_lib${BPN}_remove_mingw32 = "ca-certificates"
> > --
> > 2.17.1
> >
> > --
> > _______________________________________________
> > yocto mailing list
> > yocto at yoctoproject.org
> > https://lists.yoctoproject.org/listinfo/yocto
> yocto Info Page <https://lists.yoctoproject.org/listinfo/yocto>
> lists.yoctoproject.org
> Discussion of all things about the Yocto Project. Read our Community
> Guidelines or learn more about how to participate in other community
> discussions. Subscribe before posting to bypass moderation. To see the
> collection of prior postings to the list, visit the yocto Archives.. Using
> yocto
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20181119/2aa2962b/attachment-0001.html>


More information about the yocto mailing list