46 lines
1.9 KiB
CMake
46 lines
1.9 KiB
CMake
option(BUILD_WITH_TSAN "Build with thread sanitizer" OFF)
|
|
option(BUILD_WITH_ASAN "Build with address sanitizer" OFF)
|
|
|
|
if(BUILD_WITH_TSAN)
|
|
SET(THREAD_SANITIZER_FLAG "-fsanitize=thread")
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${THREAD_SANITIZER_FLAG}")
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THREAD_SANITIZER_FLAG}")
|
|
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${THREAD_SANITIZER_FLAG} -ltsan" )
|
|
endif()
|
|
|
|
project(ffConv)
|
|
add_executable(ffConv ffConv.cpp)
|
|
add_dependencies(ffConv ffcpp)
|
|
target_link_libraries(ffConv ffcpp)
|
|
|
|
project(ffPreview)
|
|
add_executable(ffPreview ffPreview.cpp)
|
|
add_dependencies(ffPreview ffcpp)
|
|
target_link_libraries(ffPreview ffcpp)
|
|
|
|
project(ffPlayer)
|
|
|
|
find_package(FFMPEG REQUIRED)
|
|
if(NOT FFMPEG_FOUND)
|
|
message(FATAL_ERROR "FFMpeg not found")
|
|
endif()
|
|
include_directories(${FFMPEG_INCLUDE_DIR})
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
if(NOT SDL2_FOUND)
|
|
message(FATAL_ERROR "SDL2 not found")
|
|
endif()
|
|
include_directories(${SDL2_INCLUDE_DIR})
|
|
|
|
add_executable(ffPlayer ffPlayer.cpp)
|
|
add_dependencies(ffPlayer ffcpp)
|
|
target_link_libraries(ffPlayer ffcpp ${SDL2_LIBRARY})
|
|
|
|
if(WIN32)
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVFORMAT_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVCODEC_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_AVUTIL_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_SWSCALE_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_SWRESAMPLE_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
add_custom_command(TARGET ffPlayer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SDL2_DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
endif() |