Skip to content

Commit

Permalink
Update cmake configuration (#1247)
Browse files Browse the repository at this point in the history
* Update cmake configuration

* Add -DOM_OMS_ENABLE_TESTSUITE:BOOL=ON
  • Loading branch information
lochel committed Aug 24, 2023
1 parent 793f840 commit fd3e750
Show file tree
Hide file tree
Showing 43 changed files with 62 additions and 51 deletions.
2 changes: 1 addition & 1 deletion 3rdParty
Submodule 3rdParty updated 1 files
+1 −1 CMakeLists.txt
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ set(CXX_STANDARD_REQUIRED ON)
## Make sure we do not start relying on extensions down the road.
set(CMAKE_CXX_EXTENSIONS OFF)

## If OMSimulator is being built standalone (not as part of OpenModelica)
## If OMSimulator is not being built as part of OpenModelica
## include the required settings here.
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
set(OMSIMULATOR_STANDALONE ON)
if(NOT OPENMODELICA_SUPERPROJECT)
include(OMSimulatorTopLevelSettings)
else()
set(OMSIMULATOR_STANDALONE OFF)
endif()


Expand Down Expand Up @@ -57,18 +54,23 @@ add_subdirectory(3rdParty)

##########################
# Add project modules
add_subdirectory(include)
add_subdirectory(src/OMSimulatorLib)
add_subdirectory(src/OMSimulator)
add_subdirectory(src/OMSimulatorLua)
add_subdirectory(src/OMSimulatorPython)
add_subdirectory(src/OMSimulatorServer)
add_subdirectory(src/pip)

option(OM_OMS_ENABLE_PIP "create the OMSimulator pip package" OFF)
if(OM_OMS_ENABLE_PIP)
add_subdirectory(src/pip)
endif()

add_subdirectory(doc)

## Add the testsuite directory (which adds the target testsuite-depends which in turn depends
## on omc-diff and testssuite-resources) only if OMSimulator is being used standalone.
if(OMSIMULATOR_STANDALONE)
option(OM_OMS_ENABLE_TESTSUITE "enable the OMSimulator testsuite" OFF)
if(OM_OMS_ENABLE_TESTSUITE)
add_subdirectory(testsuite)
endif()

6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ zip -r "../OMSimulator-win64-`git describe --tags --abbrev=7 --match=v*.* --excl
retry(2) { bat """
set PATH=C:\\bin\\cmake\\bin;%PATH%
cmake -S . -B build/ -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/
cmake -S . -B build/ -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/ -DOM_OMS_ENABLE_TESTSUITE:BOOL=ON
IF NOT ["%ERRORLEVEL%"]==["0"] GOTO fail
cmake --build build/ --config Release --parallel %NUMBER_OF_PROCESSORS% --target install -v
Expand Down Expand Up @@ -696,7 +696,7 @@ void buildOMS() {
echo export MAKETHREADS=-j%NUMBER_OF_PROCESSORS%
echo set -ex
echo git fetch --tags
echo cmake -S . -B build/ -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/
echo cmake -S . -B build/ -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/ -DOM_OMS_ENABLE_TESTSUITE:BOOL=ON
echo cmake --build build/ --parallel %NUMBER_OF_PROCESSORS% --target install -v
) > buildOMSimulatorWindows.sh
Expand All @@ -708,7 +708,7 @@ void buildOMS() {
echo "running on node: ${env.NODE_NAME}"
def nproc = numPhysicalCPU()
sh "git fetch --tags"
sh "cmake -S . -B build/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/"
sh "cmake -S . -B build/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install/ -DOM_OMS_ENABLE_TESTSUITE:BOOL=ON"
sh "cmake --build build/ --parallel ${nproc} --target install -v"
}
}
Expand Down
2 changes: 1 addition & 1 deletion config.cmake/OMSimulatorTopLevelSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ set(CMAKE_INSTALL_MESSAGE LAZY)
# Don't allow in-source build
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "No in-source builds supported. Change to 'build' sub-directory and do 'cmake ..'.")
endif()
endif()
8 changes: 8 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
add_library(OMSimulatorInclude INTERFACE)

target_include_directories(OMSimulatorInclude
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})

add_library(oms::public_includes ALIAS OMSimulatorInclude)
install(DIRECTORY OMSimulator TYPE INCLUDE)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMSIMULATOR_H_
#define _OMSIMULATOR_H_

#include "Types.h"
#include "OMSimulator/Types.h"

/* define OMSimulatorLib_EXPORTS *only* when building the DLL */
#if defined(OMS_STATIC)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/OMSimulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
*/

#include <OMSimulator.h>
#include "OMSimulator/OMSimulator.h"
#include <string>

int main(int argc, char *argv[])
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/AlgLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <string>
#include <vector>
#include "Types.h"
#include "OMSimulator/Types.h"
#include "DirectedGraph.h"

#include <kinsol/kinsol.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/BusConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#include "ComRef.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Connector.h"
#include "ssd/ConnectorGeometry.h"

Expand Down
3 changes: 2 additions & 1 deletion src/OMSimulatorLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ target_include_directories(OMSimulatorLib

target_link_libraries(OMSimulatorLib
PUBLIC
oms::public_includes
oms::3rd::kinsol
oms::3rd::cvode
oms::3rd::fmi4c
Expand Down Expand Up @@ -114,6 +115,7 @@ target_include_directories(OMSimulatorLib_static

target_link_libraries(OMSimulatorLib_static
PUBLIC
oms::public_includes
oms::3rd::kinsol
oms::3rd::cvode
oms::3rd::fmi4c
Expand All @@ -134,4 +136,3 @@ endif()

install(TARGETS OMSimulatorLib)
install(TARGETS OMSimulatorLib_static)
install(FILES OMSimulator.h Types.h TYPE INCLUDE)
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "ResultWriter.h"
#include "SignalDerivative.h"
#include "Snapshot.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Values.h"

#include <fmi4c.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "ComRef.h"
#include "Connector.h"
#include "ssd/ConnectionGeometry.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "ComRef.h"
#include "ssd/ConnectorGeometry.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <string>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#if !defined(NO_TLM)
#include "TLMBusConnector.h"
#endif
#include "Types.h"
#include "OMSimulator/Types.h"

namespace oms
{
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/ExternalModelInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMS_EXTERNAL_MODEL_INFO_H_
#define _OMS_EXTERNAL_MODEL_INFO_H_

#include "Types.h"
#include "OMSimulator/Types.h"

#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/FMUInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMS_FMU_INFO_H_
#define _OMS_FMU_INFO_H_

#include "Types.h"
#include "OMSimulator/Types.h"

#include <string>
#include <fmi4c.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "ComRef.h"
#include "Logging.h"
#include "Model.h"
#include "OMSimulator.h"
#include "OMSimulator/OMSimulator.h"
#include "Scope.h"
#include "System.h"
#include "Util.h"
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMS_FLAGS_H_
#define _OMS_FLAGS_H_

#include "Types.h"
#include "OMSimulator/Types.h"
#include <string>
#include <vector>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "Logging.h"
#include "Version.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <cstring>
#include <ctime>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMS_LOGGING_H_
#define _OMS_LOGGING_H_

#include "Types.h"
#include "OMSimulator/Types.h"

#include <string>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "ComRef.h"
#include "Element.h"
#include "ResultWriter.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Snapshot.h"
#include "Values.h"
#include <assert.h>
Expand Down
4 changes: 2 additions & 2 deletions src/OMSimulatorLib/OMSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
*/

#include "OMSimulator.h"
#include "OMSimulator/OMSimulator.h"

#include "Component.h"
#include "ComRef.h"
Expand All @@ -52,7 +52,7 @@
#include "TLMBusConnector.h"
#include "ExternalModel.h"
#endif
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Version.h"

#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "ComRef.h"
#include "Model.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <map>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/SignalDerivative.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _OMS_SIGNAL_DERIVATIVE_H_
#define _OMS_SIGNAL_DERIVATIVE_H_

#include "Types.h"
#include "OMSimulator/Types.h"
#include <fmi4c.h>
#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "ComRef.h"
#include "OMSFileSystem.h"
#include "ssd/Tags.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <pugixml.hpp>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/StepSizeConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _OMS_STEP_SIZE_CONFIGURATION_H_

#include "ComRef.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include <vector>

namespace oms
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#if !defined(NO_TLM)
#include "TLMBusConnector.h"
#endif
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Values.h"

#include <map>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/SystemSC.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "ComRef.h"
#include "System.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <cvode/cvode.h> /* prototypes for CVODE fcts., consts. */
#include <nvector/nvector_serial.h> /* serial N_Vector types, fcts., macros */
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/SystemWC.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "SignalDerivative.h"
#include "StepSizeConfiguration.h"
#include "System.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/TLM/ExternalModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "Logging.h"
#include "Element.h"
#include "ExternalModelInfo.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "ssd/Tags.h"

#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/TLM/ExternalModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "Option.h"
#include "ResultWriter.h"
#include "Snapshot.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Variable.h"
#include <vector>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/TLM/SystemTLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "OMTLMSimulatorLib/OMTLMSimulatorLib.h"
#include "ssd/Tags.h"
#include "SystemWC.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <thread>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/TLM/SystemTLM.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "ComRef.h"
#include "System.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "../../OMTLMSimulator/common/Plugin/PluginImplementer.h"

namespace oms
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/TLM/TLMBusConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#include "ComRef.h"
#include "Types.h"
#include "OMSimulator/Types.h"
#include "Connector.h"
#include "ssd/ConnectorGeometry.h"
#include "../../OMTLMSimulator/common/Plugin/PluginImplementer.h"
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Values.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "ComRef.h"
#include "OMSFileSystem.h"
#include "Snapshot.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <map>
#include <pugixml.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "ComRef.h"
#include "Connector.h"
#include "Types.h"
#include "OMSimulator/Types.h"

#include <fmi4c.h>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/ssd/ConnectionGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef _SSD_CONNECTION_GEOMETRY_H_
#define _SSD_CONNECTION_GEOMETRY_H_

#include "../Types.h"
#include "OMSimulator/Types.h"

#include <pugixml.hpp>

Expand Down
Loading

0 comments on commit fd3e750

Please sign in to comment.