-
Notifications
You must be signed in to change notification settings - Fork 10
/
config.w32
89 lines (82 loc) · 4.56 KB
/
config.w32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// vim:ft=javascript
ARG_ENABLE("couchbase", "whether to enable Couchbase support", "no");
if (PHP_COUCHBASE != "no") {
// we prefer standalone CMake, as the one that comes with MSVS might be too old
var CMAKE = PATH_PROG("cmake", PROGRAM_FILES + "\\CMake\\bin;" + PROGRAM_FILESx86 + "\\CMake\\bin");
if (!CMAKE) {
ERROR("cmake is required (use 'winget install Kitware.CMake')");
}
var LOCALAPPDATA = WshShell.Environment("Process").Item("LOCALAPPDATA");
var NASM = PATH_PROG("nasm", LOCALAPPDATA + "\\bin\\nasm;" + PROGRAM_FILES + "\\NASM");
if (!NASM) {
ERROR("nasm is required for BoringSSL (use 'winget install NASM.NASM')");
}
ADD_FLAG("CFLAGS", "/std:c++17");
var COUCHBASE_CMAKE_SOURCE_DIRECTORY = FSO.GetAbsolutePathName(configure_module_dirname + "\\src");
var COUCHBASE_CMAKE_BUILD_DIRECTORY = get_define("BUILD_DIR") + "\\cmake-build";
// TODO: we don't seem to need this: get_define("CFLAGS_PHP")
var COUCHBASE_PHP_CFLAGS = get_define("CFLAGS")
.replace('$(BASE_INCLUDES)', '')
.replace(new RegExp('"', 'g'), '\\"')
.replace(new RegExp('\\s+', 'g'), ' ')
.replace(new RegExp('/D ', 'g'), '/D')
.replace(new RegExp('/I ', 'g'), '/I');
STDOUT.WriteLine('MODE_PHPIZE=' + MODE_PHPIZE);
STDOUT.WriteLine('PHP_SRC_DIR="' + PHP_SRC_DIR + '"');
STDOUT.WriteLine('BUILD_DIR="' + get_define("BUILD_DIR") + '"');
if (MODE_PHPIZE) {
STDOUT.WriteLine('PHP_DIR="' + PHP_DIR + '"');
}
var php_src_prefix = MODE_PHPIZE ? (PHP_DIR + "\\include") : PHP_SRC_DIR;
var COUCHBASE_PHP_INCLUDES =
php_src_prefix + " " +
php_src_prefix + "\\main " +
php_src_prefix + "\\Zend " +
php_src_prefix + "\\TSRM " +
php_src_prefix + "\\ext";
var COUCHBASE_PHP_LIB =
(MODE_PHPIZE ? PHP_DIR + "\\lib" : get_define("BUILD_DIR")) +
"\\" + get_define("PHPLIB");
var COUCHBASE_ABI_VERSION = WshShell.Environment("Process").Item("CB_ABI_VERSION") || "";
STDOUT.WriteLine('CMAKE="' + CMAKE + '" # version: ' + probe_binary(CMAKE, "longversion"));
STDOUT.WriteLine('NASM="' + NASM + '" # version: ' + probe_binary(NASM, "version"));
STDOUT.WriteLine('COUCHBASE_CMAKE_SOURCE_DIRECTORY="' + COUCHBASE_CMAKE_SOURCE_DIRECTORY + '"');
STDOUT.WriteLine('COUCHBASE_CMAKE_BUILD_DIRECTORY="' + COUCHBASE_CMAKE_BUILD_DIRECTORY + '"');
STDOUT.WriteLine('COUCHBASE_PHP_CFLAGS="' + COUCHBASE_PHP_CFLAGS + '"');
STDOUT.WriteLine('COUCHBASE_PHP_INCLUDES="' + COUCHBASE_PHP_INCLUDES + '"');
STDOUT.WriteLine('COUCHBASE_PHP_LIB="' + COUCHBASE_PHP_LIB + '"');
STDOUT.WriteLine('COUCHBASE_ABI_VERSION="' + COUCHBASE_ABI_VERSION + '"');
// Override build rules. CMake is in charge of the build process.
MFO.WriteLine("$(BUILD_DIR)\\php_couchbase.lib: $(BUILD_DIR)\\php_couchbase.dll");
MFO.WriteLine("$(BUILD_DIR)\\php_couchbase.dll: " + (MODE_PHPIZE ? "" : "$(BUILD_DIR)\\$(PHPDLL)"));
MFO.WriteLine("\t\"" + CMAKE + "\" --build \"" + COUCHBASE_CMAKE_BUILD_DIRECTORY + "\" --verbose");
MFO.WriteLine("php_couchbase.dll: $(BUILD_DIR)\\php_couchbase.dll");
MFO.WriteLine("\t@echo EXT couchbase build complete");
// Create dummy source file to keep PHP build system happy.
dummy_source = FSO.CreateTextFile(configure_module_dirname + "\\dummy.c", true);
dummy_source.WriteLine("extern void dummy() {}");
dummy_source.Close();
EXTENSION("couchbase", "dummy.c", true);
cmake_command =
'cmd /c ""' + CMAKE + '"' +
' -S "' + COUCHBASE_CMAKE_SOURCE_DIRECTORY + '"' +
' -B "' + COUCHBASE_CMAKE_BUILD_DIRECTORY + '"' +
' -G "NMake Makefiles"' +
' -D CMAKE_BUILD_TYPE=RelWithDebInfo' +
' -D CMAKE_ASM_NASM_COMPILER:PATH="' + NASM + '"' +
' -D COUCHBASE_PHP_CFLAGS="' + COUCHBASE_PHP_CFLAGS + '"' +
' -D COUCHBASE_PHP_INCLUDES="' + COUCHBASE_PHP_INCLUDES + '"' +
' -D COUCHBASE_PHP_LIB="' + COUCHBASE_PHP_LIB + '"' +
' -D COUCHBASE_PHP_LIBDIR="' + get_define("BUILD_DIR") + '"' +
' -D COUCHBASE_CXX_CLIENT_INSTALL=OFF ' +
' -D COUCHBASE_CXX_CLIENT_BUILD_SHARED=OFF ' +
' -D COUCHBASE_CXX_CLIENT_BUILD_STATIC=OON ' +
' -D COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES=OFF ' +
' -D COUCHBASE_CXX_CLIENT_BUILD_TOOLS=OFF ' +
' -D COUCHBASE_CXX_CLIENT_BUILD_DOCS=OFF ' +
' -D COUCHBASE_ABI_VERSION="' + COUCHBASE_ABI_VERSION + '"' +
' -D COUCHBASE_CXX_CLIENT_BUILD_TESTS=OFF" 2>&1 ';
STDOUT.WriteLine(cmake_command);
cmake_output = execute(cmake_command);
STDOUT.WriteLine(cmake_output);
}