forked from spadival/headunit
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build matrix clang warning fixes
- Loading branch information
Showing
12 changed files
with
337 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Defines the Chromium style for automatic reformatting. | ||
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
BasedOnStyle: Chromium | ||
# This defaults to 'Auto'. Explicitly set it for a while, so that | ||
# 'vector<vector<int> >' in existing files gets formatted to | ||
# 'vector<vector<int>>'. ('Auto' means that clang-format will only use | ||
# 'int>>' if the file already contains at least one such instance.) | ||
Standard: Cpp11 | ||
SortIncludes: true | ||
--- | ||
Language: ObjC | ||
ColumnLimit: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
dist: trusty | ||
dist: focal | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libdbus-c++-bin | ||
- libssl-dev | ||
- libusb-1.0-0-dev | ||
- libgstreamer1.0-dev | ||
- gstreamer1.0-gl | ||
- libgstreamer-plugins-base1.0-dev | ||
- libgstreamer-plugins-bad1.0-dev | ||
- protobuf-compiler | ||
- libprotobuf-dev | ||
- libsdl1.2-dev | ||
- libsdl2-dev | ||
- libgtk-3-dev | ||
- libudev-dev | ||
- libunwind-dev | ||
- libtool-bin | ||
- libefl-all-dev | ||
|
||
language: cpp | ||
before_script: cd mazda | ||
script: make clean release | ||
deploy: | ||
- provider: releases | ||
api_key: $GITHUB_TOKEN | ||
file: AndroidAuto_*.zip | ||
file_glob: true | ||
overwrite: true | ||
skip_cleanup: true | ||
on: | ||
tags: true | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
|
||
arch: | ||
- amd64 | ||
- arm64 | ||
|
||
env: | ||
jobs: | ||
- BUILD_TYPE=Debug CMAKE_ARGS="-DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
- BUILD_TYPE=Release CMAKE_ARGS="-DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
- BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
|
||
- BUILD_TYPE=Debug CMAKE_ARGS="-DBUILD_MAZDA=ON -DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
- BUILD_TYPE=Release CMAKE_ARGS="-DBUILD_MAZDA=ON -DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
- BUILD_TYPE=MinSizeRel CMAKE_ARGS="-DBUILD_MAZDA=ON -DCMAKE_STAGING_PREFIX=`pwd`/staging/usr/local" | ||
|
||
script: | ||
- env | ||
- cd ${TRAVIS_BUILD_DIR} | ||
- mkdir build && cd build | ||
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${CMAKE_ARGS} | ||
- make install -j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
cmake_minimum_required(VERSION 3.10.2) | ||
|
||
if(NOT CMAKE_MODULE_PATH) | ||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
elseif() | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
endif() | ||
|
||
project(AAHU LANGUAGES CXX) | ||
|
||
option(BUILD_MAZDA "Builds Mazda version of Android Auto" OFF) | ||
option(BUILD_UBUNTU "Builds Ubuntu version of Android Auto" ON) | ||
if(BUILD_MAZDA) | ||
set(BUILD_UBUNTU OFF) | ||
elseif(BUILD_UBUNTU) | ||
set(BUILD_MAZDA OFF) | ||
endif() | ||
|
||
include(deps) | ||
|
||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER hu/hu.proto) | ||
|
||
set(SRC_FILES | ||
hu/hu_aap.cpp | ||
hu/hu_aad.cpp | ||
hu/hu_ssl.cpp | ||
hu/hu_usb.cpp | ||
hu/hu_uti.cpp | ||
hu/hu_tcp.cpp | ||
${PROTO_HEADER} ${PROTO_SRC} | ||
|
||
common/audio.cpp | ||
common/command_server.cpp | ||
common/config.cpp | ||
common/glib_utils.cpp | ||
common/web++/web++.cpp | ||
) | ||
|
||
set(MAZDA_SRC | ||
mazda/bt/mzd_bluetooth.cpp | ||
mazda/gps/mzd_gps.cpp | ||
mazda/hud/hud.cpp | ||
mazda/nm/mzd_nightmode.cpp | ||
mazda/callbacks.cpp | ||
mazda/outputs.cpp | ||
mazda/main.cpp | ||
) | ||
|
||
set(UBUNTU_SRC | ||
ubuntu/bt/ub_bluetooth.cpp | ||
ubuntu/main.cpp | ||
ubuntu/outputs.cpp | ||
ubuntu/callbacks.cpp | ||
) | ||
|
||
if(BUILD_MAZDA) | ||
list(APPEND SRC_FILES ${MAZDA_SRC}) | ||
endif() | ||
|
||
if(BUILD_UBUNTU) | ||
list(APPEND SRC_FILES ${UBUNTU_SRC}) | ||
endif() | ||
|
||
add_executable(headunit ${SRC_FILES}) | ||
|
||
target_include_directories(headunit PUBLIC | ||
hu common | ||
${GTK3_INCLUDE_DIRS} | ||
${USB_INCLUDE_DIRS} | ||
${GST_INCLUDE_DIRS} | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_SYSROOT}/usr/include/SDL2 | ||
) | ||
|
||
target_compile_options(headunit PUBLIC | ||
-Wno-narrowing | ||
-D__STDC_FORMAT_MACROS | ||
-DDBUS_API_SUBJECT_TO_CHANGE | ||
) | ||
|
||
target_link_libraries(headunit PUBLIC | ||
${GST_LIBRARIES} | ||
${GTK3_LIBRARIES} | ||
${X11_LIBRARIES} | ||
${ALSA_LIBRARIES} | ||
${Protobuf_LIBRARY} | ||
${GLFW_STATIC_LIBRARY} | ||
${SDL2_LIBRARIES} | ||
${UDEV_LIBRARIES} | ||
${USB_LIBRARIES} | ||
${UNWIND_LIBRARIES} | ||
OpenSSL::Crypto | ||
OpenSSL::SSL | ||
Threads::Threads | ||
-v | ||
) | ||
|
||
if(BUILD_MAZDA) | ||
add_dependencies(headunit dbus-cplusplus) | ||
|
||
target_compile_options(headunit PUBLIC -static-libstdc++ -DCMU=1) | ||
|
||
target_include_directories(headunit PUBLIC | ||
${CMAKE_STAGING_DIR}/include | ||
${THIRD_PARTY_DIR}/dbus-cplusplus | ||
${CMAKE_STAGING_DIR}/include/dbus-c++-1) | ||
|
||
target_link_libraries(headunit PUBLIC | ||
${CMAKE_STAGING_DIR}/lib/libdbus-c++-1.a | ||
${CMAKE_STAGING_DIR}/lib/libdbus-c++-glib-1.a | ||
${DBUS_LIBRARIES}) | ||
endif() | ||
|
||
install(TARGETS headunit RUNTIME DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# - Try to find DBus | ||
# Once done, this will define | ||
# | ||
# DBUS_FOUND - system has DBus | ||
# DBUS_INCLUDE_DIRS - the DBus include directories | ||
# DBUS_LIBRARIES - link these to use DBus | ||
# | ||
# Copyright (C) 2012 Raphael Kubo da Costa <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS | ||
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
FIND_PACKAGE(PkgConfig) | ||
PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1) | ||
|
||
FIND_LIBRARY(DBUS_LIBRARIES | ||
NAMES dbus-1 | ||
HINTS ${PC_DBUS_LIBDIR} | ||
${PC_DBUS_LIBRARY_DIRS} | ||
) | ||
|
||
FIND_PATH(DBUS_INCLUDE_DIR | ||
NAMES dbus/dbus.h | ||
HINTS ${PC_DBUS_INCLUDEDIR} | ||
${PC_DBUS_INCLUDE_DIRS} | ||
) | ||
|
||
GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH) | ||
FIND_PATH(DBUS_ARCH_INCLUDE_DIR | ||
NAMES dbus/dbus-arch-deps.h | ||
HINTS ${PC_DBUS_INCLUDEDIR} | ||
${PC_DBUS_INCLUDE_DIRS} | ||
${_DBUS_LIBRARY_DIR} | ||
${DBUS_INCLUDE_DIR} | ||
PATH_SUFFIXES include | ||
) | ||
|
||
SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) | ||
|
||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/include/dbus-c++/dispatcher.h b/include/dbus-c++/dispatcher.h | ||
index b5b5536..b7a4534 100644 | ||
--- a/include/dbus-c++/dispatcher.h | ||
+++ b/include/dbus-c++/dispatcher.h | ||
@@ -267,6 +267,18 @@ struct Threading | ||
return new Mx; | ||
} | ||
|
||
+#ifndef DBUS_HAS_RECURSIVE_MUTEX | ||
+ static bool mutex_free(Mutex *mx) | ||
+ { | ||
+ delete mx; | ||
+ return false; | ||
+ } | ||
+ static bool mutex_lock(Mutex *mx) | ||
+ { | ||
+ mx->lock(); | ||
+ return false; | ||
+ } | ||
+#else | ||
static void mutex_free(Mutex *mx) | ||
{ | ||
delete mx; | ||
@@ -276,6 +288,7 @@ struct Threading | ||
{ | ||
mx->lock(); | ||
} | ||
+#endif//DBUS_HAS_RECURSIVE_MUTEX | ||
|
||
static void mutex_unlock(Mutex *mx) | ||
{ | ||
diff --git a/src/eventloop-integration.cpp b/src/eventloop-integration.cpp | ||
index 0cc65c3..5776971 100644 | ||
--- a/src/eventloop-integration.cpp | ||
+++ b/src/eventloop-integration.cpp | ||
@@ -38,6 +38,7 @@ | ||
#include <cassert> | ||
#include <sys/poll.h> | ||
#include <fcntl.h> | ||
+#include <unistd.h> | ||
|
||
using namespace DBus; | ||
using namespace std; | ||
diff --git a/src/pipe.cpp b/src/pipe.cpp | ||
index 01211b3..d0572c7 100644 | ||
--- a/src/pipe.cpp | ||
+++ b/src/pipe.cpp | ||
@@ -83,5 +83,5 @@ ssize_t Pipe::read(void *buffer, unsigned int &nbytes) | ||
void Pipe::signal() | ||
{ | ||
// TODO: ignoring return of read/write generates warning; maybe relevant for eventloop work... | ||
- ::write(_fd_write, '\0', 1); | ||
+ ::write(_fd_write, "\0", 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.