commit ae7cf8c566f96a9b3d5064c866b97d9eac7d3137 Author: mnerv Date: Fri Sep 8 16:30:25 2023 +0200 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d7c9271 --- /dev/null +++ b/.editorconfig @@ -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 + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9282d3e --- /dev/null +++ b/.gitignore @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a727c89 --- /dev/null +++ b/CMakeLists.txt @@ -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}) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c94fee --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# ffmini + +Using `miniaudio` and `ffmpeg` together. + diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/cmake/FindFFmpeg.cmake @@ -0,0 +1 @@ + diff --git a/ffmini.cpp b/ffmini.cpp new file mode 100644 index 0000000..14592b9 --- /dev/null +++ b/ffmini.cpp @@ -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; +} +