Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/source/ffmpeg-cpp/.vs/ffmpeg-cpp/v15
/source/ffmpeg-cpp/ffmpeg-cpp/obj
/source/ffmpeg-cpp/demo/obj
/source/ffmpeg-cpp/x64/Debug
/source/ffmpeg-cpp/obj/Debug
/source/ffmpeg-cpp/demo/samples/out.mp4
/ffmpeg/include
/ffmpeg/include
/ffmpeg/lib
/ffmpeg/bin
/bin
/lib

/source/ffmpeg-cpp/decode_audio/obj
/source/ffmpeg-cpp/encode_audio/obj
/source/ffmpeg-cpp/encode_video/obj
/source/ffmpeg-cpp/decode_video/obj
/source/ffmpeg-cpp/filtering_video/obj
/include

/source/ffmpeg-cpp/remuxing/obj
/.vs
/.vscode
49 changes: 49 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.5)

project(ffmpegcpp VERSION 1.0.0)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

file(GLOB_RECURSE ffmpegcpp_files "include/ffmpegcpp/*.h" "src/*.cpp")
file(GLOB_RECURSE header_files "include/ffmpegcpp/*.h")

source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${ffmpegcpp_files})

add_library(ffmpegcpp STATIC ${ffmpegcpp_files})

set_target_properties(ffmpegcpp PROPERTIES
VERSION ${PROJECT_VERSION}
CXX_STANDARD 17
)

set_target_properties(ffmpegcpp PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

target_include_directories(ffmpegcpp PRIVATE
include/ffmpegcpp
ffmpeg/include
)

target_link_libraries(ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/lib/avcodec.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/avdevice.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/avfilter.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/avformat.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/avutil.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/postproc.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/swresample.lib
${PROJECT_SOURCE_DIR}/ffmpeg/lib/swscale.lib
)

install(TARGETS ffmpegcpp
ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib
LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib
PUBLIC_HEADER DESTINATION ${CMAKE_BINARY_DIR}/lib/include
)

install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ffmpeg/bin/ DESTINATION ${CMAKE_BINARY_DIR}/bin/Release FILES_MATCHING PATTERN "*.dll")
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/samples/ DESTINATION ${CMAKE_BINARY_DIR}/bin/Release/samples)

add_subdirectory(examples)
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
add_subdirectory(decode_audio)
add_subdirectory(decode_video)
add_subdirectory(demo)
add_subdirectory(encode_audio)
add_subdirectory(encode_video)
add_subdirectory(filtering_video)
add_subdirectory(remuxing)
17 changes: 17 additions & 0 deletions examples/decode_audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(decode_audio
decode_audio.cpp
)

set_target_properties(decode_audio PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(decode_audio PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(decode_audio ffmpegcpp)

set_target_properties(decode_audio PROPERTIES FOLDER examples)
17 changes: 17 additions & 0 deletions examples/decode_video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(decode_video
decode_video.cpp
)

set_target_properties(decode_video PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(decode_video PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(decode_video ffmpegcpp)

set_target_properties(decode_video PROPERTIES FOLDER examples)
19 changes: 19 additions & 0 deletions examples/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

add_executable(demo
demo.cpp
GeneratedAudioSource.cpp
GeneratedVideoSource.cpp
)

set_target_properties(demo PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(demo PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(demo ffmpegcpp)

set_target_properties(demo PROPERTIES FOLDER examples)
File renamed without changes.
17 changes: 17 additions & 0 deletions examples/encode_audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(encode_audio
encode_audio.cpp
)

set_target_properties(encode_audio PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(encode_audio PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(encode_audio ffmpegcpp)

set_target_properties(encode_audio PROPERTIES FOLDER examples)
17 changes: 17 additions & 0 deletions examples/encode_video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(encode_video
encode_video.cpp
)

set_target_properties(encode_video PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(encode_video PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(encode_video ffmpegcpp)

set_target_properties(encode_video PROPERTIES FOLDER examples)
17 changes: 17 additions & 0 deletions examples/filtering_video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(filtering_video
filtering_video.cpp
)

set_target_properties(filtering_video PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(filtering_video PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(filtering_video ffmpegcpp)

set_target_properties(filtering_video PROPERTIES FOLDER examples)
17 changes: 17 additions & 0 deletions examples/remuxing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_executable(remuxing
remuxing.cpp
)

set_target_properties(remuxing PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_include_directories(remuxing PUBLIC
${PROJECT_SOURCE_DIR}/include/ffmpegcpp
${PROJECT_SOURCE_DIR}/ffmpeg/include
)

target_link_libraries(remuxing ffmpegcpp)

set_target_properties(remuxing PROPERTIES FOLDER examples)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "Codec.h"
#include "Codecs/Codec.h"
#include "OpenCodec.h"

namespace ffmpegcpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "ffmpeg.h"
#include "InputStream.h"
#include "Frame Sinks/AudioFrameSink.h"
#include "Demuxing/InputStream.h"
#include "FrameSinks/AudioFrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ffmpeg.h"
#include "std.h"
#include "Frame Sinks/FrameSink.h"
#include "FrameSinks/FrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "ffmpeg.h"
#include "InputStream.h"
#include "Frame Sinks/VideoFrameSink.h"
#include "Demuxing/InputStream.h"
#include "FrameSinks/VideoFrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "ffmpeg.h"
#include "std.h"

#include "Frame Sinks/AudioFrameSink.h"
#include "FrameSinks/AudioFrameSink.h"
#include "Codecs/AudioCodec.h"
#include "ConvertedAudioProcessor.h"
#include "AudioFormatConverter.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "FrameSink.h"
#include "FrameSinks/FrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ffmpeg.h"

#include "Frame Sinks/VideoFrameSink.h"
#include "FrameSinks/VideoFrameSink.h"
#include "Codecs/VideoCodec.h"
#include "VideoFormatConverter.h"
#include "Muxing/Muxer.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ffmpeg.h"

#include "VideoFrameSink.h"
#include "FrameSinks/VideoFrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "FrameSink.h"
#include "FrameSinks/FrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "ffmpeg.h"
#include "Codecs/Codec.h"
#include "OutputStream.h"
#include "Muxer.h"
#include "Muxing/OutputStream.h"
#include "Muxing/Muxer.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ffmpeg.h"
#include "Codecs/Codec.h"
#include "Muxer.h"
#include "Muxing/Muxer.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "ffmpeg.h"
#include "Codecs/Codec.h"
#include "OutputStream.h"
#include "Muxer.h"
#include "Muxing/OutputStream.h"
#include "Muxing/Muxer.h"

namespace ffmpegcpp
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "ffmpeg.h"
#include "Frame Sinks/FrameSink.h"
#include "InputSource.h"
#include "FrameSinks/FrameSink.h"
#include "Sources/InputSource.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "ffmpeg.h"
#include "Frame Sinks/AudioFrameSink.h"
#include "FrameSinks/AudioFrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "ffmpeg.h"

#include "InputSource.h"
#include "Demuxer.h"
#include "Sources/InputSource.h"
#include "Sources/Demuxer.h"


namespace ffmpegcpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "ffmpeg.h"
#include "Frame Sinks/VideoFrameSink.h"
#include "FrameSinks/VideoFrameSink.h"

namespace ffmpegcpp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "ffmpeg.h"

#include "InputSource.h"
#include "Demuxer.h"
#include "Sources/InputSource.h"
#include "Sources/Demuxer.h"


namespace ffmpegcpp
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "Sources/RawVideoDataSource.h"
#include "Sources/EncodedFileSource.h"

#include "Frame Sinks/VideoEncoder.h"
#include "Frame Sinks/AudioEncoder.h"
#include "Frame Sinks/VideoFilter.h"
#include "FrameSinks/VideoEncoder.h"
#include "FrameSinks/AudioEncoder.h"
#include "FrameSinks/VideoFilter.h"

#include "Codecs/AudioCodec.h"

Expand Down
File renamed without changes.
Loading