SWIGCMakePHPExampleWindows/CMakeLists.txt

25 lines
1.3 KiB
CMake
Raw Normal View History

2018-06-30 23:37:25 +02:00
cmake_minimum_required(VERSION 3.11)
FIND_PACKAGE(SWIG 3.0.11 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
if(WIN32)
2018-10-04 20:23:32 +02:00
add_definitions(/D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0)
2018-06-30 23:37:25 +02:00
if(NOT CMAKE_CL_64)
add_definitions(-D_USE_32BIT_TIME_T)
endif(NOT CMAKE_CL_64)
ENDIF(WIN32)
2018-10-04 02:24:40 +02:00
string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER)
2018-06-30 23:37:25 +02:00
include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src)
include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/main)
include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/Zend)
include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/TSRM)
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
add_library(example STATIC example.cxx)
2018-06-30 23:37:25 +02:00
swig_add_library(php_example TYPE MODULE LANGUAGE php7 SOURCES example.i)
2018-10-04 20:23:32 +02:00
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")
2018-06-30 23:37:25 +02:00
target_link_libraries(php_example example)