-
Notifications
You must be signed in to change notification settings - Fork 13
Automated windows build: build.bat #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexandernikolic-v2c2
wants to merge
1
commit into
modelica:master
Choose a base branch
from
alexandernikolic-v2c2:windows_automated
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| @echo off | ||
| set back=%cd% | ||
| set BUILD_CONFIG=Release | ||
|
|
||
| if not exist dependencies (mkdir dependencies) | ||
| cd dependencies | ||
|
|
||
| WHERE vcpkg --version >nul 2>nul | ||
| REM IF %ERRORLEVEL% NEQ 0 (ECHO vcpkg was not found && cd %back% && EXIT /b 1) | ||
| IF %ERRORLEVEL% NEQ 0 ( | ||
| if not exist %cd%\vcpkg\scripts\buildsystems\vcpkg.cmake ( | ||
| ECHO vcpkg was not found, installing | ||
| if not exist vcpkg (git clone https://github.com/microsoft/vcpkg.git) | ||
| cd vcpkg | ||
| if not exist vcpkg.exe ( bootstrap-vcpkg.bat -disableMetrics ) | ||
| set VCPKG=%cd%\vcpkg\vcpkg.exe | ||
| %VCPKG% integrate install || ECHO Installed vcpkg locally | ||
| ) | ||
| ) ELSE ( | ||
| ECHO vcpkg found | ||
| set VCPKG=vcpkg | ||
| ) | ||
|
|
||
| %VCPKG% --version | ||
|
|
||
| cd %back% | ||
|
|
||
| cd dependencies | ||
| WHERE cmake --version >nul 2>nul | ||
| REM IF %ERRORLEVEL% NEQ 0 (ECHO cmake was not found && cd %back% && EXIT /b 1) | ||
| IF %ERRORLEVEL% NEQ 0 ( | ||
| ECHO cmake was not found, installing | ||
| if not exist cmake.zip ( curl -L -o cmake.zip https://github.com/Kitware/CMake/releases/download/v4.0.0-rc5/cmake-4.0.0-rc5-windows-x86_64.zip ) | ||
| REM if not exist cmake (tar -xf cmake.zip) | ||
| if not exist cmake (mkdir cmake && tar -xf cmake.zip --strip-components=1 -C cmake) | ||
| cd cmake | ||
| cd bin | ||
| set CMAKE=%cd%\cmake\bin\cmake.exe | ||
| ) ELSE ( | ||
| ECHO cmake found | ||
| set CMAKE=cmake | ||
| ) | ||
|
|
||
| %CMAKE% --version | ||
|
|
||
| cd %back% | ||
|
|
||
| %VCPKG% install asio xerces-c libzip | ||
|
|
||
| if not exist build (mkdir build) | ||
|
|
||
| cd build | ||
| if not exist install (mkdir install) | ||
| set VCPKG_TC_FILE=C:/Users/%USERNAME%/Downloads/dcp_PR/DCPLib/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
| %CMAKE% .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_TC_FILE% -DCMAKE_INSTALL_PREFIX=install | ||
|
|
||
| %CMAKE% --build . --target=install --config %BUILD_CONFIG% | ||
|
|
||
| cd %back% | ||
|
|
||
|
|
||
| REM Build Examples | ||
|
|
||
| for /f "tokens=*" %%G in ('dir /b /a:d "example\*"') do ( | ||
| echo Found %back%\example\%%G | ||
| if not exist %back%\build\example\%%G (mkdir %back%\build\example\%%G) | ||
| cd %back%\build\example\%%G | ||
| %CMAKE% %back%\example\%%G -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_TC_FILE% -DDCPLib_DIR=%back%\build\install\lib\DCPLib -DCMAKE_INSTALL_PREFIX=install | ||
| %CMAKE% --build . --config %BUILD_CONFIG% | ||
| REM copy /Y %back%\example\%%G\*.xml %back%\build\example\%%G | ||
| cd %back% | ||
| ) | ||
|
|
||
| REM make sure the XML File is available for any build configuration!!! (e.g. master needs one) | ||
|
|
||
| run_test.bat %cd% %BUILD_CONFIG% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| set back=%1 | ||
| set BUILD_CONFIG=%2 | ||
|
|
||
| echo > waiting.tmp | ||
| start cmd /c wrapper.bat %back%\build\example\slave\%BUILD_CONFIG% %back%\build\example\slave\%BUILD_CONFIG%\dcpslave.exe | ||
| cd %back%\build\example\master\%BUILD_CONFIG% | ||
| start /wait %back%\build\example\master\%BUILD_CONFIG%\dcpmaster.exe | ||
|
|
||
| :loop | ||
| if exist waiting.tmp goto :loop | ||
|
|
||
| taskkill /IM dcpslave.exe /F | ||
| cd %back% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| cd %1 | ||
| start /wait %2 | ||
| del waiting.tmp |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is ASIO on windows not ok?
We use ASIO on windows with vcpkg here https://github.com/eclipse-openmcx/openmcx/blob/add_dcp_support/CMakeLists.txt and don't have any problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR: This change (+ if/else and "case-sensitive" asio find_package calls) can be omitted.
This is me being used to case-paranoia, thus my bad.
As I read this information in the output of vcpkg:
I assumed by using the same case as output, I would also make sure to use the vcpkg-provided pkg-config modules. This is not the case though, as pkg-config is not used in
CMakeLists.txt- I missed to see that.Masking
cmake/FindASIO.cmakeby renaming revealed, that this file is used. To reduce future maintenance burden, removing this file and using the pkg-config way in cmake might be considered.