summaryrefslogtreecommitdiffstats
path: root/windows/build-with-cmake.bat
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 0000000..24978ba
--- /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