Skip to content

Commit

Permalink
upgrade vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-christophe81 committed Nov 6, 2024
1 parent 3f03126 commit d8e87dc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
28 changes: 19 additions & 9 deletions .github/scripts/windows-agent-compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ Write-Host $env:VCPKG_BINARY_SOURCES

$current_dir = $pwd.ToString()

#install recent version of 7zip needed by some packages
Write-Host "install 7zip"

#download 7zip
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2408-x64.msi" -OutFile "7z2408-x64.msi"
#install 7zip
Start-Process 'msiexec.exe' -ArgumentList '/I "7z2408-x64.msi" /qn' -Wait

#get cache from s3
$files_to_hash = "vcpkg.json", "custom-triplets\x64-windows.cmake", "CMakeLists.txt", "CMakeListsWindows.txt"
$files_content = Get-Content -Path $files_to_hash -Raw
Expand All @@ -32,12 +40,13 @@ $writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write($files_content -join " ")
$writer.Flush()
$stringAsStream.Position = 0
$vcpkg_release = "2024.10.21"
$vcpkg_hash = Get-FileHash -InputStream $stringAsStream -Algorithm SHA256 | Select-Object Hash
$file_name = "windows-agent-vcpkg-dependencies-cache-" + $vcpkg_hash.Hash
$file_name = "windows-agent-vcpkg-dependencies-cache-" + $vcpkg_hash.Hash + "-" + $vcpkg_release
$file_name_extension = "${file_name}.7z"

#try to get compiled dependenciesfrom s3
Write-Host "try to download compiled dependencies from s3"
Write-Host "try to download compiled dependencies from s3: $file_name_extension"
aws --quiet s3 cp s3://centreon-collect-robot-report/$file_name_extension $file_name_extension
if ( $? -ne $true ) {
#no => generate
Expand All @@ -46,7 +55,7 @@ if ( $? -ne $true ) {
Write-Host "#######################################################################################################################"

Write-Host "install vcpkg"
git clone --depth 1 -b 2024.07.12 https://github.com/microsoft/vcpkg.git
git clone --depth 1 -b $vcpkg_release https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
cd $current_dir
Expand All @@ -57,18 +66,19 @@ if ( $? -ne $true ) {
Write-Host "compile vcpkg dependencies"
vcpkg install --vcpkg-root $env:VCPKG_ROOT --x-install-root build_windows\vcpkg_installed --x-manifest-root . --overlay-triplets custom-triplets --triplet x64-windows

Write-Host "Compress binary archive"
7z a $file_name_extension build_windows\vcpkg_installed
Write-Host "Upload binary archive"
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension
Write-Host "create CMake files"
if ( $? -eq $true ) {
Write-Host "Compress binary archive"
7z a $file_name_extension build_windows\vcpkg_installed
Write-Host "Upload binary archive"
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension
}
}
else {
7z x $file_name_extension
Write-Host "Create cmake files from binary-cache downloaded without use vcpkg"
}


Write-Host "create CMake files"

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_TESTING=On -DWINDOWS=On -DBUILD_FROM_CACHE=On -S. -DVCPKG_CRT_LINKAGE=dynamic -DBUILD_SHARED_LIBS=OFF -Bbuild_windows

Expand Down
4 changes: 4 additions & 0 deletions common/process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ add_library(

target_precompile_headers(centreon_process REUSE_FROM centreon_common)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(centreon_process INTERFACE Boost::process)
endif()

set_property(TARGET centreon_process PROPERTY POSITION_INDEPENDENT_CODE ON)
2 changes: 1 addition & 1 deletion common/process/inc/com/centreon/common/process/process.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class mutex<false> {};
template <>
class lock<false> {
public:
lock(mutex<false>* dummy_mut) {}
lock(mutex<false>* /* dummy_mut*/) {}
};

} // namespace detail
Expand Down
10 changes: 5 additions & 5 deletions common/process/src/process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct boost_process {
boost_process(asio::io_context& io_context,
const std::string& exe_path,
const std::vector<std::string>& args,
bool no_stdin)
bool no_stdin [[maybe_unused]])
: stdout_pipe(io_context),
stderr_pipe(io_context),
stdin_pipe(io_context),
Expand Down Expand Up @@ -277,9 +277,9 @@ void process<use_mutex>::stdin_write_no_lock(
try {
_write_pending = true;
_proc->stdin_pipe.async_write_some(
asio::buffer(*data),
[me = shared_from_this(), caller = _proc, data](
const boost::system::error_code& err, size_t nb_written) {
asio::buffer(*data), [me = shared_from_this(), caller = _proc, data](
const boost::system::error_code& err,
size_t nb_written [[maybe_unused]]) {
detail::lock<use_mutex> l(&me->_protect);
if (caller != me->_proc) {
return;
Expand Down Expand Up @@ -438,4 +438,4 @@ template class process<true>;

template class process<false>;

} // namespace com::centreon::common
} // namespace com::centreon::common

0 comments on commit d8e87dc

Please sign in to comment.