Skip to content

Commit

Permalink
Fix OMShell-terminal on Windows and add a CMake Windows job. (#9725)
Browse files Browse the repository at this point in the history
  - There is now a PR CI job that can build OpenModelica with CMake on
    Windows. This is disabled by default and can be enabled by setting the
    label (on the PR):
    `CI/CMake/Enable/macOS`

  - OMShell-terminal: use `simulation/socket.h` from our runtime code
    instead of directly including `sys/socket.h`. OMShell-terminal can
    now be compiled on Windows and seems to work just fine.
  • Loading branch information
mahge committed Nov 18, 2022
1 parent 30e4565 commit edadd97
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .CI/common.groovy
Expand Up @@ -510,6 +510,15 @@ def shouldWeDisableAllCMakeBuilds() {
return params.DISABLE_ALL_CMAKE_BUILDS
}

def shouldWeEnableMinGWCMakeBuild() {
if (isPR()) {
if (pullRequest.labels.contains("CI/CMake/Enable/MinGW")) {
return true
}
}
return params.ENABLE_MINGW_CMAKE_BUILD
}

def shouldWeEnableMacOSCMakeBuild() {
if (isPR()) {
if (pullRequest.labels.contains("CI/CMake/Enable/macOS")) {
Expand Down
29 changes: 28 additions & 1 deletion Jenkinsfile
Expand Up @@ -2,6 +2,7 @@ def common
def shouldWeBuildMINGW
def shouldWeDisableAllCMakeBuilds_value
def shouldWeEnableMacOSCMakeBuild_value
def shouldWeEnableMinGWCMakeBuild_value
def shouldWeRunTests
def isPR
pipeline {
Expand All @@ -16,7 +17,8 @@ pipeline {
parameters {
booleanParam(name: 'BUILD_MINGW', defaultValue: false, description: 'Build with Win/MinGW')
booleanParam(name: 'DISABLE_ALL_CMAKE_BUILDS', defaultValue: false, description: 'Skip building omc with CMake (CMake 3.17.2) on all platforms')
booleanParam(name: 'ENABLE_MACOS_CMAKE_BUILD', defaultValue: false, description: 'Skip building omc with CMake on macOS')
booleanParam(name: 'ENABLE_MINGW_CMAKE_BUILD', defaultValue: false, description: 'Enable building omc with CMake on MinGW')
booleanParam(name: 'ENABLE_MACOS_CMAKE_BUILD', defaultValue: false, description: 'Enable building omc with CMake on macOS')
}
// stages are ordered according to execution time; highest time first
// nodes are selected based on a priority (in Jenkins config)
Expand All @@ -41,6 +43,8 @@ pipeline {
print "shouldWeDisableAllCMakeBuilds: ${shouldWeDisableAllCMakeBuilds_value}"
shouldWeEnableMacOSCMakeBuild_value = common.shouldWeEnableMacOSCMakeBuild()
print "shouldWeEnableMacOSCMakeBuild: ${shouldWeEnableMacOSCMakeBuild_value}"
shouldWeEnableMinGWCMakeBuild_value = common.shouldWeEnableMinGWCMakeBuild()
print "shouldWeEnableMinGWCMakeBuild: ${shouldWeEnableMinGWCMakeBuild_value}"
shouldWeRunTests = common.shouldWeRunTests()
print "shouldWeRunTests: ${shouldWeRunTests}"
}
Expand Down Expand Up @@ -167,6 +171,29 @@ pipeline {
}
}
}
stage('cmake-OMDev-gcc') {
agent {
node {
label 'windows'
}
}
when {
beforeAgent true
expression { !shouldWeDisableAllCMakeBuilds_value && shouldWeEnableMinGWCMakeBuild_value}
}
steps {
script {
withEnv (["PATH=C:\\OMDev\\tools\\msys\\usr\\bin;C:\\Program Files\\TortoiseSVN\\bin;c:\\bin\\jdk\\bin;c:\\bin\\nsis\\;${env.PATH};c:\\bin\\git\\bin;"]) {
bat "echo PATH: %PATH%"
common.buildOMC_CMake('-DCMAKE_BUILD_TYPE=Release'
+ ' -DOM_USE_CCACHE=OFF'
+ ' -DCMAKE_INSTALL_PREFIX=build'
+ ' -G "MSYS Makefiles"'
)
}
}
}
}
stage('checks') {
agent {
docker {
Expand Down
3 changes: 2 additions & 1 deletion OMCompiler/SimulationRuntime/c/Makefile.common
Expand Up @@ -74,7 +74,8 @@ RUNTIMESIMULATION_HEADERS = ./simulation/modelinfo.h \
./simulation/simulation_input_xml.h \
./simulation/simulation_omc_assert.h \
./simulation/simulation_runtime.h \
./simulation/omc_simulation_util.h
./simulation/omc_simulation_util.h \
./simulation/socket.h

RUNTIMESIMRESULTS_HEADERS = ./simulation/results/simulation_result.h

Expand Down
2 changes: 1 addition & 1 deletion OMShell/mosh/src/mosh.cpp
Expand Up @@ -42,14 +42,14 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/unistd.h>
#include <sys/stat.h>


#include <sys/param.h> /* MAXPATHLEN */
#include "options.h"
#include "omcinteractiveenvironment.h"
#include "simulation/socket.h"

#if defined(__MINGW32__) || defined(_MSC_VER)
#else
Expand Down

0 comments on commit edadd97

Please sign in to comment.