Unable to generate php wrapper for windows

Product: PHP PDFNet

Product Version: latest

Please give a brief summary of your issue:
Hi, I’m trying to create the PHP Wrapper. I’m having issue with the cmake command line, it looks like a path problem but i’m not sure, the console doesnt display swig and php version.

Please describe your issue and provide steps to reproduce it:
I’m executing this command line :

D:\PDFNetWrappers\Build>cmake -D BUILD_PDFNetPHP=ON -S D:\PDFNetWrappers\PDFNetPHP

The result :

D:\PDFNetWrappers\Build>cmake -D BUILD_PDFNetPHP=ON -S D:\PDFNetWrappers\PDFNetPHP
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.20348.
-- Windows host platform detected.
-- Generating sources for PHP bindings using swig...
CMake Error at CMakeLists.txt:101 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


CMake Error at CMakeLists.txt:102 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


-- ====================================================
-- CMAKE VERSION      = 3.25.1
-- SWIG VERSION       =
-- SWIG_MAJOR_VERSION =
-- SWIG_MINOR_VERSION =
-- PHP_MAJOR_VERSION  =
-- PHP_MINOR_VERSION  =
-- PHP_TARGET_FILE    = OFF
CMake Error at CMakeLists.txt:134 (message):
  An error has occurred while generating sources using swig.  Check
  'D:/PDFNetWrappers/Build/swig.err.log' for details.


-- Configuring incomplete, errors occurred!
See also "D:/PDFNetWrappers/Build/CMakeFiles/CMakeOutput.log".

I’ve added swig to environment path and created env var SWIG_DIR and SWIG_EXECUTABLE

Can someone help me ?
swig version : 4.0.2
php version : 7.4.33 (dev)

I’ve added the following paths in CMakeCache.txt :
//Path to a program.

PHP_CONFIG_EXECUTABLE:FILEPATH=D:/PDFNetWrappers/Build/PHP_DEVEL_DIR
PHP_INCLUDE_DIRS:FILEPATH=D:/PDFNetWrappers/Build/PHP_DEVEL_DIR/include
PHP_LIBRARY:FILEPATH=D:/PDFNetWrappers/Build/PHP_DEVEL_DIR/lib

SWIG_EXECUTABLE:FILEPATH=D:/swigwin-4.0.2/swig.exe

It looks like you are calling the PDFNetPHP/CMakeLists.txt file directly, but you should be calling the parent CMakeLists.txt file, which loads SWIG and fills in these missing values.

From your Build folder I suspect just the following will work for you.

D:\PDFNetWrappers\Build>cmake -D BUILD_PDFNetPHP=ON ..

If not, please carefully review the these instructions:
Linux PHP7: GitHub - PDFTron/PDFNetWrappers: Code repository for building different language bindings for PDFNetC.
Windows Go: GitHub - PDFTron/PDFNetWrappers: Code repository for building different language bindings for PDFNetC.

Thanks a lot it worked ! Strangely I had to specify the path of the CMakeLists.txt from the root directory :

D:\PDFNetWrappers\Build>cmake -D BUILD_PDFNetPHP=ON -S D:\PDFNetWrappers

PDFNetPHP_core.php was generated succesfully