aboutsummaryrefslogtreecommitdiff
path: root/windows/build-with-cmake.bat
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-02-18 17:17:43 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-02-21 16:57:20 +0200
commit8d38941baed05de4ff7cc775de14833108f62184 (patch)
treedae5fcc9ea37ec7a24fd0e549ad1de328ae3b7b9 /windows/build-with-cmake.bat
parentWindows: Update windows/README-Windows.txt. (diff)
downloadxz-8d38941baed05de4ff7cc775de14833108f62184.tar.xz
Windows: Major update to Windows build instructions.
Diffstat (limited to 'windows/build-with-cmake.bat')
-rw-r--r--windows/build-with-cmake.bat35
1 files changed, 35 insertions, 0 deletions
diff --git a/windows/build-with-cmake.bat b/windows/build-with-cmake.bat
new file mode 100644
index 00000000..24978ba8
--- /dev/null
+++ b/windows/build-with-cmake.bat
@@ -0,0 +1,35 @@
+@rem # SPDX-License-Identifier: 0BSD
+@rem # Author: Lasse Collin
+@rem #
+@rem ########################################################################
+@rem #
+@rem # This builds XZ Utils with CMake + MinGW-w64 (GCC or Clang/LLVM).
+@rem # See INSTALL-MinGW-w64_with_CMake.txt for detailed instructions.
+@rem #
+@rem # Summary of command line arguments:
+@rem #
+@rem # %1 = Path to CMake's bin directory. Example:
+@rem # C:\devel\cmake\bin
+@rem #
+@rem # %2 = Path to MinGW-w64's bin directory. Example:
+@rem # C:\devel\mingw64\bin
+@rem #
+@rem # %3 = ON or OFF: Set to ON to build liblzma.dll or OFF for
+@rem # static liblzma.a. With OFF, the *.exe files won't
+@rem # depend on liblzma.dll.
+@rem #
+@rem ########################################################################
+
+setlocal
+set PATH=%1;%2;%PATH%
+
+md build || exit /b
+cd build || exit /b
+
+cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_NLS=OFF -DBUILD_SHARED_LIBS=%3 ..\.. || exit /b
+mingw32-make || exit /b
+mingw32-make test || exit /b
+
+@rem liblzma.dll might not exist so ignore errors.
+strip xz.exe xzdec.exe lzmadec.exe lzmainfo.exe liblzma.dll
+exit /b 0