windows: use CMake instead of MSBuild to compile liblzma

This commit is contained in:
nulano 2023-02-12 23:24:11 +00:00
parent 083a7703be
commit 407489a0dc
No known key found for this signature in database
GPG Key ID: B650CDF63B705766
3 changed files with 9 additions and 17 deletions

View File

@ -10,7 +10,7 @@ For more extensive info, see the [Windows build instructions](build.rst).
* Requires Microsoft Visual Studio 2017 or newer with C++ component. * Requires Microsoft Visual Studio 2017 or newer with C++ component.
* Requires NASM for libjpeg-turbo, a required dependency when using this script. * Requires NASM for libjpeg-turbo, a required dependency when using this script.
* Requires CMake 3.12 or newer (available as Visual Studio component). * Requires CMake 3.13 or newer (available as Visual Studio component).
* Tested on Windows Server 2016 with Visual Studio 2017 Community, and Windows Server 2019 with Visual Studio 2022 Community (AppVeyor). * Tested on Windows Server 2016 with Visual Studio 2017 Community, and Windows Server 2019 with Visual Studio 2022 Community (AppVeyor).
* Tested on Windows Server 2022 with Visual Studio 2022 Enterprise (GitHub Actions). * Tested on Windows Server 2022 with Visual Studio 2022 Enterprise (GitHub Actions).

View File

@ -21,7 +21,7 @@ Download and install:
<https://visualstudio.microsoft.com/downloads/>`_ <https://visualstudio.microsoft.com/downloads/>`_
(MSVC C++ build tools, and any Windows SDK version required) (MSVC C++ build tools, and any Windows SDK version required)
* `CMake 3.12 or newer <https://cmake.org/download/>`_ * `CMake 3.13 or newer <https://cmake.org/download/>`_
(also available as Visual Studio component C++ CMake tools for Windows) (also available as Visual Studio component C++ CMake tools for Windows)
* x86/x64: `NASM <https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D>`_ * x86/x64: `NASM <https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D>`_

View File

@ -156,25 +156,15 @@ deps = {
"filename": "xz-5.4.1.tar.gz", "filename": "xz-5.4.1.tar.gz",
"dir": "xz-5.4.1", "dir": "xz-5.4.1",
"license": "COPYING", "license": "COPYING",
"patch": {
r"src\liblzma\api\lzma.h": {
"#ifndef LZMA_API_IMPORT": "#ifndef LZMA_API_IMPORT\n#define LZMA_API_STATIC", # noqa: E501
},
r"windows\vs2019\liblzma.vcxproj": {
# retarget to default toolset (selected by vcvarsall.bat)
"<PlatformToolset>v142</PlatformToolset>": "<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>", # noqa: E501
# retarget to latest (selected by vcvarsall.bat)
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa: E501
},
},
"build": [ "build": [
cmd_msbuild(r"windows\vs2019\liblzma.vcxproj", "Release", "Clean"), cmd_cmake("-DBUILD_SHARED_LIBS:BOOL=OFF"),
cmd_msbuild(r"windows\vs2019\liblzma.vcxproj", "Release", "Build"), cmd_nmake(target="clean"),
cmd_nmake(target="liblzma"),
cmd_mkdir(r"{inc_dir}\lzma"), cmd_mkdir(r"{inc_dir}\lzma"),
cmd_copy(r"src\liblzma\api\lzma\*.h", r"{inc_dir}\lzma"), cmd_copy(r"src\liblzma\api\lzma\*.h", r"{inc_dir}\lzma"),
], ],
"headers": [r"src\liblzma\api\lzma.h"], "headers": [r"src\liblzma\api\lzma.h"],
"libs": [r"windows\vs2019\Release\{msbuild_arch}\liblzma\liblzma.lib"], "libs": [r"liblzma.lib"],
}, },
"libwebp": { "libwebp": {
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.3.0.tar.gz", "url": "http://downloads.webmproject.org/releases/webp/libwebp-1.3.0.tar.gz",
@ -215,7 +205,9 @@ deps = {
}, },
}, },
"build": [ "build": [
cmd_cmake("-DBUILD_SHARED_LIBS:BOOL=OFF"), cmd_cmake(
"-DBUILD_SHARED_LIBS:BOOL=OFF", "-DCMAKE_C_FLAGS=-DLZMA_API_STATIC"
),
cmd_nmake(target="clean"), cmd_nmake(target="clean"),
cmd_nmake(target="tiff"), cmd_nmake(target="tiff"),
], ],