Add Thread-Safety-Support

This commit is contained in:
Alexander Gabriel 2018-10-11 15:13:53 +02:00
parent c4ac311604
commit 456bcbf614

View File

@ -7,6 +7,9 @@ add_definitions(/D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DW
if(NOT CMAKE_CL_64) if(NOT CMAKE_CL_64)
add_definitions(-D_USE_32BIT_TIME_T) add_definitions(-D_USE_32BIT_TIME_T)
endif(NOT CMAKE_CL_64) endif(NOT CMAKE_CL_64)
if(WITH_THREAD_SAFETY)
add_definitions(-DZTS=1)
endif(WITH_THREAD_SAFETY)
ENDIF(WIN32) ENDIF(WIN32)
string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER) string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER)
@ -20,5 +23,8 @@ set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
add_library(example STATIC example.cxx) add_library(example STATIC example.cxx)
swig_add_library(php_example TYPE MODULE LANGUAGE php7 SOURCES example.i) swig_add_library(php_example TYPE MODULE LANGUAGE php7 SOURCES example.i)
target_compile_options(php_example PRIVATE /D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0) target_compile_options(php_example PRIVATE /D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0)
SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/$ENV{VSCMD_ARG_TGT_ARCH}/Release/php7.lib") if(WITH_THREAD_SAFETY)
target_compile_options(php_example PRIVATE /DZTS=1)
endif(WITH_THREAD_SAFETY)
SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/$ENV{VSCMD_ARG_TGT_ARCH}/Release_TS/php7ts.lib")
target_link_libraries(php_example example) target_link_libraries(php_example example)