Skip to content

Commit

Permalink
update core and fix includes
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej committed Apr 5, 2024
1 parent d549210 commit d489542
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
7 changes: 5 additions & 2 deletions WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Clone Couchbase SDK source code (note `--recurse-submodules`):

git clone --recurse-submodules https://github.com/couchbaselabs/couchbase-php-client c:\users\user\couchbase-php-client

NOTE: it is important that path to the extension source will not have spaces, otherwise PHP build
system will not be able to work properly.

Clone PHP interpreter source code (switch to necessary branch):

git clone https://github.com/php/php-src c:\users\user\php-src
Expand All @@ -31,10 +34,10 @@ Clone PHP SDK tools

Open "Visual Studio Installer" application and make sure that "Desktop development with C++" workload is installed.

Navigate to PHP SDK tools and load build environment (we assume Visual Studio 2022, aka VS17 here):
Navigate to PHP SDK tools and load build environment (we assume Visual Studio 2019, aka VS16 here):

cd c:\php-sdk
.\phpsdk-vs17-x64.bat
.\phpsdk-vs16-x64.bat

Inside the shell with build environment, navigate to PHP interpreter sources

Expand Down
23 changes: 14 additions & 9 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ 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");
ERROR("cmake is required (use 'winget install Kitware.CMake')");
}
var LOCALAPPDATA = WshShell.Environment("Process").Item("LOCALAPPDATA");
var NASM = PATH_PROG("nasm", LOCALAPPDATA + "\\bin\\nasm");
if (!NASM) {
ERROR("nasm is required for BoringSSL");
ERROR("nasm is required for BoringSSL (use 'winget install NASM.NASM')");
}
ADD_FLAG("CFLAGS", "/std:c++17");

Expand Down Expand Up @@ -48,14 +48,19 @@ if (PHP_COUCHBASE != "no") {
STDOUT.WriteLine('COUCHBASE_PHP_INCLUDES="' + COUCHBASE_PHP_INCLUDES + '"');
STDOUT.WriteLine('COUCHBASE_PHP_LIB="' + COUCHBASE_PHP_LIB + '"');

DEFINE("LIBS_COUCHBASE", "$(BUILD_DIR)\\couchbase_php_wrapper.lib");
DEFINE("DEPS_COUCHBASE", get_define("LIBS_COUCHBASE"));
EXTENSION("couchbase", "src\\php_couchbase.cxx", true);

MFO.WriteLine("$(BUILD_DIR)\\couchbase_php_wrapper.lib: " + (MODE_PHPIZE ? "" : "$(BUILD_DIR)\\$(PHPDLL)"));
// 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("couchbase_php_wrapper.lib: $(BUILD_DIR)\\couchbase_php_wrapper.lib");
MFO.WriteLine("\t@echo EXT couchbase wrapper build complete");
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 + '"' +
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ set_target_properties(couchbase PROPERTIES PREFIX "")
if(APPLE)
set_target_properties(couchbase PROPERTIES SUFFIX ".so")
endif()
if(MSVC)
set_target_properties(couchbase PROPERTIES PREFIX "php_" IMPORT_PREFIX "php_")
endif()
target_include_directories(couchbase PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(couchbase PRIVATE ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client)
target_include_directories(couchbase PRIVATE ${PHP_INCLUDE_DIRS})
target_compile_definitions(couchbase PRIVATE ZEND_COMPILE_DL_EXT=1)
set_target_properties(couchbase_cxx_client PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
Expand Down
2 changes: 1 addition & 1 deletion src/deps/couchbase-cxx-client

0 comments on commit d489542

Please sign in to comment.