Skip to content

Commit

Permalink
[what] 搭建编译环境
Browse files Browse the repository at this point in the history
  • Loading branch information
王浩锐 committed Sep 4, 2024
1 parent 34e5efe commit 3100c8b
Show file tree
Hide file tree
Showing 12 changed files with 693 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: mpp-ci

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
debian-gcc-make:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- run : sudo apt install libgbm-dev libsdl2-dev libgl1-mesa-dev* nasm libx11-dev libdrm-dev libva-dev
- run : rm -rf build
- run : mkdir build
- run : git submodule update --init --recursive
- run : cd build && cmake .. -DUSE_OPENGL=ON -DUSE_EGL=ON -DUSE_GBM=ON -DUSE_SDL=ON -DUSE_SPRIV_CROSS=ON -DUSE_VULKAN=ON -DUSE_X11=ON -DUSE_VAAPI=ON -DUSE_OPENH264=ON && make -j4
181 changes: 181 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Compiled #
############
*.com
*.class
*.dll
*.dylib
*.exe
*.slo
*.lo
*.o
*.so
*.lai
*.la
*.a
*.d
*.vsp
*.psess
build

# Gradle #
##########
!gradle.properties
!settings.gradle
!build.gradle
!build.gradle.win
!travis/.gradle/gradle.properties
.gradle/
**/guild/
coverage/

# NuGet #
#########
*.nupkg

# WiX #
#######
*.msi
*.wixobj
*.wixpdb

# Make #
########
config.build
config.make

# CLion #
########
.idea/

# CMake #
########
cmake_install.cmake
cmake_uninstall.cmake
CMakeFiles
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
cmake_*
cmake-build-*
Sample/Sample.ini
Common/Common.cpp

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log*
*.sqlite
*.db
test*.txt
XML/testsuite/rss.xml

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
*~

# VS generated files #
######################
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.ipch
*.ncb
*.suo
*.sdf
*.opensdf
*.tlb
*.tlh
*.ilk
*.lib
*.exp
*.idb
*.rc
*.res
*.manifest
*.tlog
*.lastbuildstate
*.unsuccessfulbuild
*.opendb
.vs/
release_shared/
debug_shared/
release_static/
debug_static/
release_static_md/
debug_static_md/
release_static_mt/
debug_static_mt/
bin/
bin64/
lib/
lib64/
pocomsg.h
**/UpgradeLog*.XML

# Eclipse generated files #
###########################
.project
.cproject
.settings
cmake-build/

# Temporary files #
###################
*.bak
stage/
releases/

# vim #
#######
*.orig
*.swp
*.vim
tags

# Direct X #
############
!Extension/DirectX/**

# vscode #
##########
.vscode/settings.json
.vscode/bookmarks.json
.vscode/c_cpp_properties.json

# platfrom #
############
.platfrom/**

# Android Studio #
##################
build.gradle
gradlew
gradlew.bat
local.properties

# MMP-Core #
############
Extension/vcpkg
51 changes: 51 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.8)
project(MMP_SAMPLE DESCRIPTION "MMP(Multi Media Plugin) Sample")

set(MMP_SAMPLE_SRCS)
set(MMP_SAMPLE_INCS)
set(TMP_SAMPLE_LIBS)

list(APPEND MMP_SAMPLE_INCS
${CMAKE_CURRENT_SOURCE_DIR}/Core
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/source
)

list(APPEND MMP_SAMPLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/PngA.c
${CMAKE_CURRENT_SOURCE_DIR}/PngB.c
${CMAKE_CURRENT_SOURCE_DIR}/AbstractDisplay.cpp
)

list(APPEND MMP_SAMPLE_LIBS
Mmp::Common
Mmp::Codec
Poco::Foundation
Poco::Util
Mmp::GL
Mmp::Windows
Mmp::PG
Mmp::SL
)

if (NOT SDL2_FOUND)
find_package(SDL2 CONFIG)
endif()

if (SDL2_FOUND)
message("-- Found SDL2")
message(" -- SDL INCS : ${SDL2_INCLUDE_DIRS}")
message(" -- SDL LIB DIR : ${SDL2_LIBRARY_DIRS}")
message(" -- SDL LIBS : ${SDL2_LIBRARIES}")
list(APPEND MMP_SAMPLE_INCS ${SDL2_INCLUDE_DIRS})
list(APPEND MMP_SAMPLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/DisplaySDL.cpp
)
list(APPEND MMP_SAMPLE_LIBS ${SDL2_LIBRARIES})
add_definitions(-DSAMPLE_WITH_SDL)
endif()

add_subdirectory(Core)

add_executable(test_gl_compositor ${CMAKE_CURRENT_SOURCE_DIR}/test_gl_compositor.cpp)
target_link_libraries(test_gl_compositor ${MMP_SAMPLE_LIBS})
76 changes: 76 additions & 0 deletions include/AbstractDisplay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// AbstractDisplay.h
//
// Library: Common
// Package: Display
// Module: Display
//

#pragma once

#include <memory>

#include "Common/LogMessage.h"
#include "Common/PixelsInfo.h"

#define DISPLAY_LOG_TRACE MMP_MLOG_TRACE("Display")
#define DISPLAY_LOG_DEBUG MMP_MLOG_DEBUG("Display")
#define DISPLAY_LOG_INFO MMP_MLOG_INFO("Display")
#define DISPLAY_LOG_WARN MMP_MLOG_WARN("Display")
#define DISPLAY_LOG_ERROR MMP_MLOG_ERROR("Display")
#define DISPLAY_LOG_FATAL MMP_MLOG_FATAL("Display")

namespace Mmp
{

/**
* @brief 窗口创建器
* @note 1 - CPU
* 2 - 非线程安全
* 3 - 简易版,只能用于调试不可用于生产
*/
class AbstractDisplay
{
public:
using ptr = std::shared_ptr<AbstractDisplay>;
public:
virtual ~AbstractDisplay() = default;
public:
/**
* @brief 根据 className 创建 Display
* @param[in] className : DisplaySDL or DisplayWayland
* @note 当 className 为空时, 寻找一个默认的 display 创建并返回
*/
static AbstractDisplay::ptr Create(const std::string& className = "");
public:
/**
* @brief 初始化
*/
virtual bool Init() = 0;
/**
* @brief 重置
*/
virtual bool UnInit() = 0;
/**
* @brief 打开窗口
* @param[in] info : 像素描述信息
* @note PixelFormat 仅做参考用途(即实际打开的画面并不一定是此颜色),但是一定打开成功, UpdateWindow
* 一定支持此像素格式
* @sa PixelsInfo
*/
virtual bool Open(PixelsInfo info = {1080, 1920, 8, PixelFormat::RGBA8888}) = 0;
/**
* @brief 关闭窗口
*/
virtual bool Close() = 0;
/**
* @brief 更新整个窗口
* @param[in] frameBuffer
* @note info 信息需与 Open 时保持一致, 不同平台 surface 的像素格式不同,在允许的情况下会进行软件转换
* @todo 有需求更新 window 的话, 提供一个 UpdateSubWindow 即可
* (目前来看没有这个需求)
*/
virtual void UpdateWindow(const uint32_t* frameBuffer, PixelsInfo info = {1920, 1080, 8, PixelFormat::RGBA8888}) = 0;
};

} // namespace Mmp
16 changes: 16 additions & 0 deletions include/PngA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Autogenerated by hxtools bin2c */
#ifndef PNGA_H
#define PNGA_H 1

#ifdef __cplusplus
extern "C" {
#endif

extern const unsigned char bin2c_A_png[49526];

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif /* PNGA_H */
16 changes: 16 additions & 0 deletions include/PngB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Autogenerated by hxtools bin2c */
#ifndef PNGB_H
#define PNGB_H 1

#ifdef __cplusplus
extern "C" {
#endif

extern const unsigned char bin2c_B_png[42501];

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif /* PNGB_H */
Loading

0 comments on commit 3100c8b

Please sign in to comment.