Skip to content

Allow Windows install() to use GNUInstallDirs structure - #1518

Merged
val-ms merged 7 commits into
Cisco-Talos:mainfrom
zaddach:simplify_windows_install
Dec 15, 2025
Merged

Allow Windows install() to use GNUInstallDirs structure#1518
val-ms merged 7 commits into
Cisco-Talos:mainfrom
zaddach:simplify_windows_install

Conversation

@zaddach

@zaddach zaddach commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Right now ClamAV will install binary products in a flat directory structure on Windows. We're trying to build a conan package from the built artifacts, and it would be handy to keep the GNUInstallDirs (lib/, bin/, include/, ... ) directory structure.

This PR doesn't handle Windows install in a special way any more, but provides defaults (that default to the same behavior as before) for the GNUInstallDirs, while allowing them to be overridden by the user.

Further, it introduces an option to install runtime dependencies. The option is on by default to mimick the current behavior, and can be switched off if you don't need dependencies and system DLLs installed.

@zaddach
zaddach force-pushed the simplify_windows_install branch 5 times, most recently from 8586a24 to f9ac05b Compare June 19, 2025 13:32
@zaddach
zaddach force-pushed the simplify_windows_install branch 4 times, most recently from 0e5ba7d to 4bc3f10 Compare August 7, 2025 11:58
@zaddach

zaddach commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

Renders #1524 obsolete.

@val-ms

val-ms commented Aug 19, 2025

Copy link
Copy Markdown
Contributor

I started review but haven't had time to finish, yet. It won't make it into the clamav 1.5.0-rc. I will try to finish my review soon and if the changes aren't too extensive maybe we can put it in before the 1.5.0 stable release in ~1-2 weeks.

@val-ms val-ms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall this is really good work. I have a few change requests to improve it. Thank you for your help and for figuring out the CMakePresets.json.

Comment thread CMakeOptions.cmake Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt
Comment thread unit_tests/CMakeLists.txt Outdated
Comment thread unit_tests/examples/ex_cl_cvdunpack_test.py Outdated
Comment thread libclamav_rust/CMakeLists.txt Outdated
Comment thread examples/ex_file_inspection_callback.c Outdated
@zaddach
zaddach force-pushed the simplify_windows_install branch 2 times, most recently from 11d6988 to 9c03a4d Compare October 20, 2025 10:14
@Kreijstal

Copy link
Copy Markdown

this would be cool, merge when

The install BINDIR, SBINDIR, LIBDIR, and INCLUDEDIR may be set in
the top level CMakeLists.txt and does not need to be set for each
target. This also enables a build to customize those so that the
bins COULD go to the "bin" directory.

Also add CMake option "ENABLE_WINDOWS_INSTALL_THIRDPARTY_DEPENDENCIES".
- When enabled (default), the install will include required system runtime
  libraries and also a copy of the other third party library dependencies
  (e.g. libpcre2, libxml2, libcrypto, etc.).
- When disabled, those files are not included.
  One situation where this is useful is if vcpkg is being used to build
  ClamAV itself (including its dependencies).
@val-ms
val-ms force-pushed the simplify_windows_install branch from 26bda09 to 751ab78 Compare December 12, 2025 23:48
@val-ms

val-ms commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

I just rebased the branch and combined some of the commits to tidy up the history and put in some more high level descriptions for each commit. The content of the PR is identical to before my force-push.

Build on windows-2022, as windows-2019 is no longer available

Use updated vcpkg github action

Try to use vcpkg manifest mode

Provide vcpkg baseline commit hash

Correctly request dependency feature

Fix printing vcpkg triplet

Try building with CMakePresets.json
In inflate64.c on Windows, as zlib.h is included,
it sets ZEXTERN to " __declspec(dllimport)". In consequence,
our internal functions have the wrong linkage and linking fails
because of the missing dll functions.
The prescan and file_inspection callbacks are deprecated and should not be used.
They are replaced by a more unified scan callback system which is demonstrated in
ex_scan_callbacks.c.
Don't concatenate pythonpath and str

Fix test program path for Windows Ninja Multi-Config

Use environment variable to pass cl_cvdunpack_test location to test

Use ENABLE_EXAMPLES instead of ENABLE_TESTS to gate ex_cl_cvdunpack

Directly use the target's path on Windows

Also change the program finding for ex_scan_callbacks_test

Fix python paths handling

Fix the order of some expected results which were incorrect and for
some reason only failed when tested on Windows.
This final fix in this commit provided by Val Snyder.
@val-ms
val-ms force-pushed the simplify_windows_install branch from 79afe16 to 661826d Compare December 15, 2025 19:14
@val-ms

val-ms commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

I enabled verbose ctest output and fixed installing a couple of the example programs which was causing windows tests to fail. Looks good to me, so I squashed those changes into the commit that fixed the github actions windows workflow and force-pushed it.

@val-ms
val-ms merged commit 1a73905 into Cisco-Talos:main Dec 15, 2025
23 checks passed
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.

3 participants