Skip to content
Snippets Groups Projects
Commit d0c0e58d authored by Martin Stump's avatar Martin Stump
Browse files

Merge branch 'add-cmake-install' into 'main'

Add CMake install and package logic

See merge request eclipse/openpass/yase!9
parents 338656f3 73b31a4a
No related branches found
No related tags found
No related merge requests found
Showing
with 223 additions and 13 deletions
additional_commands:
configure_package_config_file:
flags:
- NO_SET_AND_CHECK_MACRO
- NO_CHECK_REQUIRED_COMPONENTS_MACRO
kwargs:
INSTALL_DESTINATION: "*"
PATH_VARS: "*"
INSTALL_PREFIX: "*"
find_dependency:
flags:
- CONFIG
- QUIET
- REQUIRED
kwargs:
COMPONENTS: "*"
gtest_discover_tests:
flags:
- NO_PRETTY_TYPES
- NO_PRETTY_VALUES
kwargs:
EXTRA_ARGS: "*"
WORKING_DIRECTORY: "*"
TEST_PREFIX: "*"
TEST_SUFFIX: "*"
PROPERTIES: "*"
TEST_LIST: "*"
DISCOVERY_TIMEOUT: "*"
command_case: canonical
dangle_parens: true
first_comment_is_literal: true
keyword_case: upper
line_width: 120
tab_size: 2
.vscode
build
.cache/
.vscode/
build/
bazel-*
# ##############################################################################
# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
# ##############################################################################
cmake_minimum_required(VERSION 3.16.3)
if(NOT DEFINED Yase_IS_TOP_LEVEL)
set(Yase_IS_TOP_LEVEL OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(Yase_IS_TOP_LEVEL ON)
endif()
endif()
project(
Yase
VERSION 0.9.0
DESCRIPTION "A simulator agnostic scenario/simulation engine"
HOMEPAGE_URL https://gitlab.eclipse.org/eclipse/simopenpass/yase
LANGUAGES CXX
)
option(Yase_BUILD_TESTS "Build the tests" ${Yase_IS_TOP_LEVEL})
option(Yase_BUILD_DOCS "Build the documentation (requires Doxygen and Graphviz)" ${Yase_IS_TOP_LEVEL})
option(Yase_INSTALL "Enable installation (projects embedding Yase may want to turn this OFF)" ${Yase_IS_TOP_LEVEL})
include(CMakeDependentOption)
cmake_dependent_option(Yase_USE_SYSTEM_GTEST "Use system GTest" OFF "Yase_BUILD_TESTS" OFF)
if(Yase_INSTALL)
include(GNUInstallDirs)
set(Yase_CONFIG_INSTALL_DIR
${CMAKE_INSTALL_DATADIR}/Yase/cmake
CACHE PATH "Config install directory"
)
set(Yase_INCLUDE_INSTALL_DIR
${CMAKE_INSTALL_INCLUDEDIR}
CACHE PATH "Include install directory"
)
endif()
if(Yase_BUILD_TESTS)
enable_testing()
if(Yase_USE_SYSTEM_GTEST)
find_package(GTest REQUIRED)
if(NOT TARGET GTest::gtest_main AND TARGET GTest::Main)
# CMake <3.20 FindGTest module provides the deprecated target GTest::Main while CMake >=3.20 uses GTest's own
# package config which provides the target GTest::gtest_main
add_library(GTest::gtest_main ALIAS GTest::Main)
endif()
else()
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.13.0
)
set(INSTALL_GTEST OFF)
FetchContent_MakeAvailable(googletest)
endif()
endif()
add_subdirectory(agnostic_behavior_tree)
export(
TARGETS agnostic_behavior_tree
NAMESPACE Yase::
FILE ${CMAKE_CURRENT_BINARY_DIR}/YaseTargets.cmake
)
if(Yase_INSTALL)
install(TARGETS agnostic_behavior_tree EXPORT YaseTargets)
install(
EXPORT YaseTargets
NAMESPACE Yase::
DESTINATION ${Yase_CONFIG_INSTALL_DIR}
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/YaseConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/YaseConfig.cmake
INSTALL_DESTINATION ${Yase_CONFIG_INSTALL_DIR}
NO_SET_AND_CHECK_MACRO
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/YaseConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/YaseConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/YaseConfigVersion.cmake LICENSE
DESTINATION ${Yase_CONFIG_INSTALL_DIR}
)
endif()
......@@ -4,16 +4,16 @@
The **Yase (Yet Agnostic Scenario Engine / Another Scenario Engine)** package is a simulator agnostic scenario/simulation engine in the AD/ADAS context to develop and test intelligent vehicles.
The Yase eco system allows to create customized simulation solutions, which can be adapted easily to the system complexity by adapting extensions for simulators and scenario languages where needed.
The architecture is hereby orientated on programming language compilers.
Within these compilers, programming languages are translated into an intermediate representation by a front-end.
The architecture is hereby orientated on programming language compilers.
Within these compilers, programming languages are translated into an intermediate representation by a front-end.
From here, several back-ends can translate the intermediate representation into different target architectures.
!["Example of LLVM compiler"](doc/figures/compiler_example.png?raw=true)
This modular and flexible architecture is used for the Yase eco system.
The basis is the `agnostic_behavior_tree` in the middle-end (also refereed as the simulation kernel).
This modular and flexible architecture is used for the Yase eco system.
The basis is the `agnostic_behavior_tree` in the middle-end (also refereed as the simulation kernel).
Furthermore, it contains multiple other agnostic packages.
Around this middle-end the eco system with extensions can be build, which are agnostic of the underlying simulator as well as of the used scenario input file format.
This middle-end can be filled by different front-ends, compiling in different scenario formats.
This middle-end can be filled by different front-ends, compiling in different scenario formats.
On the other side, back-ends can connect the middle-end with different simulators or simulator feature subsets.
The following figure shows a **potential** expansion with potential simulation back-ends/ scenario formats front-ends.
!["Example for a potential Yase setup"](doc/figures/scenario_compiler.png?raw=true)
......@@ -33,18 +33,43 @@ The implementation of the OpenSCENARIO1.x implementation for OpenPASS can be fou
To play around with the project, one can use the containerized setup.
It contains all required dependencies.
Open the project with docker or [vscode](https://code.visualstudio.com/docs/remote/containers).
Open the project with docker or [vscode](https://code.visualstudio.com/docs/remote/containers).
Once the container started, it is possible to build the available packages and run their tests either via cmake or bazel.
Via cmake:
Via CMake:
``` shell
mkdir build && cd build
cmake ./../middle_end/agnostic_behavior_tree && make && ./agnostic_behavior_tree_test
cmake -B build [--install-prefix=<path/to/prefix>]
cmake --build build [--target test]
cmake --install build
```
Via bazel:
``` shell
bazel build //middle_end/agnostic_behavior_tree/...
bazel test --test_output=all //middle_end/agnostic_behavior_tree/...
bazel build //agnostic_behavior_tree/...
bazel test --test_output=all //agnostic_behavior_tree/...
```
## How to use:
### Via CMake
Build and install Yase (see above), then find either the built or the installed package:
``` cmake
set(Yase_DIR <path/to/yase>)
find_package(Yase REQUIRED)
...
target_link_libraries(<target> PUBLIC Yase::agnostic_behavior_tree)
```
Integrate Yase into your project:
``` cmake
include(FetchContent)
FetchContent_Declare(
yase
GIT_REPOSITORY https://gitlab.eclipse.org/eclipse/simopenpass/yase.git
GIT_TAG main)
FetchContent_MakeAvailable(yase)
...
target_link_libraries(<target> PUBLIC Yase::agnostic_behavior_tree)
```
# ##############################################################################
# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
# ##############################################################################
project(AgnosticBehaviorTree)
add_subdirectory(src)
if(Yase_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(Yase_BUILD_DOCS)
add_subdirectory(doc)
endif()
if(Yase_INSTALL)
install(DIRECTORY include/ TYPE INCLUDE)
endif()
# ##############################################################################
# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
# ##############################################################################
find_package(Doxygen REQUIRED dot OPTIONAL_COMPONENTS mscgen dia)
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
set(DOXYGEN_DOT_IMAGE_FORMAT svg)
set(DOXYGEN_IMAGE_PATH ${CMAKE_CURRENT_LIST_DIR}/figures)
set(DOXYGEN_INTERACTIVE_SVG YES)
set(DOXYGEN_QUIET YES)
set(DOXYGEN_TAB_SIZE 2)
set(DOXYGEN_UML_LOOK YES)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)
doxygen_add_docs(
agnostic_behavior_tree_doc ${PROJECT_SOURCE_DIR}/README.md ${PROJECT_SOURCE_DIR}/include COMMENT "Generate html docs"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment