Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/build_native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ jobs:
ARCHES="$ARCH_INPUT"
fi

# On develop branch, limit to amd64 for faster feedback
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
# On develop branch, limit to amd64 for faster feedback (only for automatic pushes, not manual workflow_dispatch)
if [ "${{ github.ref }}" = "refs/heads/develop" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
ARCHES="amd64"
echo "Building only amd64 for develop branch"
echo "Building only amd64 for develop branch (automatic push)"
fi

# Expand distributions list
Expand Down Expand Up @@ -208,6 +208,15 @@ jobs:
run: |
echo "Building OpenAuto for ${{ matrix.arch }} architecture"

# Determine build type based on branch
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
BUILD_TYPE="release"
echo "Building release packages for main branch"
else
BUILD_TYPE="debug"
echo "Building debug packages for ${{ github.ref_name }} branch"
fi

# Create output directory
mkdir -p ./build-output

Expand All @@ -216,6 +225,7 @@ jobs:
--platform ${{ matrix.platform }} \
--build-arg TARGET_ARCH=${{ matrix.arch }} \
--build-arg DEBIAN_VERSION=${{ matrix.distro }} \
--build-arg BUILD_TYPE=${BUILD_TYPE} \
--tag openauto-build:${{ matrix.arch }} \
--load \
.
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,14 @@ else()
endif()

set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "openauto")

# Add debug suffix to package name for debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CPACK_PACKAGE_NAME "openauto-dbg")
else()
set(CPACK_PACKAGE_NAME "openauto")
endif()

set(CPACK_PACKAGE_VENDOR "OpenCarDev")
set(CPACK_PACKAGE_CONTACT "OpenCarDev Team <opencardevuk@gmail.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenAuto head unit application using libaasdk")
Expand Down
40 changes: 6 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ FROM debian:${DEBIAN_VERSION}-slim

# Build arguments
ARG TARGET_ARCH=amd64
ARG BUILD_TYPE=release
ARG DEBIAN_FRONTEND=noninteractive

# Set locale to avoid encoding issues
Expand Down Expand Up @@ -105,40 +106,11 @@ RUN echo "Contents of /src:" && ls -la
# Create output directory for packages
RUN mkdir -p /output

# Build OpenAuto
RUN export TARGET_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) && \
echo "Building OpenAuto for architecture: $TARGET_ARCH (native compilation)" && \
# Determine if this is a non-Pi architecture
CMAKE_NOPI_FLAG="" && \
case "$TARGET_ARCH" in \
amd64|arm64) CMAKE_NOPI_FLAG="-DNOPI=ON" ;; \
armhf) CMAKE_NOPI_FLAG="-DNOPI=ON" ;; \
*) CMAKE_NOPI_FLAG="-DNOPI=ON" ;; \
esac && \
echo "Using CMAKE_NOPI_FLAG: $CMAKE_NOPI_FLAG" && \
# Compute distro-specific release suffix to avoid cross-suite overwrite
DISTRO_DEB_RELEASE=$(bash /src/scripts/distro_release.sh) && \
CPACK_DEB_RELEASE="$DISTRO_DEB_RELEASE" && \
echo "Using CPACK_DEBIAN_PACKAGE_RELEASE: $CPACK_DEB_RELEASE" && \
# Configure
env DISTRO_DEB_RELEASE="$CPACK_DEB_RELEASE" \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release ${CMAKE_NOPI_FLAG} -DCPACK_DEBIAN_PACKAGE_RELEASE="$CPACK_DEB_RELEASE" -DCPACK_PROJECT_CONFIG_FILE=/src/cmake_modules/CPackProjectConfig.cmake && \
# Build
cmake --build build -j$(nproc) && \
# Package
cd build && \
cpack -G DEB && \
cd .. && \
# Copy packages to output
if [ -d "build" ]; then \
find build -name "*.deb" -exec cp {} /output/ \; 2>/dev/null || true && \
echo "Packages built:" && \
ls -la /output/; \
else \
echo "No build directory found"; \
exit 1; \
fi && \
echo "Build completed"
# Make build script executable
RUN chmod +x /src/build.sh

# Build OpenAuto using unified build script
RUN /src/build.sh ${BUILD_TYPE} --package --output-dir /output

# Default command
CMD ["bash", "-c", "echo 'OpenAuto build container ready. Packages are in /output/'"]
Expand Down
83 changes: 68 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,76 @@ Copyrights (c) 2018 f1x.studio (Michal Szwaj)
- OpenMAX IL API

### Building
#### Amd64
Install the packages specified in the [prebuilts](https://github.com/opencardev/prebuilts) repository. Qt5 is required, versions packaged in modern Ubuntu and Debian
seem to work fine.

You will also likely need to install the udev rules from `prebuilts`

You need to point some CMAKE variables at your `aasdk` files.
```text
-DAASDK_INCLUDE_DIRS=<path_to_aasdk_repo>/include
-DAASDK_LIBRARIES=<path_to_aasdk_repo>/lib/libaasdk.so
DAASDK_PROTO_INCLUDE_DIRS=<path_to_aasdk_build>
-DAASDK_PROTO_LIBRARIES=<path_to_aasdk_repo>/lib/libaasdk_proto.so

OpenAuto provides a unified build script (`build.sh`) that works consistently across local and Docker environments.

#### Quick Start

```bash
# Build release version (recommended for production)
# Note: main/master branches default to release, other branches default to debug
./build.sh release --package

# Build debug version with symbols (for development/debugging)
# Debug builds create packages with -dbg suffix (openauto-dbg)
./build.sh debug --package

# Auto-detect build type based on git branch
./build.sh --package

# Clean build
./build.sh release --clean --package
```

#### Raspberry Pi
Just run the scripts in the `prebuilts` repository for `aasdk` and `openauto`. It is possible to cross compile if your raspberry pi is too slow to compile the code itself.
However, its easiest to just develop on a more capable `amd64` device.
#### Build Script Options

```bash
Usage: ./build.sh [release|debug] [OPTIONS]

Build types:
release Build release version (default)
debug Build debug version with symbols

Options:
--clean Clean build directory before building
--package Create DEB packages after building
--output-dir Directory to copy packages (default: /output)
--help Show help message

Note: Builds are always done with NOPI=ON (no Pi-specific hardware)
```

#### Manual Building (Legacy)

If you need to build manually:

**AMD64/x86_64:**
1. Install dependencies from [prebuilts](https://github.com/opencardev/prebuilts) repository
2. Install Qt5 and development packages
3. Build with CMake:
```bash
mkdir -p build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
```

Note: The build script automatically enables NOPI=ON

**Raspberry Pi:**
1. Use the scripts in the `prebuilts` repository for `aasdk` and `openauto`
2. Or use the unified `build.sh` script:
```bash
./build.sh release --package
```

#### Docker Building

The Dockerfile uses the same `build.sh` script:

```bash
docker build -t openauto --build-arg DEBIAN_VERSION=trixie .
```

### Remarks
**This software is not certified by Google Inc. It is created for R&D purposes and may not work as expected by the original authors. Do not use while driving. You use this software at your own risk.**
Expand Down
Loading