33 Star 90 Fork 26

swoole / PHP-X

加入 Gitee
与超过 800 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 1.50 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
韩天峰 提交于 2017-06-13 13:11 . Optimize performance.
#project
project(phpx)
cmake_minimum_required(VERSION 3.5)
aux_source_directory(src DIR_SRCS)
file(GLOB_RECURSE HEADER_FILES include/*.h)
set(CMAKE_BUILD_TYPE Release)
if (DEFINED PHP_CONFIG_DIR)
set(PHP_CONFIG_DIR "${PHP_CONFIG_DIR}/")
else()
set(PHP_CONFIG_DIR "")
endif()
#execute_process(COMMAND ${PHP_CONFIG_DIR}php-config --includes
# RESULT_VARIABLE PHP_INCLUDE
# )
execute_process(COMMAND ${PHP_CONFIG_DIR}php-config --include-dir
OUTPUT_VARIABLE PHP_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${PHP_CONFIG_DIR}php-config --libs
OUTPUT_VARIABLE PHP_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${PHP_CONFIG_DIR}php-config --ldflags
OUTPUT_VARIABLE ${PHP_LDFLAGS}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("PHP_INCLUDE_DIR: ${PHP_INCLUDE_DIR}")
link_directories(${PHP_LDFLAGS})
include_directories(include)
include_directories(BEFORE ${PHP_INCLUDE_DIR} ${PHP_INCLUDE_DIR}/Zend ${PHP_INCLUDE_DIR}/main ${PHP_INCLUDE_DIR}/TSRM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if (APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
message(${CMAKE_SHARED_LINKER_FLAGS})
endif ()
#libary
add_library(phpx SHARED ${DIR_SRCS})
#install
install(CODE "MESSAGE(\"Are you run command using root user?\")")
install(TARGETS phpx LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(FILES ${HEADER_FILES} DESTINATION include)

评论 ( 0 )

你可以在登录后,发表评论

C++
1
https://gitee.com/swoole/PHP-X.git
git@gitee.com:swoole/PHP-X.git
swoole
PHP-X
PHP-X
master

搜索帮助