README.windows
**************

Introduction
============

This file describes the steps required to build fswatch on Windows.  fswatch was
born as a POSIX application, but Windows builds are supported through the native
Windows monitor based on ReadDirectoryChangesW.

The recommended Windows build environment is MSYS2 with a MinGW-w64 toolchain.
Cygwin compatibility is kept on a best-effort basis for users who need a POSIX
environment on Windows, but Cygwin is not required to build fswatch on Windows.

Windows has historically provided multiple versions of the same API for single
byte and multibyte character sets.  We have decided to only support the
multibyte API: the Windows monitor will thus not build on Windows system
supporting only the single-byte APIs.  In this case, the only available monitor
on the Windows OS will be the poll monitor.

MSYS2/MinGW
===========

MSYS2 is the recommended environment to build fswatch on Windows.  It provides
the MinGW-w64 native Windows toolchain, build tools, and libraries through the
pacman package manager:

    https://www.msys2.org

For a CMake build, install the MinGW-w64 compiler, CMake, and Ninja packages
for the MSYS2 environment you intend to use.  For example, in the UCRT64
environment:

  $ pacman -S --needed \
      mingw-w64-ucrt-x86_64-cmake \
      mingw-w64-ucrt-x86_64-gcc \
      mingw-w64-ucrt-x86_64-ninja

For the GNU Build System, install the corresponding compiler together with the
Autoconf, Automake, libtool, make, and gettext packages required by the build.

Cygwin
======

Cygwin builds are supported on a best-effort basis.  When configure detects the
Cygwin headers and the cygwin_create_path API, fswatch uses them to translate
between POSIX and Windows paths for the Windows monitor.  The current Cygwin
distribution can be downloaded at:

    https://cygwin.com

Cygwin is a modular environment and the following components are required to
build fswatch with the GNU Build System:

  * GNU GCC C++ compiler.

  * GNU Autoconf.

  * GNU Automake.

  * GNU Autoconf.

  * GNU libtool.

The following are optional:

  * GNU gettext (optional)

Windows Headers and Libraries
=============================

The Windows monitor requires Windows headers and libraries.  MinGW-w64 provides
compatible headers and import libraries when building through MSYS2.  Other
toolchains may require installing the Microsoft Windows SDK separately; consult
your Windows toolchain documentation for the appropriate SDK version.

GNU Build System
================

For further instruction on building the GNU Build System from scratch, please
check the README.gnu-build-system file.

Localization and gettext
========================

fswatch is localizable and locale support requires GNU gettext to be available
at build time.

Depending on gettext installation path, configure may not be able to find
<libintl.h> or libintl.  In this case, you will need to instruct configure about
their location:

  $ CPPFLAGS="-I/path/to/include" LDFLAGS="-L/path/to/lib" ./configure

If configure detects that gettext is available, you will find a message such as:

  checking whether to use NLS... yes

or, which is equivalent, config.h will contain the following definition:

  #define ENABLE_NLS 1

-----

Copyright (c) 2014-2026 Enrico M. Crisostomo

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program.  If not, see <http://www.gnu.org/licenses/>.
