Browse Source

fix

1. OpenCV包路径应该自动从系统中读取
2. 编译后不应有重启PHP服务这样影响比较大的操作
pull/1/MERGE
hao 6 years ago
parent
commit
d7b9877631
1 changed files with 3 additions and 12 deletions
  1. +3
    -12
      Prj-PHP/CMakeLists.txt

+ 3
- 12
Prj-PHP/CMakeLists.txt View File

@@ -1,21 +1,12 @@
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)
project(platescan) project(platescan)


set(OpenCV_DIR /usr/platescan/opencv-3.3.0/release/)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -O2 -std=c++11 -fpic -o")
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_CXX_STANDARD 11)

set(PHP_CONFIG_DIR /etc/php.d/)
set(PHP_CONFIG php-config)
set(POST_COMPILE_COMMAND systemctl restart php-fpm)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
find_package(OpenCV 3.3.0 REQUIRED) find_package(OpenCV 3.3.0 REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS}) include_directories( ${OpenCV_INCLUDE_DIRS})
include_directories(include) include_directories(include)



add_library( # Sets the name of the library. add_library( # Sets the name of the library.
platescan platescan


@@ -42,7 +33,7 @@ target_link_libraries(
${OpenCV_LIBS} ${OpenCV_LIBS}
) )


execute_process(COMMAND ${PHP_CONFIG} --extension-dir
execute_process(COMMAND php-config --extension-dir
OUTPUT_VARIABLE LIBRARY_DIR) OUTPUT_VARIABLE LIBRARY_DIR)


message("Test ${LIBRARY_DIR} failed.") message("Test ${LIBRARY_DIR} failed.")


Loading…
Cancel
Save