Initial commit

This commit is contained in:
2023-09-08 16:30:25 +02:00
commit ae7cf8c566
6 changed files with 180 additions and 0 deletions

22
.editorconfig Normal file
View File

@@ -0,0 +1,22 @@
[*]
end_of_line = LF
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
[*.{ts,js,tsx,jsx,lua}]
charset = utf-8
indent_style = space
indent_size = 2
[*.go]
indent_style = tab
[Makefile]
indent_style = tab
[*.{yml,json}]
indent_style = space
indent_size = 2

38
.gitignore vendored Normal file
View File

@@ -0,0 +1,38 @@
# CMake
build*
cmake-build-*
# Xcode
*.xcworkspace
*.xcodeproj
# Visual Studio
*.sln
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
.vs
# Makefile
Makefile
*.make
# nvim
.ccls
.ccls-cache
compile_commands.json
# Visual Studio Code
.vscode
# IntelliJ
.idea
# macOS
.DS_Store
.AppleDouble
.LSOverride
# JetBrains Fleet
.fleet
.cache

108
CMakeLists.txt Normal file
View File

@@ -0,0 +1,108 @@
cmake_minimum_required(VERSION 3.21)
project(ffmini VERSION 0.0.1)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Group CMake targets inside a folder
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json for language servers
include(FetchContent)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 10.1.0
)
list(APPEND FETCH_CONTENTS fmt)
FetchContent_Declare(
asio
GIT_REPOSITORY https://github.com/mononerv/asio.git
GIT_TAG 1f9c5682840d3dc32e6f36f2e0f54a0e854e87d6
)
list(APPEND FETCH_CONTENTS asio)
FetchContent_Declare(
miniaudio
GIT_REPOSITORY https://github.com/mononerv/miniaudio.git
GIT_TAG v0.11.9
)
list(APPEND FETCH_CONTENTS miniaudio)
FetchContent_MakeAvailable(${FETCH_CONTENTS})
# Group dependencies in Visual Studio and Xcode
if (CMAKE_GENERATOR MATCHES "Visual Studio" OR CMAKE_GENERATOR MATCHES "Xcode")
set_target_properties(fmt PROPERTIES FOLDER deps)
set_target_properties(miniaudio_static PROPERTIES FOLDER deps)
endif()
set(BASE_DEFINITIONS "ASIO_STANDALONE")
if (APPLE)
set(PLATFORM_LINK_LIBRARIES
"-framework Cocoa"
"-framework IOKit"
"-framework CoreVideo"
"-framework OpenGL"
)
elseif (UNIX AND NOT APPLE AND NOT EMSCRIPTEN) # Linux, BSD, Solaris, Minix
set(PLATFORM_LINK_LIBRARIES
"dl"
"m"
"GL"
"X11"
)
elseif (WIN32)
list(APPEND BASE_DEFINITIONS
"_WIN32_WINNT=0x0A00"
)
set(PLATFORM_LINK_LIBRARIES "OpenGL32.lib")
else()
message(FATAL_ERROR "Unknown platform!")
endif()
# Compiler specific options
if (NOT MSVC)
set(BASE_OPTIONS
"-Wall"
"-Wextra"
"-Wconversion"
"-Wpedantic"
"-Wshadow"
"-Werror"
# fmt warnings
"-Wno-unknown-attributes"
# asio
"-Wno-sign-conversion"
"-Wno-shadow"
"-Wno-shorten-64-to-32"
"-Wno-implicit-int-conversion"
"-Wno-unused-private-field"
"-Wno-deprecated-declarations"
)
if (EMSCRIPTEN)
list(APPEND BASE_OPTIONS
# fmt warnings
"-Wno-deprecated-literal-operator"
)
endif()
else()
set(BASE_OPTIONS
"/W4"
"/WX"
"/utf-8"
"/Zc:__cplusplus"
#"/fsanitize=address" # Doesn't work without Visual Studio
)
endif()
set(SOURCE_FILES "ffmini.cpp")
add_executable(ffmini ${HEADER_FILES} ${SOURCE_FILES})
target_include_directories(ffmini
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/dsp
)
target_compile_definitions(ffmini PRIVATE ${BASE_DEFINITIONS})
target_compile_features(ffmini PRIVATE cxx_std_20)
target_compile_options(ffmini PRIVATE ${BASE_OPTIONS})
target_link_libraries(ffmini
PRIVATE
asio::asio
fmt
)
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${SOURCE_FILES})

4
README.md Normal file
View File

@@ -0,0 +1,4 @@
# ffmini
Using `miniaudio` and `ffmpeg` together.

1
cmake/FindFFmpeg.cmake Normal file
View File

@@ -0,0 +1 @@

7
ffmini.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include "fmt/format.h"
auto main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) -> int {
fmt::print("Hello, World!\n");
return 0;
}