Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano committed Apr 27, 2024
1 parent baf1a30 commit d5bfb2e
Showing 1 changed file with 25 additions and 59 deletions.
84 changes: 25 additions & 59 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,29 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2022
# Reset the shell.
SHELL ["cmd", "/S", "/C"]

# install powershell core
RUN powershell Invoke-WebRequest -Uri https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi -OutFile $env:TEMP\powershell.msi ; \
Start-Process -Wait -FilePath msiexec.exe -ArgumentList '/i', '$env:TEMP\powershell.msi', '/quiet', '/norestart' ; \
Remove-Item $env:TEMP\powershell.msi -Force
ENV PATH="${PATH};C:\Windows\System32\WindowsPowerShell\v1.0"


# download and install vs build tools needed by vcpkg
RUN powershell -Command \
Invoke-WebRequest -Uri https://aka.ms/vs/17/release/channel -OutFile $env:TEMP\VisualStudio.chman; \
Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile $env:TEMP\vs_buildtools.exe; \
Start-Process -Wait -FilePath "$env:TEMP\vs_buildtools.exe" \
-ArgumentList "--wait", "--nocache", "--norestart", "--noUpdateInstaller", \
"--channelUri", "$env:TEMP\VisualStudio.chman", \
"--installChannelUri", "$env:TEMP\VisualStudio.chman", \
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", \
"--add", "Microsoft.Component.MSBuild", \
"--add", "Microsoft.VisualStudio.Component.Windows11SDK.22621", \
"--includeRecommended"; \
Remove-Item $env:TEMP\VisualStudio.chman -Force; \
Remove-Item $env:TEMP\vs_buildtools.exe -Force

# install git
RUN powershell -Command \
Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.exe -OutFile $env:TEMP\git-installer.exe ; \
Start-Process -Wait -FilePath "$env:TEMP\git-installer.exe" -ArgumentList '/VERYSILENT', '/NORESTART' ; \
Remove-Item $env:TEMP\git-installer.exe -Force
ENV PATH="${PATH};C:\Program Files\Git\cmd"

# install cmake
RUN powershell -Command \
Invoke-WebRequest -Uri https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-windows-x86_64.msi -OutFile $env:TEMP\cmake-installer.msi ; \
Start-Process -Wait -FilePath msiexec.exe -ArgumentList '/i', '$env:TEMP\cmake-installer.msi', '/quiet', '/norestart' ; \
Remove-Item $env:TEMP\cmake-installer.msi -Force
ENV PATH="${PATH};C:\Program Files\CMake\bin"

# add MSVC path
ENV PATH="${PATH};C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin"
ENV PATH="${PATH};C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64"

# install vcpkg
RUN git clone https://github.com/microsoft/vcpkg c:\vcpkg && \
c:\vcpkg\bootstrap-vcpkg.bat -disableMetrics
ENV VCPKG_DEFAULT_TRIPLET=x64-windows
ENV PATH="${PATH};C:\vcpkg"

# install sfcgal dependencies
RUN vcpkg integrate install && \
vcpkg install cgal boost-program-options boost-timer boost-test

# build sfcgal
# # RUN cd $env:starter_path; \
# # cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSFCGAL_BUILD_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALL_DIR\scripts\buildsystems\vcpkg.cmake"
# RUN cmake -S . -B build \
# -DCMAKE_BUILD_TYPE=Release \
# -DSFCGAL_BUILD_TESTS=OFF \
# -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALL_DIR\scripts\buildsystems\vcpkg.cmake"

# # Default to PowerShell if no other command specified.
# CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
# Install Chocolatey & packages
RUN powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \
"iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

RUN choco install --no-progress -y git
RUN choco install --no-progress -y cmake --installargs 'ADD_CMAKE_TO_PATH=System'
RUN choco install --ignoredetectedreboot --no-progress -y visualstudio2022buildtools \
--package-parameters \
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.Component.MSBuild \
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 \
--includeRecommended --nocache --installPath %MSVC_PATH%" \
|| IF "%ERRORLEVEL%"=="3010" EXIT 0

# Clone and bootstrap vcpkg.
RUN git clone https://github.com/Microsoft/vcpkg.git c:\vcpkg && \
c:\vcpkg\bootstrap-vcpkg.bat

# Install capnproto via vcpkg.
RUN c:\vcpkg\vcpkg install capnproto:x64-windows

# Use developer command prompt and start PowerShell if no other command specified.
ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=x64 -host_arch=x64 &&
CMD powershell.exe -NoLogo -ExecutionPolicy Bypass

0 comments on commit d5bfb2e

Please sign in to comment.