windows: build natively with msvc compiler#1744
Merged
BareosBot merged 67 commits intobareos:masterfrom Jul 15, 2024
Merged
Conversation
ea8a6c1 to
c3e49c3
Compare
Contributor
|
Builds tested correctly on windows 2022, especially upgrade path between older and newer installer. |
d1d0678 to
cdf01bd
Compare
b770ff5 to
e5fe0fe
Compare
199fe9a to
bc1f810
Compare
b7e5ad4 to
22af334
Compare
Now it defaults to 'Debug'.
5d1d94a to
42d8cf9
Compare
sebsura
approved these changes
Jul 15, 2024
Contributor
sebsura
left a comment
There was a problem hiding this comment.
Thanks for the great work!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thank you for contributing to the Bareos Project!
win-native: changes required to build and test
These changes allow us to build and test Bareos on
windows natively built with the MSVC compiler.
Some system tests do not work on windows (yet). These are
in the TESTS_TO_SKIP list so that there is a central point
to disable them.
Required dlls will be copied to the run directory of the produced
binaries to run system and google tests easier without to hassle too
much with the PATH settings. (See BareosCopyDllsToBinDir)
The sysemtests were adapted to be able to support both Debug and
Release build types. The current value is provided in
the environment variable CMAKE_CONFIG_TYPE
Wherever cmake creates files, we now set the NEWLINE_STYLE to UNIX.
This makes sure that the bash shell that is also used on windows
to run the system tests gets correct line endings.
CMake can both produce MS Build Projects for VisualStudio (default)
and "Ninja Multi-Config" Projects. The latter has the advantage that
it supports ccache.
To make ccache work, we need CMake >= 3.25 and CMP0141 set to NEW.
This way we can set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
Which removes compiler switch /Zi which is unupported by ccache.
Most external dependencies are provided via vcpkg.
To package the resulting windows binaries, an own nsi installer file
winbareos-native.nsiwas created.The services used by the systemtests are installed by nssm.
This is required as it is not possible to start the windows binaries
detached. Nssm also takes care of stdout and stderr and writes this
output as logfiles into the systemtests' directory.
Special start/stop scripts bareos-ctl-* for windows have been added
which take care of the creation and removeal of nssm services for the
required binaries.
The start/stop script
bareosin the systemtests has been adapted touniformly support multiple directors/filedaemons/storagedaemons.
To add an additional services, just create a subdirectory
in the format bareos- parallel to the bareos directory in
the tests. The startscript will automatically create services for
all directors, filedaemons and storage daemons that have a
configuration below this directory. For examples check
multiple-clients/etc/bareos-secondclientandautoxflate/etc/bareos-sd1Some scripts remove unexpected windows line ending characters
\rso that the bash shell can handle everything as needed.
All systemtests have been configured to disable VSS in the filesets
to speedup testing.
MSVC Compiler requires the C++ 20 Standard
Systemtests: Some symlinked files with identical content have been
split up into multiple files, as on windows the linking from the
CMAKE_BINARY_DIR to the original files does no work.
Every ctest call needs to set the configuration, i.e.
ctest --build-config Debug/Release ...<other ctest options>Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Check backport lineRequired backport PRs have been createdSource code quality