1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- cmake_minimum_required(VERSION 2.8.7)
- if(POLICY CMP0046)
- cmake_policy(SET CMP0046 NEW)
- endif()
- if(POLICY CMP0054)
- cmake_policy(SET CMP0054 NEW)
- endif()
- set(CNSTREAM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
- # compile flags
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -O2")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_REENTRANT -fPIC -Wno-deprecated-declarations -Wall -Werror")
- set(CMAKE_MODULE_PATH ${CNSTREAM_ROOT_DIR}/cmake)
- # ---[ neuware
- find_package(Neuware)
- include_directories(${NEUWARE_INCLUDE_DIR})
- # ---[ pybind11
- set(PYBIND11_PYTHON_VERSION 3.5)
- add_subdirectory(${CNSTREAM_ROOT_DIR}/3rdparty/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11)
- # ---[ rapidjson
- include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/rapidjson/include)
- set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/webserver)
- include_directories("${CNSTREAM_ROOT_DIR}/modules")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/inference/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/inference2/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/osd/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/source/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/encode/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/track/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/display/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/rtsp_sink/include")
- include_directories("${CNSTREAM_ROOT_DIR}/modules/util/include")
- include_directories("${CNSTREAM_ROOT_DIR}/samples/common")
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/pycnstream_backend)
- aux_source_directory(${CNSTREAM_ROOT_DIR}/samples/common/ util_src)
- list(APPEND service_srcs ${util_src})
- aux_source_directory(${CNSTREAM_ROOT_DIR}/samples/common/preprocess preprocess_srcs)
- list(APPEND service_srcs ${preprocess_srcs})
- aux_source_directory(${CNSTREAM_ROOT_DIR}/samples/common/postprocess postprocess_srcs)
- list(APPEND service_srcs ${postprocess_srcs})
- aux_source_directory(${CNSTREAM_ROOT_DIR}/samples/common/obj_filter obj_filter_srcs)
- list(APPEND service_srcs ${obj_filter_srcs})
- aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/pycnstream_backend pyapi_src)
- list(APPEND service_srcs ${pyapi_src})
- # make python or cpp api
- set(make_pythonapi true)
- if(make_pythonapi)
- set(MAKE_PYTHONAPI true)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAKE_PYTHONAPI")
- message("target : pycnservice package")
- include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/pybind11/include)
- include(${CNSTREAM_ROOT_DIR}/cmake/have_cnstream_target.cmake)
- have_framework_target(${CNSTREAM_ROOT_DIR})
- have_easydk_target(${CNSTREAM_ROOT_DIR})
- have_modules_target(${CNSTREAM_ROOT_DIR})
- have_modules_contrib_target(${CNSTREAM_ROOT_DIR})
- pybind11_add_module(pycnservice SHARED ${service_srcs})
- if(HAVE_FRAMEWORK_TARGET)
- add_dependencies(pycnservice cnstream_core)
- endif()
- if(HAVE_EASYDK_TARGET)
- add_dependencies(pycnservice easydk cnis)
- endif()
- if(HAVE_MODULES_TARGET)
- add_dependencies(pycnservice cnstream_va)
- endif()
- if(HAVE_MODULES_CONTRIB_TARGET)
- add_dependencies(pycnservice cnstream_contrib)
- endif()
- target_link_libraries(pycnservice PRIVATE cnstream_va easydk cnis cnstream_core ${OpenCV_LIBS} ${FFMPEG_LIBRARIES} pthread dl)
- if(HAVE_MODULES_CONTRIB)
- set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed")
- target_link_libraries(pycnservice PRIVATE cnstream_contrib)
- endif()
- endif()
- # web visualize unitest
- set(web_visualize_unitest false)
- if(web_visualize_unitest)
- add_subdirectory(unitest)
- endif()
|