Commit 001843c8 authored by Reinhard Biegel's avatar Reinhard Biegel
Browse files

Merge branch '124-build-system-fixes' into 'develop'

Resolve "Build system fixes"

See merge request !78
parents ba0637d4 22981e9b
Pipeline #4598 passed with stage
in 0 seconds
......@@ -6,7 +6,6 @@ Thumbs.db
*.orig
*.rej
*.user
.qmake*
.directory
.vscode
DoxyGen/Function/doxy_build/*
......
################################################################################
# Copyright (c) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
# 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 OSI
# Find the OSI includes and library
# Find Package Adapter for OSI (Open Simulation Interface)
#
# OSI_INCLUDE_DIR - Where to find OSI includes
# OSI_LIBRARIES - List of libraries when using OSI
# OSI_FOUND - True if OSI was found
# Creates the follwoing imported targets (if available):
# - osi::shared
# - osi::static
# - osi::pic
IF(OSI_INCLUDE_DIR)
SET(OSI_FIND_QUIETLY TRUE)
ENDIF(OSI_INCLUDE_DIR)
FIND_PATH(OSI_INCLUDE_DIR "osi3/osi_version.pb.h"
PATHS
${PREFIX_PATH}
$ENV{OSI_HOME}/include
$ENV{EXTERNLIBS}/OSI/include
/usr/local/include
/usr/include
PATH_SUFFIXES include
DOC "OSI - Headers"
set(OSI_SHARED_NAMES
open_simulation_interface.lib
libopen_simulation_interface.dll.a
libopen_simulation_interface.so
)
SET(OSI_NAMES
osi3/open_simulation_interface.lib
osi3/libopen_simulation_interface.dll.a
osi3/libopen_simulation_interface_pic.lib
osi3/libopen_simulation_interface.so
set(OSI_STATIC_NAMES
open_simulation_interface_static.lib
libopen_simulation_interface_static.a
)
SET(OSI_DBG_NAMES
osi3/open_simulation_interfaced.lib
osi3/libopen_simulation_interfaced.dll.a
osi3/libopen_simulation_interface_picd.lib
set(OSI_PIC_NAMES
open_simulation_interface_pic.lib
libopen_simulation_interface_pic.a
)
FIND_LIBRARY(OSI_LIBRARY NAMES ${OSI_NAMES}
find_library(OSI_SHARED_LIBRARY NAMES ${OSI_SHARED_NAMES}
PATHS
${PREFIX_PATH}
$ENV{OSI_HOME}
$ENV{EXTERNLIBS}/OSI
/usr/local
/usr
PATH_SUFFIXES lib lib64
DOC "OSI - Library"
${PREFIX_PATH}
/usr/local
/usr
PATH_SUFFIXES
lib/osi3
lib
lib64
)
INCLUDE(FindPackageHandleStandardArgs)
find_library(OSI_STATIC_LIBRARY NAMES ${OSI_STATIC_NAMES}
PATHS
${PREFIX_PATH}
/usr/local
/usr
PATH_SUFFIXES
lib/osi3
lib
lib64
)
IF(MSVC)
# VisualStudio needs a debug version
FIND_LIBRARY(OSI_LIBRARY_DEBUG NAMES ${OSI_DBG_NAMES}
PATHS
find_library(OSI_PIC_LIBRARY NAMES ${OSI_PIC_NAMES}
PATHS
${PREFIX_PATH}
$ENV{OSI_HOME}/lib
$ENV{EXTERNLIBS}/OSI/lib
DOC "OSI - Library (Debug)"
)
/usr/local
/usr
PATH_SUFFIXES
lib/osi3
lib
lib64
)
if(OSI_SHARED_LIBRARY)
message(STATUS "Found OSI (shared): ${OSI_SHARED_LIBRARY}")
IF(OSI_LIBRARY_DEBUG AND OSI_LIBRARY)
SET(OSI_LIBRARIES optimized ${OSI_LIBRARY} debug ${OSI_LIBRARY_DEBUG})
ENDIF(OSI_LIBRARY_DEBUG AND OSI_LIBRARY)
get_filename_component(OSI_SHARED_LIBRARY_DIR "${OSI_SHARED_LIBRARY}" DIRECTORY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSI DEFAULT_MSG OSI_LIBRARY OSI_LIBRARY_DEBUG OSI_INCLUDE_DIR)
add_library(osi::shared IMPORTED SHARED)
set_target_properties(osi::shared
PROPERTIES
IMPORTED_LOCATION ${OSI_SHARED_LIBRARY}
IMPORTED_IMPLIB ${OSI_SHARED_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OSI_SHARED_LIBRARY_DIR}/../../include
INTERFACE_LINK_LIBRARIES protobuf::libprotobuf)
else()
message(STATUS "Didn't find OSI (shared)")
endif()
MARK_AS_ADVANCED(OSI_LIBRARY OSI_LIBRARY_DEBUG OSI_INCLUDE_DIR)
ELSE(MSVC)
# rest of the world
SET(OSI_LIBRARIES ${OSI_LIBRARY})
if(OSI_STATIC_LIBRARY)
message(STATUS "Found OSI (static): ${OSI_STATIC_LIBRARY}")
get_filename_component(OSI_STATIC_LIBRARY_DIR "${OSI_STATIC_LIBRARY}" DIRECTORY)
add_library(osi::static IMPORTED STATIC)
set_target_properties(osi::static
PROPERTIES
IMPORTED_LOCATION ${OSI_STATIC_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OSI_STATIC_LIBRARY_DIR}/../../include
INTERFACE_LINK_LIBRARIES protobuf::libprotobuf_static)
else()
message(STATUS "Didn't find OSI (static)")
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSI DEFAULT_MSG OSI_LIBRARY OSI_INCLUDE_DIR)
MARK_AS_ADVANCED(OSI_LIBRARY OSI_INCLUDE_DIR)
ENDIF(MSVC)
if(OSI_PIC_LIBRARY)
message(STATUS "Found OSI (pic): ${OSI_PIC_LIBRARY}")
get_filename_component(OSI_PIC_LIBRARY_DIR "${OSI_PIC_LIBRARY}" DIRECTORY)
add_library(osi::pic IMPORTED STATIC)
set_target_properties(osi::pic
PROPERTIES
IMPORTED_LOCATION ${OSI_PIC_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OSI_PIC_LIBRARY_DIR}/../../include
INTERFACE_LINK_LIBRARIES protobuf::libprotobuf_static)
else()
message(STATUS "Didn't find OSI (pic)")
endif()
unset(OSI_SHARED_LIBRARY)
unset(OSI_STATIC_LIBRARY)
unset(OSI_PIC_LIBRARY)
################################################################################
# Copyright (c) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# 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 adapter for protobuf
#
# Original protpbuf CMake Config file doesn't provide static targets.
#
# Creates the follwoing imported targets (if available):
# - protobuf::libprotobuf
# - protobuf::libprotobuf_static
set(PROTOBUF_SHARED_NAMES
protobuf.lib
libprotobuf.dll.a
libprotobuf.so
)
set(PROTOBUF_STATIC_NAMES
protobuf_static.lib
libprotobuf.a
)
find_library(PROTOBUF_SHARED_LIBRARY NAMES ${PROTOBUF_SHARED_NAMES}
PATHS
${PREFIX_PATH}
/usr/local
/usr
PATH_SUFFIXES
lib
lib64
)
find_library(PROTOBUF_STATIC_LIBRARY NAMES ${PROTOBUF_STATIC_NAMES}
PATHS
${PREFIX_PATH}
/usr/local
/usr
PATH_SUFFIXES
lib
lib64
)
if(PROTOBUF_SHARED_LIBRARY)
message(STATUS "Found protobuf (shared): ${PROTOBUF_SHARED_LIBRARY}")
get_filename_component(PROTOBUF_SHARED_LIBRARY_DIR "${PROTOBUF_SHARED_LIBRARY}" DIRECTORY)
add_library(protobuf::libprotobuf IMPORTED SHARED)
set_target_properties(protobuf::libprotobuf
PROPERTIES
IMPORTED_LOCATION ${PROTOBUF_SHARED_LIBRARY}
IMPORTED_IMPLIB ${PROTOBUF_SHARED_LIBRARY}
INTERFACE_COMPILE_DEFINITIONS PROTOBUF_USE_DLLS
INTERFACE_INCLUDE_DIRECTORIES ${PROTOBUF_SHARED_LIBRARY_DIR}/../include
INTERFACE_LINK_LIBRARIES pthread)
else()
message(STATUS "Didn't find protobuf (shared)")
endif()
if(PROTOBUF_STATIC_LIBRARY)
message(STATUS "Found protobuf (static): ${PROTOBUF_STATIC_LIBRARY}")
get_filename_component(PROTOBUF_STATIC_LIBRARY_DIR "${PROTOBUF_STATIC_LIBRARY}" DIRECTORY)
add_library(protobuf::libprotobuf_static IMPORTED STATIC)
set_target_properties(protobuf::libprotobuf_static
PROPERTIES
IMPORTED_LOCATION ${PROTOBUF_STATIC_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${PROTOBUF_STATIC_LIBRARY_DIR}/../include
INTERFACE_LINK_LIBRARIES pthread)
else()
message(STATUS "Didn't find protobuf (static)")
endif()
unset(PROTOBUF_SHARED_LIBRARY)
unset(PROTOBUF_STATIC_LIBRARY)
......@@ -81,7 +81,7 @@ endif()
# [INCDIRS <include-directories>]
# [LIBRARIES <libraries>]
# [UIS <qt_uis>]
# [LINKOSI])
# [LINKOSI [shared|static]]
# [LINKGUI]
# [FOLDER <category>]
# [COMPONENT <gui|sim|core|bin|module>])
......@@ -94,7 +94,7 @@ endif()
# [INCDIRS <include-directories>]
# [LIBRARIES <libraries>]
# [UIS <qt_uis>]
# [LINKOSI]
# [LINKOSI [shared|static]]
# [LINKGUI]
# [FOLDER <category>]
# [COMPONENT <gui|sim|core|bin|module>])
......@@ -106,7 +106,7 @@ endif()
# [INCDIRS <include-directories>]
# [LIBRARIES <libraries>]
# [UIS <qt_uis>]
# [LINKOSI]
# [LINKOSI [shared|static]]
# [LINKGUI]
# [DEFAULT_MAIN]
# [SIMCORE_DEPS <dependencies>]
......@@ -122,7 +122,7 @@ endif()
# UIS Qt UI files
# INCDIRS Additional include directories
# LIBRARIES Additional libraries to link
# LINKOSI Shortcut for adding OSI include directories and libraries (incl. protobuf)
# LINKOSI Shortcut for adding OSI include directories and libraries (incl. protobuf) as 'static' or 'shared' (default).
# LINKGUI Shortcut for adding GUI Libraries
# DEFAULT_MAIN Links a simple main() implementation for running GTest
# SIMCORE_DEPS Adds dependencies on simulation core targets to a test
......@@ -137,12 +137,13 @@ endif()
# - gtest/gmock/pthread libraries are linked
# - Tests are excluded form the 'all' target
# - If DEFAULT_MAIN argument is provided, adds '--default-xml' to test executable command line arguments
# - PATH and LD_LIBRARY_PATH are set under Windows and Linux, respectively, so that test executables can resolve run-time dependencies.
# - General:
# - Target properties PROJECT_LABEL and OUTPUT_NAME are set to the target's name
# - Target property DEBUG_POSTFIX is set to CMAKE_DEBUG_POSTFIX
##
function(add_openpass_target)
cmake_parse_arguments(PARSED_ARG "LINKGUI;LINKOSI;DEFAULT_MAIN" "NAME;TYPE;LINKAGE" "HEADERS;SOURCES;INCDIRS;LIBRARIES;UIS;SIMCORE_DEPS;RESOURCES;FOLDER;COMPONENT" ${ARGN})
cmake_parse_arguments(PARSED_ARG "LINKGUI;DEFAULT_MAIN" "NAME;TYPE;LINKAGE;LINKOSI" "HEADERS;SOURCES;INCDIRS;LIBRARIES;UIS;SIMCORE_DEPS;RESOURCES;FOLDER;COMPONENT" ${ARGN})
if(TARGET ${PARSED_ARG_NAME})
message(STATUS "Target '${PARSED_ARG_NAME}' already defined. Skipping.")
......@@ -183,10 +184,9 @@ function(add_openpass_target)
else()
install(TARGETS ${PARSED_ARG_NAME} LIBRARY DESTINATION "${DESTDIR}")
endif()
add_to_global_target_list(lib_target_list ${PARSED_ARG_NAME})
endif()
add_to_global_target_list(lib_target_list ${PARSED_ARG_NAME})
if(OPENPASS_ADJUST_OUTPUT)
openpass_adjust_output_dir(${PARSED_ARG_NAME} ${DESTDIR})
endif()
......@@ -275,16 +275,26 @@ function(add_openpass_target)
Boost::headers
)
if(${PARSED_ARG_LINKOSI})
target_include_directories(${PARSED_ARG_NAME} PRIVATE
${OSI_INCLUDE_DIR}
protobuf::libprotobuf
)
# LINKOSI handling
target_link_libraries(${PARSED_ARG_NAME}
${OSI_LIBRARIES}
protobuf::libprotobuf
)
# fallback to default if value is omitted
if("LINKOSI" IN_LIST PARSED_ARG_KEYWORDS_MISSING_VALUES)
set(PARSED_ARG_LINKOSI "shared")
endif()
if(DEFINED PARSED_ARG_LINKOSI)
# validate value
set(VALID_LINKOSI_VALUES "" "shared" "static")
if(NOT "${PARSED_ARG_LINKOSI}" IN_LIST VALID_LINKOSI_VALUES)
message(FATAL_ERROR "Invalid value for LINKOSI. Supported settings are '', 'shared' and 'static'")
endif()
# replace static with pic for library targets
if("${PARSED_ARG_TYPE}" STREQUAL "library" AND "${PARSED_ARG_LINKOSI}" STREQUAL "static")
set(PARSED_ARG_LINKOSI "pic")
endif()
target_link_libraries(${PARSED_ARG_NAME} osi::${PARSED_ARG_LINKOSI})
endif()
target_compile_options(${PARSED_ARG_NAME} PRIVATE
......@@ -306,12 +316,13 @@ function(add_openpass_target)
if(DEFINED PARSED_ARG_LIBRARIES)
list(APPEND DEPS ${PARSED_ARG_LIBRARIES})
endif()
if(${PARSED_ARG_LINKOSI})
list(APPEND DEPS "${OSI_LIBRARIES}" protobuf::libprotobuf)
if(DEFINED PARSED_ARG_LINKOSI)
list(APPEND DEPS osi::${PARSED_ARG_LINKOSI} protobuf::libprotobuf)
endif()
message(DEBUG "Locating shared library test dependencies...")
message(DEBUG "Locating shared library test dependencies for ${PARSED_ARG_NAME}")
foreach(DEP IN LISTS DEPS)
message(DEBUG "Locating ${DEP}...")
if(TARGET ${DEP})
set(DEP_PATH "")
message(DEBUG "Target dependency: ${DEP}")
......@@ -387,7 +398,15 @@ function(add_openpass_target)
list(APPEND DEP_PATHS "${DEP_PATH}")
endforeach()
list(REMOVE_DUPLICATES DEP_PATHS)
if(WIN32)
# try to move MSYS system folder to the end of the list
set(DEP_PATHS_NO_MSYS ${DEP_PATHS})
list(FILTER DEP_PATHS EXCLUDE REGEX "msys")
list(FILTER DEP_PATHS_MSYS INCLUDE REGEX "msys")
list(APPEND DEP_PATHS ${DEP_PATHS_MSYS})
list(JOIN DEP_PATHS "\\;" ADDITIONAL_PATHS)
set(CURRENT_PATH "$ENV{PATH}")
string(REGEX REPLACE "\;" "\\\;" CURRENT_PATH "${CURRENT_PATH}")
......
......@@ -79,7 +79,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(WITH_SIMCORE OR WITH_TESTS)
find_package(Protobuf REQUIRED)
add_compile_definitions(PROTOBUF_USE_DLLS)
find_package(OSI REQUIRED)
......
......@@ -67,7 +67,7 @@ As investigated recently, the ``C:\msys64\usr\bin``must also be added to the ``P
Either set environment variable through the ``Windows PowerShell``
.. code:: PowerShell
.. code:: shell
# check if set
echo ${env:path}
......
......@@ -190,7 +190,7 @@ WITH_GUI
.. note::
Please refer to :ref:`gui_user_guide` for information on the GUI.
Please refer to :ref:`gui_plugins` for information on the GUI.
WITH_TESTS
----------
......@@ -209,7 +209,7 @@ OPENPASS_ADJUST_OUTPUT
----------------------
- Adjusts if builds are executed in the (CMake default) folder ``build`` or directly in the specified install directory.
Latter mimics the former qmake behavior let you skip the call ``make install``.
Latter let you skip the call ``make install``.
- Options: **OFF** | ON
.. warning::
......
......@@ -54,8 +54,6 @@ Version (latest tested): 3.18.4
|Op| uses `CMake <https://cmake.org/>`_ for building and testing.
For details on the provided options, see :ref:`cmake`.
.. Note:: The former support for ``qmake`` is expiring and not documented anymore.
.. _prerequisites_ccache:
Ccache
......@@ -124,7 +122,7 @@ Information on Source Packages
The second and last set of dependencies we need to dissolve are based on source packages.
Since installing such source packages is not easy, we have dedicated a separate chapter on this topic.
See :ref:`Building prerequisites` for a step-by-step instruction on how to download, build and install needed source packages.
See :ref:`building_prerequisites` for a step-by-step instruction on how to download, build and install needed source packages.
Details on source packages:
......
......@@ -298,7 +298,7 @@ VisibilityAction is an optional attribute, which allows easy parameterization of
**Follow Route Action**
This action is defined here in the init part of the Storyboard. See :ref:`scenario_followfouteaction`
This action is defined here in the init part of the Storyboard. See :ref:`scenario_followrouteaction`
**Stochastic Values**
......
......@@ -14,7 +14,7 @@
Result Visualization
====================
.. image:: result_visualization/_static/images/timePlot/select.png
.. image:: result_visualization/_static/images/timeplot/select.png
.. toctree::
:glob:
......
################################################################################
# Copyright (c) 2020 ITK Engineering GmbH
# 2019 Volkswagen Group of America
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
#-----------------------------------------------------------------------------
# \file openPASS.pro
# \brief This file includes all the subdirectories storing the files for
# the QtCreator-project for the OpenPass Gui
#-----------------------------------------------------------------------------
TEMPLATE = subdirs
SUBDIRS = \
application/openPASS.pro \
plugins/component/openPASS-Component.pro \
plugins/window/openPASS-Window.pro \
plugins/project/openPASS-Project.pro \
plugins/statistics/openPASS-Statistics.pro \
plugins/timePlot/openPASS-TimePlot.pro \
plugins/pcmSimulation/openPASS-PCM.pro \
plugins/pcmEvaluation/openPASS-PCM_Eval.pro \
plugins/system/openPASS-System.pro \
#-----------------------------------------------------------------------------
# temporary excluded until compatiblity is established
#plugins/agentConfiguration/openPASS-AgentConfiguration.pro \
#plugins/trafficSimulation/openPASS-TrafficSimulation.pro \
################################################################################
# Copyright (c) 2019 Volkswagen Group of America
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
#-----------------------------------------------------------------------------
# \file openPASS.pri
# \brief This file includes the paths to all the interfaces that needs to be
# included for their methods
#-----------------------------------------------------------------------------/
include(openPASS/openPASS.pri)
################################################################################
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
#-----------------------------------------------------------------------------
# \file openPASS.pri
# \brief This file set the list of files including methodds eventually shared
# as an interface
#
#
# Copyright (c) 2017 Volkswagen Group of America.
#
# 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
#-----------------------------------------------------------------------------/
!contains(INCLUDEPATH, $$clean_path($$PWD/..)) {
INCLUDEPATH += $$clean_path($$PWD/..)
}
HEADERS += \
$$PWD/PluginInterface.h \
$$PWD/PluginManagerInterface.h \
$$PWD/RandomInterface.h \
$$PWD/ServiceInterface.h \
$$PWD/ServiceManagerInterface.h \
$$PWD/IOPluginInterface.h
################################################################################
# Copyright (c) 2019 Volkswagen Group of America
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
HEADERS += \
$$PWD/PluginManagerModel.h \
$$PWD/ServiceManagerModel.h
SOURCES += \
$$PWD/PluginManagerModel.cpp \
$$PWD/ServiceManagerModel.cpp
################################################################################
# Copyright (c) 2021 ITK Engineering GmbH
# 2019 Volkswagen Group of America
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
include(../../sim/global.pri)
TARGET = openPASS
TEMPLATE = app
CONFIG += c++17 no_keywords
QT += core gui widgets
VERSION = 0.7
QMAKE_TARGET_PRODUCT = openPASS
QMAKE_TARGET_DESCRIPTION = openPASS
QMAKE_TARGET_COMPANY = Volkswagen Group of America
QMAKE_TARGET_COPYRIGHT = Volkswagen Group of America
Release:DESTDIR = $${DESTDIR_GUI}
Debug:DESTDIR = $${DESTDIR_GUI}
DEFINES += APPLICATION_NAME=\\\"$$TARGET\\\"
DEFINES += APPLICATION_VERSION=\\\"$$VERSION\\\"
include(Interfaces/Interfaces.pri)
include(Models/Models.pri)
RC_ICONS += \
openPASS.ico
SOURCES += \
openPASS.cpp
......@@ -10,6 +10,8 @@
#include "Histogram.h"
#include <limits>
Histogram::Histogram(int numBins, const std::vector<double> &tableColumn, double minHisto,
double maxHisto) :
minHisto(minHisto), maxHisto(maxHisto)
......