Explorar el Código

Merge pull request #25 from viest/dev

FEAT(w32): Add windows support
王杰新 hace 7 años
padre
commit
a3bfbceb08
Se han modificado 5 ficheros con 47 adiciones y 4 borrados
  1. 26 1
      README.md
  2. 1 1
      config.m4
  3. 18 0
      config.w32
  4. 1 1
      kernel/include.h
  5. 1 1
      kernel/resource.c

+ 26 - 1
README.md

@@ -18,6 +18,29 @@ git clone https://github.com/jmcnamara/libxlsxwriter.git && cd libxlsxwriter &&
 brew install libxlsxwriter
 brew install libxlsxwriter
 ```
 ```
 
 
+##### Windows
+
+> Build the basic PHP build environment.
+
+```bash
+cd PHP_BUILD_PATH/deps
+
+git clone --recursive https://github.com/jmcnamara/MSVCLibXlsxWriter.git
+```
+
+To build the DLL of the library open the LibXlsxWriterProj/LibXlsxWriter.sln project in MS Visual Studio and build the solution using the "Build -> Build Solution" menu item.
+
+In the default configuration this will build an x64 debug LibXlsxWriter .lib and .dll in:
+
+```bash
+PHP_BUILD_PATH\deps\MSVCLibXlsxWriter\LibXlsxWriterProj\x64\Debug
+```
+
+32Bit: Copy .dll files to c:\Windows\System32
+64Bit: Same thing
+
+Add the lib path to the `LIB` environment variable.
+
 #### 2、Get the source code via Git
 #### 2、Get the source code via Git
 
 
 ##### Unix
 ##### Unix
@@ -32,7 +55,9 @@ add the `extension=excel_writer.so` to `php.ini` file.
 
 
 ##### Windows
 ##### Windows
 
 
->Please look forward to the next update.
+Clone the project to the ext directory in PHP, `configure` add `--enable-excel_writer` parameter.
+
+[PHP compilation tutorial](https://wiki.php.net/internals/windows/stepbystepbuild)
 
 
 #### 3、Documents
 #### 3、Documents
 
 

+ 1 - 1
config.m4

@@ -4,7 +4,7 @@ PHP_ARG_ENABLE(excel_writer, whether to enable excel_writer support,
 if test "$PHP_EXCEL_WRITER" != "no"; then
 if test "$PHP_EXCEL_WRITER" != "no"; then
     excel_writer_sources="excel_writer.c \
     excel_writer_sources="excel_writer.c \
     kernel/exception.c \
     kernel/exception.c \
-    kernel/common/resource.c \
+    kernel/resource.c \
     "
     "
 
 
     AC_MSG_CHECKING([Check libxlsxwriter support])
     AC_MSG_CHECKING([Check libxlsxwriter support])

+ 18 - 0
config.w32

@@ -0,0 +1,18 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("excel_writer", "enable excel_writer support", "no");
+
+if (PHP_EXCEL_WRITER != "no") {
+
+    if (CHECK_LIB("LibXlsxWriter.lib", "excel_writer", PHP_EXCEL_WRITER) &&
+        CHECK_HEADER_ADD_INCLUDE("xlsxwriter.h", "CFLAGS_EXCEL_WRITER", PHP_PHP_BUILD + "\\MSVCLibXlsxWriter\\libxlsxwriter\\include;" + PHP_EXCEL_WRITER) &&
+        CHECK_HEADER_ADD_INCLUDE("packager.h", "CFLAGS_EXCEL_WRITER", PHP_PHP_BUILD + "\\MSVCLibXlsxWriter\\libxlsxwriter\\include\\xlsxwriter;" + PHP_EXCEL_WRITER) &&
+        CHECK_HEADER_ADD_INCLUDE("format.h", "CFLAGS_EXCEL_WRITER", PHP_PHP_BUILD + "\\MSVCLibXlsxWriter\\libxlsxwriter\\include\\xlsxwriter;" + PHP_EXCEL_WRITER)) {
+        EXTENSION("excel_writer", "excel_writer.c")
+        ADD_SOURCES(configure_module_dirname + "\\kernel", "resource.c exception.c excel.c write.c format.c", "excel_writer");
+    } else {
+        WARNING("excel_writer not enabled, LibXlsxWriter.lib or headers not found");
+    }
+
+}

+ 1 - 1
kernel/include.h

@@ -12,7 +12,7 @@
 #include "xlsxwriter/packager.h"
 #include "xlsxwriter/packager.h"
 #include "xlsxwriter/format.h"
 #include "xlsxwriter/format.h"
 
 
-#include "php_excel_writer.h"
+#include "../php_excel_writer.h"
 #include "excel.h"
 #include "excel.h"
 #include "exception.h"
 #include "exception.h"
 #include "format.h"
 #include "format.h"

+ 1 - 1
kernel/common/resource.c → kernel/resource.c

@@ -1,4 +1,4 @@
-#include "../include.h"
+#include "include.h"
 
 
 /* {{{ */
 /* {{{ */
 excel_resource_t * zval_get_resource(zval *handle)
 excel_resource_t * zval_get_resource(zval *handle)