Skip to content

Commit

Permalink
Merge pull request #2636 from deslaughter/f/build-windows
Browse files Browse the repository at this point in the history
Add job to build Windows executables to deploy.yml
  • Loading branch information
deslaughter authored Feb 14, 2025
2 parents 0fbd7b1 + a86ad21 commit e85ee49
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/scripts/build_windows_executables.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" %VS_VER%

for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f"
@call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat"

@REM Make the script that generates the git version description ignore dirty
@REM since building the Visual Studio projects modifies files
powershell -command "(Get-Content -Path '.\vs-build\CreateGitVersion.bat') -replace '--dirty', '' | Set-Content -Path '.\vs-build\CreateGitVersion.bat'"

echo on

@REM Build all solutions
devenv vs-build/AeroDisk/AeroDisk_Driver.sln /Build "Release|x64"
devenv vs-build/AeroDyn/AeroDyn_Driver.sln /Build "Release|x64"
devenv vs-build/AeroDyn/AeroDyn_Driver.sln /Build "Release_OpenMP|x64"
devenv vs-build/AeroDyn_Inflow_c_binding/AeroDyn_Inflow_c_binding.sln /Build "Release|x64"
devenv vs-build/AeroDyn_Inflow_c_binding/AeroDyn_Inflow_c_binding.sln /Build "Release_OpenMP|x64"
devenv vs-build/BeamDyn/BeamDyn-w-registry.sln /Build "Release|x64"
devenv vs-build/Discon/Discon.sln /Build "Release|x64"
devenv vs-build/FAST-farm/FAST-Farm.sln /Build "Release|x64"
devenv vs-build/FAST-farm/FAST-Farm.sln /Build "Release_OpenMP|x64"
devenv vs-build/HydroDyn/HydroDynDriver.sln /Build "Release|x64"
devenv vs-build/HydroDyn_c_binding/HydroDyn_c_binding.sln /Build "Release|x64"
devenv vs-build/InflowWind_c_binding/InflowWind_c_binding.sln /Build "Release|x64"
devenv vs-build/InflowWind/InflowWind_driver.sln /Build "Release|x64"
devenv vs-build/InflowWind/InflowWind_driver.sln /Build "Release_OpenMP|x64"
devenv vs-build/MoorDyn/MoorDynDriver.sln /Build "Release|x64"
devenv vs-build/MoorDyn_c_binding/MoorDyn_c_binding.sln /Build "Release|x64"
devenv vs-build/FAST/FAST.sln /Build "Release|x64"
devenv vs-build/SeaState/SeaStateDriver.sln /Build "Release|x64"
devenv vs-build/SimpleElastoDyn/SimpleElastoDyn_Driver.sln /Build "Release|x64"
devenv vs-build/SubDyn/SubDyn.sln /Build "Release|x64"
devenv vs-build/TurbSim/TurbSim.vfproj /Build "Release|x64"
devenv vs-build/UnsteadyAero/UnsteadyAero.sln /Build "Release|x64"

@REM Build MATLAB solution last
devenv vs-build/FAST/FAST.sln /Build "Release_Matlab|x64"

@REM Copy controllers to bin directory
xcopy .\reg_tests\r-test\glue-codes\openfast\5MW_Baseline\ServoData\*.dll .\build\bin\ /y

exit /b %ERRORLEVEL%
101 changes: 98 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ on:
types:
- released

push:
paths-ignore:
- 'LICENSE'
- 'README.rst'
- 'docs/**'
- 'share/**'

jobs:

# Disabled as publish-to-pypi is working correctly
publish-to-pypi-test:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
if: false
# if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -44,7 +53,7 @@ jobs:

publish-to-pypi:
runs-on: ubuntu-latest
if: github.event_name == 'release'
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3

Expand All @@ -71,9 +80,11 @@ jobs:
run: hatch publish
working-directory: openfast_io

# Disabled as it fails due to huge memory requirements
docker-build-and-push:
runs-on: ubuntu-latest
if: github.event_name == 'release'
if: false
# if: github.event_name == 'release'
timeout-minutes: 500
env:
DOCKERFILE_PATH: share/docker/Dockerfile
Expand Down Expand Up @@ -123,3 +134,87 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

build-windows-executables:
runs-on: windows-2022
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Install Intel oneAPI BaseKit (Windows)
shell: cmd
env:
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
COMPONENTS: intel.oneapi.win.mkl.devel
run: |
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
del %TEMP%\webimage.exe
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
set installer_exit_code=%ERRORLEVEL%
rd /s/q "webimage_extracted"
exit /b %installer_exit_code%
- name: Install Intel oneAPI HPCKit (Windows)
shell: cmd
env:
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe
COMPONENTS: intel.oneapi.win.ifort-compiler
run: |
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
del %TEMP%\webimage.exe
webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
set installer_exit_code=%ERRORLEVEL%
rd /s/q "webimage_extracted"
exit /b %installer_exit_code%
- name: Set up MATLAB
id: setup-matlab
uses: matlab-actions/setup-matlab@v2
with:
products: Simulink

- name: Build Executables
env:
MATLAB_ROOT: ${{ steps.setup-matlab.outputs.matlabroot }}
run: .github/scripts/build_windows_executables.bat

- name: Test version output
run: |
build/bin/openfast_x64.exe -h
build/bin/TurbSim_x64.exe -h
build/bin/FAST.Farm_x64.exe -h
- name: Build MATLAB Mex File
uses: matlab-actions/run-command@v2
with:
command: |
mexname = 'FAST_SFunc';
mex('-largeArrayDims', ...
'-v', ...
['-L' fullfile('build','bin')], ...
['-I' fullfile('modules','openfast-library','src')], ... % "FAST_Library.h"
['-I' fullfile('modules','supercontroller','src')], ... % "SuperController_Types.h"
['-I' fullfile('modules','externalinflow','src')], ... % "ExternalInflow_Types.h"
['-I' fullfile('modules','extloads','src')], ... % "ExtLoadsDX_Types.h"
['-I' fullfile(matlabroot,'simulink','include')], ...
['-I' fullfile(matlabroot,'extern','include')], ...
['COMPFLAGS=$COMPFLAGS -MT -DS_FUNCTION_NAME=' mexname], ...
'-lOpenFAST-Simulink_x64', ...
'-outdir', fullfile('build','bin'), ...
'-output', mexname, ...
fullfile('glue-codes','simulink','src','FAST_SFunc.c'));
- name: Upload executables
uses: actions/upload-artifact@v4
with:
name: openfast-binaries
path: |
build/bin/*.exe
build/bin/*.dll
build/bin/*.mexw64
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 0 files
4 changes: 2 additions & 2 deletions vs-build/OpenFAST-Simulink/OpenFAST-Simulink.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_Matlab|Win32" OutputDirectory="..\..\build\bin\" TargetName="$(ProjectName)_$(PlatformName)" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Preprocess="preprocessYes" PreprocessorDefinitions="COMPILE_SIMULINK" StandardWarnings="standardWarningsF03" DisableSpecificDiagnostics="5268,5199"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;C:\Program Files (x86)\MATLAB\R2018a\extern\lib\win32\microsoft\libmex.lib&quot;"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;$(MATLAB_ROOT)\extern\lib\win32\microsoft\libmex.lib&quot;"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
Expand All @@ -36,7 +36,7 @@
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release_Matlab|x64" OutputDirectory="..\..\build\bin\" TargetName="$(ProjectName)_$(PlatformName)" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Preprocess="preprocessYes" PreprocessorDefinitions="COMPILE_SIMULINK" StandardWarnings="standardWarningsF03" DisableSpecificDiagnostics="5268,5199"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;C:\Program Files\MATLAB\R2019b\extern\lib\win64\microsoft\libmex.lib&quot;"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;$(MATLAB_ROOT)\extern\lib\win64\microsoft\libmex.lib&quot;"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
Expand Down

0 comments on commit e85ee49

Please sign in to comment.