CMakeLists.txt 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
cmake_minimum_required(VERSION 3.2)
project(hw-extract)
include(cuda)
include(configure)

#execute_process(COMMAND wget https://paddle-serving.bj.bcebos.com/external_code/preprocesslib.zip)
#execute_process(COMMAND mv preprocesslib.zip ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/)
#execute_process(COMMAND unzip -oq ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/preprocesslib.zip -d ../core/preprocess/nvdec-extractframe/)
#execute_process(COMMAND rm -rf ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/__MACOSX)

#C flags
set(CMAKE_C_FLAGS " -g -pipe -W -Wall -fPIC -Wmissing-field-initializers")

#C++ flags.
set(CMAKE_CXX_FLAGS " -g -pipe -W -Wall -fPIC -std=c++11 -Wmissing-field-initializers")

add_subdirectory(cuda)
set(CMAKE_CUDA_FLAGS "-ccbin -Xcompiler -fPIC --std=c++11")
set(CUDA_NVCC_FLAGS "-Xcompiler -fPIC --std=c++11")
set(EXTRA_LIBS ${EXTRA_LIBS} hwgpu)
set(CUDA_LIBRARIES ${CUDA_TOOLKIT_ROOT_DIR}/lib64)

#release headers
include_directories(*.h)
include_directories(*.hpp)
include_directories(include/*.h)
include_directories(include/*.hpp)

include_directories(.)
include_directories(./include)
include_directories(./codessdkinclude/include)
include_directories(./ffmpeginclude/include)
# include_directories(./pybind11/include)
include_directories(./pythoninclude/python2.7/)
include_directories(./Utils)
include_directories(${CUDA_INCLUDE_DIRS})

# Preprocessor libs.
file(GLOB LIB_FILES ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/lib/*.so)
file(GLOB CUDA_LIB_FILES ${CUDA_LIBRARIES}/*.so)
file(GLOB NVJPEG_LIBS ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/lib/libnvjpeg.*)
file(GLOB SOURCE_FILES src/*.cpp NvDecoder/*.cpp pybind/*.cpp)

#.so
add_library(hwextract SHARED ${SOURCE_FILES})
target_link_libraries(hwextract ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/lib/libnvjpeg.so)
target_link_libraries(hwextract ${EXTRA_LIBS})
target_link_libraries(hwextract ${LIB_FILES})
target_link_libraries(hwextract ${CUDA_LIB_FILES})
# execute_process(COMMAND rm ${CMAKE_SOURCE_DIR}/core/preprocess/nvdec-extractframe/preprocesslib.zip)