Skip to content

Commit

Permalink
Merge pull request #2 from kmokstad/build-fmu
Browse files Browse the repository at this point in the history
Build FMU on Linux and Win
  • Loading branch information
kmokstad authored Oct 16, 2024
2 parents d389826 + 620cbf7 commit 756d480
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 192 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build_fmu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-FileCopyrightText: 2023 SAP SE
#
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of FEDEM - https://openfedem.org

name: Regression testing

on:
workflow_dispatch:

jobs:
build-linux:
name: Build FMU for Linux

runs-on: ubuntu-latest

steps:
- name: Silence some advice and hint
run: |
git config --global advice.detachedHead false
git config --global init.defaultBranch main
- name: Check out source repository
uses: actions/checkout@v4

- name: Configure main build
run: cmake -B ./build -DCMAKE_BUILD_TYPE=Release

- name: Build FMU library
run: cmake --build ./build --target fedem_fmu

build-linux:
name: Build FMU for Windows

runs-on: windows-latest

steps:
- name: Silence some advice and hint
run: |
git config --global advice.detachedHead false
git config --global init.defaultBranch main
- name: Check out source repository
uses: actions/checkout@v4

- name: Configure main build
run: cmake -B ./build -G "Visual Studio 17 2022"

- name: Build FMU library
run: cmake --build ./build --target fedem_fmu
32 changes: 32 additions & 0 deletions FMU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required ( VERSION 2.8...3.5 )
if ( POLICY CMP0076 )
cmake_policy ( SET CMP0076 NEW ) # convert relative target source path names
endif ( POLICY CMP0076 )

# Project setup

set ( APPLICATION_ID fedemFMU )
set ( DOMAIN_ID FEDEM )
set ( PACKAGE_ID SOLVERS )

project ( ${APPLICATION_ID} CXX )
message ( STATUS "Generating build project for ${PROJECT_SOURCE_DIR}" )
get_filename_component ( PARENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY )

find_path ( _MODULES FedemConfig.cmake
PATHS $ENV{CMAKE_MODULES}
"${PARENT_SOURCE_DIR}/fedem-foundation/cmake/Modules/"
)
if ( _MODULES )
message ( STATUS "NOTE : Using ${_MODULES}" )
list ( APPEND CMAKE_MODULE_PATH ${_MODULES} )
else ( _MODULES )
message ( STATUS "ERROR : Missing path to FedemConfig.cmake" )
message ( FATAL_ERROR "Set environment variable CMAKE_MODULES and try again" )
endif ( _MODULES )
unset ( _MODULES CACHE )

include ( FedemConfig )

add_custom_target ( all_solvers )
add_subdirectory ( ../src/FMU "${CMAKE_CURRENT_BINARY_DIR}/src" )
4 changes: 2 additions & 2 deletions src/FMU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ set ( UNIT_ID ${DOMAIN_ID}_${PACKAGE_ID}_${LIB_ID} )
message ( STATUS "INFORMATION : Processing unit ${UNIT_ID}" )

string ( APPEND CMAKE_CXX_FLAGS_DEBUG " -DFMU_DEBUG" )
if ( FTENV_WARNINGS AND LINUX AND NOT USE_INTEL_FORTRAN )
if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU )
string ( APPEND CMAKE_CXX_FLAGS " -Wno-unused-parameter" )
endif ( FTENV_WARNINGS AND LINUX AND NOT USE_INTEL_FORTRAN )
endif ( ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU )

# Build and install

Expand Down
Loading

0 comments on commit 756d480

Please sign in to comment.