-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With support for CAN Networks in FMI2 using FMI Strings. Co-authored-by: Jannik Smidt (CC/EMT3) <[email protected]>
- Loading branch information
1 parent
48e4ade
commit 86c63a2
Showing
43 changed files
with
3,599 additions
and
305 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# Copyright 2024 Robert Bosch GmbH | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.21) | ||
|
||
# set(CMAKE_VERBOSE_MAKEFILE ON) | ||
set(VERSION "$ENV{PACKAGE_VERSION}") | ||
|
||
project(Fmi | ||
VERSION ${VERSION} | ||
DESCRIPTION "Dynamic Simulation Environment - FMI Library" | ||
HOMEPAGE_URL "$ENV{PROJECT_URL}" | ||
) | ||
|
||
include(GNUInstallDirs) | ||
include(FetchContent) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/_out) | ||
set(CMAKE_C_STANDARD 99) | ||
set(CMAKE_C_STANDARD_REQUIRED TRUE) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_C_FLAGS_DEBUG "-g -ggdb") | ||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O3") | ||
list(APPEND C_CXX_WARNING_FLAGS | ||
-Wall | ||
-W | ||
-Wwrite-strings | ||
-Wno-missing-field-initializers | ||
-Wno-misleading-indentation | ||
) | ||
add_compile_options(${C_CXX_WARNING_FLAGS}) | ||
add_compile_definitions(DLL_BUILD) | ||
set(CMAKE_SHARED_LIBRARY_PREFIX "") | ||
|
||
|
||
# External Project - DSE C Lib | ||
# ---------------------------- | ||
FetchContent_Declare(dse_clib | ||
URL ${ExternalProject__CLIB__URL} | ||
HTTP_USERNAME ${ExternalProject__CLIB__USERNAME} | ||
HTTP_PASSWORD ${ExternalProject__CLIB__PASSWORD} | ||
SOURCE_DIR "$ENV{EXTERNAL_BUILD_DIR}/dse.clib" | ||
) | ||
FetchContent_MakeAvailable(dse_clib) | ||
set(DSE_CLIB_SOURCE_DIR ${dse_clib_SOURCE_DIR}/dse) | ||
set(DSE_CLIB_INCLUDE_DIR "${DSE_CLIB_SOURCE_DIR}/..") | ||
|
||
|
||
# External Project - DSE ModelC | ||
# ----------------------------- | ||
FetchContent_Declare(dse_modelc | ||
URL ${ExternalProject__MODELC__URL} | ||
HTTP_USERNAME ${ExternalProject__MODELC__USERNAME} | ||
HTTP_PASSWORD ${ExternalProject__MODELC__PASSWORD} | ||
SOURCE_DIR "$ENV{EXTERNAL_BUILD_DIR}/dse.modelc" | ||
) | ||
FetchContent_MakeAvailable(dse_modelc) | ||
set(DSE_MODELC_SOURCE_DIR ${dse_modelc_SOURCE_DIR}/dse/modelc) | ||
|
||
|
||
# External Project - DSE ModelC LIB | ||
# --------------------------------- | ||
FetchContent_Declare(dse_modelc_lib | ||
URL ${ExternalProject__MODELC_LIB__URL} | ||
HTTP_USERNAME ${ExternalProject__MODELC_LIB__USERNAME} | ||
HTTP_PASSWORD ${ExternalProject__MODELC_LIB__PASSWORD} | ||
SOURCE_DIR "$ENV{EXTERNAL_BUILD_DIR}/dse.modelc.lib" | ||
) | ||
FetchContent_MakeAvailable(dse_modelc_lib) | ||
set(DSE_MODELC_INCLUDE_DIR "${dse_modelc_lib_SOURCE_DIR}/include") | ||
|
||
|
||
# External Project - yaml | ||
# ----------------------- | ||
set(YAML_SOURCE_DIR "$ENV{EXTERNAL_BUILD_DIR}/yaml") | ||
set(YAML_BINARY_DIR "$ENV{EXTERNAL_BUILD_DIR}/yaml") | ||
find_library(YAML_LIB | ||
NAMES | ||
libyaml.a | ||
PATHS | ||
${YAML_BINARY_DIR} | ||
REQUIRED | ||
NO_DEFAULT_PATH | ||
) | ||
add_library(yaml STATIC IMPORTED GLOBAL) | ||
set_target_properties(yaml | ||
PROPERTIES | ||
IMPORTED_LOCATION "${YAML_LIB}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${YAML_BINARY_DIR}" | ||
) | ||
|
||
|
||
# External Project - dlfcn-win32 | ||
# ------------------------------ | ||
if(WIN32) | ||
set(DLFCNWIN32_SOURCE_DIR "$ENV{EXTERNAL_BUILD_DIR}/dlfcnwin32/src") | ||
set(DLFCNWIN32_BINARY_DIR "$ENV{EXTERNAL_BUILD_DIR}/dlfcnwin32-build/lib") | ||
find_library(DLFCNWIN32_LIB | ||
NAMES | ||
libdl.a | ||
PATHS | ||
${DLFCNWIN32_BINARY_DIR} | ||
REQUIRED | ||
NO_DEFAULT_PATH | ||
) | ||
add_library(dl STATIC IMPORTED GLOBAL) | ||
set_target_properties(dl | ||
PROPERTIES | ||
IMPORTED_LOCATION "${DLFCNWIN32_LIB}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${DLFCNWIN32_SOURCE_DIR}" | ||
) | ||
endif() | ||
|
||
|
||
|
||
# Sub Modules | ||
# =========== | ||
add_subdirectory(fmimcl) | ||
add_subdirectory(fmimodelc) | ||
|
||
|
||
|
||
# Common Targets | ||
# ============== | ||
install( | ||
DIRECTORY | ||
../licenses | ||
DESTINATION | ||
licenses | ||
) | ||
install( | ||
FILES | ||
${CMAKE_BINARY_DIR}/compile_commands.json | ||
DESTINATION | ||
doc | ||
) |
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,56 @@ | ||
# Copyright 2024 Robert Bosch GmbH | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
export NAMESPACE = dse | ||
export MODULE = fmi | ||
export SUBMODULES = fmimcl | ||
export EXTERNAL_BUILD_DIR ?= /tmp/$(NAMESPACE).$(MODULE) | ||
export REPO_MIRRORS ?= $(shell pwd -P)/../repo_mirrors.cmake | ||
export PACKAGE_ARCH ?= linux-amd64 | ||
export CMAKE_TOOLCHAIN_FILE ?= $(shell pwd -P)/../extra/cmake/$(PACKAGE_ARCH).cmake | ||
export PROJECT_URL ?= https://github.com/boschglobal/$(NAMESPACE).fmi.git | ||
export PACKAGE_VERSION ?= 0.0.2 | ||
|
||
|
||
default: build | ||
|
||
external: | ||
$(MAKE) -C ../extra/external | ||
|
||
build: external | ||
# Build from scratch if no build dir. | ||
if [ ! -d "build" ]; then \ | ||
mkdir -p build; \ | ||
cd build; \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) .. ; \ | ||
fi | ||
# Build incremental. | ||
cd build; make | ||
cd build; make install | ||
@echo "" | ||
@echo "Sandbox files: - $$(pwd)/build/_out" | ||
@echo "--------------" | ||
@find build/_out/ -type f -name '*' -exec ls -sh --color=auto {} \; | ||
|
||
package: | ||
@echo "Package parameters:" | ||
@echo "-------------------" | ||
@echo "NAMESPACE : $(NAMESPACE)" | ||
@echo "MODULE : $(MODULE)" | ||
@echo "VERSION : $(PACKAGE_VERSION)" | ||
@echo "ARCH : $(PACKAGE_ARCH)" | ||
cd build; make package | ||
@echo "" | ||
@echo "Package files: - $$(pwd)/build/_dist" | ||
@echo "--------------" | ||
@find build/_dist/ -type f -name '*' -exec ls -sh --color=auto {} \; | ||
|
||
clean: | ||
$(MAKE) -C ../extra/external clean | ||
rm -rf build | ||
|
||
cleanall: clean | ||
$(MAKE) -C ../extra/external cleanall | ||
|
||
.PHONY: default build external package clean cleanall |
Oops, something went wrong.