Skip to content

Commit 2a6bdb0

Browse files
authored
Merge pull request #2778 from deslaughter/build-windows-backport
Backport of GitHub Action to build windows executables on release
2 parents e0d3eea + 92a2e94 commit 2a6bdb0

File tree

3 files changed

+142
-5
lines changed

3 files changed

+142
-5
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" %VS_VER%
2+
3+
for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f"
4+
@call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat"
5+
6+
@REM Make the script that generates the git version description ignore dirty
7+
@REM since building the Visual Studio projects modifies files
8+
powershell -command "(Get-Content -Path '.\vs-build\CreateGitVersion.bat') -replace '--dirty', '' | Set-Content -Path '.\vs-build\CreateGitVersion.bat'"
9+
10+
echo on
11+
12+
@REM Build all solutions
13+
devenv vs-build/AeroDisk/AeroDisk_Driver.sln /Build "Release|x64"
14+
devenv vs-build/AeroDyn/AeroDyn_Driver.sln /Build "Release|x64"
15+
devenv vs-build/AeroDyn/AeroDyn_Driver.sln /Build "Release_OpenMP|x64"
16+
devenv vs-build/AeroDyn_Inflow_c_binding/AeroDyn_Inflow_c_binding.sln /Build "Release|x64"
17+
devenv vs-build/AeroDyn_Inflow_c_binding/AeroDyn_Inflow_c_binding.sln /Build "Release_OpenMP|x64"
18+
devenv vs-build/BeamDyn/BeamDyn-w-registry.sln /Build "Release|x64"
19+
devenv vs-build/Discon/Discon.sln /Build "Release|x64"
20+
devenv vs-build/FAST-farm/FAST-Farm.sln /Build "Release|x64"
21+
devenv vs-build/FAST-farm/FAST-Farm.sln /Build "Release_OpenMP|x64"
22+
devenv vs-build/HydroDyn/HydroDynDriver.sln /Build "Release|x64"
23+
devenv vs-build/HydroDyn_c_binding/HydroDyn_c_binding.sln /Build "Release|x64"
24+
devenv vs-build/InflowWind_c_binding/InflowWind_c_binding.sln /Build "Release|x64"
25+
devenv vs-build/InflowWind/InflowWind_driver.sln /Build "Release|x64"
26+
devenv vs-build/InflowWind/InflowWind_driver.sln /Build "Release_OpenMP|x64"
27+
devenv vs-build/MoorDyn/MoorDynDriver.sln /Build "Release|x64"
28+
devenv vs-build/MoorDyn_c_binding/MoorDyn_c_binding.sln /Build "Release|x64"
29+
devenv vs-build/FAST/FAST.sln /Build "Release|x64"
30+
devenv vs-build/SeaState/SeaStateDriver.sln /Build "Release|x64"
31+
devenv vs-build/SimpleElastoDyn/SimpleElastoDyn_Driver.sln /Build "Release|x64"
32+
devenv vs-build/SubDyn/SubDyn.sln /Build "Release|x64"
33+
devenv vs-build/TurbSim/TurbSim.vfproj /Build "Release|x64"
34+
devenv vs-build/UnsteadyAero/UnsteadyAero.sln /Build "Release|x64"
35+
36+
@REM Build MATLAB solution last
37+
devenv vs-build/FAST/FAST.sln /Build "Release_Matlab|x64"
38+
39+
@REM Copy controllers to bin directory
40+
xcopy .\reg_tests\r-test\glue-codes\openfast\5MW_Baseline\ServoData\*.dll .\build\bin\ /y
41+
42+
exit /b %ERRORLEVEL%

.github/workflows/deploy.yml

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,20 @@ on:
1111
types:
1212
- released
1313

14+
push:
15+
paths-ignore:
16+
- 'LICENSE'
17+
- 'README.rst'
18+
- 'docs/**'
19+
- 'share/**'
1420

1521
jobs:
22+
23+
# Disabled as publish-to-pypi is working correctly
1624
publish-to-pypi-test:
1725
runs-on: ubuntu-latest
18-
if: github.event_name == 'workflow_dispatch'
26+
if: false
27+
# if: github.event_name == 'workflow_dispatch'
1928
steps:
2029
- uses: actions/checkout@v3
2130

@@ -44,7 +53,7 @@ jobs:
4453

4554
publish-to-pypi:
4655
runs-on: ubuntu-latest
47-
if: github.event_name == 'release'
56+
if: github.event_name == 'release'
4857
steps:
4958
- uses: actions/checkout@v3
5059

@@ -71,9 +80,11 @@ jobs:
7180
run: hatch publish
7281
working-directory: openfast_io
7382

83+
# Disabled as it fails due to huge memory requirements
7484
docker-build-and-push:
7585
runs-on: ubuntu-latest
76-
if: github.event_name == 'release'
86+
if: false
87+
# if: github.event_name == 'release'
7788
timeout-minutes: 500
7889
env:
7990
DOCKERFILE_PATH: share/docker/Dockerfile
@@ -123,3 +134,87 @@ jobs:
123134
push: true
124135
cache-from: type=gha
125136
cache-to: type=gha,mode=max
137+
138+
build-windows-executables:
139+
runs-on: windows-2022
140+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
141+
steps:
142+
- name: Checkout
143+
uses: actions/checkout@v4
144+
with:
145+
submodules: true
146+
fetch-depth: 0
147+
148+
- name: Install Intel oneAPI BaseKit (Windows)
149+
shell: cmd
150+
env:
151+
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
152+
COMPONENTS: intel.oneapi.win.mkl.devel
153+
run: |
154+
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
155+
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
156+
del %TEMP%\webimage.exe
157+
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=.
158+
set installer_exit_code=%ERRORLEVEL%
159+
rd /s/q "webimage_extracted"
160+
exit /b %installer_exit_code%
161+
162+
- name: Install Intel oneAPI HPCKit (Windows)
163+
shell: cmd
164+
env:
165+
URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe
166+
COMPONENTS: intel.oneapi.win.ifort-compiler
167+
run: |
168+
curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
169+
start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
170+
del %TEMP%\webimage.exe
171+
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=.
172+
set installer_exit_code=%ERRORLEVEL%
173+
rd /s/q "webimage_extracted"
174+
exit /b %installer_exit_code%
175+
176+
- name: Set up MATLAB
177+
id: setup-matlab
178+
uses: matlab-actions/setup-matlab@v2
179+
with:
180+
products: Simulink
181+
182+
- name: Build Executables
183+
env:
184+
MATLAB_ROOT: ${{ steps.setup-matlab.outputs.matlabroot }}
185+
run: .github/scripts/build_windows_executables.bat
186+
187+
- name: Test version output
188+
run: |
189+
build/bin/openfast_x64.exe -h
190+
build/bin/TurbSim_x64.exe -h
191+
build/bin/FAST.Farm_x64.exe -h
192+
193+
- name: Build MATLAB Mex File
194+
uses: matlab-actions/run-command@v2
195+
with:
196+
command: |
197+
mexname = 'FAST_SFunc';
198+
mex('-largeArrayDims', ...
199+
'-v', ...
200+
['-L' fullfile('build','bin')], ...
201+
['-I' fullfile('modules','openfast-library','src')], ... % "FAST_Library.h"
202+
['-I' fullfile('modules','supercontroller','src')], ... % "SuperController_Types.h"
203+
['-I' fullfile('modules','externalinflow','src')], ... % "ExternalInflow_Types.h"
204+
['-I' fullfile('modules','extloads','src')], ... % "ExtLoadsDX_Types.h"
205+
['-I' fullfile(matlabroot,'simulink','include')], ...
206+
['-I' fullfile(matlabroot,'extern','include')], ...
207+
['COMPFLAGS=$COMPFLAGS -MT -DS_FUNCTION_NAME=' mexname], ...
208+
'-lOpenFAST-Simulink_x64', ...
209+
'-outdir', fullfile('build','bin'), ...
210+
'-output', mexname, ...
211+
fullfile('glue-codes','simulink','src','FAST_SFunc.c'));
212+
213+
- name: Upload executables
214+
uses: actions/upload-artifact@v4
215+
with:
216+
name: openfast-binaries
217+
path: |
218+
build/bin/*.exe
219+
build/bin/*.dll
220+
build/bin/*.mexw64

vs-build/OpenFAST-Simulink/OpenFAST-Simulink.vfproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
1717
<Configuration Name="Release_Matlab|Win32" OutputDirectory="..\..\build\bin\" TargetName="$(ProjectName)_$(PlatformName)" ConfigurationType="typeDynamicLibrary">
1818
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Preprocess="preprocessYes" PreprocessorDefinitions="COMPILE_SIMULINK" StandardWarnings="standardWarningsF03" DisableSpecificDiagnostics="5268,5199"/>
19-
<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;"/>
19+
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;$(MATLAB_ROOT)\extern\lib\win32\microsoft\libmex.lib&quot;"/>
2020
<Tool Name="VFResourceCompilerTool"/>
2121
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
2222
<Tool Name="VFCustomBuildTool"/>
@@ -36,7 +36,7 @@
3636
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
3737
<Configuration Name="Release_Matlab|x64" OutputDirectory="..\..\build\bin\" TargetName="$(ProjectName)_$(PlatformName)" ConfigurationType="typeDynamicLibrary">
3838
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Preprocess="preprocessYes" PreprocessorDefinitions="COMPILE_SIMULINK" StandardWarnings="standardWarningsF03" DisableSpecificDiagnostics="5268,5199"/>
39-
<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;"/>
39+
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateManifest="false" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="&quot;$(MATLAB_ROOT)\extern\lib\win64\microsoft\libmex.lib&quot;"/>
4040
<Tool Name="VFResourceCompilerTool"/>
4141
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
4242
<Tool Name="VFCustomBuildTool"/>

0 commit comments

Comments
 (0)