Skip to content

Commit

Permalink
Merge pull request #1233 from t-mat/fix-1232
Browse files Browse the repository at this point in the history
Fix #1232 : lz4 command line utility sub-project for Visual Studio 2022 missing
  • Loading branch information
Cyan4973 committed May 21, 2023
2 parents 9efa7e6 + 70ad629 commit 82435a8
Show file tree
Hide file tree
Showing 14 changed files with 487 additions and 6 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -496,6 +496,7 @@ jobs:
#
# - QEMU (ARM, ARM64, PPC, PPC64LE, S390X)
# - macOS
# - Windows
#

# QEMU
Expand Down Expand Up @@ -595,6 +596,32 @@ jobs:
run: make -j test > /dev/null


# Windows
lz4-platform-windows:
name: ${{ matrix.system.os }}
runs-on: ${{ matrix.system.os }}
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed.
matrix:
system: [
{ os: windows-2022, build_path: ".\\build\\VS2022" },
]
steps:
- uses: actions/checkout@v3

- name: Build ${{ matrix.system.os }}, Win32
run: |
pushd ${{ matrix.system.build_path }}
.\\build-and-test-win32-release.bat
popd
- name: Build ${{ matrix.system.os }}, x64
run: |
pushd ${{ matrix.system.build_path }}
.\\build-and-test-x64-release.bat
popd
###############################################################
# Build systems
#
Expand Down
2 changes: 2 additions & 0 deletions build/.gitignore
Expand Up @@ -9,8 +9,10 @@
ver*/
VS2010/bin/
VS2017/bin/
VS*/bin/
ipch

# Fixup for lz4 project directories
!VS2010/lz4
!VS2017/lz4
!VS*/lz4
39 changes: 39 additions & 0 deletions build/VS2022/_build.bat
@@ -0,0 +1,39 @@
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

rem https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference

set "sln=lz4.sln"

@rem set "Configuration=Debug"
@rem set "Platform=Win32"

set "BIN=.\bin\!Platform!_!Configuration!"
rmdir /S /Q "!BIN!" 2>nul
echo msbuild "%sln%" /p:Configuration=!Configuration! /p:Platform=!Platform!
msbuild "%sln%" ^
/nologo ^
/v:minimal ^
/m ^
/p:Configuration=!Configuration! ^
/p:Platform=!Platform! ^
/t:Clean,Build ^
|| goto :ERROR

if not exist "!BIN!\datagen.exe" ( echo FAIL: "!BIN!\datagen.exe" && goto :ERROR )
if not exist "!BIN!\frametest.exe" ( echo FAIL: "!BIN!\frametest.exe" && goto :ERROR )
if not exist "!BIN!\fullbench-dll.exe" ( echo FAIL: "!BIN!\fullbench-dll.exe" && goto :ERROR )
if not exist "!BIN!\fullbench.exe" ( echo FAIL: "!BIN!\fullbench.exe" && goto :ERROR )
if not exist "!BIN!\fuzzer.exe" ( echo FAIL: "!BIN!\fuzzer.exe" && goto :ERROR )
if not exist "!BIN!\liblz4.dll" ( echo FAIL: "!BIN!\liblz4.dll" && goto :ERROR )
if not exist "!BIN!\liblz4.lib" ( echo FAIL: "!BIN!\liblz4.lib" && goto :ERROR )
if not exist "!BIN!\liblz4_static.lib" ( echo FAIL: "!BIN!\liblz4_static.lib" && goto :ERROR )
if not exist "!BIN!\lz4.exe" ( echo FAIL: "!BIN!\lz4.exe" && goto :ERROR )

set /a errorno=0
goto :END

:ERROR

:END
exit /B %errorno%
35 changes: 35 additions & 0 deletions build/VS2022/_setup.bat
@@ -0,0 +1,35 @@
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

rem https://github.com/Microsoft/vswhere
rem https://github.com/microsoft/vswhere/wiki/Find-VC#batch

set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%vswhere%" (
echo Failed to find "vswhere.exe". Please install the latest version of Visual Studio.
goto :ERROR
)

set "InstallDir="
for /f "usebackq tokens=*" %%i in (
`"%vswhere%" -latest ^
-products * ^
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
-property installationPath`
) do (
set "InstallDir=%%i"
)
if "%InstallDir%" == "" (
echo Failed to find Visual C++. Please install the latest version of Visual C++.
goto :ERROR
)

call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" || goto :ERROR

set /a errorno=0
goto :END

:ERROR

:END
exit /B %errorno%
38 changes: 38 additions & 0 deletions build/VS2022/_test.bat
@@ -0,0 +1,38 @@
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

@rem set "Configuration=Debug"
@rem set "Platform=Win32"

set "BIN=.\bin\!Platform!_!Configuration!"
set "TEST_FILES=..\..\tests\COPYING"

echo !BIN!\lz4 -h
!BIN!\lz4 -h || goto :ERROR

echo !BIN!\lz4 -i1b
!BIN!\lz4 -i1b || goto :ERROR

echo !BIN!\lz4 -i1b5
!BIN!\lz4 -i1b5 || goto :ERROR

echo !BIN!\lz4 -i1b10
!BIN!\lz4 -i1b10 || goto :ERROR

echo !BIN!\lz4 -i1b15
!BIN!\lz4 -i1b15 || goto :ERROR

echo fullbench
!BIN!\fullbench.exe --no-prompt -i1 %TEST_FILES% || goto :ERROR

echo fuzzer
!BIN!\fuzzer.exe -v -T30s || goto :ERROR


set /a errorno=0
goto :END

:ERROR

:END
exit /B %errorno%
26 changes: 26 additions & 0 deletions build/VS2022/build-and-test-win32-debug.bat
@@ -0,0 +1,26 @@
@setlocal enabledelayedexpansion
@echo off
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

call _setup.bat || goto :ERROR

set "Configuration=Debug"
set "Platform=Win32"

call _build.bat || goto :ERROR
call _test.bat || goto :ERROR


echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
set /a errorno=0
goto :END


:ERROR
echo Abort by error.
echo Build Status -%esc%[91m ERROR %esc%[0m


:END
exit /B %errorno%
25 changes: 25 additions & 0 deletions build/VS2022/build-and-test-win32-release.bat
@@ -0,0 +1,25 @@
@setlocal enabledelayedexpansion
@echo off
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

set "Configuration=Release"
set "Platform=Win32"

call _setup.bat || goto :ERROR
call _build.bat || goto :ERROR
call _test.bat || goto :ERROR


echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
set /a errorno=0
goto :END


:ERROR
echo Abort by error.
echo Build Status -%esc%[91m ERROR %esc%[0m


:END
exit /B %errorno%
25 changes: 25 additions & 0 deletions build/VS2022/build-and-test-x64-debug.bat
@@ -0,0 +1,25 @@
@setlocal enabledelayedexpansion
@echo off
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

set "Configuration=Debug"
set "Platform=x64"

call _setup.bat || goto :ERROR
call _build.bat || goto :ERROR
call _test.bat || goto :ERROR


echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
set /a errorno=0
goto :END


:ERROR
echo Abort by error.
echo Build Status -%esc%[91m ERROR %esc%[0m


:END
exit /B %errorno%
25 changes: 25 additions & 0 deletions build/VS2022/build-and-test-x64-release.bat
@@ -0,0 +1,25 @@
@setlocal enabledelayedexpansion
@echo off
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"

set "Configuration=Release"
set "Platform=x64"

call _setup.bat || goto :ERROR
call _build.bat || goto :ERROR
call _test.bat || goto :ERROR


echo Build Status -%esc%[92m SUCCEEDED %esc%[0m
set /a errorno=0
goto :END


:ERROR
echo Abort by error.
echo Build Status -%esc%[91m ERROR %esc%[0m


:END
exit /B %errorno%
7 changes: 5 additions & 2 deletions build/VS2022/lz4.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.271
# Visual Studio Version 17
VisualStudioVersion = 17.6.33712.159
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}"
EndProject
Expand All @@ -20,6 +20,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{60A3115E-B988-41EE-8815-F4D4F253D866}"
ProjectSection(ProjectDependencies) = postProject
{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476} = {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
51 changes: 51 additions & 0 deletions build/VS2022/lz4/lz4.rc
@@ -0,0 +1,51 @@
// Microsoft Visual C++ generated resource script.
//

#include "lz4.h" /* LZ4_VERSION_STRING */
#define APSTUDIO_READONLY_SYMBOLS
#include "verrsrc.h"
#undef APSTUDIO_READONLY_SYMBOLS


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "Yann Collet"
VALUE "FileDescription", "Extremely fast compression"
VALUE "FileVersion", LZ4_VERSION_STRING
VALUE "InternalName", "lz4.exe"
VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet"
VALUE "OriginalFilename", "lz4.exe"
VALUE "ProductName", "LZ4"
VALUE "ProductVersion", LZ4_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1200
END
END

#endif

0 comments on commit 82435a8

Please sign in to comment.