Skip to content

windows: build natively with msvc compiler#1744

Merged
BareosBot merged 67 commits intobareos:masterfrom
pstorz:dev/pstorz/build-windows-native
Jul 15, 2024
Merged

windows: build natively with msvc compiler#1744
BareosBot merged 67 commits intobareos:masterfrom
pstorz:dev/pstorz/build-windows-native

Conversation

@pstorz
Copy link
Member

@pstorz pstorz commented Mar 25, 2024

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.nsi was 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 bareos in the systemtests has been adapted to
    uniformly 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-secondclient and
    autoxflate/etc/bareos-sd1

  • Some scripts remove unexpected windows line ending characters \r
    so 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

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

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-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
    Check backport line
    Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

@pstorz pstorz marked this pull request as draft March 25, 2024 09:25
@pstorz pstorz force-pushed the dev/pstorz/build-windows-native branch 6 times, most recently from ea8a6c1 to c3e49c3 Compare March 31, 2024 17:14
@arogge arogge modified the milestones: 23.1.0, 24.0.0 Apr 2, 2024
@bruno-at-bareos
Copy link
Contributor

Builds tested correctly on windows 2022, especially upgrade path between older and newer installer.
One defect is bconsole having a weird icon

@arogge arogge linked an issue Apr 18, 2024 that may be closed by this pull request
@pstorz pstorz force-pushed the dev/pstorz/build-windows-native branch from d1d0678 to cdf01bd Compare June 7, 2024 07:41
@pstorz pstorz force-pushed the dev/pstorz/build-windows-native branch 11 times, most recently from b770ff5 to e5fe0fe Compare June 25, 2024 10:40
@pstorz pstorz requested a review from sebsura June 25, 2024 15:05
@pstorz pstorz marked this pull request as ready for review June 25, 2024 15:05
@pstorz pstorz force-pushed the dev/pstorz/build-windows-native branch from 199fe9a to bc1f810 Compare July 1, 2024 11:08
@sebsura sebsura force-pushed the dev/pstorz/build-windows-native branch 2 times, most recently from b7e5ad4 to 22af334 Compare July 2, 2024 08:04
@sebsura sebsura force-pushed the dev/pstorz/build-windows-native branch from 5d1d94a to 42d8cf9 Compare July 15, 2024 08:18
Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great work!

@BareosBot BareosBot merged commit f2e02c5 into bareos:master Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intgrate "SQL Server 2005 Virtual Backup Device Interface (VDI) Specification" header files into source code restore bareos icons on windows

5 participants