Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Co-authored-by: Emil Bic <[email protected]>
Co-authored-by: Mirza Canovic <[email protected]>
  • Loading branch information
3 people committed Nov 23, 2022
0 parents commit 6ee441c
Show file tree
Hide file tree
Showing 26 changed files with 1,964 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Ubuntu

on:
push:
pull_request:
branches:
- main

jobs:
build-ubuntu:

strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]

runs-on: ${{ matrix.os }}

steps:

- name: Set Variables
run: |
if [[ '${{ matrix.os }}' == 'ubuntu-22.04' ]]; then
echo "CC_PATH=/usr/bin/gcc-11" >> "$GITHUB_ENV"
echo "CXX_PATH=/usr/bin/g++-11" >> "$GITHUB_ENV"
elif [[ '${{ matrix.os }}' == 'ubuntu-20.04' ]]; then
echo "CC_PATH=/usr/bin/gcc-9" >> "$GITHUB_ENV"
echo "CXX_PATH=/usr/bin/g++-9" >> "$GITHUB_ENV"
else
echo "CC_PATH=/usr/bin/gcc" >> "$GITHUB_ENV"
echo "CXX_PATH=/usr/bin/g++" >> "$GITHUB_ENV"
fi
- name: Install Dependencies
run: |
sudo add-apt-repository ppa:ecal/ecal-latest
sudo apt-get update
sudo apt-get install ecal qtmultimedia5-dev libqt5multimedia5-plugins qtwayland5 libprotoc-dev protobuf-compiler libhdf5-dev
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0

- name: CMake
run: |
export CC=${{ env.CC_PATH }}
export CXX=${{ env.CXX_PATH }}
mkdir "${{ runner.workspace }}/_build"
cd "${{ runner.workspace }}/_build"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu \
"${{ github.workspace }}"
shell: bash

- name: Build Release
run: cmake --build . --config Release
working-directory: ${{ runner.workspace }}/_build

- name: Extract eCAL Version Number
run: |
ECAL_VERSION=$(dpkg -s ecal | grep '^Version:' | sed 's@^[^0-9]*\([0-9.]\+\).*@\1@' | cut -d"." -f-2)
echo "ecal_version=${ECAL_VERSION}" >> "$GITHUB_ENV"
- name: Read Project Name from CMakeCache
run: |
CMAKE_PROJECT_NAME_STRING=$(cat "${{runner.workspace}}/_build/CMakeCache.txt" | grep "^CMAKE_PROJECT_NAME:")
arr=(${CMAKE_PROJECT_NAME_STRING//=/ })
CMAKE_PROJECT_NAME=${arr[1]}
echo "cmake_project_name=$CMAKE_PROJECT_NAME" >> "$GITHUB_ENV"
shell: bash

- name: Pack
run: cpack -G DEB
working-directory: ${{ runner.workspace }}/_build

- name: Rename .deb installer
run: |
mv *.deb "${{env.cmake_project_name}}-${{ matrix.os }}-ecal-${{env.ecal_version}}.deb"
shell: bash
working-directory: ${{runner.workspace}}/_build/_deploy/


- name: Upload Debian
uses: actions/upload-artifact@v3
with:
name: ${{env.cmake_project_name}}-${{ matrix.os }}-ecal-${{env.ecal_version}}
path: ${{ runner.workspace }}/_build/_deploy/*.deb
67 changes: 67 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Windows

on:
push:
branches:
- main

jobs:
build-windows:
runs-on: windows-2019

steps:
- name: Download eCAL
uses: robinraju/[email protected]
with:
repository: "eclipse-ecal/ecal"
latest: true
fileName: "ecal_*-win64.exe"

- name: Extract eCAL Version
run: |
echo "ECAL_VERSION=$(ls | sed 's@^[^0-9]*\([0-9.]\+\).*@\1@' | cut -d"." -f-2)" >> "$GITHUB_ENV"
shell: bash

- name: Install eCAL
run: Start-Process -Wait -FilePath ".\ecal_*-win64.exe" -ArgumentList "/SILENT /ALLUSERS /SUPPRESSMSGBOXES /NORESTART /TYPE=full"

- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
target: 'desktop'
arch: 'win64_msvc2015_64'

- name: CMake
run: |
mkdir "${{ runner.workspace }}\_build"
cd "${{ runner.workspace }}\_build"
cmake -G "Visual Studio 16 2019" -Tv140 -Ax64 ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON ^
-DCMAKE_PREFIX_PATH="C:/eCAL/lib/cmake/;C:/eCAL/cmake" ^
-DCMAKE_MODULE_PATH="C:/eCAL/cmake" ^
-DCMAKE_INSTALL_PREFIX="${{ runner.workspace }}\_deploy" ^
%GITHUB_WORKSPACE%
shell: cmd

- name: Build
run: cmake --build . --config Release
working-directory: ${{ runner.workspace }}\_build

- name: Install
run: |
cmake --build . --config Release --target install
working-directory: ${{ runner.workspace }}\_build

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ecal-camera-samples-windows-ecal-${{env.ECAL_VERSION}}
path: ${{ runner.workspace }}\_deploy\bin
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CMake build folders
/_build
/build

# Visual Studio 2015/2017 cache/options directory
.vs/

# Visual Studio code
*.vscode

# QtCreator temporary files
CMakeLists.txt.user

# Clion
.idea
cmake-build-*
142 changes: 142 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# ========================= LICENSE =================================
#
# Copyright (C) 2022 Continental Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ========================= LICENSE =================================

cmake_minimum_required(VERSION 3.4)
project(ecal-camera-samples)

set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME})

set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_OUTPUT_FILE_PREFIX _deploy)

set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

include(CPack)

add_definitions(-DQWT_DLL)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(UNIX)
set(CMAKE_LINK_WHAT_YOU_USE ON)
endif(UNIX)
# Set CMake policy behavior (alias targets)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0080 NEW)

# --------------------------------------------------------
# set ECAL_MON_PLUGIN_DIR install dir
# --------------------------------------------------------
include(GNUInstallDirs)
if(WIN32)
set(ECAL_MON_PLUGIN_DIR ecalmon_plugins)
else()
set(ECAL_MON_PLUGIN_DIR ecal/plugins/mon)
endif()

set(eCAL_install_lib_dir ${CMAKE_INSTALL_LIBDIR})
set(eCAL_install_bin_dir ${CMAKE_INSTALL_BINDIR})

if (WIN32)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(PLATFORM_NAME "x64")
else()
set(PLATFORM_NAME "win32")
endif()
set(VS_PLATFORM "v140_${PLATFORM_NAME}")
endif()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake_utils/mon_functions.cmake)

# --------------------------------------------------------
# command line build options
# use it that way cmake .. -DHAS_OPENCV=ON
# --------------------------------------------------------
include(CMakeDependentOption)

# --------------------------------------------------------
# detect qt library
# --------------------------------------------------------
if(WIN32)
if(NOT DEFINED ENV{QT5_ROOT_DIRECTORY})
# If the QT5_ROOT_DIRECTORY Variable is not set, there is still a chance that
# the user set the CMAKE_PREFIX_PATH himself. Thus we try to find
# Qt5 Core just to see if that works. If we can find Qt, we assume
# that the user knows what he is doing.
find_package(Qt5 COMPONENTS Core)
if (NOT Qt5_FOUND)
message(FATAL_ERROR "QT5_ROOT_DIRECTORY is not defined. Please create an \
environment variable QT5_ROOT_DIRECTORY pointing to your QT5 installation \
(the directory that contains the msvc2015 or msvc2015_64 \
directory)")
endif()
else()
if(NOT CMAKE_CL_64)
# Add 32bit Qt5
list(APPEND CMAKE_PREFIX_PATH $ENV{QT5_ROOT_DIRECTORY}/msvc2015/)
message(STATUS "QT 32 Bit")
message(STATUS "CMAKE_PREFIX_PATH appended: $ENV{QT5_ROOT_DIRECTORY}/msvc2015/")
else ()
# Add 64bit Qt5
list(APPEND CMAKE_PREFIX_PATH $ENV{QT5_ROOT_DIRECTORY}/msvc2015_64/)
message(STATUS "QT 64 Bit")
message(STATUS "CMAKE_PREFIX_PATH appended: $ENV{QT5_ROOT_DIRECTORY}/msvc2015_64/")
endif()
endif()
endif(WIN32)

if(WIN32)
include(${CMAKE_CURRENT_LIST_DIR}/cmake_utils/qt/qt_windeployqt.cmake)
endif()


if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC OFF) # Reason for being turned off: AutoUIC will prevent VS from detecting changes in .ui files
set(CMAKE_AUTORCC OFF) # Reason for being turned off: AutoRCC will create an entirely new project in VS which clutters the solution appearance. Additionally, we cannot assign a source group to the generated .cpp files which will clutter the project.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(eCAL COMPONENTS core pb mon_plugin_lib REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
find_package(Protobuf REQUIRED)

create_targets_protobuf()
set(THREADS_PREFER_PTHREAD_FLAG ON)

if(UNIX)
message(STATUS "GCC detected - Adding flags")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-fno-pie -fno-PIE -fPIC)
if(NOT CMAKE_VERSION VERSION_LESS 3.10 AND NOT OpenGL_GL_PREFERENCE)
set(OpenGL_GL_PREFERENCE GLVND)
endif()
endif()


add_subdirectory(ecal_camera_snd)
add_subdirectory(camera_receiver_mon_plugin)
Loading

0 comments on commit 6ee441c

Please sign in to comment.