Skip to content

Commit

Permalink
Feature/300 split c cpp (#571)
Browse files Browse the repository at this point in the history
* Removed all C code from repo.

* Moved sources up one level

* Moved tests up one level

* Renamed all occurrences of CSECORE_ to LIBCOSIM_

* Renamed namespace from cse to cosim

* Renamed csexsdembedder to osp-xsd-embedder

* Renamed cse_config_parser to osp_config_parser

* Renamed cse folder to cosim

* Clang format

* Typo

* Rename cse_config_parser class to osp_config_parser

* Renamed cse:: to cosim::

* Embedder to return osp_config_xsd

* Rename CSE_ to COSIM_

* Temp folders to be prefixed with libcosim_

* Renaming cse to libcosim

* Renamed csecorecpp to cosim

* Namespace ending

* Rename cse-core in Jenkinsfile

* Rename Conan package to libcosim

* Rename doxygen project name

* Fixup cleanup script

* Rename CSE -> libcosim

* Do not record fingerprints. Not uesed anyway

* Use ${publicHeadersFull} to install public headers.

* Use ${publicHeaders} to install public headers.

* Fix install public headers.

* Adding build with GitHub Actions

* Adding build with GitHub Actions

* 'auto' seems to not work with GitHub Actions

* Temporarily add build and upload of libevent for previously non-built config.

* Temporarily add build and upload for previously non-built packages.

* Packages uploaded, revert to not building any dependencies.

* GitHub Windows runners seems to struggle with long paths.

* Debugging
  • Loading branch information
Halvor Platou authored May 12, 2020
1 parent 0773ed0 commit 8232cac
Show file tree
Hide file tree
Showing 217 changed files with 2,196 additions and 6,410 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ BraceWrapping:
AfterClass: true
SplitEmptyFunction: false
AfterFunction: true
AfterNamespace : true
AfterNamespace: true
AfterControlStatement: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"]cse[/.]'
- Regex: '^[<"]cosim[/.]'
Priority: 20
- Regex: '^[<"](boost|event2|fmilib|gsl|nlohmann|xercesc|zip)[/.]'
Priority: 30
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/ci-conan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: libcosim CI Conan

# This workflow is triggered on pushes to the repository.
on: [push]

env:
CONAN_LOGIN_USERNAME_OSP: ${{ secrets.osp_conan_usr }}
CONAN_PASSWORD_OSP: ${{ secrets.osp_conan_pwd }}
CONAN_REVISIONS_ENABLED: 1
CONAN_NON_INTERACTIVE: True

jobs:
conan-on-linux:
name: Conan
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04]
build_type: [Debug, Release]
compiler_version: [7]
compiler_libcxx: [libstdc++11]
option_fmuproxy: ['fmuproxy=True', 'fmuproxy=False']

steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
sudo pip3 install --upgrade setuptools pip
sudo pip3 install conan
sudo apt-get install -y doxygen
- name: Configure Conan
run: conan remote add osp https://osp-conan.azurewebsites.net/artifactory/api/conan/public --force
- name: Conan create
run: |
BRANCH=${GITHUB_REF#refs/heads/}
SHORT_BRANCH=${BRANCH:0:50}
CHANNEL=${SHORT_BRANCH//\//_}
conan create -s build_type=${{ matrix.build_type }} -s compiler.version=${{ matrix.compiler_version }} -s compiler.libcxx=${{ matrix.compiler_libcxx }} -o ${{ matrix.option_fmuproxy }} . osp/${CHANNEL}
- name: Conan upload
run: |
conan upload --all -c -r osp 'libcosim*'
conan-on-windows:
name: Conan
runs-on: ${{ matrix.os }}
env:
CONAN_USER_HOME_SHORT: C:\c
CONAN_USE_ALWAYS_SHORT_PATHS: 1
strategy:
fail-fast: false
matrix:
os: [windows-2016]
build_type: [Debug, Release]
compiler_version: [15]
option_fmuproxy: ['fmuproxy=True', 'fmuproxy=False']

exclude:
- os: windows-2016
build_type: Debug
option_fmuproxy: 'fmuproxy=True'

steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
pip3 install --upgrade setuptools pip
pip3 install conan
choco install doxygen.install
- name: Configure Conan
run: conan remote add osp https://osp-conan.azurewebsites.net/artifactory/api/conan/public --force
- name: Conan create
shell: bash
run: |
BRANCH=${GITHUB_REF#refs/heads/}
SHORT_BRANCH=${BRANCH:0:50}
CHANNEL=${SHORT_BRANCH//\//_}
conan create -s build_type=${{ matrix.build_type }} -s compiler.version=${{ matrix.compiler_version }} -o ${{ matrix.option_fmuproxy }} . osp/${CHANNEL}
- name: Conan upload
run: conan upload --all -c -r osp 'libcosim*'
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

##### Fixed
* `cse_local_slave_create` is broken when adding more than one instance of the same FMU ([#381](https://github.com/open-simulation-platform/cse-core/issues/381))
* Memory error when moving a cse::uri ([#361](https://github.com/open-simulation-platform/cse-core/issues/361))
* Memory error when moving a cosim::uri ([#361](https://github.com/open-simulation-platform/cse-core/issues/361))
* Cryptic error message with ill-defined or missing osp:FixedStepMaster in SSP ([#338](https://github.com/open-simulation-platform/cse-core/issues/338))
* Invalid connections in SSP are not properly handled ([#336](https://github.com/open-simulation-platform/cse-core/issues/336))
* Cannot use "." as file_observer output directory ([#310](https://github.com/open-simulation-platform/cse-core/issues/310))
Expand Down
85 changes: 40 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
cmake_minimum_required(VERSION 3.9)
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" projectVersion)
project("csecore" VERSION ${projectVersion})
message("Current cse-core version: ${CMAKE_PROJECT_VERSION}\n")
project("libcosim" VERSION ${projectVersion})
message("Current libcosim version: ${CMAKE_PROJECT_VERSION}\n")

# ==============================================================================
# Build settings
# ==============================================================================

option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)
option(CSECORE_TREAT_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
option(CSECORE_BUILD_TESTS "Build test suite" ON)
option(CSECORE_BUILD_PRIVATE_APIDOC "Build private API documentation" OFF)
option(CSECORE_STANDALONE_INSTALLATION "Whether to build for a standalone installation (Linux only; sets a relative RPATH)" OFF)
option(CSECORE_USING_CONAN "Whether Conan is used for package management" OFF)
option(CSECORE_WITH_FMUPROXY "Whether or not to build with fmuproxy integration" OFF)
option(CSECORE_TEST_FMUPROXY "Whether or not to run fmuproxy tests (only if CSECORE_WITH_FMUPROXY=ON)" ON)
option(LIBCOSIM_TREAT_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
option(LIBCOSIM_BUILD_TESTS "Build test suite" ON)
option(LIBCOSIM_BUILD_PRIVATE_APIDOC "Build private API documentation" OFF)
option(LIBCOSIM_STANDALONE_INSTALLATION "Whether to build for a standalone installation (Linux only; sets a relative RPATH)" OFF)
option(LIBCOSIM_USING_CONAN "Whether Conan is used for package management" OFF)
option(LIBCOSIM_WITH_FMUPROXY "Whether or not to build with fmuproxy integration" OFF)
option(LIBCOSIM_TEST_FMUPROXY "Whether or not to run fmuproxy tests (only if LIBCOSIM_WITH_FMUPROXY=ON)" ON)

# ==============================================================================
# Global internal configuration
Expand Down Expand Up @@ -50,20 +50,19 @@ endforeach()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options("-Wall" "-Wextra" "-Wpedantic")
add_compile_options("-Wno-parentheses")
if(CSECORE_TREAT_WARNINGS_AS_ERRORS)
if(LIBCOSIM_TREAT_WARNINGS_AS_ERRORS)
add_compile_options("-Werror")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options("/W4")
if(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
if(CMAKE_GENERATOR MATCHES "NMake Makefiles.*")
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif()
add_compile_options("/wd4996")
if(CSECORE_TREAT_WARNINGS_AS_ERRORS)
if(LIBCOSIM_TREAT_WARNINGS_AS_ERRORS)
add_compile_options("/WX")
endif()
if(CSECORE_USING_CONAN)
if(LIBCOSIM_USING_CONAN)
# C4251: 'identifier' : class 'type' needs to have dll-interface to be
# used by clients of class 'type2'
#
Expand All @@ -84,26 +83,26 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Prepare for export and installation.
set(CSECORE_HEADER_INSTALL_DIR "include")
set(LIBCOSIM_HEADER_INSTALL_DIR "include")
if(WIN32)
set(CSECORE_CMAKE_INSTALL_DIR "cmake")
set(CSECORE_DOC_INSTALL_DIR "doc")
set(LIBCOSIM_CMAKE_INSTALL_DIR "cmake")
set(LIBCOSIM_DOC_INSTALL_DIR "doc")
else()
set(CSECORE_CMAKE_INSTALL_DIR "share/${PROJECT_NAME}/cmake")
set(CSECORE_DOC_INSTALL_DIR "share/doc/${PROJECT_NAME}")
set(LIBCOSIM_CMAKE_INSTALL_DIR "share/${PROJECT_NAME}/cmake")
set(LIBCOSIM_DOC_INSTALL_DIR "share/doc/${PROJECT_NAME}")
endif()
set(CSECORE_INSTALL_DESTINATIONS
set(LIBCOSIM_INSTALL_DESTINATIONS
ARCHIVE DESTINATION "lib"
LIBRARY DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${CSECORE_HEADER_INSTALL_DIR}")
set(CSECORE_EXPORT_TARGET "${PROJECT_NAME}-targets")
INCLUDES DESTINATION "${LIBCOSIM_HEADER_INSTALL_DIR}")
set(LIBCOSIM_EXPORT_TARGET "${PROJECT_NAME}-targets")

# ==============================================================================
# Dependencies
# ==============================================================================

if(CSECORE_USING_CONAN)
if(LIBCOSIM_USING_CONAN)
if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup(NO_OUTPUT_DIRS)
Expand All @@ -113,7 +112,7 @@ if(CSECORE_USING_CONAN)
endif()

set(Boost_components date_time fiber filesystem log)
if (CSECORE_BUILD_TESTS)
if (LIBCOSIM_BUILD_TESTS)
list(APPEND Boost_components timer unit_test_framework)
endif()

Expand All @@ -123,21 +122,19 @@ find_package(FMILibrary REQUIRED)
find_package(LIBZIP REQUIRED)
find_package(YAML_CPP REQUIRED)
find_package(XercesC REQUIRED)
if(CSECORE_WITH_FMUPROXY)
if(LIBCOSIM_WITH_FMUPROXY)
find_package(THRIFT REQUIRED)
endif()

# ==============================================================================
# Targets
# ==============================================================================

add_subdirectory("src/cpp")
add_subdirectory("src/c")
add_subdirectory("tools/cse_xsd_embedder")
if(CSECORE_BUILD_TESTS)
add_subdirectory("src")
add_subdirectory("tools/osp-xsd-embedder")
if(LIBCOSIM_BUILD_TESTS)
enable_testing()
add_subdirectory("test/cpp")
add_subdirectory("test/c")
add_subdirectory("tests")
endif()

# ==============================================================================
Expand All @@ -147,8 +144,8 @@ endif()
find_package(Doxygen)
if(DOXYGEN_FOUND)
message("Found Doxygen, API documentation will be built.")
set(DOXYGEN_PROJECT_NAME "CSE core")
set(DOXYGEN_PROJECT_BRIEF "C/C++ library for distributed co-simulation")
set(DOXYGEN_PROJECT_NAME "libcosim")
set(DOXYGEN_PROJECT_BRIEF "C++ library for distributed co-simulation")
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output/doc")
set(DOXYGEN_GENERATE_LATEX "NO")
set(DOXYGEN_RECURSIVE "YES")
Expand All @@ -161,14 +158,12 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_MULTILINE_CPP_IS_BRIEF "YES")
set(DOXYGEN_EXCLUDE_PATTERNS "*.cpp" "*.c" "*/fmuproxy/*service*")
set(doxygenInputs "${CMAKE_SOURCE_DIR}/include")
if(CSECORE_BUILD_PRIVATE_APIDOC)
if(LIBCOSIM_BUILD_PRIVATE_APIDOC)
list(APPEND doxygenInputs
"${CMAKE_SOURCE_DIR}/src/cpp"
"${CMAKE_SOURCE_DIR}/src/c"
)
list(APPEND DOXYGEN_STRIP_FROM_INC_PATH
"${CMAKE_SOURCE_DIR}/src/cpp"
"${CMAKE_SOURCE_DIR}/src/c"
)
list(APPEND DOXYGEN_STRIP_FROM_PATH "${CMAKE_SOURCE_DIR}")
endif()
Expand All @@ -177,7 +172,7 @@ if(DOXYGEN_FOUND)
install-doc
"${CMAKE_COMMAND}" "-E" "copy_directory"
"${DOXYGEN_OUTPUT_DIRECTORY}"
"${CMAKE_INSTALL_PREFIX}/${CSECORE_DOC_INSTALL_DIR}/"
"${CMAKE_INSTALL_PREFIX}/${LIBCOSIM_DOC_INSTALL_DIR}/"
DEPENDS doc
)
else()
Expand All @@ -190,34 +185,34 @@ endif()

install(
FILES "README.md" "LICENCE.txt"
DESTINATION "${CSECORE_DOC_INSTALL_DIR}"
DESTINATION "${LIBCOSIM_DOC_INSTALL_DIR}"
)
install(
EXPORT "${CSECORE_EXPORT_TARGET}"
DESTINATION "${CSECORE_CMAKE_INSTALL_DIR}"
EXPORT "${LIBCOSIM_EXPORT_TARGET}"
DESTINATION "${LIBCOSIM_CMAKE_INSTALL_DIR}"
NAMESPACE "${PROJECT_NAME}::"
)

include(CMakePackageConfigHelpers)

# Generate and install package-config file.
set(configFile "${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.cmake")
set(targetsFile "${CSECORE_CMAKE_INSTALL_DIR}/${CSECORE_EXPORT_TARGET}.cmake")
set(targetsFile "${LIBCOSIM_CMAKE_INSTALL_DIR}/${LIBCOSIM_EXPORT_TARGET}.cmake")
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/project-config.cmake.in"
"${configFile}"
INSTALL_DESTINATION "${CSECORE_CMAKE_INSTALL_DIR}"
INSTALL_DESTINATION "${LIBCOSIM_CMAKE_INSTALL_DIR}"
PATH_VARS targetsFile
)
install(FILES "${configFile}" DESTINATION "${CSECORE_CMAKE_INSTALL_DIR}")
install(FILES "${configFile}" DESTINATION "${LIBCOSIM_CMAKE_INSTALL_DIR}")

# Generate and install package-version file
set(versionFile "${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake")
write_basic_package_version_file(
"${versionFile}"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY "SameMajorVersion")
install(FILES "${versionFile}" DESTINATION "${CSECORE_CMAKE_INSTALL_DIR}")
install(FILES "${versionFile}" DESTINATION "${LIBCOSIM_CMAKE_INSTALL_DIR}")

# Install custom find modules
install(FILES
Expand All @@ -227,5 +222,5 @@ install(FILES
"${CMAKE_SOURCE_DIR}/cmake/FindTHRIFT.cmake"
"${CMAKE_SOURCE_DIR}/cmake/FindYAML_CPP.cmake"
DESTINATION
"${CSECORE_CMAKE_INSTALL_DIR}"
"${LIBCOSIM_CMAKE_INSTALL_DIR}"
)
Loading

0 comments on commit 8232cac

Please sign in to comment.