src
cmake_minimum_required(VERSION 3.8) ###### build .so and .a ###### MESSAGE(STATUS "This is BINARY dir " ${PROJECT_BINARY_DIR}) MESSAGE(STATUS "This is SOURCE dir " ${PROJECT_SOURCE_DIR}) MESSAGE(STATUS "This is PREFIX dir " ${CMAKE_INSTALL_PREFIX}) # add_definitions(-std=c++11) add_definitions(-D DEBUG_CONSOLE) #project(E2EPostProcess LANGUAGES C CXX) include_directories(${TOP_PATH}/include) include_directories(${TOP_PATH}/src) include_directories(${TOP_PATH}/thirdparty/webrtc) link_directories(${TOP_PATH}/lib) FILE(GLOB TRTENGINE_SRC *.cpp *.cu *.c) FILE(GLOB VAD_3TD_FILES ${TOP_PATH}/thirdparty/webrtc/common_audio/*/*.c ${TOP_PATH}/thirdparty/webrtc/rtc_base/*.c*) MESSAGE(STATUS "VAD_3TD_FILES: " ${VAD_3TD_FILES}) SET(LIBRARY_OUTPUT_PATH ${TOP_PATH}/lib/) add_library(E2EPostProcess SHARED ${TRTENGINE_SRC} ${VAD_3TD_FILES}) target_include_directories(E2EPostProcess PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cub) target_link_libraries(E2EPostProcess -lpthread -lglog )
e2e
#build lib rm -rf ./build #mkdir build && cd build && cmake .. && make -j8 #build test program mkdir build && cd build && cmake ../ -DBUILD_TESTS=true -D_DEBUG=true && make -j8 cmake_minimum_required(VERSION 3.8) add_definitions(-std=c++11) SET(TOP_PATH ${CMAKE_SOURCE_DIR}) SET(BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}) SET(SOURCE_PATH ${TOP_PATH}/src) SET(CUDA_HOME "/usr/local/cuda") SET(TENSORFLOW_PATH "/home/xxx/TensorRT-7.0.0.11") SET (BASE_LIBRARYS ${CMAKE_SOURCE_DIR}/lib/libxxx.so ) SET (TRT_LIBRARYS ${TENSORFLOW_PATH}/lib/libxxx.so.7 ${CUDA_HOME}/lib64/libcudart.so.9.0 ) MACRO(ADD_LINK_PATH _link_path) link_directories(${_link_path}) SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${_link_path}) SET(ADDITIONAL_LINK_PATH ${ADDITIONAL_LINK_PATH} ${_link_path}) ENDMACRO(ADD_LINK_PATH) project(ttsEngine LANGUAGES C CXX ) SET(CMAKE_POSITION_INDEPENDENT_CODE ON) SET(CMAKE_CXX_FLAGS "-g -O0 -Wno-deprecated-declarations") SET(COMPILE_CUDA_ARCHS "30 32 35 50 52 53 60 61 62 70") string(REPLACE " " ";" COMPILE_CUDA_ARCHLIST ${COMPILE_CUDA_ARCHS}) foreach(archcode ${COMPILE_CUDA_ARCHLIST}) SET(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_${archcode},code=sm_${archcode}") endforeach() message("------------ Options -------------") message(" CMAKE_PROJECT: ${PROJECT_NAME}") message(" CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message(" CMAKE_BUILD_BITS: ${CMAKE_BUILD_BITS}") message(" CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") message(" EXECUTABLE_OUTPUT_PATH: ${EXECUTABLE_OUTPUT_PATH}") message(" LIBRARY_OUTPUT_PATH: ${LIBRARY_OUTPUT_PATH}") message(" CONF_OUTPUT_PATH: ${CONF_OUTPUT_PATH}") message(" DATA_OUTPUT_PATH: ${DATA_OUTPUT_PATH}") message(" TOP_PATH: ${TOP_PATH}") message(" BUILD_PATH: ${BUILD_PATH}") message(" SOURCE_PATH: ${SOURCE_PATH}") message("------------ end -------------") add_subdirectory(src) ADD_LINK_PATH(${TENSORRT_5_PATH}/lib) ADD_LINK_PATH(${CUDA_HOME}/lib64) include_directories(${TOP_PATH}/include) include_directories(${TOP_PATH}/test/common) include_directories(${TOP_PATH}/include) include_directories(${TOP_PATH}/include/cuda) include_directories(${TENSORFLOW_PATH}/include) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) link_directories(${TENSORFLOW_PATH}/lib) link_directories(${TOP_PATH}/lib) link_directories(${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) if(BUILD_TESTS) message(STATUS "BUILD " ${PROJECT_NAME} " ttsTestMain") add_subdirectory(test) endif()