'Unable to build libharu on windows

I've been trying all day to find a way to use the libharu library on windows with c++, but I can't figure out how to build it...

I've tried nmake -f script/Makefile.msvc but this gives me:

Microsoft (R) Program Maintenance Utility Version 14.31.31107.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -Fosrc\hpdf_utils.obj -MT -nologo -O2 -Iinclude -Iwin32\include -I"../../libpng"\include -I"../../zlib"\include -c src\hpdf_utils.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.

I also tried using vcpkg but I get an error saying it cannot find visual studio. I put a VCPKG_VISUAL_STUDIO_PATH variable pointing to C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE and it still can't find a valid visual studio instance.

Since my c++ project is compiled with mingw I tried using mysys and ran the buildconf.sh file to make a configure file which I then ran with ./configure within mysys and I get

checking Zlib install prefix... configure: error: Unable to locate Zlib headers, please use --with-zlib=<DIR>

I'm kind of tired of working on this thing and I need to be able to use this library. I don't really know how I can install zlib on mysys or whatever this problem is. I know on Linux it would be easier but I need to compile this for windows. Did anyone ever successfully build libharu on windows and if yes how did you do it?

Looking forward to any help I can get.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source