headunit icon indicating copy to clipboard operation
headunit copied to clipboard

Cmake cleanup

Open jwinarske opened this issue 5 years ago • 7 comments

Adds CMake support.

Builds on x86_64 host for both, as well as cross compiling with AGL SDK 10.0.0 aarch64.

dbus-cplusplus dispatcher .h changes are from this.

Only able to test on Ubuntu 20 Desktop with an Android 11 device. I don't own the Mazda in question. Connectivity with device was not dead solid, but I can get it to work :+1:

jwinarske avatar Oct 19 '20 23:10 jwinarske

Current build can be found here

Only build issues with this PR are related to dbus-cplusplus and clang.

SDL and GTK can both be factored out using GLFW3. If this repo is active I'll consider doing the refactor work.

jwinarske avatar Oct 28 '20 00:10 jwinarske

I took a quick look, and can't tell if this is being built with the m3-toolchain, or not? I will have to test it out, but I know the Mazda 3 CMU is pretty outdated library wise, which may give us some trouble? All the libraries on it are from around 2012, and I doubt we can update them without the factory software getting very upset with us :)

silverchris avatar Nov 04 '20 19:11 silverchris

I will add m3 build to the pipeline matrix.

jwinarske avatar Nov 04 '20 21:11 jwinarske

I was doing some playing with this, and I think our toolchain needs both libunwind, and protobuf libraries installed. I added them, and pushed the changes to my fork https://github.com/silverchris/m3-toolchain The version of protobuf is up to date, so the protoc compiler used by the system will need to match 3.14.0-rc1

And this is what I did to your cmake files to make them work for the toolchain https://github.com/silverchris/headunit/tree/cmake There are probably a lot of mistakes/non-optimal things in mine, as I don't really know cmake that well, and are mostly the result of trying things and seeing what sticks. Hopefully it is somewhat helpful to you

silverchris avatar Nov 10 '20 06:11 silverchris

@silverchris cool I'll keep your changes in mind

jwinarske avatar Nov 11 '20 00:11 jwinarske

@silverchris there are quite a few more missing dependencies. List is below. For Mazda build it's currently failing to find SDL2. I think the proper way is to have the headunit app as an external project. This would allow building all the dependencies correctly.

In theory quite a bit of the binaries are not needed to cross compile for Mazda. They should be built as a dependency of headunit.

The X11 and GTK3 dependency can be factored out with some minor re-work.

find_package(Threads REQUIRED) find_package(OpenSSL REQUIRED) find_package(Protobuf REQUIRED) find_package(SDL2 REQUIRED) find_package(ALSA REQUIRED) find_package(X11 REQUIRED)

find_package(PkgConfig REQUIRED) if(PKG_CONFIG_EXECUTABLE)

pkg_check_modules(GST REQUIRED gstreamer-1.0
                            gstreamer-video-1.0
                            gstreamer-app-1.0
                            gstreamer-audio-1.0
                            gstreamer-codecparsers-1.0)

pkg_check_modules(USB REQUIRED libusb-1.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(UNWIND REQUIRED libunwind)
pkg_check_modules(UDEV REQUIRED libudev)

endif()

jwinarske avatar Nov 14 '20 08:11 jwinarske

@jwinarske Ya, we do not need SDL2, X11 or GTK on the Mazda build. They are only used for running on Ubuntu. We only need for the Mazda target

  • Threads
  • OpenSSL
  • Protobuf
  • ALSA
  • gstreamer-0.10
  • libusb
  • libunwind
  • libudev
  • dbus-1
  • dbus-c++-1
  • dbus-c++-glib-1

The rest are only needed when compiling for Ubuntu.

We are somewhat limited on what libraries we can use for the Mazda build, as it shipped with glibc 2.11.1, which is rather dated now. Our toolchain also features a nice and ancient version of gcc at 4.9.1.

On an unrelated note, I have been trying to get glibc 2.11.1 to compile with a newer GCC, so I can try to build aasdk for the Mazda, as our dated GCC doesn't have proper support for C++14!

silverchris avatar Nov 14 '20 15:11 silverchris